[Xquartz-changes] xserver: Branch 'master' - 3 commits

Jeremy Huddleston jeremyhu at freedesktop.org
Tue Jun 8 12:22:02 PDT 2010


Rebased ref, commits from common ancestor:
commit 0be81f9a163f2838448caee41b2dda274d73391a
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Sun Jun 6 16:31:19 2010 -0700

    XQuartz: Fix build regression from faeebead7bfcc78535757ca7acc1faf7554c03b7
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xquartz/xpr/dri.c b/hw/xquartz/xpr/dri.c
index 72a7ecf..aa5687b 100644
--- a/hw/xquartz/xpr/dri.c
+++ b/hw/xquartz/xpr/dri.c
@@ -205,14 +205,14 @@ DRIScreenInit(ScreenPtr pScreen)
     DRIScreenPrivPtr    pDRIPriv;
     int                 i;
 
-    if (!dixRegisterPrivateKey(&DRIScreenPrivateKeyRec, PRIVATE_SCREEN, 0))
-	return FALSE:
-    if (!dixRegisterPrivateKey(&DRIWindowPrivateKeyRec, PRIVATE_WINDOW, 0))
-	return FALSE:
-    if (!dixRegisterPrivateKey(&DRIPixmapPrivateKeyRec, PRIVATE_PIXMAP, 0))
-	return FALSE:
-    if (!dixRegisterPrivateKey(&DRIPixmapBufferPrivateKeyRec, PRIVATE_PIXMAP, 0))
-	return FALSE:
+    if (!dixRegisterPrivateKey(&DRIScreenPrivKeyRec, PRIVATE_SCREEN, 0))
+	return FALSE;
+    if (!dixRegisterPrivateKey(&DRIWindowPrivKeyRec, PRIVATE_WINDOW, 0))
+	return FALSE;
+    if (!dixRegisterPrivateKey(&DRIPixmapPrivKeyRec, PRIVATE_PIXMAP, 0))
+	return FALSE;
+    if (!dixRegisterPrivateKey(&DRIPixmapBufferPrivKeyRec, PRIVATE_PIXMAP, 0))
+	return FALSE;
 
     pDRIPriv = (DRIScreenPrivPtr) calloc(1, sizeof(DRIScreenPrivRec));
     if (!pDRIPriv) {
diff --git a/hw/xquartz/xpr/driWrap.c b/hw/xquartz/xpr/driWrap.c
index efbae3c..65843b8 100644
--- a/hw/xquartz/xpr/driWrap.c
+++ b/hw/xquartz/xpr/driWrap.c
@@ -530,18 +530,12 @@ DRIWrapInit(ScreenPtr pScreen) {
     if(!dixRegisterPrivateKey(&driGCKeyRec, PRIVATE_GC, sizeof(DRIGCRec)))
 	return FALSE;
 
-    if(!dixRegisterPrivateKey(&driWrapScreenKeyRec, PRIVATE_WINDOW, sizeof(DRIWrapScreenRec)))
-	return FALSE;
-    
-    pScreenPriv = malloc(sizeof(*pScreenPriv));
-
-    if(NULL == pScreenPriv)
+    if(!dixRegisterPrivateKey(&driWrapScreenKeyRec, PRIVATE_SCREEN, sizeof(DRIWrapScreenRec)))
 	return FALSE;
 
+    pScreenPriv = dixGetPrivateAddr(&pScreen->devPrivates, &driWrapScreenKeyRec);
     pScreenPriv->CreateGC = pScreen->CreateGC;
     pScreen->CreateGC = DRICreateGC;
     
-    dixSetPrivate(&pScreen->devPrivates, driWrapScreenKey, pScreenPriv);
-        
     return TRUE;
 }
diff --git a/hw/xquartz/xpr/xprCursor.c b/hw/xquartz/xpr/xprCursor.c
index c268c2c..67fcbe7 100644
--- a/hw/xquartz/xpr/xprCursor.c
+++ b/hw/xquartz/xpr/xprCursor.c
@@ -58,7 +58,7 @@ typedef struct {
 } QuartzCursorScreenRec, *QuartzCursorScreenPtr;
 
 static DevPrivateKeyRec darwinCursorScreenKeyRec;
-#define darwinCursorScreenKey (&darwinCursorScreenKey)
+#define darwinCursorScreenKey (&darwinCursorScreenKeyRec)
 
 #define CURSOR_PRIV(pScreen) ((QuartzCursorScreenPtr) \
     dixLookupPrivate(&pScreen->devPrivates, darwinCursorScreenKey))
