summaryrefslogtreecommitdiff
path: root/hw/xquartz/xpr/xprFrame.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/xquartz/xpr/xprFrame.c')
-rw-r--r--hw/xquartz/xpr/xprFrame.c39
1 files changed, 0 insertions, 39 deletions
diff --git a/hw/xquartz/xpr/xprFrame.c b/hw/xquartz/xpr/xprFrame.c
index aad375b52..ba84548b5 100644
--- a/hw/xquartz/xpr/xprFrame.c
+++ b/hw/xquartz/xpr/xprFrame.c
@@ -43,11 +43,7 @@
#include "windowstr.h"
#include "quartz.h"
-#ifdef HAVE_LIBDISPATCH
#include <dispatch/dispatch.h>
-#else
-#include <pthread.h>
-#endif
#ifdef DEBUG_XP_LOCK_WINDOW
#include <execinfo.h>
@@ -70,11 +66,7 @@ DEFINE_ATOM_HELPER(xa_native_window_id, "_NATIVE_WINDOW_ID")
static x_hash_table * window_hash;
/* Need to guard window_hash since xprIsX11Window can be called from any thread. */
-#ifdef HAVE_LIBDISPATCH
static dispatch_queue_t window_hash_serial_q;
-#else
-static pthread_rwlock_t window_hash_rwlock;
-#endif
/* Prototypes for static functions */
static Bool
@@ -209,15 +201,9 @@ xprCreateFrame(RootlessWindowPtr pFrame, ScreenPtr pScreen,
return FALSE;
}
-#ifdef HAVE_LIBDISPATCH
dispatch_async(window_hash_serial_q, ^ {
x_hash_table_insert(window_hash, pFrame->wid, pFrame);
});
-#else
- pthread_rwlock_wrlock(&window_hash_rwlock);
- x_hash_table_insert(window_hash, pFrame->wid, pFrame);
- pthread_rwlock_unlock(&window_hash_rwlock);
-#endif
xprSetNativeProperty(pFrame);
@@ -232,15 +218,9 @@ xprDestroyFrame(RootlessFrameID wid)
{
xp_error err;
-#ifdef HAVE_LIBDISPATCH
dispatch_async(window_hash_serial_q, ^ {
x_hash_table_remove(window_hash, wid);
});
-#else
- pthread_rwlock_wrlock(&window_hash_rwlock);
- x_hash_table_remove(window_hash, wid);
- pthread_rwlock_unlock(&window_hash_rwlock);
-#endif
err = xp_destroy_window(x_cvt_vptr_to_uint(wid));
if (err != Success)
@@ -293,9 +273,7 @@ xprRestackFrame(RootlessFrameID wid, RootlessFrameID nextWid)
{
xp_window_changes wc;
unsigned int mask = XP_STACKING;
-#ifdef HAVE_LIBDISPATCH
__block
-#endif
RootlessWindowRec * winRec;
/* Stack frame below nextWid it if it exists, or raise
@@ -310,15 +288,9 @@ xprRestackFrame(RootlessFrameID wid, RootlessFrameID nextWid)
wc.sibling = x_cvt_vptr_to_uint(nextWid);
}
-#ifdef HAVE_LIBDISPATCH
dispatch_sync(window_hash_serial_q, ^ {
winRec = x_hash_table_lookup(window_hash, wid, NULL);
});
-#else
- pthread_rwlock_rdlock(&window_hash_rwlock);
- winRec = x_hash_table_lookup(window_hash, wid, NULL);
- pthread_rwlock_unlock(&window_hash_rwlock);
-#endif
if (winRec) {
if (XQuartzIsRootless)
@@ -519,13 +491,9 @@ xprInit(ScreenPtr pScreen)
rootless_CopyWindow_threshold = xp_scroll_area_threshold;
assert((window_hash = x_hash_table_new(NULL, NULL, NULL, NULL)));
-#ifdef HAVE_LIBDISPATCH
assert((window_hash_serial_q =
dispatch_queue_create(BUNDLE_ID_PREFIX ".X11.xpr_window_hash",
NULL)));
-#else
- assert(0 == pthread_rwlock_init(&window_hash_rwlock, NULL));
-#endif
return TRUE;
}
@@ -537,19 +505,12 @@ xprInit(ScreenPtr pScreen)
WindowPtr
xprGetXWindow(xp_window_id wid)
{
-#ifdef HAVE_LIBDISPATCH
RootlessWindowRec *winRec __block;
dispatch_sync(window_hash_serial_q, ^ {
winRec =
x_hash_table_lookup(window_hash,
x_cvt_uint_to_vptr(wid), NULL);
});
-#else
- RootlessWindowRec *winRec;
- pthread_rwlock_rdlock(&window_hash_rwlock);
- winRec = x_hash_table_lookup(window_hash, x_cvt_uint_to_vptr(wid), NULL);
- pthread_rwlock_unlock(&window_hash_rwlock);
-#endif
return winRec != NULL ? winRec->win : NULL;
}