[PATCH] input: Fix BorderSizeNotEmpty for redirected windows

Adam Jackson ajax at redhat.com
Wed Jul 30 10:12:59 PDT 2014


In the words of the spec, grabs are meant to fail "if the confine-to
window lies completely outside the boundaries of the root window".
Redirected windows (and therefore windows with backing store enabled)
have a pWin->borderSize that's not clipped to the root window, which
means BorderSizeNotEmpty() is always true and the grab will succeed when
it oughtn't.

This is a somewhat ugly fix, as it's ignoring whatever was passed to
miRegisterRedirectBorderClipProc and assuming composite was the only
caller.  It's not entirely clear to me why those are registered function
pointers instead of just more explicit composite knowledge in mivaltree.

Signed-off-by: Adam Jackson <ajax at redhat.com>
---
 dix/events.c | 24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/dix/events.c b/dix/events.c
index b8c67fd..ac851eb 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -133,6 +133,10 @@ typedef const char *string;
 #include "Xserver-dtrace.h"
 #endif
 
+#ifdef COMPOSITE
+#include "compint.h"
+#endif
+
 #include <X11/extensions/XIproto.h>
 #include <X11/extensions/XI2proto.h>
 #include <X11/extensions/XI.h>
@@ -3619,7 +3623,14 @@ ProcWarpPointer(ClientPtr client)
 static Bool
 BorderSizeNotEmpty(DeviceIntPtr pDev, WindowPtr pWin)
 {
-    if (RegionNotEmpty(&pWin->borderSize))
+    RegionPtr reg = &pWin->borderSize;
+
+#ifdef COMPOSITE
+    if (pWin->redirectDraw != RedirectDrawNone)
+	reg = compGetRedirectBorderClip(pWin);
+#endif
+
+    if (RegionNotEmpty(reg))
         return TRUE;
 
 #ifdef PANORAMIX
@@ -3627,8 +3638,15 @@ BorderSizeNotEmpty(DeviceIntPtr pDev, WindowPtr pWin)
         int i;
 
         FOR_NSCREENS_FORWARD_SKIP(i) {
-            if (RegionNotEmpty
-                (&pDev->spriteInfo->sprite->windows[i]->borderSize))
+	    WindowPtr pWin = &pDev->spriteInfo->sprite->windows[i];
+
+	    reg = &pWin->borderSize;
+#ifdef COMPOSITE
+	    if (pWin->redirectDraw != RedirectDrawNone)
+		reg = compGetRedirectBorderClip(pWin);
+#endif
+
+            if (RegionNotEmpty(reg))
                 return TRUE;
         }
     }
-- 
2.0.1



More information about the xorg-devel mailing list