XQuartz: Don't use keycode 0 to determine !swallow since our most common key to swallow is actual keycode 0 (a)

(cherry picked from commit 33f43a7f03023bfbab25a957cb81fc25b4afa4ca)
This commit is contained in:
Jeremy Huddleston 2008-12-21 21:03:59 -08:00
parent f0cdccd1e2
commit ba9dc353a6

View File

@ -266,7 +266,8 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
case NSKeyDown: case NSKeyUp: case NSKeyDown: case NSKeyUp:
if(_x_active) { if(_x_active) {
static int swallow_up; static BOOL do_swallow = NO;
static int swallow_keycode;
if([e type] == NSKeyDown) { if([e type] == NSKeyDown) {
/* Before that though, see if there are any global /* Before that though, see if there are any global
@ -274,17 +275,20 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
if(darwinAppKitModMask & [e modifierFlags]) { if(darwinAppKitModMask & [e modifierFlags]) {
/* Override to force sending to Appkit */ /* Override to force sending to Appkit */
swallow_up = [e keyCode]; swallow_keycode = [e keyCode];
do_swallow = YES;
for_x = NO; for_x = NO;
#if XPLUGIN_VERSION >= 1 #if XPLUGIN_VERSION >= 1
} else if(X11EnableKeyEquivalents && } else if(X11EnableKeyEquivalents &&
xp_is_symbolic_hotkey_event([e eventRef])) { xp_is_symbolic_hotkey_event([e eventRef])) {
swallow_up = [e keyCode]; swallow_keycode = [e keyCode];
do_swallow = YES;
for_x = NO; for_x = NO;
#endif #endif
} else if(X11EnableKeyEquivalents && } else if(X11EnableKeyEquivalents &&
[[self mainMenu] performKeyEquivalent:e]) { [[self mainMenu] performKeyEquivalent:e]) {
swallow_up = [e keyCode]; swallow_keycode = [e keyCode];
do_swallow = YES;
for_appkit = NO; for_appkit = NO;
for_x = NO; for_x = NO;
} else if(!quartzEnableRootless } else if(!quartzEnableRootless
@ -292,7 +296,8 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
&& ([e keyCode] == 0 /*a*/ || [e keyCode] == 53 /*Esc*/)) { && ([e keyCode] == 0 /*a*/ || [e keyCode] == 53 /*Esc*/)) {
/* We have this here to force processing fullscreen /* We have this here to force processing fullscreen
* toggle even if X11EnableKeyEquivalents is disabled */ * toggle even if X11EnableKeyEquivalents is disabled */
swallow_up = [e keyCode]; swallow_keycode = [e keyCode];
do_swallow = YES;
for_x = NO; for_x = NO;
for_appkit = NO; for_appkit = NO;
DarwinSendDDXEvent(kXquartzToggleFullscreen, 0); DarwinSendDDXEvent(kXquartzToggleFullscreen, 0);
@ -303,9 +308,8 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
} else { /* KeyUp */ } else { /* KeyUp */
/* If we saw a key equivalent on the down, don't pass /* If we saw a key equivalent on the down, don't pass
* the up through to X. */ * the up through to X. */
if (do_swallow && [e keyCode] == swallow_keycode) {
if (swallow_up != 0 && [e keyCode] == swallow_up) { do_swallow = NO;
swallow_up = 0;
for_x = NO; for_x = NO;
} }
} }