From fdb081b430ddffb495aa5b05bcc4cf10882ff4b2 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Mon, 7 Jun 2010 00:54:18 -0700 Subject: [PATCH] dri2: Deal with input-only windows by using WindowDrawable() Input only windows aren't DRAWABLE_WINDOW, but casting them to a PixmapPtr is a bit harsh, and unlikely to get the appropriate privates structure. use WindowDrawable instead which checks for both input-output and input-only windows. Signed-off-by: Keith Packard Tested-by: Eric Anholt --- hw/xfree86/dri2/dri2.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c index baa6706d6..d33b0d1b0 100644 --- a/hw/xfree86/dri2/dri2.c +++ b/hw/xfree86/dri2/dri2.c @@ -118,7 +118,7 @@ DRI2GetDrawable(DrawablePtr pDraw) WindowPtr pWin; PixmapPtr pPixmap; - if (pDraw->type == DRAWABLE_WINDOW) { + if (WindowDrawable(pDraw->type)) { pWin = (WindowPtr) pDraw; return dixLookupPrivate(&pWin->devPrivates, dri2WindowPrivateKey); } else { @@ -161,7 +161,7 @@ DRI2AllocateDrawable(DrawablePtr pDraw) pPriv->last_swap_ust = 0; list_init(&pPriv->reference_list); - if (pDraw->type == DRAWABLE_WINDOW) { + if (WindowDrawable(pDraw->type)) { pWin = (WindowPtr) pDraw; dixSetPrivate(&pWin->devPrivates, dri2WindowPrivateKey, pPriv); } else { @@ -272,7 +272,7 @@ static int DRI2DrawableGone(pointer p, XID id) return Success; pDraw = pPriv->drawable; - if (pDraw->type == DRAWABLE_WINDOW) { + if (WindowDrawable(pDraw->type)) { pWin = (WindowPtr) pDraw; dixSetPrivate(&pWin->devPrivates, dri2WindowPrivateKey, NULL); } else { @@ -411,12 +411,12 @@ do_get_buffers(DrawablePtr pDraw, int *width, int *height, need_real_front--; front_format = format; - if (pDraw->type == DRAWABLE_WINDOW) { + if (WindowDrawable(pDraw->type)) { need_fake_front++; } } - if (pDraw->type == DRAWABLE_WINDOW) { + if (WindowDrawable(pDraw->type)) { if (attachment == DRI2BufferFakeFrontLeft) { need_fake_front--; have_fake_front = 1;