diff options
author | culler <culler> | 2018-11-30 22:11:48 (GMT) |
---|---|---|
committer | culler <culler> | 2018-11-30 22:11:48 (GMT) |
commit | dbf1875126153a5dff05b89cbd7ab1d9ce6ef5d0 (patch) | |
tree | da98509c5fc6e022f17a7d355153b31cbbac4ae3 /macosx/tkMacOSXKeyEvent.c | |
parent | 2f18a3f080b8f55b2b4be4a90e948531f203eb7d (diff) | |
download | tk-dbf1875126153a5dff05b89cbd7ab1d9ce6ef5d0.zip tk-dbf1875126153a5dff05b89cbd7ab1d9ce6ef5d0.tar.gz tk-dbf1875126153a5dff05b89cbd7ab1d9ce6ef5d0.tar.bz2 |
Make tabbed windows work correctly on macOS.
Diffstat (limited to 'macosx/tkMacOSXKeyEvent.c')
-rw-r--r-- | macosx/tkMacOSXKeyEvent.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/macosx/tkMacOSXKeyEvent.c b/macosx/tkMacOSXKeyEvent.c index 31fffa1..a153797 100644 --- a/macosx/tkMacOSXKeyEvent.c +++ b/macosx/tkMacOSXKeyEvent.c @@ -55,9 +55,11 @@ unsigned short releaseCode; #endif NSWindow* w; NSEventType type = [theEvent type]; - NSUInteger modifiers, len = 0; + NSUInteger modifiers = ([theEvent modifierFlags] & + NSDeviceIndependentModifierFlagsMask); + NSUInteger len = 0; BOOL repeat = NO; - unsigned short keyCode; + unsigned short keyCode = [theEvent keyCode]; NSString *characters = nil, *charactersIgnoringModifiers = nil; static NSUInteger savedModifiers = 0; static NSMutableArray *nsEvArray; @@ -77,6 +79,16 @@ unsigned short releaseCode; return theEvent; } + /* + * Control-Tab and Control-Shift-Tab are used to switch tabs in a tabbed + * window. We do not want to generate an Xevent for these since that might + * cause the deselected tab to be reactivated. + */ + + if (keyCode == 48 && (modifiers & NSControlKeyMask) == NSControlKeyMask) { + return theEvent; + } + switch (type) { case NSKeyUp: /*Fix for bug #1ba71a86bb: key release firing on key press.*/ @@ -90,8 +102,6 @@ unsigned short releaseCode; charactersIgnoringModifiers = [theEvent charactersIgnoringModifiers]; len = [charactersIgnoringModifiers length]; case NSFlagsChanged: - modifiers = [theEvent modifierFlags]; - keyCode = [theEvent keyCode]; #if defined(TK_MAC_DEBUG_EVENTS) || NS_KEYLOG == 1 TKLog(@"-[%@(%p) %s] r=%d mods=%u '%@' '%@' code=%u c=%d %@ %d", [self class], self, _cmd, repeat, modifiers, characters, charactersIgnoringModifiers, keyCode,([charactersIgnoringModifiers length] == 0) ? 0 : [charactersIgnoringModifiers characterAtIndex: 0], w, type); |