diff options
author | Jeremy Huddleston <jeremyhu@apple.com> | 2011-04-22 01:23:09 -0700 |
---|---|---|
committer | Jeremy Huddleston <jeremyhu@apple.com> | 2011-04-22 02:20:59 -0700 |
commit | 5f496bc91941140ceaa3061472fda95bd812f2d2 (patch) | |
tree | df061a8e4fd3df2b09ae1fa3e14ca13b3a3eac79 /hw | |
parent | 72bd232b117b2867282e0ae1855d779e126f912b (diff) |
XQuartz: Do translation and handoff of NSEvent to X11 in a separate serial queue
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/xquartz/X11Application.m | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m index 1e3643670..e56bf0cf3 100644 --- a/hw/xquartz/X11Application.m +++ b/hw/xquartz/X11Application.m @@ -61,6 +61,12 @@ extern int xpbproxy_run (void); #define XSERVER_VERSION "?" #endif +#ifdef HAVE_LIBDISPATCH +#include <dispatch/dispatch.h> + +static dispatch_queue_t eventTranslationQueue; +#endif + /* Stuck modifier / button state... force release when we context switch */ static NSEventType keyState[NUM_KEYCODES]; @@ -385,7 +391,15 @@ static void message_kit_thread (SEL selector, NSObject *arg) { if (for_appkit) [super sendEvent:e]; - if (for_x) [self sendX11NSEvent:e]; + if (for_x) { +#ifdef HAVE_LIBDISPATCH + dispatch_async(eventTranslationQueue, ^{ +#endif + [self sendX11NSEvent:e]; +#ifdef HAVE_LIBDISPATCH + }); +#endif + } } - (void) set_window_menu:(NSArray *)list { @@ -999,6 +1013,11 @@ void X11ApplicationMain (int argc, char **argv, char **envp) { aquaMenuBarHeight = NSHeight([[NSScreen mainScreen] frame]) - NSMaxY([[NSScreen mainScreen] visibleFrame]); +#ifdef HAVE_LIBDISPATCH + eventTranslationQueue = dispatch_queue_create(LAUNCHD_ID_PREFIX".X11.NSEventsToX11EventsQueue", NULL); + assert(eventTranslationQueue != NULL); +#endif + /* Set the key layout seed before we start the server */ #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 last_key_layout = TISCopyCurrentKeyboardLayoutInputSource(); |