xserver: Branch 'master' - 3 commits

Peter Hutterer whot at kemper.freedesktop.org
Tue Jul 21 21:25:32 PDT 2009


 Xi/xipassivegrab.c |    8 ++++----
 configure.ac       |    2 +-
 dix/events.c       |   10 +++++-----
 dix/grabs.c        |    2 +-
 dix/property.c     |   11 ++++++++---
 test/input.c       |    4 ++--
 6 files changed, 21 insertions(+), 16 deletions(-)

New commits:
commit 48585bd1e3e98db0f3df1ecc68022510216e00cc
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Wed Jul 22 12:09:24 2009 +1000

    dix: use the event mask of the grab for TryClientEvents.
    
    A client that grabs for button/key events may not have the
    ButtonPress/KeyPress mask set and should not receive an event in that case.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/dix/events.c b/dix/events.c
index 4ddf802..7505463 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -3347,6 +3347,7 @@ CheckPassiveGrabsOnWindow(
     {
 	DeviceIntPtr	gdev;
 	XkbSrvInfoPtr	xkbi = NULL;
+	Mask		mask;
 
 	gdev= grab->modifierDevice;
         if (grab->grabtype == GRABTYPE_CORE)
@@ -3461,6 +3462,7 @@ CheckPassiveGrabsOnWindow(
                 }
                 xE = &core;
                 count = 1;
+                mask = grab->eventMask;
             } else if (match & XI2_MATCH)
             {
                 rc = EventToXI2((InternalEvent*)event, &xE);
@@ -3472,6 +3474,7 @@ CheckPassiveGrabsOnWindow(
                     continue;
                 }
                 count = 1;
+                mask = grab->xi2mask[device->id][((xGenericEvent*)xE)->evtype/8];
             } else
             {
                 rc = EventToXI((InternalEvent*)event, &xE, &count);
@@ -3482,6 +3485,7 @@ CheckPassiveGrabsOnWindow(
                                 "(%d, %d).\n", device->name, event->type, rc);
                     continue;
                 }
+                mask = grab->eventMask;
             }
 
 	    (*grabinfo->ActivateGrab)(device, grab, currentTime, TRUE);
