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 <keithp@keithp.com>
Tested-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
Keith Packard 2010-06-07 00:54:18 -07:00
parent bc26665661
commit fdb081b430

View File

@ -118,7 +118,7 @@ DRI2GetDrawable(DrawablePtr pDraw)
WindowPtr pWin; WindowPtr pWin;
PixmapPtr pPixmap; PixmapPtr pPixmap;
if (pDraw->type == DRAWABLE_WINDOW) { if (WindowDrawable(pDraw->type)) {
pWin = (WindowPtr) pDraw; pWin = (WindowPtr) pDraw;
return dixLookupPrivate(&pWin->devPrivates, dri2WindowPrivateKey); return dixLookupPrivate(&pWin->devPrivates, dri2WindowPrivateKey);
} else { } else {
@ -161,7 +161,7 @@ DRI2AllocateDrawable(DrawablePtr pDraw)
pPriv->last_swap_ust = 0; pPriv->last_swap_ust = 0;
list_init(&pPriv->reference_list); list_init(&pPriv->reference_list);
if (pDraw->type == DRAWABLE_WINDOW) { if (WindowDrawable(pDraw->type)) {
pWin = (WindowPtr) pDraw; pWin = (WindowPtr) pDraw;
dixSetPrivate(&pWin->devPrivates, dri2WindowPrivateKey, pPriv); dixSetPrivate(&pWin->devPrivates, dri2WindowPrivateKey, pPriv);
} else { } else {
@ -272,7 +272,7 @@ static int DRI2DrawableGone(pointer p, XID id)
return Success; return Success;
pDraw = pPriv->drawable; pDraw = pPriv->drawable;
if (pDraw->type == DRAWABLE_WINDOW) { if (WindowDrawable(pDraw->type)) {
pWin = (WindowPtr) pDraw; pWin = (WindowPtr) pDraw;
dixSetPrivate(&pWin->devPrivates, dri2WindowPrivateKey, NULL); dixSetPrivate(&pWin->devPrivates, dri2WindowPrivateKey, NULL);
} else { } else {
@ -411,12 +411,12 @@ do_get_buffers(DrawablePtr pDraw, int *width, int *height,
need_real_front--; need_real_front--;
front_format = format; front_format = format;
if (pDraw->type == DRAWABLE_WINDOW) { if (WindowDrawable(pDraw->type)) {
need_fake_front++; need_fake_front++;
} }
} }
if (pDraw->type == DRAWABLE_WINDOW) { if (WindowDrawable(pDraw->type)) {
if (attachment == DRI2BufferFakeFrontLeft) { if (attachment == DRI2BufferFakeFrontLeft) {
need_fake_front--; need_fake_front--;
have_fake_front = 1; have_fake_front = 1;