diff options
author | Ulrich Sibiller <uli42@gmx.de> | 2018-05-04 22:29:55 +0200 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2018-05-24 09:42:24 +0200 |
commit | f9bae755424cc413707e9657c8baf84a6cd8effe (patch) | |
tree | dcf156a5196578abdc83b841338ce374dcd5f804 /nx-X11/programs | |
parent | 00c1f05efd043fb6f2dba342694c7091dad342cb (diff) | |
download | nx-libs-f9bae755424cc413707e9657c8baf84a6cd8effe.tar.gz nx-libs-f9bae755424cc413707e9657c8baf84a6cd8effe.tar.bz2 nx-libs-f9bae755424cc413707e9657c8baf84a6cd8effe.zip |
Events.c: catch intermediate window position changes
nxagentHandleConfigureNotify() has an optimization that accumulates
ConfigureNotify events from the queue to only perform the changes of
the last ConfigureNotify event in the queue. But that code used to
ignore position changes and only adapt the new window position if the
last event happened to contain a position change.
This change ensures the latest position change - if any - found in the
queue will be applied after the accumulation.
Fixes: ArticaProject/nx-libs#688 (second part)
Diffstat (limited to 'nx-X11/programs')
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/Events.c | 40 |
1 files changed, 35 insertions, 5 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c index 34d1d314a..dee8dd7e0 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Events.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Events.c @@ -3341,13 +3341,26 @@ int nxagentHandleConfigureNotify(XEvent* X) { if (nxagentOption(AllScreens) == 0) { + /* + * - WITHOUT window manager any position change is relevant + * - WITH window manager only synthetic position changes send + * by the window manager are relevant, see ICCCM Chapter 4, + * "Configuring the Window" + */ + Bool updatePos = (nxagentWMIsRunning == 0 || X -> xconfigure.send_event != 0); + int newX = X -> xconfigure.x; + int newY = X -> xconfigure.y; + if (nxagentOption(DesktopResize) == 1) { if (nxagentOption(Width) != X -> xconfigure.width || nxagentOption(Height) != X -> xconfigure.height || - nxagentOption(X) != X -> xconfigure.x || - nxagentOption(Y) != X -> xconfigure.y) + (updatePos && (nxagentOption(X) != newX || + nxagentOption(Y) != newY))) { + #ifdef DEBUG + int count = 0; + #endif Bool newEvents = False; doRandR = True; @@ -3372,17 +3385,34 @@ int nxagentHandleConfigureNotify(XEvent* X) while (XCheckTypedWindowEvent(nxagentDisplay, nxagentDefaultWindows[pScreen -> myNum], ConfigureNotify, X)) { + #ifdef DEBUG + count++; + #endif + + if (nxagentWMIsRunning == 0 || X -> xconfigure.send_event) + { + updatePos = True; + newX = X -> xconfigure.x; + newY = X -> xconfigure.y; + } newEvents = True; } } while (newEvents); + + #ifdef DEBUG + fprintf(stderr, "%s: accumulated %d events\n", __func__, count); + #endif } } - if (nxagentWMIsRunning == 0 || X -> xconfigure.send_event) + if (updatePos) { - nxagentChangeOption(X, X -> xconfigure.x); - nxagentChangeOption(Y, X -> xconfigure.y); + #ifdef DEBUG + fprintf(stderr, "%s: Updating nxagent window position [%d,%d]\n", __func__, newX, newY); + #endif + nxagentChangeOption(X, newX); + nxagentChangeOption(Y, newY); } if (nxagentOption(Shadow) == 1 && nxagentOption(DesktopResize) == 1 && |