@@ -3490,8 +3494,7 @@ CheckPassiveGrabsOnWindow(
             {
                 FixUpEventFromWindow(device, xE, grab->window, None, TRUE);
 
-                TryClientEvents(rClient(grab), device, xE, count,
-                                       GetEventFilter(device, xE),
+                TryClientEvents(rClient(grab), device, xE, count, mask,
                                        GetEventFilter(device, xE), grab);
             }
 
commit 4dc91b3e54503a1be555bae5b18f3e52f58be307
Author: Pierre Willenbrock <pierre at pirsoft.de>
Date:   Tue Jul 21 17:21:28 2009 +0200

    Check if new space was actually allocated before freeing.
    
    There will be no new space allocated, if mode != PropModeReplace and
    len == 0, or if mode is not one of the handled modes.
    This fixes freeing data that is still in use, leading to double frees and
    other memory corruption.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/dix/property.c b/dix/property.c
index 20c18d7..10b8482 100644
--- a/dix/property.c
+++ b/dix/property.c
@@ -351,9 +351,14 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property,
 	access_mode |= DixPostAccess;
 	rc = XaceHookPropertyAccess(pClient, pWin, &pProp, access_mode);
 	if (rc == Success)
-	    xfree(savedProp.data);
-	else {
-	    xfree(pProp->data);
+	{
+	    if (savedProp.data != pProp->data)
+		xfree(savedProp.data);
+	}
+	else
+	{
+	    if (savedProp.data != pProp->data)
+		xfree(pProp->data);
 	    *pProp = savedProp;
 	    return rc;
 	}
commit 9a1bfa5664a80f03cedeb89b9f8a86115a08e7af
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Mon Jul 20 16:39:16 2009 +1000

    input: remove XI2 keysym grabs, use keycode grabs instead.
    
    Keysym grabs are tricky in the details, keycode grabs are known to work. So
    for now, provide keycode grabs only.
    
    Requires inputproto 1.9.99.15.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/Xi/xipassivegrab.c b/Xi/xipassivegrab.c
index df0f5be..1d6200f 100644
--- a/Xi/xipassivegrab.c
+++ b/Xi/xipassivegrab.c
@@ -102,7 +102,7 @@ ProcXIPassiveGrabDevice(ClientPtr client)
     }
 
     if (stuff->grab_type != XIGrabtypeButton &&
-        stuff->grab_type != XIGrabtypeKeysym &&
+        stuff->grab_type != XIGrabtypeKeycode &&
         stuff->grab_type != XIGrabtypeEnter &&
         stuff->grab_type != XIGrabtypeFocusIn)
     {
@@ -180,7 +180,7 @@ ProcXIPassiveGrabDevice(ClientPtr client)
                 status = GrabButton(client, dev, mod_dev, stuff->detail,
                                     &param, GRABTYPE_XI2, &mask);
                 break;
-            case XIGrabtypeKeysym:
+            case XIGrabtypeKeycode:
                 status = GrabKey(client, dev, mod_dev, stuff->detail,
                                  &param, GRABTYPE_XI2, &mask);
                 break;
@@ -265,7 +265,7 @@ ProcXIPassiveUngrabDevice(ClientPtr client)
 	return rc;
 
     if (stuff->grab_type != XIGrabtypeButton &&
-        stuff->grab_type != XIGrabtypeKeysym &&
+        stuff->grab_type != XIGrabtypeKeycode &&
         stuff->grab_type != XIGrabtypeEnter &&
         stuff->grab_type != XIGrabtypeFocusIn)
     {
@@ -295,7 +295,7 @@ ProcXIPassiveUngrabDevice(ClientPtr client)
     switch(stuff->grab_type)
     {
         case XIGrabtypeButton:  tempGrab.type = XI_ButtonPress; break;
-        case XIGrabtypeKeysym:  tempGrab.type = XI_KeyPress;    break;
+        case XIGrabtypeKeycode:  tempGrab.type = XI_KeyPress;    break;
         case XIGrabtypeEnter:   tempGrab.type = XI_Enter;       break;
         case XIGrabtypeFocusIn: tempGrab.type = XI_FocusIn;     break;
     }
diff --git a/configure.ac b/configure.ac
index 84613cc..9052398 100644
--- a/configure.ac
+++ b/configure.ac
@@ -708,7 +708,7 @@ XEXT_LIB='$(top_builddir)/Xext/libXext.la'
 XEXTXORG_LIB='$(top_builddir)/Xext/libXextbuiltin.la'
 
 dnl Core modules for most extensions, et al.
-REQUIRED_MODULES="[randrproto >= 1.2.99.3] [renderproto >= 0.11] [fixesproto >= 4.0] [damageproto >= 1.1] xcmiscproto [xextproto >= 7.0.99.1] [xproto >= 7.0.13] [xtrans >= 1.2.2] bigreqsproto resourceproto fontsproto [inputproto >= 1.9.99.14] [kbproto >= 1.0.3]"
+REQUIRED_MODULES="[randrproto >= 1.2.99.3] [renderproto >= 0.11] [fixesproto >= 4.0] [damageproto >= 1.1] xcmiscproto [xextproto >= 7.0.99.1] [xproto >= 7.0.13] [xtrans >= 1.2.2] bigreqsproto resourceproto fontsproto [inputproto >= 1.9.99.15] [kbproto >= 1.0.3]"
 REQUIRED_LIBS="xfont xau fontenc [pixman-1 >= 0.15.14]"
 
 dnl HAVE_DBUS is true if we actually have the D-Bus library, whereas
diff --git a/dix/events.c b/dix/events.c
index f6369f6..4ddf802 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -117,7 +117,6 @@ of the copyright holder.
 #endif
 
 #include <X11/X.h>
-#include <X11/keysym.h>
 #include "misc.h"
 #include "resource.h"
 #include <X11/Xproto.h>
@@ -3375,8 +3374,6 @@ CheckPassiveGrabsOnWindow(
         /* Check for XI2 and XI grabs first */
         tempGrab.type = GetXI2Type((InternalEvent*)event);
         tempGrab.grabtype = GRABTYPE_XI2;
-        if (event->type == ET_KeyPress)
-            tempGrab.detail.exact = XkbGetKeysym(device, event);
         if (GrabMatchesSecond(&tempGrab, grab, FALSE))
             match = XI2_MATCH;
 
diff --git a/dix/grabs.c b/dix/grabs.c
index 06d6d03..4a351d6 100644
--- a/dix/grabs.c
+++ b/dix/grabs.c
@@ -451,7 +451,7 @@ DeletePassiveGrabFromList(GrabPtr pMinuendGrab)
     any_modifier = (pMinuendGrab->grabtype == GRABTYPE_XI2) ?
                    (unsigned int)XIAnyModifier : (unsigned int)AnyModifier;
     any_key = (pMinuendGrab->grabtype == GRABTYPE_XI2) ?
-                   (unsigned int)XIAnyKeysym : (unsigned int)AnyKey;
+                   (unsigned int)XIAnyKeycode : (unsigned int)AnyKey;
     ndels = nadds = nups = 0;
     ok = TRUE;
     for (grab = wPassiveGrabs(pMinuendGrab->window);
diff --git a/test/input.c b/test/input.c
index e2faaef..8beb9fa 100644
--- a/test/input.c
+++ b/test/input.c
@@ -643,10 +643,10 @@ static void dix_grab_matching(void)
     rc = GrabMatchesSecond(&b, &a, FALSE);
     g_assert(rc == TRUE);
 
-    /* AnyKey or XIAnyKeysym must succeed */
+    /* AnyKey or XIAnyKeycode must succeed */
     a.grabtype = GRABTYPE_XI2;
     b.grabtype = GRABTYPE_XI2;
-    a.detail.exact = XIAnyKeysym;
+    a.detail.exact = XIAnyKeycode;
     b.detail.exact = 1;
     a.modifiersDetail.exact = 1;
     b.modifiersDetail.exact = 1;


More information about the xorg-commit mailing list