summaryrefslogtreecommitdiff
path: root/mi
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2009-05-20 10:55:03 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2009-05-22 15:44:57 +1000
commitebe45e1a72a81ad22413e5d0514869b3e45a69b7 (patch)
tree3932faf98c84b604e123b7e12a00cce52a4c4bb0 /mi
parentbc63c8a4570c989f19a036965854bceb9800ce19 (diff)
input: introduce partial class copying depending on the event.
Copying all classes into the master device has drawbacks for hybrid devices (devices that are both mice and keyboards). If such a device posts an event, it's key classes are moved into the VCP. The key event itself is unaffected by keyboard grabs and the like. Partial class copying copies depending on the event and copies the classes into the right master device (i.e. the VCK for key events, the VCP for pointer events). Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'mi')
-rw-r--r--mi/mi.h5
-rw-r--r--mi/mieq.c44
2 files changed, 35 insertions, 14 deletions
diff --git a/mi/mi.h b/mi/mi.h
index 182cea593..4431239cf 100644
--- a/mi/mi.h
+++ b/mi/mi.h
@@ -221,11 +221,10 @@ extern _X_EXPORT void mieqProcessInputEvents(
void
);
-extern void CopyGetMasterEvent(
- DeviceIntPtr /* mdev */,
+extern DeviceIntPtr CopyGetMasterEvent(
DeviceIntPtr /* sdev */,
InternalEvent* /* original */,
- EventListPtr /* master */
+ EventListPtr /* mlist */
);
/**
diff --git a/mi/mieq.c b/mi/mieq.c
index d094e1313..7ba755c29 100644
--- a/mi/mieq.c
+++ b/mi/mieq.c
@@ -307,28 +307,53 @@ FixUpEventForMaster(DeviceIntPtr mdev, DeviceIntPtr sdev,
/**
* Copy the given event into master.
- * @param mdev The master device
* @param sdev The slave device the original event comes from
* @param original The event as it came from the EQ
* @param master The event after being copied
+ * @return The master device or NULL if the device is a floating slave.
*/
-void
-CopyGetMasterEvent(DeviceIntPtr mdev, DeviceIntPtr sdev,
- InternalEvent* original, EventListPtr master)
+DeviceIntPtr
+CopyGetMasterEvent(DeviceIntPtr sdev,
+ InternalEvent* original, EventListPtr mlist)
{
+ DeviceIntPtr mdev;
int len = original->any.length;
InternalEvent *mevent;
CHECKEVENT(original);
- if (master->evlen < len)
- SetMinimumEventSize(master, 1, len);
+ if (!sdev->u.master)
+ return NULL;
+
+ switch(original->any.type)
+ {
+ case ET_KeyPress:
+ case ET_KeyRelease:
+ mdev = GetMaster(sdev, MASTER_KEYBOARD);
+ break;
+ case ET_ButtonPress:
+ case ET_ButtonRelease:
+ case ET_Motion:
+ case ET_ProximityIn:
+ case ET_ProximityOut:
+ mdev = GetMaster(sdev, MASTER_POINTER);
+ break;
+ default:
+ mdev = sdev->u.master;
+ break;
+ }
+
+
+ if (mlist->evlen < len)
+ SetMinimumEventSize(mlist, 1, len);
- mevent = (InternalEvent*)master->event;
+ mevent = (InternalEvent*)mlist->event;
memcpy(mevent, original, len);
ChangeDeviceID(mdev, mevent);
FixUpEventForMaster(mdev, sdev, original, mevent);
+
+ return mdev;
}
@@ -359,10 +384,7 @@ mieqProcessDeviceEvent(DeviceIntPtr dev,
NewCurrentScreen (dev, DequeueScreen(dev), x, y);
}
else {
- master = (!IsMaster(dev) && dev->u.master) ? dev->u.master : NULL;
-
- if (master)
- CopyGetMasterEvent(master, dev, event, masterEvents);
+ master = CopyGetMasterEvent(dev, event, masterEvents);
/* If someone's registered a custom event handler, let them
* steal it. */