diff options
author | Peter Hutterer <peter.hutterer@redhat.com> | 2008-10-14 16:21:00 +1030 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@redhat.com> | 2008-10-14 16:22:00 +1030 |
commit | 0405f7b17fb0ce5cadcc6c5aa6eeb61bdacdf9cd (patch) | |
tree | 62b39a8ae96f4eb9b62020c8d4107273b8f1392f /src/emuWheel.c | |
parent | 088e0a175a4913bf827c1f7e19de09fdf987d347 (diff) |
Tidy up evdev.h
This includes shuffling some functions around so we don't need the prototypes
in evdev.h.
Diffstat (limited to 'src/emuWheel.c')
-rw-r--r-- | src/emuWheel.c | 128 |
1 files changed, 63 insertions, 65 deletions
diff --git a/src/emuWheel.c b/src/emuWheel.c index b9c9e13..6504b8d 100644 --- a/src/emuWheel.c +++ b/src/emuWheel.c @@ -311,71 +311,6 @@ EvdevWheelEmuPreInit(InputInfoPtr pInfo) } #ifdef HAVE_PROPERTIES -void -EvdevWheelEmuInitProperty(DeviceIntPtr dev) -{ - InputInfoPtr pInfo = dev->public.devicePrivate; - EvdevPtr pEvdev = pInfo->private; - int rc = TRUE; - INT32 vals[4] = { TRUE, FALSE}; - - if (!dev->button) /* don't init prop for keyboards */ - return; - - prop_wheel_emu = MakeAtom(EVDEV_PROP_WHEEL, strlen(EVDEV_PROP_WHEEL), TRUE); - rc = XIChangeDeviceProperty(dev, prop_wheel_emu, XA_INTEGER, 8, - PropModeReplace, 1, - &pEvdev->emulateWheel.enabled, FALSE); - if (rc != Success) - return; - - XISetDevicePropertyDeletable(dev, prop_wheel_emu, FALSE); - - vals[0] = pEvdev->emulateWheel.X.up_button; - vals[1] = pEvdev->emulateWheel.X.down_button; - vals[2] = pEvdev->emulateWheel.Y.up_button; - vals[3] = pEvdev->emulateWheel.Y.down_button; - - prop_wheel_axismap = MakeAtom(EVDEV_PROP_WHEEL_AXES, strlen(EVDEV_PROP_WHEEL_AXES), TRUE); - rc = XIChangeDeviceProperty(dev, prop_wheel_axismap, XA_INTEGER, 8, - PropModeReplace, 4, vals, FALSE); - - if (rc != Success) - return; - - XISetDevicePropertyDeletable(dev, prop_wheel_axismap, FALSE); - - prop_wheel_inertia = MakeAtom(EVDEV_PROP_WHEEL_INERTIA, strlen(EVDEV_PROP_WHEEL_INERTIA), TRUE); - rc = XIChangeDeviceProperty(dev, prop_wheel_inertia, XA_INTEGER, 16, - PropModeReplace, 1, - &pEvdev->emulateWheel.inertia, FALSE); - if (rc != Success) - return; - - XISetDevicePropertyDeletable(dev, prop_wheel_inertia, FALSE); - - prop_wheel_timeout = MakeAtom(EVDEV_PROP_WHEEL_TIMEOUT, strlen(EVDEV_PROP_WHEEL_TIMEOUT), TRUE); - rc = XIChangeDeviceProperty(dev, prop_wheel_timeout, XA_INTEGER, 16, - PropModeReplace, 1, - &pEvdev->emulateWheel.timeout, FALSE); - if (rc != Success) - return; - - XISetDevicePropertyDeletable(dev, prop_wheel_timeout, FALSE); - - prop_wheel_button = MakeAtom(EVDEV_PROP_WHEEL_BUTTON, strlen(EVDEV_PROP_WHEEL_BUTTON), TRUE); - rc = XIChangeDeviceProperty(dev, prop_wheel_button, XA_INTEGER, 8, - PropModeReplace, 1, - &pEvdev->emulateWheel.button, FALSE); - if (rc != Success) - return; - - XISetDevicePropertyDeletable(dev, prop_wheel_button, FALSE); - - XIRegisterPropertyHandler(dev, EvdevWheelEmuSetProperty, NULL, NULL); -} - - int EvdevWheelEmuSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val, BOOL checkonly) @@ -465,4 +400,67 @@ EvdevWheelEmuSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val, return Success; } +void +EvdevWheelEmuInitProperty(DeviceIntPtr dev) +{ + InputInfoPtr pInfo = dev->public.devicePrivate; + EvdevPtr pEvdev = pInfo->private; + int rc = TRUE; + INT32 vals[4] = { TRUE, FALSE}; + + if (!dev->button) /* don't init prop for keyboards */ + return; + + prop_wheel_emu = MakeAtom(EVDEV_PROP_WHEEL, strlen(EVDEV_PROP_WHEEL), TRUE); + rc = XIChangeDeviceProperty(dev, prop_wheel_emu, XA_INTEGER, 8, + PropModeReplace, 1, + &pEvdev->emulateWheel.enabled, FALSE); + if (rc != Success) + return; + + XISetDevicePropertyDeletable(dev, prop_wheel_emu, FALSE); + + vals[0] = pEvdev->emulateWheel.X.up_button; + vals[1] = pEvdev->emulateWheel.X.down_button; + vals[2] = pEvdev->emulateWheel.Y.up_button; + vals[3] = pEvdev->emulateWheel.Y.down_button; + + prop_wheel_axismap = MakeAtom(EVDEV_PROP_WHEEL_AXES, strlen(EVDEV_PROP_WHEEL_AXES), TRUE); + rc = XIChangeDeviceProperty(dev, prop_wheel_axismap, XA_INTEGER, 8, + PropModeReplace, 4, vals, FALSE); + + if (rc != Success) + return; + + XISetDevicePropertyDeletable(dev, prop_wheel_axismap, FALSE); + + prop_wheel_inertia = MakeAtom(EVDEV_PROP_WHEEL_INERTIA, strlen(EVDEV_PROP_WHEEL_INERTIA), TRUE); + rc = XIChangeDeviceProperty(dev, prop_wheel_inertia, XA_INTEGER, 16, + PropModeReplace, 1, + &pEvdev->emulateWheel.inertia, FALSE); + if (rc != Success) + return; + + XISetDevicePropertyDeletable(dev, prop_wheel_inertia, FALSE); + + prop_wheel_timeout = MakeAtom(EVDEV_PROP_WHEEL_TIMEOUT, strlen(EVDEV_PROP_WHEEL_TIMEOUT), TRUE); + rc = XIChangeDeviceProperty(dev, prop_wheel_timeout, XA_INTEGER, 16, + PropModeReplace, 1, + &pEvdev->emulateWheel.timeout, FALSE); + if (rc != Success) + return; + + XISetDevicePropertyDeletable(dev, prop_wheel_timeout, FALSE); + + prop_wheel_button = MakeAtom(EVDEV_PROP_WHEEL_BUTTON, strlen(EVDEV_PROP_WHEEL_BUTTON), TRUE); + rc = XIChangeDeviceProperty(dev, prop_wheel_button, XA_INTEGER, 8, + PropModeReplace, 1, + &pEvdev->emulateWheel.button, FALSE); + if (rc != Success) + return; + + XISetDevicePropertyDeletable(dev, prop_wheel_button, FALSE); + + XIRegisterPropertyHandler(dev, EvdevWheelEmuSetProperty, NULL, NULL); +} #endif |