[PATCH 1/4] input: remove GetKeyboardValuatorEvents, this is now unnecessary.

Peter Hutterer peter.hutterer at who-t.net
Thu Apr 14 19:47:22 PDT 2011


GetKeyboardValuatorEvents handles NULL valuator masks already, so the
GetKeyboardEvents wrapper is not needed. Rename GKVE to GKE.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 Xext/xtest.c                   |    2 +-
 dix/devices.c                  |    2 +-
 dix/getevents.c                |   21 ++++-----------------
 hw/dmx/input/dmxevents.c       |    6 +++---
 hw/kdrive/src/kinput.c         |    4 ++--
 hw/xfree86/common/xf86Events.c |    2 +-
 hw/xfree86/common/xf86Xinput.c |   13 +++----------
 hw/xnest/Events.c              |    2 +-
 hw/xquartz/darwinEvents.c      |    2 +-
 hw/xwin/winkeybd.c             |    2 +-
 include/input.h                |    6 ------
 11 files changed, 18 insertions(+), 44 deletions(-)

diff --git a/Xext/xtest.c b/Xext/xtest.c
index 6780aa6..18e1ef7 100644
--- a/Xext/xtest.c
+++ b/Xext/xtest.c
@@ -423,7 +423,7 @@ ProcXTestFakeInput(ClientPtr client)
             break;
         case KeyPress:
         case KeyRelease:
-            nevents = GetKeyboardEvents(xtest_evlist, dev, type, ev->u.u.detail);
+            nevents = GetKeyboardEvents(xtest_evlist, dev, type, ev->u.u.detail, NULL);
             break;
     }
 
