xserver: Branch 'mpx' - 6 commits

Peter Hutterer whot at kemper.freedesktop.org
Thu Apr 24 00:53:56 PDT 2008


 Xext/geext.c                   |  112 +++++++++++++++++++++++------------------
 Xext/geext.h                   |   10 +--
 Xext/geint.h                   |    2 
 hw/xfree86/common/xf86Events.c |    2 
 hw/xfree86/common/xf86Xinput.c |    2 
 5 files changed, 72 insertions(+), 56 deletions(-)

New commits:
commit 7dc40c8eca90ec1bfab84b6f54418b64c0e62d63
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Thu Apr 24 12:47:29 2008 +0930

    xfree86: Don't free master devices.
    
    The previous check works in the master-branch, but doesn't work with MPX. We
    actually copy the SD's information into the MDs public.devicePrivate, so we
    need to explicitly check whether a device is a MD before freeing the module.

diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index 30e0e6b..8ff31e8 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -490,7 +490,7 @@ DeleteInputDeviceRequest(DeviceIntPtr pDev)
     }
     RemoveDevice(pDev);
 
-    if (!pInfo) /* VCP and VCK */
+    if (pDev->isMaster)
         return;
 
     if(drv->UnInit)
commit cc13f87cd8ac54223fdb0b3d3c043dc9b9be5a42
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Thu Apr 24 11:43:47 2008 +0930

    Xext: XGE: change function definition to have return value on separate line.
    
    This seems to be the common style in most parts of the server.

diff --git a/Xext/geext.c b/Xext/geext.c
index 19763a0..29ddacd 100644
--- a/Xext/geext.c
+++ b/Xext/geext.c
@@ -64,7 +64,8 @@ static void SGEGenericEvent(xEvent* from, xEvent* to);
 /*                request handlers                          */
 /************************************************************/
 
-static int ProcGEQueryVersion(ClientPtr client)
+static int
+ProcGEQueryVersion(ClientPtr client)
 {
     int n;
     GEClientInfoPtr pGEClient = GEGetClient(client);
@@ -160,9 +161,10 @@ SProcGEDispatch(ClientPtr client)
  * We alloc a simple struct to store the client's major/minor version. Can be
  * used in the furture for versioning support.
  */
-static void GEClientCallback(CallbackListPtr *list,
-        pointer closure,
-        pointer data)
+static void
+GEClientCallback(CallbackListPtr *list,
+                 pointer closure,
+                 pointer data)
 {
     NewClientInfoRec	*clientinfo = (NewClientInfoRec *) data;
     ClientPtr		pClient = clientinfo->client;
@@ -256,12 +258,11 @@ GEExtensionInit(void)
  * @param ev_fill Called for an event before delivery. The extension now has
  * the chance to fill in necessary fields for the event.
  */
-void GERegisterExtension(
-        int extension,
-        void (*ev_swap)(xGenericEvent* from, xGenericEvent* to),
-        void (*ev_fill)(xGenericEvent* ev, DeviceIntPtr pDev,
-                        WindowPtr pWin, GrabPtr pGrab)
-        )
+void
+GERegisterExtension(int extension,
+                    void (*ev_swap)(xGenericEvent* from, xGenericEvent* to),
+                    void (*ev_fill)(xGenericEvent* ev, DeviceIntPtr pDev,
+                                    WindowPtr pWin, GrabPtr pGrab))
 {
     if ((extension & 0x7F) >=  MAXEXTENSIONS)
         FatalError("GE: extension > MAXEXTENSIONS. This should not happen.\n");
@@ -275,7 +276,8 @@ void GERegisterExtension(
 /* Sets type and extension field for a generic event. This is just an
  * auxiliary function, extensions could do it manually too.
  */
-void GEInitEvent(xGenericEvent* ev, int extension)
+void
+GEInitEvent(xGenericEvent* ev, int extension)
 {
     ev->type = GenericEvent;
     ev->extension = extension;
@@ -312,8 +314,9 @@ GERecalculateWinMask(WindowPtr pWin)
 }
 
 /* Set generic event mask for given window. */
-void GEWindowSetMask(ClientPtr pClient, DeviceIntPtr pDev,
-                     WindowPtr pWin, int extension, Mask mask)
+void
+GEWindowSetMask(ClientPtr pClient, DeviceIntPtr pDev,
+                WindowPtr pWin, int extension, Mask mask)
 {
     GenericMaskPtr cli;
 
@@ -397,8 +400,9 @@ void GEWindowSetMask(ClientPtr pClient, DeviceIntPtr pDev,
  * @param extension Extension ID
  * @param mask Event mask
  */
-BOOL GEDeviceMaskIsSet(WindowPtr pWin, DeviceIntPtr pDev,
-                       int extension, Mask mask)
+BOOL
+GEDeviceMaskIsSet(WindowPtr pWin, DeviceIntPtr pDev,
+                  int extension, Mask mask)
 {
     GenericMaskPtr gemask;
 
commit d0890c40b9a9c7965c08608e6950c078a29aac16
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Thu Apr 24 11:32:36 2008 +0930

    Xext: add a few lines of comments to XGE.

diff --git a/Xext/geext.c b/Xext/geext.c
index c6c8713..19763a0 100644
--- a/Xext/geext.c
+++ b/Xext/geext.c
@@ -178,7 +178,7 @@ static void GEClientCallback(CallbackListPtr *list,
     pGEClient->minor_version = 0;
 }
 
-/* reset extension */
+/* Reset extension. Called on server shutdown. */
 static void
 GEResetProc(ExtensionEntry *extEntry)
 {
@@ -190,7 +190,13 @@ GEResetProc(ExtensionEntry *extEntry)
     GEEventType = 0;
 }
 
-/*  Calls the registered event swap function for the extension. */
+/*  Calls the registered event swap function for the extension.
+ *
+ *  Each extension can register a swap function to handle GenericEvents being
+ *  swapped properly. The server calls SGEGenericEvent() before the event is
+ *  written on the wire, this one calls the registered swap function to do the
+ *  work.
+ */
 static void
 SGEGenericEvent(xEvent* from, xEvent* to)
 {
@@ -207,7 +213,10 @@ SGEGenericEvent(xEvent* from, xEvent* to)
         GEExtensions[gefrom->extension & 0x7F].evswap(gefrom, geto);
 }
 
-/* init extension, register at server */
+/* Init extension, register at server.
+ * Since other extensions may rely on XGE (XInput does already), it is a good
+ * idea to init XGE first, before any other extension.
+ */
 void
 GEExtensionInit(void)
 {
@@ -357,8 +366,8 @@ void GEWindowSetMask(ClientPtr pClient, DeviceIntPtr pDev,
         {
             pWin->optional->geMasks->geClients = cli->next;
             xfree(cli);
-        } else 
-        { 
+        } else
+        {
             GenericMaskPtr prev = cli;
             cli = cli->next;
 
commit 745b90cde1007383ec8c887f02439a34ab427f31
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Thu Apr 24 11:27:22 2008 +0930

    Xext: re-do the XGE versioning handling.
    
    Basically the same approach RandR takes. Remember which one the client
    requested, send back the one the server supports. Also divide XGE server
    version (now defined in geext.c) and the client's version (still in the
    protocol definition).

diff --git a/Xext/geext.c b/Xext/geext.c
index 8347322..c6c8713 100644
--- a/Xext/geext.c
+++ b/Xext/geext.c
@@ -1,4 +1,4 @@
-/* 
+/*
 
 Copyright 2007 Peter Hutterer <peter at cs.unisa.edu.au>
 
@@ -36,6 +36,11 @@ from the author.
 #include "geint.h"
 #include "geext.h"
 
+/* Currently supported XGE version */
+#define SERVER_GE_MAJOR 1
+#define SERVER_GE_MINOR 0
+
+
 int GEEventBase;
 int GEErrorBase;
 DevPrivateKey GEClientPrivateKey = &GEClientPrivateKey;
@@ -73,20 +78,13 @@ static int ProcGEQueryVersion(ClientPtr client)
     rep.length = 0;
     rep.sequenceNumber = client->sequence;
 
-    if (stuff->majorVersion < GE_MAJOR) {
-        rep.majorVersion = stuff->majorVersion;
-        rep.minorVersion = stuff->minorVersion;
-    } else {
-        rep.majorVersion = GE_MAJOR;
-        if (stuff->majorVersion == GE_MAJOR &&
-                stuff->minorVersion < GE_MINOR)
-            rep.minorVersion = stuff->minorVersion;
-        else
-            rep.minorVersion = GE_MINOR;
-    }
+    /* return the supported version by the server */
+    rep.majorVersion = SERVER_GE_MAJOR;
+    rep.minorVersion = SERVER_GE_MINOR;
 
-    pGEClient->major_version = rep.majorVersion;
-    pGEClient->minor_version = rep.minorVersion;
+    /* Remember version the client requested */
+    pGEClient->major_version = stuff->majorVersion;
+    pGEClient->minor_version = stuff->minorVersion;
 
     if (client->swapped)
     {
@@ -156,7 +154,12 @@ SProcGEDispatch(ClientPtr client)
     return (*SProcGEVector[stuff->ReqType])(client);
 }
 
-/* new client callback */
+/**
+ * Called when a new client inits a connection to the X server.
+ *
+ * We alloc a simple struct to store the client's major/minor version. Can be
+ * used in the furture for versioning support.
+ */
 static void GEClientCallback(CallbackListPtr *list,
         pointer closure,
         pointer data)
commit 5f3e5b3462bb02e828c70d0e1890b5a83d399d42
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Thu Apr 24 11:03:23 2008 +0930

    Xext: remove trailing whitespaces in geext.{c|h}

diff --git a/Xext/geext.c b/Xext/geext.c
index 77bb181..8347322 100644
--- a/Xext/geext.c
+++ b/Xext/geext.c
@@ -78,7 +78,7 @@ static int ProcGEQueryVersion(ClientPtr client)
         rep.minorVersion = stuff->minorVersion;
     } else {
         rep.majorVersion = GE_MAJOR;
-        if (stuff->majorVersion == GE_MAJOR && 
+        if (stuff->majorVersion == GE_MAJOR &&
                 stuff->minorVersion < GE_MINOR)
             rep.minorVersion = stuff->minorVersion;
         else
@@ -90,8 +90,8 @@ static int ProcGEQueryVersion(ClientPtr client)
 
     if (client->swapped)
     {
-    	swaps(&rep.sequenceNumber, n);
-    	swapl(&rep.length, n);
+	swaps(&rep.sequenceNumber, n);
+        swapl(&rep.length, n);
         swaps(&rep.majorVersion, n);
         swaps(&rep.minorVersion, n);
     }
@@ -132,7 +132,7 @@ int (*SProcGEVector[GENumberRequests])(ClientPtr) = {
 /************************************************************/
 
 /* dispatch requests */
-static int 
+static int
 ProcGEDispatch(ClientPtr client)
 {
     GEClientInfoPtr pGEClient = GEGetClient(client);
@@ -188,7 +188,7 @@ GEResetProc(ExtensionEntry *extEntry)
 }
 
 /*  Calls the registered event swap function for the extension. */
-static void 
+static void
 SGEGenericEvent(xEvent* from, xEvent* to)
 {
     xGenericEvent* gefrom = (xGenericEvent*)from;
@@ -215,9 +215,9 @@ GEExtensionInit(void)
         FatalError("GEExtensionInit: register client callback failed.\n");
     }
 
-    if((extEntry = AddExtension(GE_NAME, 
-                        GENumberEvents, GENumberErrors, 
-                        ProcGEDispatch, SProcGEDispatch, 
+    if((extEntry = AddExtension(GE_NAME,
+                        GENumberEvents, GENumberErrors,
+                        ProcGEDispatch, SProcGEDispatch,
                         GEResetProc, StandardMinorOpcode)) != 0)
     {
         GEEventBase = extEntry->eventBase;
@@ -239,15 +239,15 @@ GEExtensionInit(void)
 
 /* Register an extension with GE. The given swap function will be called each
  * time an event is sent to a client with different byte order.
- * @param extension The extensions major opcode 
- * @param ev_swap The event swap function.  
+ * @param extension The extensions major opcode
+ * @param ev_swap The event swap function.
  * @param ev_fill Called for an event before delivery. The extension now has
  * the chance to fill in necessary fields for the event.
  */
 void GERegisterExtension(
-        int extension, 
+        int extension,
         void (*ev_swap)(xGenericEvent* from, xGenericEvent* to),
-        void (*ev_fill)(xGenericEvent* ev, DeviceIntPtr pDev, 
+        void (*ev_fill)(xGenericEvent* ev, DeviceIntPtr pDev,
                         WindowPtr pWin, GrabPtr pGrab)
         )
 {
@@ -261,8 +261,8 @@ void GERegisterExtension(
 
 
 /* Sets type and extension field for a generic event. This is just an
- * auxiliary function, extensions could do it manually too. 
- */ 
+ * auxiliary function, extensions could do it manually too.
+ */
 void GEInitEvent(xGenericEvent* ev, int extension)
 {
     ev->type = GenericEvent;
@@ -271,7 +271,7 @@ void GEInitEvent(xGenericEvent* ev, int extension)
 }
 
 /* Recalculates the summary mask for the window. */
-static void 
+static void
 GERecalculateWinMask(WindowPtr pWin)
 {
     int i;
@@ -300,7 +300,7 @@ GERecalculateWinMask(WindowPtr pWin)
 }
 
 /* Set generic event mask for given window. */
-void GEWindowSetMask(ClientPtr pClient, DeviceIntPtr pDev, 
+void GEWindowSetMask(ClientPtr pClient, DeviceIntPtr pDev,
                      WindowPtr pWin, int extension, Mask mask)
 {
     GenericMaskPtr cli;
@@ -403,7 +403,7 @@ BOOL GEDeviceMaskIsSet(WindowPtr pWin, DeviceIntPtr pDev,
 
     while(gemask)
     {
-        if ((!gemask->dev || gemask->dev == pDev) && 
+        if ((!gemask->dev || gemask->dev == pDev) &&
                 (gemask->eventMask[extension] & mask))
             return TRUE;
 
diff --git a/Xext/geext.h b/Xext/geext.h
index 577654a..84539a9 100644
--- a/Xext/geext.h
+++ b/Xext/geext.h
@@ -1,4 +1,4 @@
-/* 
+/*
 
 Copyright 2007 Peter Hutterer <peter at cs.unisa.edu.au>
 
@@ -46,7 +46,7 @@ typedef struct _GenericMaskRec {
     ClientPtr       client;                /* client who set the event mask */
     DeviceIntPtr    dev;
     Mask            eventMask[MAXEXTENSIONS]; /* one mask per extension */
-    struct _GenericMaskRec* next;            
+    struct _GenericMaskRec* next;
 } GenericMaskRec, *GenericMaskPtr;
 
 
@@ -57,7 +57,7 @@ typedef struct _GenericMaskRec {
  */
 typedef struct _GEExtension {
     void (*evswap)(xGenericEvent* from, xGenericEvent* to);
-    void (*evfill)(xGenericEvent* ev, 
+    void (*evfill)(xGenericEvent* ev,
                     DeviceIntPtr pDev,  /* device */
                     WindowPtr pWin,     /* event window */
                     GrabPtr pGrab       /* current grab, may be NULL */
@@ -101,12 +101,12 @@ void GEWindowSetMask(ClientPtr pClient, DeviceIntPtr pDev,
 void GERegisterExtension(
         int extension,
         void (*ev_dispatch)(xGenericEvent* from, xGenericEvent* to),
-        void (*ev_fill)(xGenericEvent* ev, DeviceIntPtr pDev, 
+        void (*ev_fill)(xGenericEvent* ev, DeviceIntPtr pDev,
                         WindowPtr pWin, GrabPtr pGrab)
         );
 
 void GEInitEvent(xGenericEvent* ev, int extension);
-BOOL GEDeviceMaskIsSet(WindowPtr pWin, DeviceIntPtr pDev, 
+BOOL GEDeviceMaskIsSet(WindowPtr pWin, DeviceIntPtr pDev,
                        int extension, Mask mask);
 
 void GEExtensionInit(void);
diff --git a/Xext/geint.h b/Xext/geint.h
index 57404d8..7747234 100644
--- a/Xext/geint.h
+++ b/Xext/geint.h
@@ -1,4 +1,4 @@
-/* 
+/*
 
 Copyright 2007 Peter Hutterer <peter at cs.unisa.edu.au>
 
commit 275cdc1c74b7e43ecd931d312469fecc8d998ed1
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Wed Apr 23 16:16:15 2008 +0930

    xfree86: pass correct value to mieqEnqueue (merge detritus I guess)

diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c
index d1e4393..f408fc9 100644
--- a/hw/xfree86/common/xf86Events.c
+++ b/hw/xfree86/common/xf86Events.c
@@ -818,7 +818,7 @@ xf86ReleaseKeys(DeviceIntPtr pDev)
 		    int sigstate = xf86BlockSIGIO ();
                     nevents = GetKeyboardEvents(xf86Events, pDev, KeyRelease, i);
                     for (j = 0; j < nevents; j++)
-                        mieqEnqueue(pDev, xf86Events + j);
+                        mieqEnqueue(pDev, (xf86Events + j)->event);
 		    xf86UnblockSIGIO(sigstate);
                 }
                 break;


More information about the xorg-commit mailing list