diff options
author | Daniel Stone <daniels@collabora.com> | 2015-11-20 15:37:29 +0000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2015-11-24 11:36:32 +1000 |
commit | c3788394e9190130a8eed44c5c93eeb93c2a9893 (patch) | |
tree | 16680fcc42e5b61778b432be8c037270ab6b4777 /dix | |
parent | 2e61901e46d28ce2f436219ad1a495aa0dcd0fba (diff) |
Input: Add DeviceEventSource enum
Add a flag to DeviceEvents, giving the source of the event. Currently
this only supports a 'normal' flag, but will be used later to add a
'focus-in' flag, noting events synthesised from key/button arrays on
focus-in notifications.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'dix')
-rw-r--r-- | dix/getevents.c | 24 | ||||
-rw-r--r-- | dix/inpututils.c | 4 |
2 files changed, 16 insertions, 12 deletions
diff --git a/dix/getevents.c b/dix/getevents.c index 7ebddc419..f04b415ef 100644 --- a/dix/getevents.c +++ b/dix/getevents.c @@ -1092,6 +1092,7 @@ GetKeyboardEvents(InternalEvent *events, DeviceIntPtr pDev, int type, CARD32 ms = 0; DeviceEvent *event; RawDeviceEvent *raw; + enum DeviceEventSource source_type = EVENT_SOURCE_NORMAL; #if XSERVER_DTRACE if (XSERVER_INPUT_EVENT_ENABLED()) { @@ -1126,14 +1127,15 @@ GetKeyboardEvents(InternalEvent *events, DeviceIntPtr pDev, int type, ms = GetTimeInMillis(); - raw = &events->raw_event; - events++; - num_events++; - - init_raw(pDev, raw, ms, type, key_code); + if (source_type == EVENT_SOURCE_NORMAL) { + raw = &events->raw_event; + init_raw(pDev, raw, ms, type, key_code); + events++; + num_events++; + } event = &events->device_event; - init_device_event(event, pDev, ms); + init_device_event(event, pDev, ms, source_type); event->detail.key = key_code; if (type == KeyPress) { @@ -1468,7 +1470,7 @@ fill_pointer_events(InternalEvent *events, DeviceIntPtr pDev, int type, } event = &events->device_event; - init_device_event(event, pDev, ms); + init_device_event(event, pDev, ms, EVENT_SOURCE_NORMAL); if (type == MotionNotify) { event->type = ET_Motion; @@ -1804,7 +1806,7 @@ GetProximityEvents(InternalEvent *events, DeviceIntPtr pDev, int type, UpdateFromMaster(events, pDev, DEVCHANGE_POINTER_EVENT, &num_events); event = &events->device_event; - init_device_event(event, pDev, GetTimeInMillis()); + init_device_event(event, pDev, GetTimeInMillis(), EVENT_SOURCE_NORMAL); event->type = (type == ProximityIn) ? ET_ProximityIn : ET_ProximityOut; clipValuators(pDev, &mask); @@ -1939,7 +1941,7 @@ GetTouchEvents(InternalEvent *events, DeviceIntPtr dev, uint32_t ddx_touchid, event = &events->device_event; num_events++; - init_device_event(event, dev, ms); + init_device_event(event, dev, ms, EVENT_SOURCE_NORMAL); switch (type) { case XI_TouchBegin: @@ -2054,7 +2056,7 @@ GetDixTouchEnd(InternalEvent *ievent, DeviceIntPtr dev, TouchPointInfoPtr ti, BUG_WARN(!dev->enabled); - init_device_event(event, dev, ms); + init_device_event(event, dev, ms, EVENT_SOURCE_NORMAL); event->sourceid = ti->sourceid; event->type = ET_TouchEnd; @@ -2098,7 +2100,7 @@ PostSyntheticMotion(DeviceIntPtr pDev, #endif memset(&ev, 0, sizeof(DeviceEvent)); - init_device_event(&ev, pDev, time); + init_device_event(&ev, pDev, time, EVENT_SOURCE_NORMAL); ev.root_x = x; ev.root_y = y; ev.type = ET_Motion; diff --git a/dix/inpututils.c b/dix/inpututils.c index 136398842..5b7da3ab2 100644 --- a/dix/inpututils.c +++ b/dix/inpututils.c @@ -727,7 +727,8 @@ verify_internal_event(const InternalEvent *ev) * device. */ void -init_device_event(DeviceEvent *event, DeviceIntPtr dev, Time ms) +init_device_event(DeviceEvent *event, DeviceIntPtr dev, Time ms, + enum DeviceEventSource source_type) { memset(event, 0, sizeof(DeviceEvent)); event->header = ET_Internal; @@ -735,6 +736,7 @@ init_device_event(DeviceEvent *event, DeviceIntPtr dev, Time ms) event->time = ms; event->deviceid = dev->id; event->sourceid = dev->id; + event->source_type = source_type; } int |