[PATCH 06/19] input: Purge Register*Device() functions.

Peter Hutterer peter.hutterer at who-t.net
Thu Jul 29 23:21:22 PDT 2010


RegisterPointerDevice() and RegisterKeyboardDevice() were already mapped to
RegisterOtherDevice() and obsolete.

RegisterOtherDevice() was called for all devices and the two assignments can
simply be moved into AddInputDevice(). Purge RegisterOtherDevice() and
pretend it never happened.

*lalalalala*

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 Xi/exevents.c                  |    7 -------
 Xi/stubs.c                     |    1 -
 dix/devices.c                  |   17 +++--------------
 doc/xml/Xserver-spec.xml       |   25 -------------------------
 hw/dmx/doc/dmx.xml             |   14 +-------------
 hw/dmx/input/dmxinputinit.c    |    8 +-------
 hw/kdrive/src/kinput.c         |    4 ----
 hw/vfb/InitInput.c             |    2 --
 hw/xfree86/common/xf86Xinput.c |    1 -
 hw/xquartz/darwin.c            |    5 -----
 hw/xquartz/darwinXinput.c      |    1 -
 hw/xwin/InitInput.c            |    4 ----
 include/exevents.h             |    4 ----
 include/input.h                |    6 ------
 14 files changed, 5 insertions(+), 94 deletions(-)

diff --git a/Xi/exevents.c b/Xi/exevents.c
index e990aeb..7eb67ff 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -111,13 +111,6 @@ XIShouldNotify(ClientPtr client, DeviceIntPtr dev)
     return 0;
 }
 
-void
-RegisterOtherDevice(DeviceIntPtr device)
-{
-    device->public.processInputProc = ProcessOtherEvent;
-    device->public.realInputProc = ProcessOtherEvent;
-}
-
 Bool
 IsPointerEvent(InternalEvent* event)
 {
diff --git a/Xi/stubs.c b/Xi/stubs.c
index 296a8c4..de80042 100644
--- a/Xi/stubs.c
+++ b/Xi/stubs.c
@@ -122,7 +122,6 @@ AddOtherInputDevices(void)
 
     dev = (DeviceIntPtr) AddInputDevice(deviceProc, TRUE);
     dev->public.devicePrivate = private;
-    RegisterOtherDevice(dev);
     dev->inited = ((*dev->deviceProc)(dev, DEVICE_INIT) == Success);
     ************************************************************************/
 
diff --git a/dix/devices.c b/dix/devices.c
index ac5806a..aea5778 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -261,8 +261,8 @@ AddInputDevice(ClientPtr client, DeviceProc deviceProc, Bool autoStart)
     if (!dev)
 	return (DeviceIntPtr)NULL;
     dev->id = devid;
-    dev->public.processInputProc = (ProcessInputProc)NoopDDA;
-    dev->public.realInputProc = (ProcessInputProc)NoopDDA;
+    dev->public.processInputProc = ProcessOtherEvent;
+    dev->public.realInputProc = ProcessOtherEvent;
     dev->public.enqueueInputProc = EnqueueEvent;
     dev->deviceProc = deviceProc;
     dev->startup = autoStart;
@@ -272,6 +272,7 @@ AddInputDevice(ClientPtr client, DeviceProc deviceProc, Bool autoStart)
     dev->deviceGrab.ActivateGrab = ActivateKeyboardGrab;
     dev->deviceGrab.DeactivateGrab = DeactivateKeyboardGrab;
 
+
     dev->coreEvents = TRUE;
 
     /* sprite defaults */
@@ -1106,18 +1107,6 @@ NumMotionEvents(void)
     return inputInfo.pointer->valuator->numMotionEvents;
 }
 
-void
-RegisterPointerDevice(DeviceIntPtr device)
-{
-    RegisterOtherDevice(device);
-}
-
-void
-RegisterKeyboardDevice(DeviceIntPtr device)
-{
-    RegisterOtherDevice(device);
-}
-
 int
 dixLookupDevice(DeviceIntPtr *pDev, int id, ClientPtr client, Mask access_mode)
 {
diff --git a/doc/xml/Xserver-spec.xml b/doc/xml/Xserver-spec.xml
index 466b79d..26c89a4 100644
--- a/doc/xml/Xserver-spec.xml
+++ b/doc/xml/Xserver-spec.xml
@@ -1703,8 +1703,6 @@ Input initialization is a bit complicated.
 It all starts with InitInput(), a routine that you write to call
 AddInputDevice() twice
 (once for pointing device and once for keyboard.)
-You also want to call RegisterKeyboardDevice() and RegisterPointerDevice()
-on them.
 </para>
 <para>
 When you Add the devices, a routine you supply for each device
@@ -1724,8 +1722,6 @@ the pointer is the pointer.
 InitInput is a DDX routine you must write to initialize the
 input subsystem in DDX.
 It must call AddInputDevice() for each device that might generate events.
-In addition, you must register the main keyboard and pointing devices by
-calling RegisterPointerDevice() and RegisterKeyboardDevice().
 </para>
 <para>
 <blockquote><programlisting>
@@ -1748,25 +1744,6 @@ Note also that except for the main keyboard and pointing device,
 an extension is needed to provide for a client interface to a device.
 </para>
 <para>
-<blockquote><programlisting>
-
-	void RegisterPointerDevice(device)
-		DevicePtr device;
-</programlisting></blockquote>
-RegisterPointerDevice is a DIX routine that your DDX code calls that
-makes that device the main pointing device.
-This routine is called once upon initialization and cannot be called again.
-</para>
-<para>
-<blockquote><programlisting>
-
-	void RegisterKeyboardDevice(device)
-		DevicePtr device;
-</programlisting></blockquote>
-RegisterKeyboardDevice makes the given device the main keyboard.
-This routine is called once upon initialization and cannot be called again.
-</para>
-<para>
 The following DIX
 procedures return the specified DevicePtr. They may or may not be useful
 to DDX implementors.
@@ -5147,8 +5124,6 @@ mi and fb implementations.</para>
 	      </row>
 	    </thead>
 	    <tbody>
-<row><entry><function>RegisterKeyboardDevice</function></entry><entry><literal>dix</literal></entry><entry><para></para></entry></row>
-<row><entry><function>RegisterPointerDevice</function></entry><entry><literal>dix</literal></entry><entry><para></para></entry></row>
 <row><entry><function>RemoveEnabledDevice</function></entry><entry><literal>os</literal></entry><entry><para></para></entry></row>
 <row><entry><function>ResetCurrentRequest</function></entry><entry><literal>os</literal></entry><entry><para></para></entry></row>
 <row><entry><function>SaveScreen</function></entry><entry><literal>ddx</literal></entry><entry><para>Screen</para></entry></row>
diff --git a/hw/dmx/doc/dmx.xml b/hw/dmx/doc/dmx.xml
index c6dc0cc..8dbb7d8 100644
--- a/hw/dmx/doc/dmx.xml
+++ b/hw/dmx/doc/dmx.xml
@@ -817,22 +817,10 @@ is called once for each input device.
 </para>
 
 <para>Once input handles for core keyboard and core pointer devices have
-been obtained from AddInputDevice(), they are registered as core devices
-by calling RegisterPointerDevice() and RegisterKeyboardDevice().  Each
-of these should be called once.  If both core devices are not
+been obtained from AddInputDevice().  If both core devices are not
 registered, then the X server will exit with a fatal error when it
 attempts to start the input devices in InitAndStartDevices(), which is
 called directly after InitInput() (see below).
-
-<variablelist>
-<varlistentry>
-<term>Register{Pointer,Keyboard}Device()</term>
-<listitem><para>These DIX functions take a
-handle returned from AddInputDevice() and initialize the core input
-device fields in inputInfo, and initialize the input processing and grab
-functions for each core input device.
-</para></listitem></varlistentry>
-</variablelist>
 </para>
 
 <para>The core pointer device is then registered with the miPointer code
diff --git a/hw/dmx/input/dmxinputinit.c b/hw/dmx/input/dmxinputinit.c
index 83a2abb..829a289 100644
--- a/hw/dmx/input/dmxinputinit.c
+++ b/hw/dmx/input/dmxinputinit.c
@@ -693,7 +693,6 @@ static DeviceIntPtr dmxAddDevice(DMXLocalInputInfoPtr dmxLocal)
     DeviceIntPtr pDevice;
     Atom         atom;
     const char   *name = NULL;
-    void         (*registerProcPtr)(DeviceIntPtr)   = NULL;
     char         *devname;
     DMXInputInfo *dmxInput;
 
@@ -706,22 +705,19 @@ static DeviceIntPtr dmxAddDevice(DMXLocalInputInfoPtr dmxLocal)
             dmxLocal->isCore     = 1;
             dmxLocalCoreKeyboard = dmxLocal;
             name                 = "keyboard";
-            registerProcPtr      = RegisterKeyboardDevice;
         }
         if (dmxLocal->type == DMX_LOCAL_MOUSE && !dmxLocalCorePointer) {
             dmxLocal->isCore     = 1;
             dmxLocalCorePointer  = dmxLocal;
             name                 = "pointer";
-            registerProcPtr      = RegisterPointerDevice;
         }
     }
 
     if (!name) {
         name            = "extension";
-        registerProcPtr = RegisterOtherDevice;
     }
 
