Skip to content

Commit

Permalink
fix(mac): clear the modifier keys when the OSK window is closed
Browse files Browse the repository at this point in the history
  • Loading branch information
sgschantz committed Dec 17, 2024
1 parent 6026302 commit 803a218
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,11 @@ - (void)windowDidResize:(NSNotification *)notification {
}

- (void)windowWillClose:(NSNotification *)notification {
os_log_debug([KMLogs oskLog], "OSKWindowController windowWillClose");
[KMSettingsRepository.shared writeShowOskOnActivate:NO];
os_log_debug([KMLogs oskLog], "OSKWindowController windowWillClose, updating settings writeShowOsk to NO");

// whenever the OSK is closed clear all of its modifier keys
[self.oskView clearOskModifiers];
}

- (void)helpAction:(id)sender {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
- (void)setOskOptionState:(BOOL)oskAltState;
- (void)setPhysicalControlState:(BOOL)ctrlState;
- (void)setOskControlState:(BOOL)oskCtrlState;
- (void)clearOskModifiers;
- (void)resetOSK;
- (void)resizeOSKLayout;
- (int64_t)createOskEventUserData;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,17 @@ - (NSArray *)oskDefaultNKeys {
return _oskDefaultNKeys;
}

/**
* called when closing the OSK
* when the OSK is not visible then modifier state is determined solely by the physical keyboard
*/
- (void)clearOskModifiers {
_oskShiftState = NO;
_oskOptionState = NO;
_oskControlState = NO;
[self displayKeyLabelsForLayer];
}

- (void)resetOSK {
[self setOskShiftState:NO];
[self setOskOptionState:NO];
Expand Down

0 comments on commit 803a218

Please sign in to comment.