DIX: Make PrintWindowTree actually useful
Rewrite PrintWindowTree to make it actually tell you what you want to know. Signed-off-by: Daniel Stone <daniel@fooishbar.org> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
b27d61e443
commit
ddf735fd4e
141
dix/window.c
141
dix/window.c
|
@ -108,6 +108,7 @@ Equipment Corporation.
|
||||||
#include "regionstr.h"
|
#include "regionstr.h"
|
||||||
#include "validate.h"
|
#include "validate.h"
|
||||||
#include "windowstr.h"
|
#include "windowstr.h"
|
||||||
|
#include "propertyst.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "inputstr.h"
|
#include "inputstr.h"
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
@ -124,10 +125,13 @@ Equipment Corporation.
|
||||||
#include "dixevents.h"
|
#include "dixevents.h"
|
||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
#include "mi.h" /* miPaintWindow */
|
#include "mi.h" /* miPaintWindow */
|
||||||
|
#include "compint.h"
|
||||||
|
|
||||||
#include "privates.h"
|
#include "privates.h"
|
||||||
#include "xace.h"
|
#include "xace.h"
|
||||||
|
|
||||||
|
#include <X11/Xatom.h> /* must come after server includes */
|
||||||
|
|
||||||
/******
|
/******
|
||||||
* Window stuff for server
|
* Window stuff for server
|
||||||
*
|
*
|
||||||
|
@ -176,46 +180,129 @@ static Bool TileScreenSaver(ScreenPtr pScreen, int kind);
|
||||||
|
|
||||||
#define SubStrSend(pWin,pParent) (StrSend(pWin) || SubSend(pParent))
|
#define SubStrSend(pWin,pParent) (StrSend(pWin) || SubSend(pParent))
|
||||||
|
|
||||||
#ifdef DEBUG
|
static const char *overlay_win_name = "<composite overlay>";
|
||||||
/******
|
|
||||||
* PrintWindowTree
|
|
||||||
* For debugging only
|
|
||||||
******/
|
|
||||||
|
|
||||||
static void
|
static const char *
|
||||||
PrintChildren(WindowPtr p1, int indent)
|
get_window_name(WindowPtr pWin)
|
||||||
{
|
{
|
||||||
WindowPtr p2;
|
#define WINDOW_NAME_BUF_LEN 512
|
||||||
int i;
|
PropertyPtr prop;
|
||||||
|
CompScreenPtr comp_screen = GetCompScreen(pWin->drawable.pScreen);
|
||||||
|
static char buf[WINDOW_NAME_BUF_LEN];
|
||||||
|
int len;
|
||||||
|
|
||||||
while (p1)
|
if (comp_screen && pWin == comp_screen->pOverlayWin)
|
||||||
|
return overlay_win_name;
|
||||||
|
|
||||||
|
for (prop = wUserProps(pWin); prop; prop = prop->next)
|
||||||
{
|
{
|
||||||
p2 = p1->firstChild;
|
if (prop->propertyName == XA_WM_NAME && prop->type == XA_STRING &&
|
||||||
ErrorF("[dix] ");
|
prop->data)
|
||||||
for (i=0; i<indent; i++) ErrorF(" ");
|
{
|
||||||
ErrorF("%lx\n", p1->drawable.id);
|
len = min(prop->size, WINDOW_NAME_BUF_LEN - 1);
|
||||||
RegionPrint(&p1->clipList);
|
memcpy(buf, prop->data, len);
|
||||||
PrintChildren(p2, indent+4);
|
buf[len] = '\0';
|
||||||
p1 = p1->nextSib;
|
return buf;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
#undef WINDOW_NAME_BUF_LEN
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void log_window_info(WindowPtr pWin, int depth)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
const char *win_name, *visibility;
|
||||||
|
BoxPtr rects;
|
||||||
|
ScreenPtr pScreen = pWin->drawable.pScreen;
|
||||||
|
|
||||||
|
for (i = 0; i < (depth << 2); i++)
|
||||||
|
ErrorF(" ");
|
||||||
|
|
||||||
|
win_name = get_window_name(pWin);
|
||||||
|
ErrorF("win 0x%.8x (%s), [%d, %d] to [%d, %d]",
|
||||||
|
pWin->drawable.id,
|
||||||
|
win_name ? win_name : "no name",
|
||||||
|
pWin->drawable.x, pWin->drawable.y,
|
||||||
|
pWin->drawable.x + pWin->drawable.width,
|
||||||
|
pWin->drawable.y + pWin->drawable.height);
|
||||||
|
|
||||||
|
if (pWin->overrideRedirect)
|
||||||
|
ErrorF(" (override redirect)");
|
||||||
|
if (pWin->redirectDraw)
|
||||||
|
ErrorF(" (%s compositing: pixmap %x)",
|
||||||
|
(pWin->redirectDraw == RedirectDrawAutomatic) ?
|
||||||
|
"automatic" : "manual",
|
||||||
|
pScreen->GetWindowPixmap(pWin)->drawable.id);
|
||||||
|
|
||||||
|
switch (pWin->visibility)
|
||||||
|
{
|
||||||
|
case VisibilityUnobscured:
|
||||||
|
visibility = "unobscured";
|
||||||
|
break;
|
||||||
|
case VisibilityPartiallyObscured:
|
||||||
|
visibility = "partially obscured";
|
||||||
|
break;
|
||||||
|
case VisibilityFullyObscured:
|
||||||
|
visibility = "fully obscured";
|
||||||
|
break;
|
||||||
|
case VisibilityNotViewable:
|
||||||
|
visibility = "unviewable";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
ErrorF(", %s", visibility);
|
||||||
|
|
||||||
|
if (REGION_NOTEMPTY(pScreen, &pWin->clipList))
|
||||||
|
{
|
||||||
|
ErrorF(", clip list:");
|
||||||
|
rects = REGION_RECTS(&pWin->clipList);
|
||||||
|
for (i = 0; i < REGION_NUM_RECTS(&pWin->clipList); i++)
|
||||||
|
ErrorF(" [(%d, %d) to (%d, %d)]",
|
||||||
|
rects[i].x1, rects[i].y1,
|
||||||
|
rects[i].x2, rects[i].y2);
|
||||||
|
ErrorF("; extents [(%d, %d) to (%d, %d)]",
|
||||||
|
pWin->clipList.extents.x1, pWin->clipList.extents.y1,
|
||||||
|
pWin->clipList.extents.x2, pWin->clipList.extents.y2);
|
||||||
|
}
|
||||||
|
|
||||||
|
ErrorF("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
PrintWindowTree(void)
|
PrintWindowTree(void)
|
||||||
{
|
{
|
||||||
int i;
|
int scrnum, depth;
|
||||||
WindowPtr pWin, p1;
|
ScreenPtr pScreen;
|
||||||
|
WindowPtr pWin;
|
||||||
|
|
||||||
for (i=0; i<screenInfo.numScreens; i++)
|
for (scrnum = 0; scrnum < screenInfo.numScreens; scrnum++)
|
||||||
{
|
{
|
||||||
ErrorF("[dix] WINDOW %d\n", i);
|
pScreen = screenInfo.screens[scrnum];
|
||||||
pWin = screenInfo.screens[i]->root;
|
ErrorF("[dix] Dumping windows for screen %d (pixmap %x):\n", scrnum,
|
||||||
RegionPrint(&pWin->clipList);
|
pScreen->GetScreenPixmap(pScreen)->drawable.id);
|
||||||
p1 = pWin->firstChild;
|
pWin = pScreen->root;
|
||||||
PrintChildren(p1, 4);
|
depth = 1;
|
||||||
|
while (pWin)
|
||||||
|
{
|
||||||
|
log_window_info(pWin, depth);
|
||||||
|
if (pWin->firstChild)
|
||||||
|
{
|
||||||
|
pWin = pWin->firstChild;
|
||||||
|
depth++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
while (pWin && !pWin->nextSib)
|
||||||
|
{
|
||||||
|
pWin = pWin->parent;
|
||||||
|
depth--;
|
||||||
|
}
|
||||||
|
if (!pWin)
|
||||||
|
break;
|
||||||
|
pWin = pWin->nextSib;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
int
|
int
|
||||||
TraverseTree(WindowPtr pWin, VisitWindowProcPtr func, pointer data)
|
TraverseTree(WindowPtr pWin, VisitWindowProcPtr func, pointer data)
|
||||||
|
|
|
@ -267,4 +267,6 @@ extern _X_EXPORT void EnableMapUnmapEvents(
|
||||||
WindowPtr /* pWin */ );
|
WindowPtr /* pWin */ );
|
||||||
|
|
||||||
extern _X_EXPORT void SetRootClip(ScreenPtr pScreen, Bool enable);
|
extern _X_EXPORT void SetRootClip(ScreenPtr pScreen, Bool enable);
|
||||||
|
extern _X_EXPORT void PrintWindowTree(void);
|
||||||
|
|
||||||
#endif /* WINDOW_H */
|
#endif /* WINDOW_H */
|
||||||
|
|
Loading…
Reference in New Issue