summaryrefslogtreecommitdiff
path: root/src/emuMB.c
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@redhat.com>2008-08-07 17:34:54 +0930
committerPeter Hutterer <peter.hutterer@redhat.com>2008-08-08 16:04:23 +0930
commit134829d911c698704595014ba402516ae9a2f36c (patch)
treee1251750fa92bfd21a5e6c88acccc401bb75d00d /src/emuMB.c
parent4e121b297ee0a9b179f8188926564fb8b2c3f6c8 (diff)
Simplify the property handler registration.
Instead of having separate handlers for each property, just handle all of them in one handler for emuMB, and one handler for emuWheel.
Diffstat (limited to 'src/emuMB.c')
-rw-r--r--src/emuMB.c34
1 files changed, 16 insertions, 18 deletions
diff --git a/src/emuMB.c b/src/emuMB.c
index 1992654..40175bf 100644
--- a/src/emuMB.c
+++ b/src/emuMB.c
@@ -47,6 +47,9 @@ enum {
MBEMU_AUTO
};
+static const char *propname_mbemu = "Middle Button Emulation";
+static const char *propname_mbtimeout = "Middle Button Timeout";
+
static Atom prop_mbemu = 0; /* Middle button emulation on/off property */
static Atom prop_mbtimeout = 0; /* Middle button timeout property */
@@ -349,8 +352,11 @@ EvdevMBEmuEnable(InputInfoPtr pInfo, BOOL enable)
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 3
-Atom
-EvdevMBEmuInitProperty(DeviceIntPtr dev, char* name)
+/**
+ * Initialise property for MB emulation on/off.
+ */
+void
+EvdevMBEmuInitProperty(DeviceIntPtr dev)
{
InputInfoPtr pInfo = dev->public.devicePrivate;
EvdevPtr pEvdev = pInfo->private;
@@ -358,38 +364,30 @@ EvdevMBEmuInitProperty(DeviceIntPtr dev, char* name)
INT32 valid_vals[] = { MBEMU_DISABLED, MBEMU_ENABLED, MBEMU_AUTO };
if (!dev->button) /* don't init prop for keyboards */
- return 0;
+ return;
- prop_mbemu = MakeAtom(name, strlen(name), TRUE);
+ prop_mbemu = MakeAtom((char*)propname_mbemu, strlen(propname_mbemu), TRUE);
rc = XIChangeDeviceProperty(dev, prop_mbemu, XA_INTEGER, 8,
PropModeReplace, 1,
&pEvdev->emulateMB.enabled,
FALSE, FALSE, FALSE);
if (rc != Success)
- return 0;
+ return;
rc = XIConfigureDeviceProperty(dev, prop_mbemu, FALSE, FALSE, FALSE, 3, valid_vals);
if (rc != Success)
- return 0;
- return prop_mbemu;
-}
-
-Atom
-EvdevMBEmuInitPropertyTimeout(DeviceIntPtr dev, char *name)
-{
- InputInfoPtr pInfo = dev->public.devicePrivate;
- EvdevPtr pEvdev = pInfo->private;
- int rc = TRUE;
+ return;
- prop_mbtimeout = MakeAtom(name, strlen(name), TRUE);
+ prop_mbtimeout = MakeAtom((char*)propname_mbtimeout,
+ strlen(propname_mbtimeout),
+ TRUE);
rc = XIChangeDeviceProperty(dev, prop_mbtimeout, XA_INTEGER, 16, PropModeReplace, 1,
&pEvdev->emulateMB.timeout, FALSE, FALSE,
FALSE);
if (rc != Success)
- return 0;
- return prop_mbtimeout;
+ return;
}
BOOL