[PATCH 4/4] dix: Make InputOnly window checking more consistent

Adam Jackson ajax at redhat.com
Fri Mar 4 13:05:21 PST 2011


Remove the UNDRAWABLE_WINDOW macro (which was just needlessly cute) and
always check ->class to decide if a window is InputOnly or InputOutput.
->type is now always either window or pixmap.

Signed-off-by: Adam Jackson <ajax at redhat.com>
---
 dix/dispatch.c   |    3 ++-
 dix/window.c     |    2 --
 include/pixmap.h |    7 ++-----
 mi/miexpose.c    |    2 +-
 4 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/dix/dispatch.c b/dix/dispatch.c
index 321bb92..0fda232 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -3048,7 +3048,8 @@ ProcQueryBestSize (ClientPtr client)
     rc = dixLookupDrawable(&pDraw, stuff->drawable, client, DixGetAttrAccess);
     if (rc != Success)
 	return rc;
-    if (stuff->class != CursorShape && pDraw->type == UNDRAWABLE_WINDOW)
+    if (stuff->class != CursorShape && pDraw->type == DRAWABLE_WINDOW &&
+	pDraw->class == InputOnly)
 	return BadMatch;
     pScreen = pDraw->pScreen;
     rc = XaceHook(XACE_SCREEN_ACCESS, client, pScreen, DixGetAttrAccess);
diff --git a/dix/window.c b/dix/window.c
index 9be7064..f18c33e 100644
--- a/dix/window.c
+++ b/dix/window.c
@@ -654,8 +654,6 @@ CreateWindow(Window wid, WindowPtr pParent, int x, int y, unsigned w,
 	    ;
 	pWin->drawable.bitsPerPixel = format->bitsPerPixel;
     }
-    if (class == InputOnly)
-	pWin->drawable.type = (short) UNDRAWABLE_WINDOW;
     pWin->drawable.serialNumber = NEXT_SERIAL_NUMBER;
 
     pWin->drawable.id = wid;
diff --git a/include/pixmap.h b/include/pixmap.h
index b29c256..29038e5 100644
--- a/include/pixmap.h
+++ b/include/pixmap.h
@@ -54,7 +54,6 @@ SOFTWARE.
 /* types for Drawable */
 #define DRAWABLE_WINDOW 0
 #define DRAWABLE_PIXMAP 1
-#define UNDRAWABLE_WINDOW 2
 
 /* flags to PaintWindow() */
 #define PW_BACKGROUND 0
@@ -76,11 +75,9 @@ typedef union _PixUnion {
 #define EqualPixUnion(as, a, bs, b)				\
     ((as) == (bs) && (SamePixUnion (a, b, as)))
 
-#define OnScreenDrawable(type) \
-	(type == DRAWABLE_WINDOW)
+#define OnScreenDrawable(type) (type == DRAWABLE_WINDOW)
 
-#define WindowDrawable(type) \
-	((type == DRAWABLE_WINDOW) || (type == UNDRAWABLE_WINDOW))
+#define WindowDrawable(type) (type == DRAWABLE_WINDOW)
 
 extern _X_EXPORT PixmapPtr GetScratchPixmapHeader(
     ScreenPtr /*pScreen*/,
diff --git a/mi/miexpose.c b/mi/miexpose.c
index 94258b8..ee4590d 100644
--- a/mi/miexpose.c
+++ b/mi/miexpose.c
@@ -549,7 +549,7 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
     DrawablePtr	drawable = &pWin->drawable;
 
 #ifdef ROOTLESS
-    if(!drawable || drawable->type == UNDRAWABLE_WINDOW)
+    if(!drawable || pWin->class == InputOnly)
 	return;
 
     if(IsFramedWindow(pWin)) {
-- 
1.7.3.5



More information about the xorg-devel mailing list