summaryrefslogtreecommitdiff
path: root/xkb/ddxDevBtn.c
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@redhat.com>2008-10-31 14:36:48 +1030
committerPeter Hutterer <peter.hutterer@redhat.com>2008-11-04 16:04:15 +1030
commitcbc6f983959595aa21c9dd72fac6a7070a650ef7 (patch)
treefe64df0f19ec15dda6b1a1cd531850097a11d708 /xkb/ddxDevBtn.c
parent4971315296cbf868dd738c1c0c1c504fcfe1b619 (diff)
xkb: when faking mouse button events, fake them on the correct devices.
When MouseKeys are activated, keyboard devices may generate fake mouse button events through XKB. Let's get then running through the appropriate paths, i.e. as XI events on the correct device. To make matters more fun, ProcessOtherEvents drops events if the DIX device state cannot be updated accordingly, i.e. all button events from keyboard devices. Hence we need to get the paired MD for the device in XkbDDXFakeDeviceButton, and post the event through the paired MD (usually the VCP). Removes now-unused ddxFakeBtn.c. Note: this patch only half-arsedly fixed button events, motion events are a more complicated matter.
Diffstat (limited to 'xkb/ddxDevBtn.c')
-rw-r--r--xkb/ddxDevBtn.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/xkb/ddxDevBtn.c b/xkb/ddxDevBtn.c
index e812e0be6..b68a28b2a 100644
--- a/xkb/ddxDevBtn.c
+++ b/xkb/ddxDevBtn.c
@@ -47,11 +47,13 @@ XkbDDXFakeDeviceButton(DeviceIntPtr dev,Bool press,int button)
{
int * devVal;
INT32 * evVal;
-xEvent events[2];
+xEvent events[2],
+ *m_events = NULL; /* master dev */
deviceKeyButtonPointer *btn;
deviceValuator * val;
int x,y;
int nAxes, i, count;
+DeviceIntPtr master = NULL;
if (dev == inputInfo.pointer || !dev->public.on)
return;
@@ -95,6 +97,28 @@ int nAxes, i, count;
count= 1+((nAxes+5)/6);
}
+ /* XXX: This is obnoxious. ProcessOtherEvent updates the DIX device state,
+ * but may not do anything if the device state is invalid. This happens if
+ * we post a mouse event from a pure keyboard device. So we need to hack
+ * around that by getting the master, then posting the event for the
+ * pointer paired with the master.
+ *
+ * Note:the DeviceButtonEvent on the SD itself will do nothing in most
+ * cases, unless dev is both a keyboard and a mouse.
+ */
+ if (!dev->isMaster && dev->u.master) {
+ master = dev->u.master;
+ if (!IsPointerDevice(master))
+ master = GetPairedDevice(dev->u.master);
+
+ CopyGetMasterEvent(master, &events, &m_events, count);
+ }
+
(*dev->public.processInputProc)((xEventPtr)btn, dev, count);
+
+ if (master) {
+ (*master->public.processInputProc)(m_events, master, count);
+ xfree(m_events);
+ }
return;
}