xserver: Branch 'master' - 19 commits

Keith Packard keithp at kemper.freedesktop.org
Sun Jan 20 15:55:46 PST 2013


 Xi/exevents.c                     |   38 ++++++++++----------------------------
 dix/events.c                      |   21 ++++++++-------------
 dix/getevents.c                   |    8 ++++----
 dix/ptrveloc.c                    |    2 +-
 dix/touch.c                       |   38 ++++++++++++++++++++++++--------------
 hw/xfree86/common/xf86DGA.c       |   10 +++++++---
 hw/xfree86/common/xf86Events.c    |   10 ++++++----
 hw/xfree86/common/xf86Module.h    |    2 +-
 hw/xfree86/common/xf86Option.c    |    2 +-
 hw/xwin/winconfig.c               |    2 +-
 include/input.h                   |    4 ++--
 include/inputstr.h                |   20 ++++++++++++--------
 mi/mieq.c                         |    6 +++++-
 render/animcur.c                  |    3 ++-
 test/xi2/protocol-xiwarppointer.c |    2 +-
 xkb/xkbUtils.c                    |   10 ++++++++--
 16 files changed, 93 insertions(+), 85 deletions(-)

New commits:
commit 591c06277bb120ab9615633f2d28addbd3a2aa5f
Merge: 6703a7c fa6ab7d
Author: Keith Packard <keithp at keithp.com>
Date:   Sun Jan 20 15:52:26 2013 -0800

    Merge remote-tracking branch 'whot/for-keith'

commit fa6ab7d9b2d7fd8184f1e068360607845f5c33ab
Merge: adde4e6 0e1ab43
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Fri Jan 11 14:58:17 2013 +1000

    Merge branch 'pointer-emulation-fixes-56558-v2' into for-keith

commit adde4e64480315dc5b47a727ee37d86f5cd8584f
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Thu Jan 10 10:33:05 2013 +1000

    dix: typo fix in comment
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/dix/ptrveloc.c b/dix/ptrveloc.c
index 338f415..c7994b0 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,
commit 05ed095dd8d6cf939b4ebd9a59d70ce32705df7c
Author: Benjamin Tissoires <benjamin.tissoires at gmail.com>
Date:   Wed Jan 9 19:32:19 2013 +0100

    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 <benjamin.tissoires at gmail.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/dix/getevents.c b/dix/getevents.c
index 3d41e1e..a1e1938 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:
commit f4a58469a298c226668fd8dce375bf22331c902d
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Wed Jan 9 13:58:56 2013 +1000

    xfree86: don't access the old input handler after freeing it
    
    Introduced in 323869f3298cbbfe864af9404a8aed1bf7995d79
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Dave Airlie <airlied at redhat.com>

diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c
index d8d4fad..377e936 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
commit 205cfbd6d9824fb9a67c21b19bc8f1e66c9df4d2
Author: Dave Airlie <airlied at gmail.com>
Date:   Sat Jan 5 18:35:42 2013 +1000

    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 <airlied at redhat.com>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/hw/xfree86/common/xf86Module.h b/hw/xfree86/common/xf86Module.h
index 1be7ba5..e545c14 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)
 
commit ad3bc571348a7007a2960bf87ae739397c5511ee
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Tue Jan 8 11:19:09 2013 +1000

    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 <http://bugs.freedesktop.org/show_bug.cgi?id=59100>
    
    Reported-by: Steven Elliott <selliott4 at austin.rr.com>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Dave Airlie <airlied at redhat.com>

diff --git a/hw/xfree86/common/xf86DGA.c b/hw/xfree86/common/xf86DGA.c
index c10dd32..6a05ce5 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:
commit c5f2818edbec2f87383baa6c6be5c389b73ca6f9
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Tue Jan 8 10:13:53 2013 +1000

    xfree86: set event->detail for DGA pointer events
    
    Reported-by: Steven Elliott <selliott4 at austin.rr.com>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Dave Airlie <airlied at redhat.com>

diff --git a/hw/xfree86/common/xf86DGA.c b/hw/xfree86/common/xf86DGA.c
index c25a274..c10dd32 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
     };
