Commit 337afd83 authored by Ulrich Sibiller's avatar Ulrich Sibiller Committed by Mike Gabriel

Events.c: add more DEBUG output

parent 8deda7bd
...@@ -3135,8 +3135,26 @@ int nxagentCheckWindowConfiguration(XConfigureEvent* X) ...@@ -3135,8 +3135,26 @@ int nxagentCheckWindowConfiguration(XConfigureEvent* X)
return 1; return 1;
} }
#define DEBUG
#define TEST
int nxagentHandleConfigureNotify(XEvent* X) int nxagentHandleConfigureNotify(XEvent* X)
{ {
#ifdef DEBUG
fprintf(stderr, "%s: Event info:\n", __func__);
fprintf(stderr, "%s: X->serial [%ld]\n", __func__, X->xconfigure.serial);
fprintf(stderr, "%s: X->override_redirect [%d]\n", __func__, X->xconfigure.override_redirect);
fprintf(stderr, "%s: X->border_width [%d]\n", __func__, X->xconfigure.border_width);
fprintf(stderr, "%s: X->send_event [%d]\n", __func__, X->xconfigure.send_event);
fprintf(stderr, "%s: X->window [0x%lx]\n", __func__, X->xconfigure.window);
fprintf(stderr, "%s: X->event [0x%lx]\n", __func__, X->xconfigure.event);
fprintf(stderr, "%s: X->x, X->y [%d][%d]\n", __func__, X->xconfigure.x, X->xconfigure.y);
fprintf(stderr, "%s: X->width, X->height [%d][%d]\n", __func__, X->xconfigure.width, X->xconfigure.height);
fprintf(stderr, "%s: References:\n", __func__);
fprintf(stderr, "%s: DefaultWindow[0]: [0x%x]\n", __func__, nxagentDefaultWindows[0]);
fprintf(stderr, "%s: DefaultRootWindow(DISPLAY) [0x%lx]\n", __func__, DefaultRootWindow(nxagentDisplay));
#endif
if (nxagentOption(Rootless) == True) if (nxagentOption(Rootless) == True)
{ {
int sendEventAnyway = 0; int sendEventAnyway = 0;
...@@ -3326,6 +3344,10 @@ int nxagentHandleConfigureNotify(XEvent* X) ...@@ -3326,6 +3344,10 @@ int nxagentHandleConfigureNotify(XEvent* X)
if (!nxagentWMIsRunning || X -> xconfigure.send_event) if (!nxagentWMIsRunning || X -> xconfigure.send_event)
{ {
updatePos = True; updatePos = True;
#ifdef DEBUG
fprintf(stderr, "%s: Accumulating event %d: x [%d] y [%d] width [%d] height [%d]\n", __func__, count,
X -> xconfigure.x, X -> xconfigure.y, X -> xconfigure.width, X -> xconfigure.height);
#endif
newX = X -> xconfigure.x; newX = X -> xconfigure.x;
newY = X -> xconfigure.y; newY = X -> xconfigure.y;
} }
...@@ -3340,10 +3362,11 @@ int nxagentHandleConfigureNotify(XEvent* X) ...@@ -3340,10 +3362,11 @@ int nxagentHandleConfigureNotify(XEvent* X)
} }
} }
if (updatePos) if (updatePos && (nxagentOption(X) != newX || nxagentOption(Y) != newY))
{ {
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, "%s: Updating nxagent window position [%d,%d]\n", __func__, newX, newY); fprintf(stderr, "%s: Updating nxagent window position [%d,%d] -> [%d,%d]\n", __func__,
nxagentOption(X), nxagentOption(Y), newX, newY);
#endif #endif
nxagentChangeOption(X, newX); nxagentChangeOption(X, newX);
nxagentChangeOption(Y, newY); nxagentChangeOption(Y, newY);
...@@ -3356,8 +3379,16 @@ int nxagentHandleConfigureNotify(XEvent* X) ...@@ -3356,8 +3379,16 @@ int nxagentHandleConfigureNotify(XEvent* X)
nxagentShadowResize = 1; nxagentShadowResize = 1;
} }
nxagentChangeOption(Width, X -> xconfigure.width); if (nxagentOption(Width) != X->xconfigure.width || nxagentOption(Height) != X->xconfigure.height)
nxagentChangeOption(Height, X -> xconfigure.height); {
#ifdef DEBUG
fprintf(stderr, "%s: Updating width and height [%d,%d] -> [%d,%d]\n", __func__,
nxagentOption(Width), nxagentOption(Height),
X->xconfigure.width, X->xconfigure.height);
#endif
nxagentChangeOption(Width, X -> xconfigure.width);
nxagentChangeOption(Height, X -> xconfigure.height);
}
nxagentChangeOption(ViewportXSpan, (int) X -> xconfigure.width - nxagentChangeOption(ViewportXSpan, (int) X -> xconfigure.width -
(int) nxagentOption(RootWidth)); (int) nxagentOption(RootWidth));
...@@ -3378,9 +3409,6 @@ int nxagentHandleConfigureNotify(XEvent* X) ...@@ -3378,9 +3409,6 @@ int nxagentHandleConfigureNotify(XEvent* X)
doRandR = False; doRandR = False;
} }
nxagentChangeOption(Width, X -> xconfigure.width);
nxagentChangeOption(Height, X -> xconfigure.height);
XMoveResizeWindow(nxagentDisplay, nxagentInputWindows[0], 0, 0, XMoveResizeWindow(nxagentDisplay, nxagentInputWindows[0], 0, 0,
X -> xconfigure.width, X -> xconfigure.height); X -> xconfigure.width, X -> xconfigure.height);
...@@ -3449,13 +3477,31 @@ int nxagentHandleConfigureNotify(XEvent* X) ...@@ -3449,13 +3477,31 @@ int nxagentHandleConfigureNotify(XEvent* X)
} }
} }
#ifdef TEST
fprintf(stderr, "%s: received for unexpected window [%ld]\n", __func__, X -> xconfigure.window);
#endif
return 0; return 0;
} }
int nxagentHandleReparentNotify(XEvent* X) int nxagentHandleReparentNotify(XEvent* X)
{ {
#ifdef TEST #ifdef TEST
fprintf(stderr, "%s: Going to handle a new reparent event.\n", __func__); fprintf(stderr, "%s: Going to handle a new reparent event (serial [%ld].\n", __func__, X->xreparent.serial);
#endif
#ifdef DEBUG
fprintf(stderr, "%s: Event info:\n", __func__);
fprintf(stderr, "%s: X->send_event [%d]\n", __func__, X->xreparent.send_event);
fprintf(stderr, "%s: X->event [0x%lx]\n", __func__, X->xreparent.event);
fprintf(stderr, "%s: X->window [0x%lx]\n", __func__, X->xreparent.window);
fprintf(stderr, "%s: X->parent [0x%lx]\n", __func__, X->xreparent.parent);
fprintf(stderr, "%s: X->x, X->y [%d][%d]\n", __func__, X->xreparent.x, X->xreparent.y);
fprintf(stderr, "%s: X->override_redirect [%d]\n", __func__, X->xreparent.override_redirect);
fprintf(stderr, "%s: References:\n", __func__);
fprintf(stderr, "%s: DefaultWindow[0]: [0x%x]\n", __func__, nxagentDefaultWindows[0]);
fprintf(stderr, "%s: RootWindow(DISPLAY, 0): [0x%lx]\n", __func__, RootWindow(nxagentDisplay, 0));
fprintf(stderr, "%s: DefaultRootWindow(DISPLAY): [0x%lx]\n", __func__, DefaultRootWindow(nxagentDisplay));
#endif #endif
if (nxagentOption(Rootless)) if (nxagentOption(Rootless))
...@@ -3560,21 +3606,30 @@ int nxagentHandleReparentNotify(XEvent* X) ...@@ -3560,21 +3606,30 @@ int nxagentHandleReparentNotify(XEvent* X)
&attributes) == 0)) &attributes) == 0))
{ {
#ifdef WARNING #ifdef WARNING
fprintf(stderr, "%s: WARNING! XGetWindowAttributes failed.\n", __func__); fprintf(stderr, "%s: WARNING! XGetWindowAttributes for parent window failed.\n", __func__);
#endif #endif
return 1; return 1;
} }
XlibWindow junk;
int x = attributes.x; int x = attributes.x;
int y = attributes.y; int y = attributes.y;
XlibWindow junk; #ifdef DEBUG
int before_x = x;
int before_y = y;
#endif
XTranslateCoordinates(nxagentDisplay, X -> xreparent.window, XTranslateCoordinates(nxagentDisplay, X -> xreparent.window,
attributes.root, -attributes.border_width, attributes.root, -attributes.border_width,
-attributes.border_width, &x, &y, &junk); -attributes.border_width, &x, &y, &junk);
/* #ifdef DEBUG
fprintf(stderr, "%s: translated coordinates x,y [%d,%d] -> [%d,%d].\n", __func__, before_x, before_y, x, y);
#endif
/*
* Calculate the parent X and parent Y. * Calculate the parent X and parent Y.
*/ */
...@@ -3623,6 +3678,18 @@ int nxagentHandleReparentNotify(XEvent* X) ...@@ -3623,6 +3678,18 @@ int nxagentHandleReparentNotify(XEvent* X)
nxagentChangeOption(WMBorderWidth, (x - attributes.x)); nxagentChangeOption(WMBorderWidth, (x - attributes.x));
nxagentChangeOption(WMTitleHeight, (y - attributes.y)); nxagentChangeOption(WMTitleHeight, (y - attributes.y));
#ifdef DEBUG
fprintf(stderr, "%s: WMBorderWidth [%d]\n", __func__, nxagentOption(WMBorderWidth));
fprintf(stderr, "%s: WMTitleHeight [%d]\n", __func__, nxagentOption(WMTitleHeight));
fprintf(stderr, "%s: win_gravity [%d]\n", __func__, attributes.win_gravity);
fprintf(stderr, "%s: bit_gravity [%d]\n", __func__, attributes.bit_gravity);
fprintf(stderr, "%s: border_width [%d]\n", __func__, attributes.border_width);
fprintf(stderr, "%s: height [%d]\n", __func__, attributes.height);
fprintf(stderr, "%s: width [%d]\n", __func__, attributes.width);
fprintf(stderr, "%s: x [%d]\n", __func__, attributes.x);
fprintf(stderr, "%s: y [%d]\n", __func__, attributes.y);
#endif
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment