From 0fb7a5c261aa0d87d6596d72b70696bffe0c0aff Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 22 Jul 2010 09:53:35 +1000 Subject: [PATCH] input: Purge Register*Device() functions. 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 Reviewed-by: Adam Jackson Reviewed-by: Daniel Stone --- 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 e19e207fd0..9689ef8f8f 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 296a8c4a53..de80042ecd 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 2e65a041dd..0f00f24099 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 563705fb9d..ec7f1b77b3 100644 --- a/doc/xml/Xserver-spec.xml +++ b/doc/xml/Xserver-spec.xml @@ -1710,8 +1710,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. When you Add the devices, a routine you supply for each device @@ -1731,8 +1729,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().
@@ -1755,25 +1751,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. -
- - void RegisterPointerDevice(device) - DevicePtr device; -
-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. -
- -
- - void RegisterKeyboardDevice(device) - DevicePtr device; -
-RegisterKeyboardDevice makes the given device the main keyboard. -This routine is called once upon initialization and cannot be called again. -
- The following DIX procedures return the specified DevicePtr. They may or may not be useful to DDX implementors. @@ -5163,8 +5140,6 @@ mi and fb implementations. -RegisterKeyboardDevicedix -RegisterPointerDevicedix RemoveEnabledDeviceos ResetCurrentRequestos SaveScreenddxScreen diff --git a/hw/dmx/doc/dmx.xml b/hw/dmx/doc/dmx.xml index c6dc0ccd4a..8dbb7d86fa 100644 --- a/hw/dmx/doc/dmx.xml +++ b/hw/dmx/doc/dmx.xml @@ -817,22 +817,10 @@ is called once for each input device. 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). - - - -Register{Pointer,Keyboard}Device() -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. - - 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 83a2abbb82..829a289509 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 fcb02b5b35..a4691dfec7 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 801aaa0b4d..60b59c1644 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 f773ac2d6e..0428673c4b 100644 --- a/hw/xfree86/common/xf86Xinput.c +++ b/hw/xfree86/common/xf86Xinput.c @@ -353,7 +353,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 a99c0f1553..2362faca51 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 19aefb153d..966aaf3e5a 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 705e618de4..563adb6c17 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 39e1c70fe8..b64252f367 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 ffb1c33fa8..388ef21460 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 */,