@@ -359,7 +359,7 @@ QuartzInitCursor(ScreenPtr pScreen)
     if (!miDCInitialize(pScreen, &quartzScreenFuncsRec))
         return FALSE;
 
-    if (!dixRegisterPrivate(&darwinCursorScreenKeyRec, PRIVATE_SCREEN, 0))
+    if (!dixRegisterPrivateKey(&darwinCursorScreenKeyRec, PRIVATE_SCREEN, 0))
 	return FALSE;
 
     ScreenPriv = calloc(1, sizeof(QuartzCursorScreenRec));
commit 8e97e5f9425639ad0a084150d0b232cad417595d
Author: Keith Packard <keithp at keithp.com>
Date:   Mon Jun 7 14:23:47 2010 -0700

    If XTest is always required, then eliminate the XTest devPrivate
    
    The internals of XTest are used by Xi and Xkb, and both Xi and Xkb are
    always required, so it makes little sense to have XTest place data in
    a devPrivate, especially a devPrivate which is only available when the
    XTest extension is enabled.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/Xext/xtest.c b/Xext/xtest.c
index 6ee8430..2c733d8 100644
--- a/Xext/xtest.c
+++ b/Xext/xtest.c
@@ -62,10 +62,6 @@ extern int DeviceValuator;
  * other's memory */
 static EventListPtr xtest_evlist;
 
-/* Used to store if a device is an XTest Virtual device */
-static DevPrivateKeyRec XTestDevicePrivateKeyRec;
-#define XTestDevicePrivateKey (&XTestDevicePrivateKeyRec)
-
 /**
  * xtestpointer
  * is the virtual pointer for XTest. It is the first slave
@@ -99,18 +95,9 @@ static DISPATCH_PROC(SProcXTestFakeInput);
 static DISPATCH_PROC(SProcXTestGetVersion);
 static DISPATCH_PROC(SProcXTestGrabControl);
 
-Bool
-XTestInitPrivates(void)
-{
-    return dixRegisterPrivateKey(&XTestDevicePrivateKeyRec, PRIVATE_DEVICE, 0);
-}
-
 void
 XTestExtensionInit(INITARGS)
 {
-    if (!XTestInitPrivates())
-	return;
-
     AddExtension(XTestExtensionName, 0, 0,
             ProcXTestDispatch, SProcXTestDispatch,
             NULL, StandardMinorOpcode);
@@ -654,8 +641,8 @@ int AllocXTestDevice (ClientPtr client, char* name,
 
     retval = AllocDevicePair( client, xtestname, ptr, keybd, CorePointerProc, CoreKeyboardProc, FALSE);
     if ( retval == Success ){
-        dixSetPrivate(&((*ptr)->devPrivates), XTestDevicePrivateKey, (void *)(intptr_t)master_ptr->id);
-        dixSetPrivate(&((*keybd)->devPrivates), XTestDevicePrivateKey, (void *)(intptr_t)master_keybd->id);
+	(*ptr)->xtest_master_id = master_ptr->id;
+	(*keybd)->xtest_master_id = master_keybd->id;
 
         XIChangeDeviceProperty(*ptr, XIGetKnownProperty(XI_PROP_XTEST_DEVICE),
                 XA_INTEGER, 8, PropModeReplace, 1, &dummy,
@@ -683,23 +670,15 @@ int AllocXTestDevice (ClientPtr client, char* name,
 BOOL
 IsXTestDevice(DeviceIntPtr dev, DeviceIntPtr master)
 {
-    int is_XTest = FALSE;
-    int mid;
-    void *tmp; /* shut up, gcc! */
-
     if (IsMaster(dev))
-        return is_XTest;
-
-    tmp = dixLookupPrivate(&dev->devPrivates, XTestDevicePrivateKey);
-    mid = (intptr_t)tmp;
+        return FALSE;
 
     /* deviceid 0 is reserved for XIAllDevices, non-zero mid means XTest
      * device */
-    if ((!master && mid) ||
-        (master && mid == master->id))
-        is_XTest = TRUE;
+    if (master)
+	return dev->xtest_master_id == master->id;
 
-    return is_XTest;
+    return dev->xtest_master_id != 0;
 }
 
 /**
diff --git a/include/input.h b/include/input.h
index 3b29855..c68a284 100644
--- a/include/input.h
+++ b/include/input.h
@@ -237,7 +237,6 @@ extern int key_is_down(DeviceIntPtr pDev, int key_code, int type);
 
 extern void InitCoreDevices(void);
 extern void InitXTestDevices(void);
-extern Bool XTestInitPrivates(void);
 
 extern _X_EXPORT DeviceIntPtr AddInputDevice(
     ClientPtr /*client*/,