commit 519d183d78e0b0eaf47a473e94f5d8611baf8463
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Mon Jan 7 10:44:33 2013 +1000

    Fix two typos "requires an string value"
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/hw/xfree86/common/xf86Option.c b/hw/xfree86/common/xf86Option.c
index c2ec79a..40c9d15 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 313320f..9e38113 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 {
commit 4e13dd90144dde47550aceea4db4b4329e531279
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Wed Aug 22 10:34:07 2012 +1000

    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 <http://bugs.freedesktop.org/show_bug.cgi?id=53897>
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Keith Packard <keithp at keithp.com>

diff --git a/dix/events.c b/dix/events.c
index 7359362..adbb762 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);
         }
commit 0e1ab433f4048b3367bb2f01d16cd00502538e4d
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Fri Jan 4 12:26:58 2013 +1000

    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 <peter.hutterer at who-t.net>
    Reviewed-by: Keith Packard <keithp at keithp.com>

diff --git a/dix/events.c b/dix/events.c
index b742f67..a46aaf6 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);
-    }
 }
 
 /**
commit 32a6d8a6b59c42f8d65002d7ca1cafb1957b656f
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Thu Dec 20 16:25:43 2012 +1000

    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 <peter.hutterer at who-t.net>
    Reviewed-by: Keith Packard <keithp at keithp.com>

diff --git a/dix/events.c b/dix/events.c
index bea68cc..b742f67 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);
         }
commit f59499b5d05fde83813709e9848152951592120d
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Tue Oct 30 12:44:08 2012 +1000

    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 <peter.hutterer at who-t.net>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Reviewed-by: Chase Douglas <chase.douglas at ubuntu.com>

diff --git a/Xi/exevents.c b/Xi/exevents.c
index 22bb563..74f3610 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 99f105b..0db842c 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 79739e2..f53ed99 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 32d7b62..fc21913 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 */
commit 9ad0fdb135a1c336771aee1f6eab75a6ad874aff
Author: Keith Packard <keithp at keithp.com>
Date:   Tue Nov 27 11:21:17 2012 -0800

    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 <keithp at keithp.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/Xi/exevents.c b/Xi/exevents.c
index 58fe493..22bb563 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 7359362..bea68cc 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 d890b62..99f105b 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 23a20b5..79739e2 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 a9d46cc..32d7b62 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 {
commit 91ab237358c6e33da854914d3de493a9cbea7637
Author: Keith Packard <keithp at keithp.com>
Date:   Tue Nov 27 11:21:16 2012 -0800

    input: Pull TouchListener declaration to top-level
    
    No reason to have a struct declared inside another struct
    
    Signed-off-by: Keith Packard <keithp at keithp.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/include/inputstr.h b/include/inputstr.h
index 17cee98..a9d46cc 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 */
commit 3578cc3c2e1b5cb8eb191e2d12ad88e1bc9e6e1e
Author: Andreas Wettstein <wettstein509 at solnet.ch>
Date:   Wed Dec 19 18:13:21 2012 +0100

    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 <FK07> {
        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 <wettstein509 at solnet.ch>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/xkb/xkbUtils.c b/xkb/xkbUtils.c
index c23cd77..6c6af60 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;
 }
commit df746a73410b892a4d41a2934cf9cd2e8ad7ba51
Author: Carlos Garnacho <carlosg at gnome.org>
Date:   Wed Dec 19 18:42:39 2012 +0100

    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 <carlosg at gnome.org>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/render/animcur.c b/render/animcur.c
index ebc5b8e..9cbba83 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);
commit 0fbd779a82919d5dbf8776be9b57a76c0eae6b14
Author: Carlos Garnacho <carlosg at gnome.org>
Date:   Wed Dec 19 18:42:38 2012 +0100

    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 <carlosg at gnome.org>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/mi/mieq.c b/mi/mieq.c
index 22f8c91..d7d73de 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
commit 8f4820be7a2e0f6e286ddc85c4b75bccdbe8a730
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Thu Dec 20 12:44:16 2012 +1000

    test/xi2: fix compiler warning
    
    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 <peter.hutterer at who-t.net>

diff --git a/test/xi2/protocol-xiwarppointer.c b/test/xi2/protocol-xiwarppointer.c
index 4bea333..f7986c1 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);


More information about the xorg-commit mailing list