diff --git a/dix/devices.c b/dix/devices.c
index 089c3c3..8acb88d 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -2383,7 +2383,7 @@ ReleaseButtonsAndKeys(DeviceIntPtr dev)
     {
         if (BitIsOn(k->down, i))
         {
-            nevents = GetKeyboardEvents(eventlist, dev, KeyRelease, i);
+            nevents = GetKeyboardEvents(eventlist, dev, KeyRelease, i, NULL);
             for (j = 0; j < nevents; j++)
                 mieqProcessDeviceEvent(dev, (InternalEvent*)(eventlist+j)->event, NULL);
         }
diff --git a/dix/getevents.c b/dix/getevents.c
index 644b388..0fa8046 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -616,8 +616,8 @@ updateMotionHistory(DeviceIntPtr pDev, CARD32 ms, ValuatorMask *mask,
 
 
 /**
- * Returns the maximum number of events GetKeyboardEvents,
- * GetKeyboardValuatorEvents, and GetPointerEvents will ever return.
+ * Returns the maximum number of events GetKeyboardEvents
+ * and GetPointerEvents will ever return.
  *
  * This MUST be absolutely constant, from init until exit.
  */
@@ -926,19 +926,6 @@ updateHistory(DeviceIntPtr dev, ValuatorMask *mask, CARD32 ms)
 }
 
 /**
- * Convenience wrapper around GetKeyboardValuatorEvents, that takes no
- * valuators.
- */
-int
-GetKeyboardEvents(EventList *events, DeviceIntPtr pDev, int type, int key_code) {
-    ValuatorMask mask;
-
-    valuator_mask_zero(&mask);
-    return GetKeyboardValuatorEvents(events, pDev, type, key_code, &mask);
-}
-
-
-/**
  * Returns a set of InternalEvents for KeyPress/KeyRelease, optionally
  * also with valuator events.
  *
@@ -947,8 +934,8 @@ GetKeyboardEvents(EventList *events, DeviceIntPtr pDev, int type, int key_code)
  * place via GetMaximumEventsNum(), and for freeing it.
  */
 int
-GetKeyboardValuatorEvents(EventList *events, DeviceIntPtr pDev, int type,
-                          int key_code, const ValuatorMask *mask_in) {
+GetKeyboardEvents(EventList *events, DeviceIntPtr pDev, int type,
+                  int key_code, const ValuatorMask *mask_in) {
     int num_events = 0;
     CARD32 ms = 0;
     DeviceEvent *event;
diff --git a/hw/dmx/input/dmxevents.c b/hw/dmx/input/dmxevents.c
index 0360517..15d80f5 100644
--- a/hw/dmx/input/dmxevents.c
+++ b/hw/dmx/input/dmxevents.c
@@ -453,8 +453,8 @@ static int dmxTranslateAndEnqueueExtEvent(DMXLocalInputInfoPtr dmxLocal,
         if (block)
             dmxSigioBlock();
         GetEventList(&events);
-        nevents = GetKeyboardValuatorEvents(events, pDevice, event,
-                                            ke->keycode, &mask);
+        nevents = GetKeyboardEvents(events, pDevice, event,
+                                    ke->keycode, &mask);
         for (i = 0; i < nevents; i++)
             mieqEnqueue(pDevice, (InternalEvent*)(events + i)->event);
 
@@ -685,7 +685,7 @@ void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym,
 
         GetEventList(&events);
         /*ErrorF("KEY %d  sym %d\n", detail, (int) keySym);*/
-        nevents = GetKeyboardEvents(events, p, type, detail);
+        nevents = GetKeyboardEvents(events, p, type, detail, NULL);
         for (i = 0; i < nevents; i++)
             mieqEnqueue(p, (InternalEvent*)(events + i)->event);
         return;
diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c
index e3bc4c5..f21475f 100644
--- a/hw/kdrive/src/kinput.c
+++ b/hw/kdrive/src/kinput.c
@@ -1804,7 +1804,7 @@ KdReleaseAllKeys (void)
             if (key_is_down(ki->dixdev, key, KEY_POSTED | KEY_PROCESSED)) {
                 KdHandleKeyboardEvent(ki, KeyRelease, key);
                 GetEventList(&kdEvents);
-                nEvents = GetKeyboardEvents(kdEvents, ki->dixdev, KeyRelease, key);
+                nEvents = GetKeyboardEvents(kdEvents, ki->dixdev, KeyRelease, key, NULL);
                 for (i = 0; i < nEvents; i++)
                     KdQueueEvent (ki->dixdev, (kdEvents + i)->event);
             }
@@ -1864,7 +1864,7 @@ KdEnqueueKeyboardEvent(KdKeyboardInfo   *ki,
 
         GetEventList(&kdEvents);
 
-        nEvents = GetKeyboardEvents(kdEvents, ki->dixdev, type, key_code);
+        nEvents = GetKeyboardEvents(kdEvents, ki->dixdev, type, key_code, NULL);
         for (i = 0; i < nEvents; i++)
             KdQueueEvent(ki->dixdev, (InternalEvent *)((kdEvents + i)->event));
     }
diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c
index 84c0d18..3006ad1 100644
--- a/hw/xfree86/common/xf86Events.c
+++ b/hw/xfree86/common/xf86Events.c
@@ -399,7 +399,7 @@ xf86ReleaseKeys(DeviceIntPtr pDev)
          i++) {
         if (key_is_down(pDev, i, KEY_POSTED)) {
             sigstate = xf86BlockSIGIO ();
-            nevents = GetKeyboardEvents(xf86Events, pDev, KeyRelease, i);
+            nevents = GetKeyboardEvents(xf86Events, pDev, KeyRelease, i, NULL);
             for (j = 0; j < nevents; j++)
                 mieqEnqueue(pDev, (InternalEvent*)(xf86Events + j)->event);
             xf86UnblockSIGIO(sigstate);
diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index ee1b53f..ef4542c 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -1250,16 +1250,9 @@ xf86PostKeyEventM(DeviceIntPtr	device,
     }
 #endif
 
-    if (is_absolute) {
-        nevents = GetKeyboardValuatorEvents(xf86Events, device,
-                                            is_down ? KeyPress : KeyRelease,
-                                            key_code, mask);
-    }
-    else {
-        nevents = GetKeyboardEvents(xf86Events, device,
-                                    is_down ? KeyPress : KeyRelease,
-                                    key_code);
-    }
+    nevents = GetKeyboardEvents(xf86Events, device,
+                                is_down ? KeyPress : KeyRelease,
+                                key_code, mask);
 
     for (i = 0; i < nevents; i++)
         mieqEnqueue(device, (InternalEvent*)((xf86Events + i)->event));
diff --git a/hw/xnest/Events.c b/hw/xnest/Events.c
index 5ff6d21..5c80086 100644
--- a/hw/xnest/Events.c
+++ b/hw/xnest/Events.c
@@ -108,7 +108,7 @@ xnestQueueKeyEvent(int type, unsigned int keycode)
 
   GetEventList(&xnestEvents);
   lastEventTime = GetTimeInMillis();
-  n = GetKeyboardEvents(xnestEvents, xnestKeyboardDevice, type, keycode);
+  n = GetKeyboardEvents(xnestEvents, xnestKeyboardDevice, type, keycode, NULL);
   for (i = 0; i < n; i++)
     mieqEnqueue(xnestKeyboardDevice, (InternalEvent*)(xnestEvents + i)->event);
 }
diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c
index 16fec4a..451129e 100644
--- a/hw/xquartz/darwinEvents.c
+++ b/hw/xquartz/darwinEvents.c
@@ -482,7 +482,7 @@ void DarwinSendKeyboardEvents(int ev_type, int keycode) {
 	}
 
     darwinEvents_lock(); {
-        num_events = GetKeyboardEvents(darwinEvents, darwinKeyboard, ev_type, keycode + MIN_KEYCODE);
+        num_events = GetKeyboardEvents(darwinEvents, darwinKeyboard, ev_type, keycode + MIN_KEYCODE, NULL);
         for(i=0; i<num_events; i++) mieqEnqueue(darwinKeyboard, (InternalEvent*)darwinEvents[i].event);
         if(num_events > 0) DarwinPokeEQ();
     } darwinEvents_unlock();
diff --git a/hw/xwin/winkeybd.c b/hw/xwin/winkeybd.c
index 9e5a9b0..912e2de 100644
--- a/hw/xwin/winkeybd.c
+++ b/hw/xwin/winkeybd.c
@@ -485,7 +485,7 @@ winSendKeyEvent (DWORD dwKey, Bool fDown)
   g_winKeyState[dwKey] = fDown;
 
   GetEventList(&events);
-  nevents = GetKeyboardEvents(events, g_pwinKeyboard, fDown ? KeyPress : KeyRelease, dwKey + MIN_KEYCODE);
+  nevents = GetKeyboardEvents(events, g_pwinKeyboard, fDown ? KeyPress : KeyRelease, dwKey + MIN_KEYCODE, NULL);
 
   for (i = 0; i < nevents; i++)
     mieqEnqueue(g_pwinKeyboard, (InternalEvent*)events[i].event);
diff --git a/include/input.h b/include/input.h
index 44e18a4..d0a86aa 100644
--- a/include/input.h
+++ b/include/input.h
@@ -459,12 +459,6 @@ extern _X_EXPORT int GetKeyboardEvents(
     EventListPtr events,
     DeviceIntPtr pDev,
     int type,
-    int key_code);
-
-extern int GetKeyboardValuatorEvents(
-    EventListPtr events,
-    DeviceIntPtr pDev,
-    int type,
     int key_code,
     const ValuatorMask *mask);
 
-- 
1.7.4.2



More information about the xorg-devel mailing list