aboutsummaryrefslogtreecommitdiff
path: root/nx-X11
diff options
context:
space:
mode:
authorUlrich Sibiller <uli42@gmx.de>2020-05-25 18:36:21 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2020-10-17 22:38:05 +0200
commit337afd839b99733baed52e7b1d01d24c737a8849 (patch)
treea2cf1e65e0edb979d74cc4e96d38f981a3abf1e9 /nx-X11
parent8deda7bd4f1ada976010c2edcd7cab9a4bdf8140 (diff)
downloadnx-libs-337afd839b99733baed52e7b1d01d24c737a8849.tar.gz
nx-libs-337afd839b99733baed52e7b1d01d24c737a8849.tar.bz2
nx-libs-337afd839b99733baed52e7b1d01d24c737a8849.zip
Events.c: add more DEBUG output
Diffstat (limited to 'nx-X11')
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Events.c89
1 files changed, 78 insertions, 11 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c
index bf6e20e20..899afcce6 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Events.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Events.c
@@ -3135,8 +3135,26 @@ int nxagentCheckWindowConfiguration(XConfigureEvent* X)
return 1;
}
+#define DEBUG
+#define TEST
+
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)
{
int sendEventAnyway = 0;
@@ -3326,6 +3344,10 @@ int nxagentHandleConfigureNotify(XEvent* X)
if (!nxagentWMIsRunning || X -> xconfigure.send_event)
{
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;
newY = X -> xconfigure.y;
}
@@ -3340,10 +3362,11 @@ int nxagentHandleConfigureNotify(XEvent* X)
}
}
- if (updatePos)
+ if (updatePos && (nxagentOption(X) != newX || nxagentOption(Y) != newY))
{
#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
nxagentChangeOption(X, newX);
nxagentChangeOption(Y, newY);
@@ -3356,8 +3379,16 @@ int nxagentHandleConfigureNotify(XEvent* X)
nxagentShadowResize = 1;
}
- nxagentChangeOption(Width, X -> xconfigure.width);
- nxagentChangeOption(Height, X -> xconfigure.height);
+ if (nxagentOption(Width) != X->xconfigure.width || nxagentOption(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 -
(int) nxagentOption(RootWidth));
@@ -3378,9 +3409,6 @@ int nxagentHandleConfigureNotify(XEvent* X)
doRandR = False;
}
- nxagentChangeOption(Width, X -> xconfigure.width);
- nxagentChangeOption(Height, X -> xconfigure.height);
-
XMoveResizeWindow(nxagentDisplay, nxagentInputWindows[0], 0, 0,
X -> xconfigure.width, X -> xconfigure.height);
@@ -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;
}
int nxagentHandleReparentNotify(XEvent* X)
{
#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
if (nxagentOption(Rootless))
@@ -3560,21 +3606,30 @@ int nxagentHandleReparentNotify(XEvent* X)
&attributes) == 0))
{
#ifdef WARNING
- fprintf(stderr, "%s: WARNING! XGetWindowAttributes failed.\n", __func__);
+ fprintf(stderr, "%s: WARNING! XGetWindowAttributes for parent window failed.\n", __func__);
#endif
return 1;
}
+ XlibWindow junk;
int x = attributes.x;
int y = attributes.y;
- XlibWindow junk;
+ #ifdef DEBUG
+ int before_x = x;
+ int before_y = y;
+ #endif
+
XTranslateCoordinates(nxagentDisplay, X -> xreparent.window,
attributes.root, -attributes.border_width,
-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.
*/
@@ -3623,6 +3678,18 @@ int nxagentHandleReparentNotify(XEvent* X)
nxagentChangeOption(WMBorderWidth, (x - attributes.x));
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
}
}