summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Huddleston <jeremyhu@apple.com>2012-07-25 11:40:33 -0700
committerJeremy Huddleston <jeremyhu@apple.com>2012-07-25 12:19:01 -0700
commitfd228d318428d0d9dea52ca560a9b66660dd2d02 (patch)
tree6299727b440794157033ef5835138dff3ce5507d
parent3b7f313b3d74f9df876152c55d55cbb339bf2d02 (diff)
XQuartz: Call xp_window_bring_all_to_front if available in libXplugin
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
-rw-r--r--hw/xquartz/xpr/xprEvent.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/hw/xquartz/xpr/xprEvent.c b/hw/xquartz/xpr/xprEvent.c
index 106a91931..73bcc930d 100644
--- a/hw/xquartz/xpr/xprEvent.c
+++ b/hw/xquartz/xpr/xprEvent.c
@@ -52,9 +52,20 @@
#include <sys/uio.h>
#include <unistd.h>
+#ifdef HAVE_LIBDISPATCH
+#include <dispatch/dispatch.h>
+#endif
+
#include "rootlessWindow.h"
#include "xprEvent.h"
+/* This is important enough to declare here if building against an old
+ * libXplugin, so we pick it up whenever libXplugin starts to support it.
+ */
+#if !defined(XPLUGIN_VERSION) || XPLUGIN_VERSION < 6
+extern xp_error xp_window_bring_all_to_front(void) __attribute__((weak_import));
+#endif
+
Bool
QuartzModeEventHandler(int screenNum, XQuartzEvent *e, DeviceIntPtr dev)
{
@@ -72,7 +83,28 @@ QuartzModeEventHandler(int screenNum, XQuartzEvent *e, DeviceIntPtr dev)
case kXquartzBringAllToFront:
DEBUG_LOG("kXquartzBringAllToFront\n");
+ /* There's no need to do xp_window_bring_all_to_front on Leopard,
+ * and we don't care about the result, so just do it async.
+ */
+#if defined(HAVE_LIBDISPATCH)
+#if (defined(XPLUGIN_VERSION_MIN_REQUIRED) && XPLUGIN_VERSION_MIN_REQUIRED >= 6) || \
+ (!defined(XPLUGIN_VERSION_MIN_REQUIRED) && defined(XPLUGIN_VERSION) && XPLUGIN_VERSION >= 6)
+ dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+ xp_window_bring_all_to_front();
+ });
+#else
+ if (&xp_window_bring_all_to_front) {
+ dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+ xp_window_bring_all_to_front();
+ });
+ } else {
+ RootlessOrderAllWindows(e->data[0]);
+ }
+#endif
+#else
RootlessOrderAllWindows(e->data[0]);
+#endif
+
return TRUE;
default: