[X2Go-Commits] [nx-libs] 16/23: Events.c: catch intermediate window position changes

git-admin at x2go.org git-admin at x2go.org
Sat Jun 16 15:30:48 CEST 2018


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch 3.6.x
in repository nx-libs.

commit f9bae755424cc413707e9657c8baf84a6cd8effe
Author: Ulrich Sibiller <uli42 at gmx.de>
Date:   Fri May 4 22:29:55 2018 +0200

    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)
---
 nx-X11/programs/Xserver/hw/nxagent/Events.c | 40 +++++++++++++++++++++++++----
 1 file 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 34d1d31..dee8dd7 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 &&

--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/nx-libs.git


More information about the x2go-commits mailing list