summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Huddleston <jeremyhu@freedesktop.org>2008-12-21 21:03:59 -0800
committerJeremy Huddleston <jeremyhu@freedesktop.org>2008-12-21 21:36:00 -0800
commit84f0c03418bf74188596635dcac128fc05f204ad (patch)
treed0ccca32a0c75cf988a45cf3f93c433ab1254d2a
parent7e7758e1780326ad867be74dbd583a154bad017b (diff)
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)
-rw-r--r--hw/xquartz/X11Application.m22
1 files changed, 13 insertions, 9 deletions
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index 2c6b60bc1..4c8d11332 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -266,7 +266,8 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
case NSKeyDown: case NSKeyUp:
if(_x_active) {
- static int swallow_up;
+ static BOOL do_swallow = NO;
+ static int swallow_keycode;
if([e type] == NSKeyDown) {
/* 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]) {
/* Override to force sending to Appkit */
- swallow_up = [e keyCode];
+ swallow_keycode = [e keyCode];
+ do_swallow = YES;
for_x = NO;
#if XPLUGIN_VERSION >= 1
} else if(X11EnableKeyEquivalents &&
- xp_is_symbolic_hotkey_event([e eventRef])) {
- swallow_up = [e keyCode];
+ xp_is_symbolic_hotkey_event([e eventRef])) {
+ swallow_keycode = [e keyCode];
+ do_swallow = YES;
for_x = NO;
#endif
} else if(X11EnableKeyEquivalents &&
[[self mainMenu] performKeyEquivalent:e]) {
- swallow_up = [e keyCode];
+ swallow_keycode = [e keyCode];
+ do_swallow = YES;
for_appkit = NO;
for_x = NO;
} else if(!quartzEnableRootless
@@ -292,7 +296,8 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
&& ([e keyCode] == 0 /*a*/ || [e keyCode] == 53 /*Esc*/)) {
/* We have this here to force processing fullscreen
* toggle even if X11EnableKeyEquivalents is disabled */
- swallow_up = [e keyCode];
+ swallow_keycode = [e keyCode];
+ do_swallow = YES;
for_x = NO;
for_appkit = NO;
DarwinSendDDXEvent(kXquartzToggleFullscreen, 0);
@@ -303,9 +308,8 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
} else { /* KeyUp */
/* If we saw a key equivalent on the down, don't pass
* the up through to X. */
-
- if (swallow_up != 0 && [e keyCode] == swallow_up) {
- swallow_up = 0;
+ if (do_swallow && [e keyCode] == swallow_keycode) {
+ do_swallow = NO;
for_x = NO;
}
}