-    if (!name || !registerProcPtr)
+    if (!name)
         dmxLog(dmxFatal, "Cannot add device %s\n", dmxLocal->name);
 
     pDevice                       = AddInputDevice(serverClient, dmxDeviceOnOff, TRUE);
@@ -738,8 +734,6 @@ static DeviceIntPtr dmxAddDevice(DMXLocalInputInfoPtr dmxLocal)
     pDevice->type = atom;
     pDevice->name = devname;
 
-    registerProcPtr(pDevice);
-
     if (dmxLocal->isCore && dmxLocal->type == DMX_LOCAL_MOUSE) {
 #if 00 /*BP*/
         miRegisterPointerDevice(screenInfo.screens[0], pDevice);
diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c
index fcb02b5..a4691df 100644
--- a/hw/kdrive/src/kinput.c
+++ b/hw/kdrive/src/kinput.c
@@ -943,8 +943,6 @@ KdAddKeyboard (KdKeyboardInfo *ki)
         return !Success;
     }
 
-    RegisterOtherDevice(ki->dixdev);
-
 #ifdef DEBUG
     ErrorF("added keyboard %s with dix id %d\n", ki->name, ki->dixdev->id);
 #endif
@@ -1012,8 +1010,6 @@ KdAddPointer (KdPointerInfo *pi)
         return BadDevice;
     }
 
-    RegisterOtherDevice(pi->dixdev);
-
     for (prev = &kdPointers; *prev; prev = &(*prev)->next);
     *prev = pi;
 
diff --git a/hw/vfb/InitInput.c b/hw/vfb/InitInput.c
index 801aaa0..60b59c1 100644
--- a/hw/vfb/InitInput.c
+++ b/hw/vfb/InitInput.c
@@ -138,10 +138,8 @@ InitInput(int argc, char *argv[])
     Atom xiclass;
     p = AddInputDevice(serverClient, vfbMouseProc, TRUE);
     k = AddInputDevice(serverClient, vfbKeybdProc, TRUE);
-    RegisterPointerDevice(p);
     xiclass = MakeAtom(XI_MOUSE, sizeof(XI_MOUSE) - 1, TRUE);
     AssignTypeAndName(p, xiclass, "Xvfb mouse");
-    RegisterKeyboardDevice(k);
     xiclass = MakeAtom(XI_KEYBOARD, sizeof(XI_KEYBOARD) - 1, TRUE);
     AssignTypeAndName(k, xiclass, "Xvfb keyboard");
     (void)mieqInit();
diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index 65eea0e..0a0de8e 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -357,7 +357,6 @@ xf86ActivateDevice(LocalDevicePtr local)
 
         dev->config_info = xf86SetStrOption(local->options, "config_info", NULL);
 
-        RegisterOtherDevice(dev);
         XkbSetExtension(dev, ProcessKeyboardEvent);
 
         if (serverGeneration == 1) 
diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c
index a99c0f1..2362fac 100644
--- a/hw/xquartz/darwin.c
+++ b/hw/xquartz/darwin.c
@@ -468,7 +468,6 @@ void InitInput( int argc, char **argv )
     XkbSetRulesDflts(&rmlvo);
 
     darwinKeyboard = AddInputDevice(serverClient, DarwinKeybdProc, TRUE);
-    RegisterKeyboardDevice( darwinKeyboard );
     darwinKeyboard->name = strdup("keyboard");
 
     /* here's the snippet from the current gdk sources:
@@ -486,19 +485,15 @@ void InitInput( int argc, char **argv )
     */
 
     darwinPointer = AddInputDevice(serverClient, DarwinMouseProc, TRUE);
-    RegisterPointerDevice( darwinPointer );
     darwinPointer->name = strdup("pointer");
 
     darwinTabletStylus = AddInputDevice(serverClient, DarwinTabletProc, TRUE);
-    RegisterPointerDevice( darwinTabletStylus );
     darwinTabletStylus->name = strdup("pen");
 
     darwinTabletCursor = AddInputDevice(serverClient, DarwinTabletProc, TRUE);
-    RegisterPointerDevice( darwinTabletCursor );
     darwinTabletCursor->name = strdup("cursor");
 
     darwinTabletEraser = AddInputDevice(serverClient, DarwinTabletProc, TRUE);
-    RegisterPointerDevice( darwinTabletEraser );
     darwinTabletEraser->name = strdup("eraser");
 
     darwinTabletCurrent = darwinTabletStylus;
diff --git a/hw/xquartz/darwinXinput.c b/hw/xquartz/darwinXinput.c
index 19aefb1..966aaf3 100644
--- a/hw/xquartz/darwinXinput.c
+++ b/hw/xquartz/darwinXinput.c
@@ -120,7 +120,6 @@ AddOtherInputDevices(void)
 
     dev = (DeviceIntPtr) AddInputDevice(deviceProc, TRUE);
     dev->public.devicePrivate = private;
-    RegisterOtherDevice(dev);
     dev->inited = ((*dev->deviceProc)(dev, DEVICE_INIT) == Success);
     ************************************************************************/
   DEBUG_LOG("AddOtherInputDevices\n");
diff --git a/hw/xwin/InitInput.c b/hw/xwin/InitInput.c
index 705e618..563adb6 100644
--- a/hw/xwin/InitInput.c
+++ b/hw/xwin/InitInput.c
@@ -137,10 +137,6 @@ InitInput (int argc, char *argv[])
 
   g_pwinPointer = AddInputDevice (serverClient, winMouseProc, TRUE);
   g_pwinKeyboard = AddInputDevice (serverClient, winKeybdProc, TRUE);
-  
-  RegisterPointerDevice (g_pwinPointer);
-  RegisterKeyboardDevice (g_pwinKeyboard);
-
   g_pwinPointer->name = strdup("Windows mouse");
   g_pwinKeyboard->name = strdup("Windows keyboard");
 
diff --git a/include/exevents.h b/include/exevents.h
index 39e1c70..b64252f 100644
--- a/include/exevents.h
+++ b/include/exevents.h
@@ -146,10 +146,6 @@ typedef struct _GrabParameters {
 } GrabParameters;
 
 
-extern void
-RegisterOtherDevice (
-	DeviceIntPtr           /* device */);
-
 extern int
 UpdateDeviceState (
 	DeviceIntPtr           /* device */,
diff --git a/include/input.h b/include/input.h
index 55b1537..5f1a079 100644
--- a/include/input.h
+++ b/include/input.h
@@ -274,12 +274,6 @@ extern _X_EXPORT int RemoveDevice(
 
 extern _X_EXPORT int NumMotionEvents(void);
 
-extern void RegisterPointerDevice(
-    DeviceIntPtr /*device*/);
-
-extern void RegisterKeyboardDevice(
-    DeviceIntPtr /*device*/);
-
 extern _X_EXPORT int dixLookupDevice(
     DeviceIntPtr *         /* dev */,
     int                    /* id */,
-- 
1.7.2



More information about the xorg-devel mailing list