[gtk/wip/matthiasc/popup5: 146/151] Don't assume that gdk_surface[_move]_resize() is asynchronous



commit 90058ed951e7dd44ee2b5b2d6108bd043caaf2a2
Author: Руслан Ижбулатов <lrn1986 gmail com>
Date:   Tue May 28 16:14:39 2019 +0000

    Don't assume that gdk_surface[_move]_resize() is asynchronous
    
    On Windows that call resizes the native window immediately,
    and the corresponding GDK event is emitted and processed
    before the control is returned to gtk_window_move_resize().
    Therefore, update freeze and configure_request_count increment
    must happen before the call, not after it.

 gtk/gtkwindow.c | 52 +++++++++++++++++++++++++++++-----------------------
 1 file changed, 29 insertions(+), 23 deletions(-)
---
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 5cb64664d8..eae7baaec0 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -7485,6 +7485,35 @@ gtk_window_move_resize (GtkWindow *window)
        * we don't get the ConfigureNotify back, the resize queue will never be run.
        */
 
+      if (priv->type != GTK_WINDOW_POPUP)
+        {
+         /* Increment the number of have-not-yet-received-notify requests.
+           * This is done before gdk_surface[_move]_resize(), because
+           * that call might be synchronous (depending on which GDK backend
+           * is being used), so any preparations for its effects must
+           * be done beforehand.
+           */
+         priv->configure_request_count += 1;
+
+          gdk_surface_freeze_toplevel_updates (surface);
+
+         /* for GTK_RESIZE_QUEUE toplevels, we are now awaiting a new
+          * configure event in response to our resizing request.
+          * the configure event will cause a new resize with
+          * ->configure_notify_received=TRUE.
+          * until then, we want to
+          * - discard expose events
+          * - coalesce resizes for our children
+          * - defer any window resizes until the configure event arrived
+          * to achieve this, we queue a resize for the window, but remove its
+          * resizing handler, so resizing will not be handled from the next
+          * idle handler but when the configure event arrives.
+          *
+          * FIXME: we should also dequeue the pending redraws here, since
+          * we handle those ourselves upon ->configure_notify_received==TRUE.
+          */
+       }
+
       /* Now send the configure request */
       if (configure_request_pos_changed)
         {
@@ -7510,29 +7539,6 @@ gtk_window_move_resize (GtkWindow *window)
 
           gtk_widget_size_allocate (widget, &allocation, -1);
        }
-      else
-        {
-         /* Increment the number of have-not-yet-received-notify requests */
-         priv->configure_request_count += 1;
-
-          gdk_surface_freeze_toplevel_updates (surface);
-
-         /* for GTK_RESIZE_QUEUE toplevels, we are now awaiting a new
-          * configure event in response to our resizing request.
-          * the configure event will cause a new resize with
-          * ->configure_notify_received=TRUE.
-          * until then, we want to
-          * - discard expose events
-          * - coalesce resizes for our children
-          * - defer any window resizes until the configure event arrived
-          * to achieve this, we queue a resize for the window, but remove its
-          * resizing handler, so resizing will not be handled from the next
-          * idle handler but when the configure event arrives.
-          *
-          * FIXME: we should also dequeue the pending redraws here, since
-          * we handle those ourselves upon ->configure_notify_received==TRUE.
-          */
-       }
     }
   else
     {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]