summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@redhat.com>2008-09-26 10:46:47 +0930
committerPeter Hutterer <peter.hutterer@redhat.com>2008-09-30 12:24:07 +0930
commit2718a5c56b9f34360738b6525c89ea0af4c368d1 (patch)
tree650373823a83cd134ce3e4dad9ca0050e101d580
parent90d1d494f82255b07d07800d8270ad754163b7ab (diff)
Register property handlers directly, instead of abstracting them.
This removes a left-over from the early device property code where we could only have a single handler. Now it's easier to just register the handlers for each subsystem (emulate wheel, draglock and MB emulation).
-rw-r--r--src/evdev.c64
1 files changed, 6 insertions, 58 deletions
diff --git a/src/evdev.c b/src/evdev.c
index ec23786..b678a0e 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -97,22 +97,6 @@ static const char *evdevDefaults[] = {
NULL
};
-#ifdef HAVE_PROPERTIES
-typedef struct _PropHandler {
- void (*init)(DeviceIntPtr dev);
- int (*handle)(DeviceIntPtr dev, Atom prop, XIPropertyValuePtr val);
-} PropHandler;
-
-static PropHandler evdevPropHandlers[] =
-{
- {EvdevMBEmuInitProperty, EvdevMBEmuSetProperty},
- {EvdevWheelEmuInitProperty, EvdevWheelEmuSetProperty},
- {EvdevDragLockInitProperty, EvdevDragLockSetProperty},
- {NULL, NULL}
-};
-
-#endif
-
static int EvdevOn(DeviceIntPtr);
static int EvdevCacheCompare(InputInfoPtr pInfo, Bool compare);
@@ -174,30 +158,6 @@ PostKbdEvent(InputInfoPtr pInfo, struct input_event *ev, int value)
xf86PostKeyboardEvent(pInfo->dev, code, value);
}
-#ifdef HAVE_PROPERTIES
-static int
-EvdevSetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr val)
-{
- PropHandler *handler = evdevPropHandlers;
- int rc;
-
- while (handler->init || handler->handle)
- {
- if (handler->handle)
- {
- rc = handler->handle(dev, property, val);
- if (rc != Success)
- return rc;
- }
- handler++;
- }
-
- /* property not handled, report success */
- return Success;
-}
-
-#endif
-
/**
* Coming back from resume may leave us with a file descriptor that can be
* opened but fails on the first read (ENODEV).
@@ -936,22 +896,6 @@ EvdevInitButtonMapping(InputInfoPtr pInfo)
}
-
-#ifdef HAVE_PROPERTIES
-static void
-EvdevInitProperties(DeviceIntPtr device)
-{
- PropHandler *handler = evdevPropHandlers;
- while(handler->init || handler->handle)
- {
- if (handler->init)
- (*handler->init)(device);
- handler++;
- }
-
-}
-#endif
-
static int
EvdevInit(DeviceIntPtr device)
{
@@ -985,8 +929,12 @@ EvdevInit(DeviceIntPtr device)
/* We drop the return value, the only time we ever want the handlers to
* unregister is when the device dies. In which case we don't have to
* unregister anyway */
- XIRegisterPropertyHandler(device, EvdevSetProperty, NULL, NULL);
- EvdevInitProperties(device);
+ XIRegisterPropertyHandler(device, EvdevMBEmuSetProperty, NULL, NULL);
+ XIRegisterPropertyHandler(device, EvdevWheelEmuSetProperty, NULL, NULL);
+ XIRegisterPropertyHandler(device, EvdevDragLockSetProperty, NULL, NULL);
+ EvdevMBEmuInitProperty(device);
+ EvdevWheelEmuInitProperty(device);
+ EvdevDragLockInitProperty(device);
#endif
return Success;