mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-05 16:35:33 +00:00
[Mac] Prevent permanently hiding OSK when a menu is dropped down
This *might* possibly fix #894, but not likely
This commit is contained in:
parent
37c1201c7f
commit
c840cedef9
5 changed files with 21 additions and 16 deletions
|
|
@ -57,7 +57,7 @@ NSMutableArray *servers;
|
|||
@synchronized(servers) {
|
||||
[sender overrideKeyboardWithKeyboardNamed:@"com.apple.keylayout.US"];
|
||||
|
||||
[self.AppDelegate wakeUp];
|
||||
[self.AppDelegate wakeUpWith:sender];
|
||||
[servers addObject:sender];
|
||||
|
||||
if (_eventHandler != nil) {
|
||||
|
|
@ -102,19 +102,19 @@ NSMutableArray *servers;
|
|||
if ([self.AppDelegate debugMode]) {
|
||||
NSLog(@"No known active server for Keyman IM. Starting countdown to sleep...");
|
||||
}
|
||||
[self performSelector:@selector(timerAction:) withObject:nil afterDelay:0.7];
|
||||
[self performSelector:@selector(timerAction:) withObject:sender afterDelay:0.7];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)timerAction:(NSTimer *)timer {
|
||||
- (void)timerAction:(id)lastServer {
|
||||
@synchronized(servers) {
|
||||
if (servers.count == 0) {
|
||||
if (_eventHandler != nil) {
|
||||
[_eventHandler deactivate];
|
||||
_eventHandler = nil;
|
||||
}
|
||||
[self.AppDelegate sleep];
|
||||
[self.AppDelegate sleepFollowingDeactivationOfServer:lastServer];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,8 +92,8 @@ extern NSString *const kWebSite;
|
|||
- (void)showAboutWindow;
|
||||
- (void)showOSK;
|
||||
- (void)showConfigurationWindow;
|
||||
- (void)sleep;
|
||||
- (void)wakeUp;
|
||||
- (void)sleepFollowingDeactivationOfServer:(id)lastServer;
|
||||
- (void)wakeUpWith:(id)newServer;
|
||||
- (void)handleKeyEvent:(NSEvent *)event;
|
||||
- (BOOL)unzipFile:(NSString *)filePath;
|
||||
- (NSWindowController *)downloadKBWindow_;
|
||||
|
|
|
|||
|
|
@ -63,6 +63,8 @@ typedef enum {
|
|||
@synthesize contextBuffer = _contextBuffer;
|
||||
@synthesize alwaysShowOSK = _alwaysShowOSK;
|
||||
|
||||
id _lastServerWithOSKShowing = nil;
|
||||
|
||||
- (id)init {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
|
|
@ -188,7 +190,7 @@ typedef enum {
|
|||
return (KMInputMethodAppDelegate *)[NSApp delegate];
|
||||
}
|
||||
|
||||
-(void) sleep {
|
||||
-(void) sleepFollowingDeactivationOfServer:(id)lastServer {
|
||||
if ([self debugMode]) {
|
||||
NSLog(@"Keyman no longer active IM.");
|
||||
}
|
||||
|
|
@ -197,6 +199,9 @@ typedef enum {
|
|||
if ([self debugMode]) {
|
||||
NSLog(@"Hiding OSK.");
|
||||
}
|
||||
// Storing this ensures that if the deactivation is temporary, resulting from dropping down a menu,
|
||||
// the OSK will re-display when that client application re-activates.
|
||||
_lastServerWithOSKShowing = lastServer;
|
||||
[self.oskWindow.window setIsVisible:NO];
|
||||
}
|
||||
if (self.lowLevelEventTap) {
|
||||
|
|
@ -207,7 +212,7 @@ typedef enum {
|
|||
}
|
||||
}
|
||||
|
||||
-(void) wakeUp {
|
||||
-(void) wakeUpWith:(id)newServer {
|
||||
self.sleeping = NO;
|
||||
if (self.lowLevelEventTap && !CGEventTapIsEnabled(self.lowLevelEventTap)) {
|
||||
if ([self debugMode]) {
|
||||
|
|
@ -215,6 +220,10 @@ typedef enum {
|
|||
}
|
||||
CGEventTapEnable(self.lowLevelEventTap, YES);
|
||||
}
|
||||
// See note in sleepFollowingDeactivationOfServer.
|
||||
if (_kvk != nil && (_alwaysShowOSK || _lastServerWithOSKShowing == newServer)) {
|
||||
[self showOSK];
|
||||
}
|
||||
}
|
||||
|
||||
CGEventRef eventTapFunction(CGEventTapProxy proxy, CGEventType type, CGEventRef event, void *refcon) {
|
||||
|
|
|
|||
|
|
@ -359,14 +359,7 @@
|
|||
|
||||
- (void)keyAction:(id)sender {
|
||||
KeyView *keyView = (KeyView *)sender;
|
||||
NSUInteger keyCode;
|
||||
@try {
|
||||
keyCode = [keyView.key keyCode];
|
||||
}
|
||||
@catch (NSException *exception) {
|
||||
NSLog(@"Exception in keyAction:sender - %@", exception);
|
||||
return;
|
||||
}
|
||||
NSUInteger keyCode = [keyView.key keyCode];
|
||||
if (keyCode < 0x100) {
|
||||
ProcessSerialNumber psn;
|
||||
GetFrontProcess(&psn);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
# Keyman for macOS Version History
|
||||
|
||||
## 2018-06-27 10.0.52 beta
|
||||
* Prevented permanently hiding OSK when a menu is dropped down (#1031)
|
||||
|
||||
## 2018-06-26 10.0.51 beta
|
||||
* Prevented calling CFRelease() with a NULL argument (#1019)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue