[PATCH xf86-input-mouse] Support input ABI version 23 and 24

Keith Packard keithp at keithp.com
Mon May 30 08:42:20 UTC 2016


Version 23 has threaded input, so locking uses input_lock/input_unlock
instead of xf86BlockSIGIO/xf86UnblockSIGIO.

Version 24 removes the FD_SET arguments from block and wakeup handlers

Signed-off-by: Keith Packard <keithp at keithp.com>
---
 src/mouse.c | 45 ++++++++++++++++++++++++++++++++++++---------
 1 file changed, 36 insertions(+), 9 deletions(-)

diff --git a/src/mouse.c b/src/mouse.c
index f9f874b..dae98aa 100644
--- a/src/mouse.c
+++ b/src/mouse.c
@@ -129,6 +129,18 @@ typedef struct _DragLockRec {
 } DragLockRec, *DragLockPtr;
 
 
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 23
+#define HAVE_THREADED_INPUT	1
+#endif
+
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 24
+#define BLOCK_HANDLER_ARGS     	void *data, void *waitTime
+#define WAKEUP_HANDLER_ARGS	void *data, int i
+#else
+#define BLOCK_HANDLER_ARGS	pointer data, struct timeval **waitTime, pointer LastSelectMask
+#define WAKEUP_HANDLER_ARGS	void *data, int i, pointer LastSelectMask
+#endif
+
 #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 12
 static InputInfoPtr MousePreInit(InputDriverPtr drv, IDevPtr dev, int flags);
 #else
@@ -140,9 +152,8 @@ static void MouseCtrl(DeviceIntPtr device, PtrCtrl *ctrl);
 static void MousePostEvent(InputInfoPtr pInfo, int buttons,
                            int dx, int dy, int dz, int dw);
 static void MouseReadInput(InputInfoPtr pInfo);
-static void MouseBlockHandler(pointer data, struct timeval **waitTime,
-                              pointer LastSelectMask);
-static void MouseWakeupHandler(pointer data, int i, pointer LastSelectMask);
+static void MouseBlockHandler(BLOCK_HANDLER_ARGS);
+static void MouseWakeupHandler(WAKEUP_HANDLER_ARGS);
 static void FlushButtons(MouseDevPtr pMse);
 
 static Bool SetupMouse(InputInfoPtr pInfo);
@@ -2025,12 +2036,18 @@ static CARD32
 buttonTimer(InputInfoPtr pInfo)
 {
     MouseDevPtr pMse;
+#if !HAVE_THREADED_INPUT
     int sigstate;
+#endif
     int id;
 
     pMse = pInfo->private;
 
+#if HAVE_THREADED_INPUT
+    input_lock();
+#else
     sigstate = xf86BlockSIGIO ();
+#endif
 
     pMse->emulate3Pending = FALSE;
     if ((id = stateTab[pMse->emulateState][4][0]) != 0) {
@@ -2041,7 +2058,11 @@ buttonTimer(InputInfoPtr pInfo)
             "Got unexpected buttonTimer in state %d\n", pMse->emulateState);
     }
 
+#if HAVE_THREADED_INPUT
+    input_unlock();
+#else
     xf86UnblockSIGIO (sigstate);
+#endif
     return 0;
 }
 
@@ -2098,9 +2119,7 @@ Emulate3ButtonsSoft(InputInfoPtr pInfo)
 #endif
 }
 
-static void MouseBlockHandler(pointer data,
-                              struct timeval **waitTime,
-                              pointer LastSelectMask)
+static void MouseBlockHandler(BLOCK_HANDLER_ARGS)
 {
     InputInfoPtr    pInfo = (InputInfoPtr) data;
     MouseDevPtr     pMse = (MouseDevPtr) pInfo->private;
@@ -2115,9 +2134,7 @@ static void MouseBlockHandler(pointer data,
     }
 }
 
-static void MouseWakeupHandler(pointer data,
-                               int i,
-                               pointer LastSelectMask)
+static void MouseWakeupHandler(WAKEUP_HANDLER_ARGS)
 {
     InputInfoPtr    pInfo = (InputInfoPtr) data;
     MouseDevPtr     pMse = (MouseDevPtr) pInfo->private;
@@ -3276,14 +3293,20 @@ createProtoList(MouseDevPtr pMse, MouseProtocolID *protoList)
     unsigned char *para;
     mousePrivPtr mPriv = (mousePrivPtr)pMse->mousePriv;
     MouseProtocolID *tmplist = NULL;
+#if !HAVE_THREADED_INPUT
     int blocked;
+#endif
 
     AP_DBGC(("Autoprobe: "));
     for (i = 0; i < mPriv->count; i++)
         AP_DBGC(("%2.2x ", (unsigned char) mPriv->data[i]));
     AP_DBGC(("\n"));
 
+#if HAVE_THREADED_INPUT
+    input_lock();
+#else
     blocked = xf86BlockSIGIO ();
+#endif
 
     /* create a private copy first so we can write in the old list */
     if ((tmplist = malloc(sizeof(MouseProtocolID) * NUM_AUTOPROBE_PROTOS))){
@@ -3392,7 +3415,11 @@ createProtoList(MouseDevPtr pMse, MouseProtocolID *protoList)
         }
     }
 
+#if HAVE_THREADED_INPUT
+    input_unlock();
+#else
     xf86UnblockSIGIO(blocked);
+#endif
 
     mPriv->protoList[k] = PROT_UNKNOWN;
 
-- 
2.8.1



More information about the xorg-devel mailing list