From 2c15d7df55c4a85bf5ce0b489f898764db1a0b34 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 18 Dec 2012 15:57:57 +1000 Subject: [PATCH] dix: skip subpixel-only core motion events (#57383) Core events don't do subpixel, so mark motion events that have coordinate changes in the subpixel range and skip them on delivery. XI 1.x events don't do subpixel either, but the valuators may change even when the pixel coordinates don't, so we need to keep sending those. X.Org Bug 57383 Signed-off-by: Peter Hutterer --- Xi/exevents.c | 8 +++++++- dix/eventconvert.c | 5 +++++ include/eventstr.h | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Xi/exevents.c b/Xi/exevents.c index 4c1aeb4..03621c5 100644 --- a/Xi/exevents.c +++ b/Xi/exevents.c @@ -1662,6 +1662,7 @@ ProcessDeviceEvent(InternalEvent *ev, DeviceIntPtr device) int corestate; DeviceIntPtr mouse = NULL, kbd = NULL; DeviceEvent *event = &ev->device_event; + int old_root_x = INT_MIN, old_root_y = INT_MIN; if (IsPointerDevice(device)) { kbd = GetMaster(device, KEYBOARD_OR_FLOAT); @@ -1685,8 +1686,10 @@ ProcessDeviceEvent(InternalEvent *ev, DeviceIntPtr device) b = device->button; - if (IsMaster(device) || IsFloating(device)) + if (IsMaster(device) || IsFloating(device)) { + GetSpritePosition(device, &old_root_x, &old_root_y); CheckMotion(event, device); + } switch (event->type) { case ET_Motion: @@ -1702,6 +1705,9 @@ ProcessDeviceEvent(InternalEvent *ev, DeviceIntPtr device) NoticeEventTime((InternalEvent *) event, device); event->corestate = corestate; key = event->detail.key; + if (event->type == ET_Motion && + rootX == old_root_x && rootY == old_root_y) + event->subpixel_only = 1; break; default: break; diff --git a/dix/eventconvert.c b/dix/eventconvert.c index 2e422d7..7f005ab 100644 --- a/dix/eventconvert.c +++ b/dix/eventconvert.c @@ -117,6 +117,11 @@ EventToCore(InternalEvent *event, xEvent **core_out, int *count_out) ret = BadMatch; goto out; } + + if (e->subpixel_only) { + ret = BadMatch; + goto out; + } } /* fallthrough */ case ET_ButtonPress: diff --git a/include/eventstr.h b/include/eventstr.h index dd6fbef..168df6e 100644 --- a/include/eventstr.h +++ b/include/eventstr.h @@ -120,6 +120,7 @@ struct _DeviceEvent { Window root; /**< Root window of the event */ int corestate; /**< Core key/button state BEFORE the event */ int key_repeat; /**< Internally-generated key repeat event */ + int subpixel_only;/**< Only a subpixel motion event */ uint32_t flags; /**< Flags to be copied into the generated event */ }; -- 1.8.0.2