aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xquartz/xpr/xprFrame.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/hw/xquartz/xpr/xprFrame.c')
-rw-r--r--xorg-server/hw/xquartz/xpr/xprFrame.c107
1 files changed, 78 insertions, 29 deletions
diff --git a/xorg-server/hw/xquartz/xpr/xprFrame.c b/xorg-server/hw/xquartz/xpr/xprFrame.c
index 864ef0d40..9a143ade0 100644
--- a/xorg-server/hw/xquartz/xpr/xprFrame.c
+++ b/xorg-server/hw/xquartz/xpr/xprFrame.c
@@ -33,7 +33,7 @@
#include "xpr.h"
#include "rootlessCommon.h"
-#include "Xplugin.h"
+#include <Xplugin.h>
#include "x-hash.h"
#include "x-list.h"
#include "applewmExt.h"
@@ -43,6 +43,8 @@
#include <X11/Xatom.h>
#include "windowstr.h"
+#include "threadSafety.h"
+
#include <pthread.h>
#define DEFINE_ATOM_HELPER(func,atom_name) \
@@ -62,18 +64,35 @@ DEFINE_ATOM_HELPER(xa_native_window_id, "_NATIVE_WINDOW_ID")
static x_hash_table *window_hash;
static pthread_mutex_t window_hash_mutex;
-static Bool no_configure_window;
+/* Prototypes for static functions */
+static Bool xprCreateFrame(RootlessWindowPtr pFrame, ScreenPtr pScreen,
+ int newX, int newY, RegionPtr pShape);
+static void xprDestroyFrame(RootlessFrameID wid);
+static void xprMoveFrame(RootlessFrameID wid, ScreenPtr pScreen, int newX, int newY);
+static void xprResizeFrame(RootlessFrameID wid, ScreenPtr pScreen,
+ int newX, int newY, unsigned int newW, unsigned int newH,
+ unsigned int gravity);
+static void xprRestackFrame(RootlessFrameID wid, RootlessFrameID nextWid);
+static void xprReshapeFrame(RootlessFrameID wid, RegionPtr pShape);
+static void xprUnmapFrame(RootlessFrameID wid);
+static void xprStartDrawing(RootlessFrameID wid, char **pixelData, int *bytesPerRow);
+static void xprStopDrawing(RootlessFrameID wid, Bool flush);
+static void xprUpdateRegion(RootlessFrameID wid, RegionPtr pDamage);
+static void xprDamageRects(RootlessFrameID wid, int nrects, const BoxRec *rects,
+ int shift_x, int shift_y);
+static void xprSwitchWindow(RootlessWindowPtr pFrame, WindowPtr oldWin);
+static Bool xprDoReorderWindow(RootlessWindowPtr pFrame);
+static void xprCopyWindow(RootlessFrameID wid, int dstNrects, const BoxRec *dstRects,
+ int dx, int dy);
static inline xp_error
xprConfigureWindow(xp_window_id id, unsigned int mask,
const xp_window_changes *values)
{
- // ErrorF("xprConfigureWindow()\n");
- if (!no_configure_window)
- return xp_configure_window(id, mask, values);
- else
- return XP_Success;
+ TA_SERVER();
+
+ return xp_configure_window(id, mask, values);
}
@@ -84,7 +103,9 @@ xprSetNativeProperty(RootlessWindowPtr pFrame)
unsigned int native_id;
long data;
- err = xp_get_native_window((xp_window_id) pFrame->wid, &native_id);
+ TA_SERVER();
+
+ err = xp_get_native_window(x_cvt_vptr_to_uint(pFrame->wid), &native_id);
if (err == Success)
{
/* FIXME: move this to AppleWM extension */
@@ -108,6 +129,8 @@ xprCreateFrame(RootlessWindowPtr pFrame, ScreenPtr pScreen,
unsigned int mask = 0;
xp_error err;
+ TA_SERVER();
+
wc.x = newX;
wc.y = newY;
wc.width = pFrame->width;
@@ -118,11 +141,9 @@ xprCreateFrame(RootlessWindowPtr pFrame, ScreenPtr pScreen,
if (pWin->drawable.depth == 8)
{
wc.depth = XP_DEPTH_INDEX8;
-#if 0
- wc.colormap = xprColormapCallback;
+ wc.colormap = RootlessColormapCallback;
wc.colormap_data = pScreen;
mask |= XP_COLORMAP;
-#endif
}
else if (pWin->drawable.depth == 15)
wc.depth = XP_DEPTH_RGB555;
@@ -169,11 +190,13 @@ xprCreateFrame(RootlessWindowPtr pFrame, ScreenPtr pScreen,
void
xprDestroyFrame(RootlessFrameID wid)
{
+ TA_SERVER();
+
pthread_mutex_lock(&window_hash_mutex);
x_hash_table_remove(window_hash, wid);
pthread_mutex_unlock(&window_hash_mutex);
- xp_destroy_window((xp_window_id) wid);
+ xp_destroy_window(x_cvt_vptr_to_uint(wid));
}
@@ -183,12 +206,14 @@ xprDestroyFrame(RootlessFrameID wid)
void
xprMoveFrame(RootlessFrameID wid, ScreenPtr pScreen, int newX, int newY)
{
+ TA_SERVER();
+
xp_window_changes wc;
wc.x = newX;
wc.y = newY;
// ErrorF("xprMoveFrame(%d, %p, %d, %d)\n", wid, pScreen, newX, newY);
- xprConfigureWindow((xp_window_id) wid, XP_ORIGIN, &wc);
+ xprConfigureWindow(x_cvt_vptr_to_uint(wid), XP_ORIGIN, &wc);
}
@@ -202,6 +227,8 @@ xprResizeFrame(RootlessFrameID wid, ScreenPtr pScreen,
{
xp_window_changes wc;
+ TA_SERVER();
+
wc.x = newX;
wc.y = newY;
wc.width = newW;
@@ -211,7 +238,7 @@ xprResizeFrame(RootlessFrameID wid, ScreenPtr pScreen,
/* It's unlikely that being async will save us anything here.
But it can't hurt. */
- xprConfigureWindow((xp_window_id) wid, XP_BOUNDS, &wc);
+ xprConfigureWindow(x_cvt_vptr_to_uint(wid), XP_BOUNDS, &wc);
}
@@ -223,7 +250,9 @@ xprRestackFrame(RootlessFrameID wid, RootlessFrameID nextWid)
{
xp_window_changes wc;
- /* Stack frame below nextWid it if it exists, or raise
+ TA_SERVER();
+
+ /* Stack frame below nextWid it if it exists, or raise
frame above everything otherwise. */
if (nextWid == NULL)
@@ -234,10 +263,10 @@ xprRestackFrame(RootlessFrameID wid, RootlessFrameID nextWid)
else
{
wc.stack_mode = XP_MAPPED_BELOW;
- wc.sibling = (xp_window_id) nextWid;
+ wc.sibling = x_cvt_vptr_to_uint(nextWid);
}
- xprConfigureWindow((xp_window_id) wid, XP_STACKING, &wc);
+ xprConfigureWindow(x_cvt_vptr_to_uint(wid), XP_STACKING, &wc);
}
@@ -249,6 +278,8 @@ xprReshapeFrame(RootlessFrameID wid, RegionPtr pShape)
{
xp_window_changes wc;
+ TA_SERVER();
+
if (pShape != NULL)
{
wc.shape_nrects = REGION_NUM_RECTS(pShape);
@@ -262,7 +293,7 @@ xprReshapeFrame(RootlessFrameID wid, RegionPtr pShape)
wc.shape_tx = wc.shape_ty = 0;
- xprConfigureWindow((xp_window_id) wid, XP_SHAPE, &wc);
+ xprConfigureWindow(x_cvt_vptr_to_uint(wid), XP_SHAPE, &wc);
}
@@ -274,10 +305,12 @@ xprUnmapFrame(RootlessFrameID wid)
{
xp_window_changes wc;
+ TA_SERVER();
+
wc.stack_mode = XP_UNMAPPED;
wc.sibling = 0;
- xprConfigureWindow((xp_window_id) wid, XP_STACKING, &wc);
+ xprConfigureWindow(x_cvt_vptr_to_uint(wid), XP_STACKING, &wc);
}
@@ -292,9 +325,11 @@ xprStartDrawing(RootlessFrameID wid, char **pixelData, int *bytesPerRow)
unsigned int rowbytes[2];
xp_error err;
- err = xp_lock_window((xp_window_id) wid, NULL, NULL, data, rowbytes, NULL);
+ TA_SERVER();
+
+ err = xp_lock_window(x_cvt_vptr_to_uint(wid), NULL, NULL, data, rowbytes, NULL);
if (err != Success)
- FatalError("Could not lock window %i for drawing.", (int) wid);
+ FatalError("Could not lock window %i for drawing.", (int)x_cvt_vptr_to_uint(wid));
*pixelData = data[0];
*bytesPerRow = rowbytes[0];
@@ -307,7 +342,9 @@ xprStartDrawing(RootlessFrameID wid, char **pixelData, int *bytesPerRow)
void
xprStopDrawing(RootlessFrameID wid, Bool flush)
{
- xp_unlock_window((xp_window_id) wid, flush);
+ TA_SERVER();
+
+ xp_unlock_window(x_cvt_vptr_to_uint(wid), flush);
}
@@ -317,7 +354,9 @@ xprStopDrawing(RootlessFrameID wid, Bool flush)
void
xprUpdateRegion(RootlessFrameID wid, RegionPtr pDamage)
{
- xp_flush_window((xp_window_id) wid);
+ TA_SERVER();
+
+ xp_flush_window(x_cvt_vptr_to_uint(wid));
}
@@ -328,7 +367,9 @@ void
xprDamageRects(RootlessFrameID wid, int nrects, const BoxRec *rects,
int shift_x, int shift_y)
{
- xp_mark_window((xp_window_id) wid, nrects, rects, shift_x, shift_y);
+ TA_SERVER();
+
+ xp_mark_window(x_cvt_vptr_to_uint(wid), nrects, rects, shift_x, shift_y);
}
@@ -341,6 +382,8 @@ xprSwitchWindow(RootlessWindowPtr pFrame, WindowPtr oldWin)
{
DeleteProperty(serverClient, oldWin, xa_native_window_id());
+ TA_SERVER();
+
xprSetNativeProperty(pFrame);
}
@@ -352,6 +395,8 @@ Bool xprDoReorderWindow(RootlessWindowPtr pFrame)
{
WindowPtr pWin = pFrame->win;
+ TA_SERVER();
+
return AppleWMDoReorderWindow(pWin);
}
@@ -364,7 +409,9 @@ void
xprCopyWindow(RootlessFrameID wid, int dstNrects, const BoxRec *dstRects,
int dx, int dy)
{
- xp_copy_window((xp_window_id) wid, (xp_window_id) wid,
+ TA_SERVER();
+
+ xp_copy_window(x_cvt_vptr_to_uint(wid), x_cvt_vptr_to_uint(wid),
dstNrects, dstRects, dx, dy);
}
@@ -398,13 +445,13 @@ xprInit(ScreenPtr pScreen)
{
RootlessInit(pScreen, &xprRootlessProcs);
+ TA_SERVER();
+
rootless_CopyBytes_threshold = xp_copy_bytes_threshold;
rootless_FillBytes_threshold = xp_fill_bytes_threshold;
rootless_CompositePixels_threshold = xp_composite_area_threshold;
rootless_CopyWindow_threshold = xp_scroll_area_threshold;
- no_configure_window = FALSE;
-
return TRUE;
}
@@ -421,7 +468,7 @@ xprGetXWindow(xp_window_id wid)
if (window_hash == NULL)
return NULL;
- winRec = x_hash_table_lookup(window_hash, (void *) wid, NULL);
+ winRec = x_hash_table_lookup(window_hash, x_cvt_uint_to_vptr(wid), NULL);
return winRec != NULL ? winRec->win : NULL;
}
@@ -452,7 +499,7 @@ xprGetXWindowFromAppKit(int windowNumber)
pthread_mutex_unlock(&window_hash_mutex);
if (!ret) return NULL;
- winRec = x_hash_table_lookup(window_hash, (void *) wid, NULL);
+ winRec = x_hash_table_lookup(window_hash, x_cvt_uint_to_vptr(wid), NULL);
return winRec != NULL ? winRec->win : NULL;
}
@@ -498,6 +545,8 @@ xprHideWindows(Bool hide)
int screen;
WindowPtr pRoot, pWin;
+ TA_SERVER();
+
for (screen = 0; screen < screenInfo.numScreens; screen++) {
pRoot = WindowTable[screenInfo.screens[screen]->myNum];
RootlessFrameID prevWid = NULL;