From 02af74d7a5a7225f408915254c40856159dc7f19 Mon Sep 17 00:00:00 2001 From: Jeremy Huddleston Date: Tue, 19 Aug 2008 02:02:11 -0700 Subject: [PATCH] XQuartz: Added appkit_modifiers defaults option which users can set to 'rcommand' to get access to the input menu with right command --- hw/xquartz/X11Application.h | 1 + hw/xquartz/X11Application.m | 22 +++++++++++++++------- hw/xquartz/darwin.c | 3 +++ hw/xquartz/darwin.h | 1 + 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/hw/xquartz/X11Application.h b/hw/xquartz/X11Application.h index 8e7fed23b..22a8728a8 100644 --- a/hw/xquartz/X11Application.h +++ b/hw/xquartz/X11Application.h @@ -91,6 +91,7 @@ extern int quartzHasRoot, quartzEnableRootless; #define PREFS_NO_QUIT_ALERT "no_quit_alert" #define PREFS_FAKE_BUTTON2 "fake_button2" #define PREFS_FAKE_BUTTON3 "fake_button3" +#define PREFS_APPKIT_MODIFIERS "appkit_modifiers" #define PREFS_ROOTLESS "rootless" #define PREFS_FULLSCREEN_HOTKEYS "fullscreen_hotkeys" #define PREFS_SWAP_ALT_META "swap_alt_meta" diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m index 9096f3d68..45a1190af 100644 --- a/hw/xquartz/X11Application.m +++ b/hw/xquartz/X11Application.m @@ -200,6 +200,11 @@ static void message_kit_thread (SEL selector, NSObject *arg) { /* By default pass down the responder chain and to X. */ for_appkit = YES; for_x = YES; + + if(darwinAppKitModMask & [e modifierFlags]) { + [super sendEvent:e]; + return; + } switch (type) { case NSLeftMouseDown: case NSRightMouseDown: case NSOtherMouseDown: @@ -620,14 +625,17 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) { darwinFakeButtons = [self prefs_get_boolean:@PREFS_FAKEBUTTONS default:darwinFakeButtons]; if (darwinFakeButtons) { - const char *fake2, *fake3; - - fake2 = [self prefs_get_string:@PREFS_FAKE_BUTTON2 default:NULL]; - fake3 = [self prefs_get_string:@PREFS_FAKE_BUTTON3 default:NULL]; - - if (fake2 != NULL) darwinFakeMouse2Mask = DarwinParseModifierList(fake2); - if (fake3 != NULL) darwinFakeMouse3Mask = DarwinParseModifierList(fake3); + const char *fake2, *fake3; + + fake2 = [self prefs_get_string:@PREFS_FAKE_BUTTON2 default:NULL]; + fake3 = [self prefs_get_string:@PREFS_FAKE_BUTTON3 default:NULL]; + + if (fake2 != NULL) darwinFakeMouse2Mask = DarwinParseModifierList(fake2); + if (fake3 != NULL) darwinFakeMouse3Mask = DarwinParseModifierList(fake3); } + + tem = [self prefs_get_string:@PREFS_APPKIT_MODIFIERS default:NULL]; + if (tem != NULL) darwinAppKitModMask = DarwinParseModifierList(tem); X11EnableKeyEquivalents = [self prefs_get_boolean:@PREFS_KEYEQUIVS default:X11EnableKeyEquivalents]; diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c index a1f3df294..722276fd8 100644 --- a/hw/xquartz/darwin.c +++ b/hw/xquartz/darwin.c @@ -114,6 +114,9 @@ int darwinFakeMouse2Mask = NX_ALTERNATEMASK; int darwinFakeMouse3Mask = NX_COMMANDMASK; #endif +// Modifier mask for overriding event delivery to appkit (might be useful to set this to rcommand for input menu +int darwinAppKitModMask = 0; + // devices DeviceIntPtr darwinPointer = NULL; DeviceIntPtr darwinTablet = NULL; diff --git a/hw/xquartz/darwin.h b/hw/xquartz/darwin.h index 51a03691c..cbd6d6748 100644 --- a/hw/xquartz/darwin.h +++ b/hw/xquartz/darwin.h @@ -79,6 +79,7 @@ extern int darwinMouseAccelChange; extern int darwinFakeButtons; extern int darwinFakeMouse2Mask; extern int darwinFakeMouse3Mask; +extern int darwinAppKitModMask; extern char *darwinKeymapFile; extern int darwinSyncKeymap; extern unsigned int darwinDesiredWidth, darwinDesiredHeight;