From 8f4820be7a2e0f6e286ddc85c4b75bccdbe8a730 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 20 Dec 2012 12:44:16 +1000 Subject: test/xi2: fix compiler warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit protocol-xiwarppointer.c: In function ‘ScreenSetCursorPosition’: protocol-xiwarppointer.c:71:53: warning: declaration of ‘screen’ shadows a global declaration [-Wshadow] Signed-off-by: Peter Hutterer --- test/xi2/protocol-xiwarppointer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/xi2/protocol-xiwarppointer.c b/test/xi2/protocol-xiwarppointer.c index 4bea333c3..f7986c1eb 100644 --- a/test/xi2/protocol-xiwarppointer.c +++ b/test/xi2/protocol-xiwarppointer.c @@ -68,7 +68,7 @@ __wrap_dixLookupWindow(WindowPtr *win, XID id, ClientPtr client, Mask access) * This function overrides the one in the screen rec. */ static Bool -ScreenSetCursorPosition(DeviceIntPtr dev, ScreenPtr screen, +ScreenSetCursorPosition(DeviceIntPtr dev, ScreenPtr scr, int x, int y, Bool generateEvent) { assert(x == expected_x); -- cgit v1.2.3 From 0fbd779a82919d5dbf8776be9b57a76c0eae6b14 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Wed, 19 Dec 2012 18:42:38 +0100 Subject: mi: Ensure pointer emulating touch events update the sprite Different miPointerSpriteFuncRec implementations do a varying business at ultimately calling miPointerUpdateSprite(), this particularly fails when using the plain mi sprite on touch events, where the sprite is just moved/updated on cursor changes. So, ensure miPointerUpdateSprite() is called generically for pointer emulating touch events as with regular motion events. Signed-off-by: Carlos Garnacho Reviewed-by: Peter Hutterer Signed-off-by: Peter Hutterer --- mi/mieq.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mi/mieq.c b/mi/mieq.c index 22f8c91bb..d7d73deb6 100644 --- a/mi/mieq.c +++ b/mi/mieq.c @@ -627,7 +627,11 @@ mieqProcessInputEvents(void) mieqProcessDeviceEvent(dev, &event, screen); /* Update the sprite now. Next event may be from different device. */ - if (event.any.type == ET_Motion && master) + if (master && + (event.any.type == ET_Motion || + ((event.any.type == ET_TouchBegin || + event.any.type == ET_TouchUpdate) && + event.device_event.flags & TOUCH_POINTER_EMULATED))) miPointerUpdateSprite(dev); #ifdef XQUARTZ -- cgit v1.2.3 From df746a73410b892a4d41a2934cf9cd2e8ad7ba51 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Wed, 19 Dec 2012 18:42:39 +0100 Subject: render: Unwrap early on the animated cursor BlockHandler The loop above the previous call may end up triggering other handlers attaching to the same function slot, so unwrapping the handler after that could leave the just attached handler in a dangling but not unset state. This issue was most visible on the XO, where destroying a window with an animated cursor set and running would trigger this inconsistent state, never calling the miSpriteBlockHandler again after the animated cursor is unset. Signed-off-by: Carlos Garnacho Reviewed-by: Peter Hutterer Signed-off-by: Peter Hutterer --- render/animcur.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/render/animcur.c b/render/animcur.c index ebc5b8ef7..9cbba83fa 100644 --- a/render/animcur.c +++ b/render/animcur.c @@ -143,6 +143,8 @@ AnimCurScreenBlockHandler(ScreenPtr pScreen, Bool activeDevice = FALSE; CARD32 now = 0, soonest = ~0; /* earliest time to wakeup again */ + Unwrap(as, pScreen, BlockHandler); + for (dev = inputInfo.devices; dev; dev = dev->next) { if (IsPointerDevice(dev) && pScreen == dev->spriteInfo->anim.pScreen) { if (!activeDevice) { @@ -180,7 +182,6 @@ AnimCurScreenBlockHandler(ScreenPtr pScreen, if (activeDevice) AdjustWaitForDelay(pTimeout, soonest - now); - Unwrap(as, pScreen, BlockHandler); (*pScreen->BlockHandler) (pScreen, pTimeout, pReadmask); if (activeDevice) Wrap(as, pScreen, BlockHandler, AnimCurScreenBlockHandler); -- cgit v1.2.3 From 3578cc3c2e1b5cb8eb191e2d12ad88e1bc9e6e1e Mon Sep 17 00:00:00 2001 From: Andreas Wettstein Date: Wed, 19 Dec 2012 18:13:21 +0100 Subject: xkb: Do not use base group as an array index. The base group is not brought into range and, therefore, using it as an array index crashed the X server. Also, at this place, we should ignore locked groups, but not latched groups. Therefore, use sum of base and latched groups, brought into range. Reproducible with: key { type= "ONE_LEVEL", symbols[Group1]= [ NoSymbol ], actions[Group1]= [ LatchGroup(group=-1, clearLocks) ] }; And hitting F7 will exceed the group level and access arbitrary memory. Signed-off-by: Andreas Wettstein Reviewed-by: Peter Hutterer Signed-off-by: Peter Hutterer --- xkb/xkbUtils.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/xkb/xkbUtils.c b/xkb/xkbUtils.c index c23cd7784..6c6af60f0 100644 --- a/xkb/xkbUtils.c +++ b/xkb/xkbUtils.c @@ -642,6 +642,7 @@ XkbComputeCompatState(XkbSrvInfoPtr xkbi) CARD16 grp_mask; XkbStatePtr state = &xkbi->state; XkbCompatMapPtr map; + XkbControlsPtr ctrls; if (!state || !xkbi->desc || !xkbi->desc->ctrls || !xkbi->desc->compat) return; @@ -650,9 +651,14 @@ XkbComputeCompatState(XkbSrvInfoPtr xkbi) grp_mask = map->groups[state->group].mask; state->compat_state = state->mods | grp_mask; state->compat_lookup_mods = state->lookup_mods | grp_mask; + ctrls= xkbi->desc->ctrls; - if (xkbi->desc->ctrls->enabled_ctrls & XkbIgnoreGroupLockMask) - grp_mask = map->groups[state->base_group].mask; + if (ctrls->enabled_ctrls & XkbIgnoreGroupLockMask) { + unsigned char grp = state->base_group+state->latched_group; + if (grp >= ctrls->num_groups) + grp = XkbAdjustGroup(XkbCharToInt(grp), ctrls); + grp_mask = map->groups[grp].mask; + } state->compat_grab_mods = state->grab_mods | grp_mask; return; } -- cgit v1.2.3 From 91ab237358c6e33da854914d3de493a9cbea7637 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 27 Nov 2012 11:21:16 -0800 Subject: input: Pull TouchListener declaration to top-level No reason to have a struct declared inside another struct Signed-off-by: Keith Packard Reviewed-by: Peter Hutterer Signed-off-by: Peter Hutterer --- include/inputstr.h | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/include/inputstr.h b/include/inputstr.h index 17cee9854..a9d46cc32 100644 --- a/include/inputstr.h +++ b/include/inputstr.h @@ -298,6 +298,15 @@ typedef struct _ValuatorClassRec { int v_scroll_axis; /* vert smooth-scrolling axis */ } ValuatorClassRec; +typedef struct _TouchListener { + XID listener; /* grabs/event selection IDs receiving + * events for this touch */ + enum TouchListenerType type; + enum TouchListenerState state; + enum InputLevel level; /* matters only for emulating touches */ + WindowPtr window; +} TouchListener; + typedef struct _TouchPointInfo { uint32_t client_id; /* touch ID as seen in client events */ int sourceid; /* Source device's ID for this touchpoint */ @@ -306,14 +315,7 @@ typedef struct _TouchPointInfo { * but still owned by a grab */ SpriteRec sprite; /* window trace for delivery */ ValuatorMask *valuators; /* last recorded axis values */ - struct _TouchListener { - XID listener; /* grabs/event selection IDs receiving - * events for this touch */ - enum TouchListenerType type; - enum TouchListenerState state; - enum InputLevel level; /* matters only for emulating touches */ - WindowPtr window; - } *listeners; + TouchListener *listeners; /* set of listeners */ int num_listeners; int num_grabs; /* number of open grabs on this touch * which have not accepted or rejected */ -- cgit v1.2.3 From 9ad0fdb135a1c336771aee1f6eab75a6ad874aff Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 27 Nov 2012 11:21:17 -0800 Subject: input: Record grab pointer in TouchListener This places a pointer to the grab related to a TouchListener directly in the TouchListener structure rather than hoping to find the grab later on using the resource ID. Passive grabs have resource ID in the resource DB so they can be removed when a client exits, and those resource IDs get copied when activated, but implicit grabs are constructed on-the-fly and have no resource DB entry. Signed-off-by: Keith Packard Reviewed-by: Peter Hutterer Signed-off-by: Peter Hutterer --- Xi/exevents.c | 27 ++++++--------------------- dix/events.c | 1 + dix/touch.c | 22 +++++++++++++++------- include/input.h | 2 +- include/inputstr.h | 1 + 5 files changed, 24 insertions(+), 29 deletions(-) diff --git a/Xi/exevents.c b/Xi/exevents.c index 58fe49363..22bb5639a 100644 --- a/Xi/exevents.c +++ b/Xi/exevents.c @@ -1187,7 +1187,6 @@ TouchRejected(DeviceIntPtr sourcedev, TouchPointInfoPtr ti, XID resource, TouchOwnershipEvent *ev) { Bool was_owner = (resource == ti->listeners[0].listener); - void *grab; int i; /* Send a TouchEnd event to the resource being removed, but only if they @@ -1202,11 +1201,7 @@ TouchRejected(DeviceIntPtr sourcedev, TouchPointInfoPtr ti, XID resource, /* Remove the resource from the listener list, updating * ti->num_listeners, as well as ti->num_grabs if it was a grab. */ - if (TouchRemoveListener(ti, resource)) { - if (dixLookupResourceByType(&grab, resource, RT_PASSIVEGRAB, - serverClient, DixGetAttrAccess) == Success) - ti->num_grabs--; - } + TouchRemoveListener(ti, resource); /* If the current owner was removed and there are further listeners, deliver * the TouchOwnership or TouchBegin event to the new owner. */ @@ -1300,21 +1295,10 @@ RetrieveTouchDeliveryData(DeviceIntPtr dev, TouchPointInfoPtr ti, if (listener->type == LISTENER_GRAB || listener->type == LISTENER_POINTER_GRAB) { - rc = dixLookupResourceByType((pointer *) grab, listener->listener, - RT_PASSIVEGRAB, - serverClient, DixSendAccess); - if (rc != Success) { - /* the grab doesn't exist but we have a grabbing listener - this - * is an implicit/active grab */ - rc = dixLookupClient(client, listener->listener, serverClient, - DixSendAccess); - if (rc != Success) - return FALSE; - - *grab = dev->deviceGrab.grab; - if (!*grab) - return FALSE; - } + + *grab = listener->grab; + + BUG_RETURN_VAL(!*grab, FALSE); *client = rClient(*grab); *win = (*grab)->window; @@ -1467,6 +1451,7 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, */ l = &ti->listeners[ti->num_listeners - 1]; l->listener = devgrab->resource; + l->grab = devgrab; if (devgrab->grabtype != XI2 || devgrab->type != XI_TouchBegin) l->type = LISTENER_POINTER_GRAB; diff --git a/dix/events.c b/dix/events.c index 73593626e..bea68cc51 100644 --- a/dix/events.c +++ b/dix/events.c @@ -1438,6 +1438,7 @@ UpdateTouchesForGrab(DeviceIntPtr mouse) ti->listeners[0].type = LISTENER_POINTER_GRAB; else ti->listeners[0].type = LISTENER_GRAB; + ti->listeners[0].grab = grab; } } } diff --git a/dix/touch.c b/dix/touch.c index d890b6227..99f105b2e 100644 --- a/dix/touch.c +++ b/dix/touch.c @@ -677,13 +677,17 @@ TouchResourceIsOwner(TouchPointInfoPtr ti, XID resource) void TouchAddListener(TouchPointInfoPtr ti, XID resource, enum InputLevel level, enum TouchListenerType type, enum TouchListenerState state, - WindowPtr window) + WindowPtr window, + GrabPtr grab) { ti->listeners[ti->num_listeners].listener = resource; ti->listeners[ti->num_listeners].level = level; ti->listeners[ti->num_listeners].state = state; ti->listeners[ti->num_listeners].type = type; ti->listeners[ti->num_listeners].window = window; + ti->listeners[ti->num_listeners].grab = grab; + if (grab) + ti->num_grabs++; ti->num_listeners++; } @@ -702,6 +706,11 @@ TouchRemoveListener(TouchPointInfoPtr ti, XID resource) if (ti->listeners[i].listener == resource) { int j; + if (ti->listeners[i].grab) { + ti->listeners[i].grab = NULL; + ti->num_grabs--; + } + for (j = i; j < ti->num_listeners - 1; j++) ti->listeners[j] = ti->listeners[j + 1]; ti->num_listeners--; @@ -733,8 +742,7 @@ TouchAddGrabListener(DeviceIntPtr dev, TouchPointInfoPtr ti, } TouchAddListener(ti, grab->resource, grab->grabtype, - type, LISTENER_AWAITING_BEGIN, grab->window); - ti->num_grabs++; + type, LISTENER_AWAITING_BEGIN, grab->window, grab); } /** @@ -790,7 +798,7 @@ TouchAddRegularListener(DeviceIntPtr dev, TouchPointInfoPtr ti, TouchEventHistoryAllocate(ti); TouchAddListener(ti, iclients->resource, XI2, - type, LISTENER_AWAITING_BEGIN, win); + type, LISTENER_AWAITING_BEGIN, win, NULL); return TRUE; } } @@ -806,7 +814,7 @@ TouchAddRegularListener(DeviceIntPtr dev, TouchPointInfoPtr ti, TouchEventHistoryAllocate(ti); TouchAddListener(ti, iclients->resource, XI, LISTENER_POINTER_REGULAR, LISTENER_AWAITING_BEGIN, - win); + win, NULL); return TRUE; } } @@ -821,7 +829,7 @@ TouchAddRegularListener(DeviceIntPtr dev, TouchPointInfoPtr ti, TouchEventHistoryAllocate(ti); TouchAddListener(ti, win->drawable.id, CORE, LISTENER_POINTER_REGULAR, LISTENER_AWAITING_BEGIN, - win); + win, NULL); return TRUE; } @@ -832,7 +840,7 @@ TouchAddRegularListener(DeviceIntPtr dev, TouchPointInfoPtr ti, TouchEventHistoryAllocate(ti); TouchAddListener(ti, oclients->resource, CORE, - type, LISTENER_AWAITING_BEGIN, win); + type, LISTENER_AWAITING_BEGIN, win, NULL); return TRUE; } } diff --git a/include/input.h b/include/input.h index 23a20b59d..79739e274 100644 --- a/include/input.h +++ b/include/input.h @@ -567,7 +567,7 @@ extern void TouchEventHistoryReplay(TouchPointInfoPtr ti, DeviceIntPtr dev, extern Bool TouchResourceIsOwner(TouchPointInfoPtr ti, XID resource); extern void TouchAddListener(TouchPointInfoPtr ti, XID resource, enum InputLevel level, enum TouchListenerType type, - enum TouchListenerState state, WindowPtr window); + enum TouchListenerState state, WindowPtr window, GrabPtr grab); extern Bool TouchRemoveListener(TouchPointInfoPtr ti, XID resource); extern void TouchSetupListeners(DeviceIntPtr dev, TouchPointInfoPtr ti, InternalEvent *ev); diff --git a/include/inputstr.h b/include/inputstr.h index a9d46cc32..32d7b621c 100644 --- a/include/inputstr.h +++ b/include/inputstr.h @@ -305,6 +305,7 @@ typedef struct _TouchListener { enum TouchListenerState state; enum InputLevel level; /* matters only for emulating touches */ WindowPtr window; + GrabPtr grab; } TouchListener; typedef struct _TouchPointInfo { -- cgit v1.2.3 From f59499b5d05fde83813709e9848152951592120d Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 30 Oct 2012 12:44:08 +1000 Subject: dix: add resource type to touch listeners Instead of guessing what resource type the listener is and what property to retrieve, store the resource type in the listener directly. Breaks XIT test cases: TouchGrabTestMultipleTaps.PassiveGrabPointerEmulationMultipleTouchesFastSuccession Fixes https://bugs.freedesktop.org/show_bug.cgi?id=56557 Signed-off-by: Peter Hutterer Reviewed-by: Keith Packard Reviewed-by: Chase Douglas --- Xi/exevents.c | 11 ++++------- dix/touch.c | 18 ++++++++++-------- include/input.h | 2 +- include/inputstr.h | 1 + 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Xi/exevents.c b/Xi/exevents.c index 22bb5639a..74f3610cc 100644 --- a/Xi/exevents.c +++ b/Xi/exevents.c @@ -1305,13 +1305,9 @@ RetrieveTouchDeliveryData(DeviceIntPtr dev, TouchPointInfoPtr ti, *mask = (*grab)->xi2mask; } else { - if (listener->level == CORE) - rc = dixLookupWindow(win, listener->listener, - serverClient, DixSendAccess); - else - rc = dixLookupResourceByType((pointer *) win, listener->listener, - RT_INPUTCLIENT, - serverClient, DixSendAccess); + rc = dixLookupResourceByType((pointer *) win, listener->listener, + listener->resource_type, + serverClient, DixSendAccess); if (rc != Success) return FALSE; @@ -1452,6 +1448,7 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, l = &ti->listeners[ti->num_listeners - 1]; l->listener = devgrab->resource; l->grab = devgrab; + //l->resource_type = RT_NONE; if (devgrab->grabtype != XI2 || devgrab->type != XI_TouchBegin) l->type = LISTENER_POINTER_GRAB; diff --git a/dix/touch.c b/dix/touch.c index 99f105b2e..0db842c65 100644 --- a/dix/touch.c +++ b/dix/touch.c @@ -675,12 +675,13 @@ TouchResourceIsOwner(TouchPointInfoPtr ti, XID resource) * Add the resource to this touch's listeners. */ void -TouchAddListener(TouchPointInfoPtr ti, XID resource, enum InputLevel level, - enum TouchListenerType type, enum TouchListenerState state, - WindowPtr window, +TouchAddListener(TouchPointInfoPtr ti, XID resource, int resource_type, + enum InputLevel level, enum TouchListenerType type, + enum TouchListenerState state, WindowPtr window, GrabPtr grab) { ti->listeners[ti->num_listeners].listener = resource; + ti->listeners[ti->num_listeners].resource_type = resource_type; ti->listeners[ti->num_listeners].level = level; ti->listeners[ti->num_listeners].state = state; ti->listeners[ti->num_listeners].type = type; @@ -741,7 +742,8 @@ TouchAddGrabListener(DeviceIntPtr dev, TouchPointInfoPtr ti, type = LISTENER_POINTER_GRAB; } - TouchAddListener(ti, grab->resource, grab->grabtype, + /* grab listeners are always RT_NONE since we keep the grab pointer */ + TouchAddListener(ti, grab->resource, RT_NONE, grab->grabtype, type, LISTENER_AWAITING_BEGIN, grab->window, grab); } @@ -797,7 +799,7 @@ TouchAddRegularListener(DeviceIntPtr dev, TouchPointInfoPtr ti, if (!xi2mask_isset(iclients->xi2mask, dev, XI_TouchOwnership)) TouchEventHistoryAllocate(ti); - TouchAddListener(ti, iclients->resource, XI2, + TouchAddListener(ti, iclients->resource, RT_INPUTCLIENT, XI2, type, LISTENER_AWAITING_BEGIN, win, NULL); return TRUE; } @@ -812,7 +814,7 @@ TouchAddRegularListener(DeviceIntPtr dev, TouchPointInfoPtr ti, continue; TouchEventHistoryAllocate(ti); - TouchAddListener(ti, iclients->resource, XI, + TouchAddListener(ti, iclients->resource, RT_INPUTCLIENT, XI, LISTENER_POINTER_REGULAR, LISTENER_AWAITING_BEGIN, win, NULL); return TRUE; @@ -827,7 +829,7 @@ TouchAddRegularListener(DeviceIntPtr dev, TouchPointInfoPtr ti, /* window owner */ if (IsMaster(dev) && (win->eventMask & core_filter)) { TouchEventHistoryAllocate(ti); - TouchAddListener(ti, win->drawable.id, CORE, + TouchAddListener(ti, win->drawable.id, RT_WINDOW, CORE, LISTENER_POINTER_REGULAR, LISTENER_AWAITING_BEGIN, win, NULL); return TRUE; @@ -839,7 +841,7 @@ TouchAddRegularListener(DeviceIntPtr dev, TouchPointInfoPtr ti, continue; TouchEventHistoryAllocate(ti); - TouchAddListener(ti, oclients->resource, CORE, + TouchAddListener(ti, oclients->resource, RT_OTHERCLIENT, CORE, type, LISTENER_AWAITING_BEGIN, win, NULL); return TRUE; } diff --git a/include/input.h b/include/input.h index 79739e274..f53ed9905 100644 --- a/include/input.h +++ b/include/input.h @@ -565,7 +565,7 @@ extern void TouchEventHistoryPush(TouchPointInfoPtr ti, const DeviceEvent *ev); extern void TouchEventHistoryReplay(TouchPointInfoPtr ti, DeviceIntPtr dev, XID resource); extern Bool TouchResourceIsOwner(TouchPointInfoPtr ti, XID resource); -extern void TouchAddListener(TouchPointInfoPtr ti, XID resource, +extern void TouchAddListener(TouchPointInfoPtr ti, XID resource, int resource_type, enum InputLevel level, enum TouchListenerType type, enum TouchListenerState state, WindowPtr window, GrabPtr grab); extern Bool TouchRemoveListener(TouchPointInfoPtr ti, XID resource); diff --git a/include/inputstr.h b/include/inputstr.h index 32d7b621c..fc21913e1 100644 --- a/include/inputstr.h +++ b/include/inputstr.h @@ -301,6 +301,7 @@ typedef struct _ValuatorClassRec { typedef struct _TouchListener { XID listener; /* grabs/event selection IDs receiving * events for this touch */ + int resource_type; /* listener's resource type */ enum TouchListenerType type; enum TouchListenerState state; enum InputLevel level; /* matters only for emulating touches */ -- cgit v1.2.3 From 32a6d8a6b59c42f8d65002d7ca1cafb1957b656f Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 20 Dec 2012 16:25:43 +1000 Subject: dix: check for the right device's xi2 mask events.c: In function 'DeactivatePointerGrab': events.c:1524:51: warning: 'dev' may be used uninitialized in this function [-Wuninitialized dev is unset when we get here, the device to check is "mouse". Introduced in ece8157a59751b3ed492fb2e1eb8d5f20221e195. Signed-off-by: Peter Hutterer Reviewed-by: Keith Packard --- dix/events.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dix/events.c b/dix/events.c index bea68cc51..b742f6787 100644 --- a/dix/events.c +++ b/dix/events.c @@ -1522,7 +1522,7 @@ DeactivatePointerGrab(DeviceIntPtr mouse) emulate a ButtonRelease here. So pretend the listener already has the end event */ if (grab->grabtype == CORE || grab->grabtype == XI || - !xi2mask_isset(dev->deviceGrab.grab->xi2mask, dev, XI_TouchBegin)) + !xi2mask_isset(mouse->deviceGrab.grab->xi2mask, mouse, XI_TouchBegin)) ti->listeners[0].state = LISTENER_HAS_END; TouchListenerAcceptReject(mouse, ti, 0, XIRejectTouch); } -- cgit v1.2.3 From 0e1ab433f4048b3367bb2f01d16cd00502538e4d Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Fri, 4 Jan 2013 12:26:58 +1000 Subject: dix: remove already-moved hunk Should've been removed in bc1f90a615018c05994fae3e678dd2341256cd82a, but got left here due to a botched rebase. Fixes stray button events sent to clients after deactivating an async pointer grab on a pointer-emulating-touch. Signed-off-by: Peter Hutterer Reviewed-by: Keith Packard --- dix/events.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/dix/events.c b/dix/events.c index b742f6787..a46aaf660 100644 --- a/dix/events.c +++ b/dix/events.c @@ -1551,15 +1551,6 @@ DeactivatePointerGrab(DeviceIntPtr mouse) ReattachToOldMaster(mouse); ComputeFreezes(); - - /* If an explicit grab was deactivated, we must remove it from the head of - * all the touches' listener lists. */ - for (i = 0; mouse->touch && i < mouse->touch->num_touches; i++) { - TouchPointInfoPtr ti = mouse->touch->touches + i; - - if (ti->active && TouchResourceIsOwner(ti, grab_resource)) - TouchListenerAcceptReject(mouse, ti, 0, XIRejectTouch); - } } /** -- cgit v1.2.3 From 4e13dd90144dde47550aceea4db4b4329e531279 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 22 Aug 2012 10:34:07 +1000 Subject: dix: don't filter RawEvents if the grab window is not the root window (#53897) If a XI2.1+ client has a grab on a non-root window, it must still receive raw events on the root window. Test case: register for XI_ButtonPress on window and XI_RawMotion on root. No raw events are received once the press activates an implicit grab on the window. X.Org Bug 53897 Signed-off-by: Peter Hutterer Reviewed-by: Keith Packard --- dix/events.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/dix/events.c b/dix/events.c index 73593626e..adbb76274 100644 --- a/dix/events.c +++ b/dix/events.c @@ -2246,7 +2246,7 @@ DeliverEventsToWindow(DeviceIntPtr pDev, WindowPtr pWin, xEvent * @return TRUE if the event should be discarded, FALSE otherwise. */ static BOOL -FilterRawEvents(const ClientPtr client, const GrabPtr grab) +FilterRawEvents(const ClientPtr client, const GrabPtr grab, WindowPtr root) { XIClientPtr client_xi_version; int cmp; @@ -2262,7 +2262,10 @@ FilterRawEvents(const ClientPtr client, const GrabPtr grab) client_xi_version->minor_version, 2, 0); /* XI 2.0: if device is grabbed, skip XI 2.1: if device is grabbed by us, skip, we've already delivered */ - return (cmp == 0) ? TRUE : SameClient(grab, client); + if (cmp == 0) + return TRUE; + + return (grab->window != root) ? FALSE : SameClient(grab, client); } /** @@ -2315,7 +2318,7 @@ DeliverRawEvent(RawDeviceEvent *ev, DeviceIntPtr device) */ ic.next = NULL; - if (!FilterRawEvents(rClient(&ic), grab)) + if (!FilterRawEvents(rClient(&ic), grab, root)) DeliverEventToInputClients(device, &ic, root, xi, 1, filter, NULL, &c, &m); } -- cgit v1.2.3 From 519d183d78e0b0eaf47a473e94f5d8611baf8463 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Mon, 7 Jan 2013 10:44:33 +1000 Subject: Fix two typos "requires an string value" Signed-off-by: Peter Hutterer --- hw/xfree86/common/xf86Option.c | 2 +- hw/xwin/winconfig.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/xfree86/common/xf86Option.c b/hw/xfree86/common/xf86Option.c index c2ec79a53..40c9d15f4 100644 --- a/hw/xfree86/common/xf86Option.c +++ b/hw/xfree86/common/xf86Option.c @@ -515,7 +515,7 @@ ParseOptionValue(int scrnIndex, XF86OptionPtr options, OptionInfoPtr p, if (*s == '\0') { if (markUsed) { xf86DrvMsg(scrnIndex, X_WARNING, - "Option \"%s\" requires an string value\n", + "Option \"%s\" requires a string value\n", p->name); } p->found = FALSE; diff --git a/hw/xwin/winconfig.c b/hw/xwin/winconfig.c index 313320f1a..9e38113a5 100644 --- a/hw/xwin/winconfig.c +++ b/hw/xwin/winconfig.c @@ -762,7 +762,7 @@ ParseOptionValue(int scrnIndex, pointer options, OptionInfoPtr p) case OPTV_STRING: if (*s == '\0') { winDrvMsg(scrnIndex, X_WARNING, - "Option \"%s\" requires an string value\n", p->name); + "Option \"%s\" requires a string value\n", p->name); p->found = FALSE; } else { -- cgit v1.2.3 From c5f2818edbec2f87383baa6c6be5c389b73ca6f9 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 8 Jan 2013 10:13:53 +1000 Subject: xfree86: set event->detail for DGA pointer events Reported-by: Steven Elliott Signed-off-by: Peter Hutterer Reviewed-by: Dave Airlie --- hw/xfree86/common/xf86DGA.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/xfree86/common/xf86DGA.c b/hw/xfree86/common/xf86DGA.c index c25a2747b..c10dd3212 100644 --- a/hw/xfree86/common/xf86DGA.c +++ b/hw/xfree86/common/xf86DGA.c @@ -1074,6 +1074,7 @@ DGAProcessPointerEvent(ScreenPtr pScreen, DGAEvent * event, DeviceIntPtr mouse) DeviceEvent ev = { .header = ET_Internal, .length = sizeof(ev), + .detail.key = event->detail, .type = event->subtype, .corestate = butc ? butc->state : 0 }; -- cgit v1.2.3 From ad3bc571348a7007a2960bf87ae739397c5511ee Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 8 Jan 2013 11:19:09 +1000 Subject: xfree86: update the device state for all DGA events (#59100) DGA only handles master devices but it does intercept slave device events as well (since the event handlers are per event type, not per device). The DGA code must thus call into UpdateDeviceState to reset the button/key state on the slave device before it discards the remainder of the event. Test case: - Passive GrabModeSync on VCP - Press button - Enable DGA after ButtonPress - AllowEvents(SyncPointer) - Release button The button release is handled by DGAProcessPointerEvent but the device state is never updated, so the slave ends up with the button permanently down. And since the master's button state is the union of the slave states, the master has the button permanently down. X.Org Bug 59100 Reported-by: Steven Elliott Signed-off-by: Peter Hutterer Reviewed-by: Dave Airlie --- hw/xfree86/common/xf86DGA.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/hw/xfree86/common/xf86DGA.c b/hw/xfree86/common/xf86DGA.c index c10dd3212..6a05ce536 100644 --- a/hw/xfree86/common/xf86DGA.c +++ b/hw/xfree86/common/xf86DGA.c @@ -1033,6 +1033,9 @@ DGAProcessKeyboardEvent(ScreenPtr pScreen, DGAEvent * event, DeviceIntPtr keybd) UpdateDeviceState(keybd, &ev); + if (!IsMaster(keybd)) + return; + /* * Deliver the DGA event */ @@ -1084,6 +1087,9 @@ DGAProcessPointerEvent(ScreenPtr pScreen, DGAEvent * event, DeviceIntPtr mouse) UpdateDeviceState(mouse, &ev); + if (!IsMaster(mouse)) + return; + /* * Deliver the DGA event */ @@ -1191,9 +1197,6 @@ DGAHandleEvent(int screen_num, InternalEvent *ev, DeviceIntPtr device) if (!pScreenPriv) return; - if (!IsMaster(device)) - return; - switch (event->subtype) { case KeyPress: case KeyRelease: -- cgit v1.2.3 From 205cfbd6d9824fb9a67c21b19bc8f1e66c9df4d2 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Sat, 5 Jan 2013 18:35:42 +1000 Subject: xf86: bump input ABI version to 19 The changes to miPointerSetPosition interface from int->double breaks the SIS driver build, so time to bump this. Signed-off-by: Dave Airlie Signed-off-by: Peter Hutterer --- hw/xfree86/common/xf86Module.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/xfree86/common/xf86Module.h b/hw/xfree86/common/xf86Module.h index 1be7ba54d..e545c1498 100644 --- a/hw/xfree86/common/xf86Module.h +++ b/hw/xfree86/common/xf86Module.h @@ -81,7 +81,7 @@ typedef enum { */ #define ABI_ANSIC_VERSION SET_ABI_VERSION(0, 4) #define ABI_VIDEODRV_VERSION SET_ABI_VERSION(14, 1) -#define ABI_XINPUT_VERSION SET_ABI_VERSION(18, 0) +#define ABI_XINPUT_VERSION SET_ABI_VERSION(19, 0) #define ABI_EXTENSION_VERSION SET_ABI_VERSION(7, 0) #define ABI_FONT_VERSION SET_ABI_VERSION(0, 6) -- cgit v1.2.3 From f4a58469a298c226668fd8dce375bf22331c902d Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 9 Jan 2013 13:58:56 +1000 Subject: xfree86: don't access the old input handler after freeing it Introduced in 323869f3298cbbfe864af9404a8aed1bf7995d79 Signed-off-by: Peter Hutterer Reviewed-by: Dave Airlie --- hw/xfree86/common/xf86Events.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c index d8d4fad9c..377e936f7 100644 --- a/hw/xfree86/common/xf86Events.c +++ b/hw/xfree86/common/xf86Events.c @@ -619,14 +619,16 @@ InputHandlerProc xf86SetConsoleHandler(InputHandlerProc proc, pointer data) { static IHPtr handler = NULL; - IHPtr old_handler = handler; + InputHandlerProc old_proc = NULL; - if (old_handler) - xf86RemoveGeneralHandler(old_handler); + if (handler) { + old_proc = handler->ihproc; + xf86RemoveGeneralHandler(handler); + } handler = xf86AddGeneralHandler(xf86Info.consoleFd, proc, data); - return (old_handler) ? old_handler->ihproc : NULL; + return old_proc; } static void -- cgit v1.2.3 From 05ed095dd8d6cf939b4ebd9a59d70ce32705df7c Mon Sep 17 00:00:00 2001 From: Benjamin Tissoires Date: Wed, 9 Jan 2013 19:32:19 +0100 Subject: dix: fix error logging occuring in signal context of GetTouchEvents GetTouchEvents is usually called in a signal context. Calling ErrorF for the error messages leads to X complaining about log: (EE) BUG: triggered 'if (inSignalContext)' (EE) BUG: log.c:484 in LogVMessageVerb() (EE) Warning: attempting to log data in a signal unsafe manner while in signal context. Please update to check inSignalContext and/or use LogMessageVerbSigSafe() or ErrorFSigSafe(). The offending log format message is: %s: Attempted to start touch without x/y (driver bug) Signed-off-by: Benjamin Tissoires Reviewed-by: Peter Hutterer Signed-off-by: Peter Hutterer --- dix/getevents.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dix/getevents.c b/dix/getevents.c index 3d41e1e5a..a1e193815 100644 --- a/dix/getevents.c +++ b/dix/getevents.c @@ -1895,16 +1895,16 @@ GetTouchEvents(InternalEvent *events, DeviceIntPtr dev, uint32_t ddx_touchid, if (!mask_in || !valuator_mask_isset(mask_in, 0) || !valuator_mask_isset(mask_in, 1)) { - ErrorF("%s: Attempted to start touch without x/y (driver bug)\n", - dev->name); + ErrorFSigSafe("%s: Attempted to start touch without x/y " + "(driver bug)\n", dev->name); return 0; } break; case XI_TouchUpdate: event->type = ET_TouchUpdate; if (!mask_in || valuator_mask_num_valuators(mask_in) <= 0) { - ErrorF("%s: TouchUpdate with no valuators? Driver bug\n", - dev->name); + ErrorFSigSafe("%s: TouchUpdate with no valuators? Driver bug\n", + dev->name); } break; case XI_TouchEnd: -- cgit v1.2.3 From adde4e64480315dc5b47a727ee37d86f5cd8584f Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 10 Jan 2013 10:33:05 +1000 Subject: dix: typo fix in comment Signed-off-by: Peter Hutterer --- dix/ptrveloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dix/ptrveloc.c b/dix/ptrveloc.c index 338f415c5..c7994b03d 100644 --- a/dix/ptrveloc.c +++ b/dix/ptrveloc.c @@ -738,7 +738,7 @@ ApplyConstantDeceleration(DeviceVelocityPtr vel, double *fdx, double *fdy) } /* - * compute the acceleration for given velocity and enforce min_acceleartion + * compute the acceleration for given velocity and enforce min_acceleration */ double BasicComputeAcceleration(DeviceIntPtr dev, -- cgit v1.2.3