Remove debugging code which did a full tree walk on every window operation

Eliminate needless (and, it turns out, dangerous) call to ChangeGC on
    DestroyGCPrivate.
in cwSetWindowPixmap, check if the pixmap is the screen pixmap and disable
    the wrapper by setting the private to NULL.
This commit is contained in:
Keith Packard 2004-08-15 19:05:01 +00:00
parent 5db70ae257
commit a68f350195
3 changed files with 16 additions and 13 deletions

View File

@ -49,6 +49,12 @@
#include <X11/extensions/compositeproto.h> #include <X11/extensions/compositeproto.h>
#include <assert.h> #include <assert.h>
/*
* enable this for debugging
#define COMPOSITE_DEBUG
*/
typedef struct _CompClientWindow { typedef struct _CompClientWindow {
struct _CompClientWindow *next; struct _CompClientWindow *next;
XID id; XID id;
@ -118,10 +124,6 @@ typedef struct _CompScreen {
XID alternateVisuals[NUM_COMP_ALTERNATE_VISUALS]; XID alternateVisuals[NUM_COMP_ALTERNATE_VISUALS];
} CompScreenRec, *CompScreenPtr; } CompScreenRec, *CompScreenPtr;
#define HasCompRedirect(w) (wPixmap(w) != wPixmap(w->parent))
#define wScreen(w) ((w)->drawable.pScreen)
#define wPixmap(w) (*(wScreen(w)->GetWindowPixmap) (w))
extern int CompScreenPrivateIndex; extern int CompScreenPrivateIndex;
extern int CompWindowPrivateIndex; extern int CompWindowPrivateIndex;
extern int CompSubwindowsPrivateIndex; extern int CompSubwindowsPrivateIndex;
@ -192,11 +194,11 @@ compScreenInit (ScreenPtr pScreen);
* compwindow.c * compwindow.c
*/ */
#ifdef NDEBUG #ifdef COMPOSITE_DEBUG
#define compCheckTree(s)
#else
void void
compCheckTree (ScreenPtr pScreen); compCheckTree (ScreenPtr pScreen);
#else
#define compCheckTree(s)
#endif #endif
void void

View File

@ -27,7 +27,7 @@
#endif #endif
#include "compint.h" #include "compint.h"
#ifndef NDEBUG #ifdef COMPOSITE_DEBUG
static int static int
compCheckWindow (WindowPtr pWin, pointer data) compCheckWindow (WindowPtr pWin, pointer data)
{ {
@ -151,8 +151,10 @@ compPositionWindow (WindowPtr pWin, int x, int y)
* *
compCheckRedirect (pWin); compCheckRedirect (pWin);
*/ */
#ifdef COMPOSITE_DEBUG
if (pWin->redirectDraw != (pWin->viewable && (GetCompWindow(pWin) != NULL))) if (pWin->redirectDraw != (pWin->viewable && (GetCompWindow(pWin) != NULL)))
abort (); abort ();
#endif
if (pWin->redirectDraw) if (pWin->redirectDraw)
{ {
PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin); PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin);

View File

@ -164,11 +164,6 @@ cwDestroyGCPrivate(GCPtr pGC)
FreeGC(pPriv->pBackingGC, (XID)0); FreeGC(pPriv->pBackingGC, (XID)0);
setCwGC (pGC, pPriv->wrapFuncs); setCwGC (pGC, pPriv->wrapFuncs);
xfree((pointer)pPriv); xfree((pointer)pPriv);
/* The ChangeGC and ValidateGCs on the window haven't been passed down the
* stack, so report all state being changed.
*/
pGC->stateChanges |= (1 << (GCLastBit + 1)) - 1;
(*pGC->funcs->ChangeGC)(pGC, (1 << (GCLastBit + 1)) - 1);
} }
/* GCFuncs wrappers. These only get used when the drawable is a window with a /* GCFuncs wrappers. These only get used when the drawable is a window with a
@ -747,6 +742,10 @@ cwGetWindowPixmap (WindowPtr pWin)
static void static void
cwSetWindowPixmap (WindowPtr pWindow, PixmapPtr pPixmap) cwSetWindowPixmap (WindowPtr pWindow, PixmapPtr pPixmap)
{ {
ScreenPtr pScreen = pWindow->drawable.pScreen;
if (pPixmap == (*pScreen->GetScreenPixmap) (pScreen))
pPixmap = NULL;
setCwPixmap (pWindow, pPixmap); setCwPixmap (pWindow, pPixmap);
} }