diff --git a/include/inputstr.h b/include/inputstr.h
index a83e863..1b504e9 100644
--- a/include/inputstr.h
+++ b/include/inputstr.h
@@ -554,6 +554,9 @@ typedef struct _DeviceIntRec {
 
     /* coordinate transformation matrix for absolute input devices */
     struct pixman_f_transform transform;
+
+    /* XTest related master device id */
+    int xtest_master_id;
 } DeviceIntRec;
 
 typedef struct {
diff --git a/test/xi2/protocol-common.c b/test/xi2/protocol-common.c
index ad18042..50f2b86 100644
--- a/test/xi2/protocol-common.c
+++ b/test/xi2/protocol-common.c
@@ -157,7 +157,6 @@ void init_simple(void)
     dixResetPrivates();
     InitAtoms();
     XkbInitPrivates();
-    XTestInitPrivates();
     dixRegisterPrivateKey(&XIClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(XIClientRec));
     dixRegisterPrivateKey(&miPointerScreenKeyRec, PRIVATE_SCREEN, 0);
     dixRegisterPrivateKey(&miPointerPrivKeyRec, PRIVATE_DEVICE, 0);
diff --git a/test/xtest.c b/test/xtest.c
index af75f0c..6ea6862 100644
--- a/test/xtest.c
+++ b/test/xtest.c
@@ -61,7 +61,6 @@ static void xtest_init_devices(void)
     InitAtoms();
 
     XkbInitPrivates();
-    XTestInitPrivates();
 
     /* this also inits the xtest devices */
     InitCoreDevices();
commit fdb081b430ddffb495aa5b05bcc4cf10882ff4b2
Author: Keith Packard <keithp at keithp.com>
Date:   Mon Jun 7 00:54:18 2010 -0700

    dri2: Deal with input-only windows by using WindowDrawable()
    
    Input only windows aren't DRAWABLE_WINDOW, but casting them to a
    PixmapPtr is a bit harsh, and unlikely to get the appropriate privates
    structure. use WindowDrawable instead which checks for both
    input-output and input-only windows.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>
    Tested-by: Eric Anholt <eric at anholt.net>

diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
index baa6706..d33b0d1 100644
--- a/hw/xfree86/dri2/dri2.c
+++ b/hw/xfree86/dri2/dri2.c
@@ -118,7 +118,7 @@ DRI2GetDrawable(DrawablePtr pDraw)
     WindowPtr pWin;
     PixmapPtr pPixmap;
 
-    if (pDraw->type == DRAWABLE_WINDOW) {
+    if (WindowDrawable(pDraw->type)) {
 	pWin = (WindowPtr) pDraw;
 	return dixLookupPrivate(&pWin->devPrivates, dri2WindowPrivateKey);
     } else {
@@ -161,7 +161,7 @@ DRI2AllocateDrawable(DrawablePtr pDraw)
     pPriv->last_swap_ust = 0;
     list_init(&pPriv->reference_list);
 
-    if (pDraw->type == DRAWABLE_WINDOW) {
+    if (WindowDrawable(pDraw->type)) {
 	pWin = (WindowPtr) pDraw;
 	dixSetPrivate(&pWin->devPrivates, dri2WindowPrivateKey, pPriv);
     } else {
@@ -272,7 +272,7 @@ static int DRI2DrawableGone(pointer p, XID id)
 	return Success;
 
     pDraw = pPriv->drawable;
-    if (pDraw->type == DRAWABLE_WINDOW) {
+    if (WindowDrawable(pDraw->type)) {
 	pWin = (WindowPtr) pDraw;
 	dixSetPrivate(&pWin->devPrivates, dri2WindowPrivateKey, NULL);
     } else {
@@ -411,12 +411,12 @@ do_get_buffers(DrawablePtr pDraw, int *width, int *height,
 	    need_real_front--;
 	    front_format = format;
 
-	    if (pDraw->type == DRAWABLE_WINDOW) {
+	    if (WindowDrawable(pDraw->type)) {
 		need_fake_front++;
 	    }
 	}
 
-	if (pDraw->type == DRAWABLE_WINDOW) {
+	if (WindowDrawable(pDraw->type)) {
 	    if (attachment == DRI2BufferFakeFrontLeft) {
 		need_fake_front--;
 		have_fake_front = 1;


More information about the Xquartz-changes mailing list