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 <peter.hutterer@who-t.net>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
This commit is contained in:
Peter Hutterer 2010-07-22 09:53:35 +10:00
parent 67ffbcc14c
commit 0fb7a5c261
14 changed files with 5 additions and 94 deletions

View File

@ -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)
{

View File

@ -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);
************************************************************************/

View File

@ -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)
{

View File

@ -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.
</para>
<para>
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().
</para>
<para>
<blockquote><programlisting>
@ -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.
</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.
@ -5163,8 +5140,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>

View File

@ -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

View File

@ -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);

View File

@ -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;

View File

@ -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();

View File

@ -353,7 +353,6 @@ xf86ActivateDevice(LocalDevicePtr local)
dev->config_info = xf86SetStrOption(local->options, "config_info", NULL);
RegisterOtherDevice(dev);
XkbSetExtension(dev, ProcessKeyboardEvent);
if (serverGeneration == 1)

View File

@ -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;

View File

@ -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");

View File

@ -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");

View File

@ -146,10 +146,6 @@ typedef struct _GrabParameters {
} GrabParameters;
extern void
RegisterOtherDevice (
DeviceIntPtr /* device */);
extern int
UpdateDeviceState (
DeviceIntPtr /* device */,

View File

@ -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 */,