[mutter/wip/carlosg/frames-client: 37/39] x11: Delay next resize op after sync resize until frame is painted




commit e4034d7505a1af466acda7b220ebf562e5f23457
Author: Carlos Garnacho <carlosg gnome org>
Date:   Fri Sep 16 13:06:23 2022 +0200

    x11: Delay next resize op after sync resize until frame is painted
    
    Since the frames are now rendered by a separate process, we no longer
    can guarantee at this point that all updates were handled. Engaging
    in a new synchronous resize operation will again freeze the actor,
    so sometimes we are left with a not-quite-current buffer for the
    frame+window surface.
    
    In order to ensure that the right changes made it onscreen, delay
    this next synchronous resize step until the moment the surface was
    repainted. This avoids those glitches, while still ensuing the
    resize operation ends up in sync with the pointer.

 src/compositor/meta-window-actor-x11.c |  8 ++++++++
 src/x11/meta-sync-counter.c            | 27 +++++----------------------
 src/x11/window-x11-private.h           |  2 --
 src/x11/window-x11.h                   |  2 ++
 4 files changed, 15 insertions(+), 24 deletions(-)
---
diff --git a/src/compositor/meta-window-actor-x11.c b/src/compositor/meta-window-actor-x11.c
index 9d68ac9e6e..4b5c508564 100644
--- a/src/compositor/meta-window-actor-x11.c
+++ b/src/compositor/meta-window-actor-x11.c
@@ -1245,6 +1245,14 @@ meta_window_actor_x11_after_paint (MetaWindowActor  *actor,
       meta_window_x11_thaw_commits (window);
       meta_window_x11_set_thaw_after_paint (window, FALSE);
     }
+
+  if (window == window->display->grab_window &&
+      meta_grab_op_is_resizing (window->display->grab_op))
+    {
+      /* This means we are ready for another configure;
+       * no pointer round trip here, to keep in sync */
+      meta_window_x11_check_update_resize (window);
+    }
 }
 
 static gboolean
diff --git a/src/x11/meta-sync-counter.c b/src/x11/meta-sync-counter.c
index 57575b57b6..e202e3962a 100644
--- a/src/x11/meta-sync-counter.c
+++ b/src/x11/meta-sync-counter.c
@@ -291,29 +291,12 @@ meta_sync_counter_update (MetaSyncCounter *sync_counter,
   meta_compositor_sync_updates_frozen (window->display->compositor, window);
 
   if (new_counter_value >= sync_counter->sync_request_wait_serial &&
-      sync_counter->sync_request_timeout_id)
+      sync_counter->sync_request_timeout_id &&
+      (!sync_counter->extended_sync_request_counter ||
+       new_counter_value % 2 == 0))
     {
-      if (!sync_counter->extended_sync_request_counter ||
-          new_counter_value % 2 == 0)
-        {
-          g_clear_handle_id (&sync_counter->sync_request_timeout_id,
-                             g_source_remove);
-        }
-
-      if (window == window->display->grab_window &&
-          meta_grab_op_is_resizing (window->display->grab_op) &&
-          (!sync_counter->extended_sync_request_counter ||
-           new_counter_value % 2 == 0))
-        {
-          meta_topic (META_DEBUG_RESIZING,
-                      "Alarm event received last motion x = %d y = %d",
-                      window->display->grab_latest_motion_x,
-                      window->display->grab_latest_motion_y);
-
-          /* This means we are ready for another configure;
-           * no pointer round trip here, to keep in sync */
-          meta_window_x11_check_update_resize (window);
-        }
+      g_clear_handle_id (&sync_counter->sync_request_timeout_id,
+                         g_source_remove);
     }
 
   /* If sync was previously disabled, turn it back on and hope
diff --git a/src/x11/window-x11-private.h b/src/x11/window-x11-private.h
index 2c8af9f08c..973fc083b8 100644
--- a/src/x11/window-x11-private.h
+++ b/src/x11/window-x11-private.h
@@ -95,8 +95,6 @@ void meta_window_x11_queue_update_icon (MetaWindowX11 *window_x11);
 
 void meta_window_x11_initialize_state (MetaWindow *window);
 
-void meta_window_x11_check_update_resize (MetaWindow *window);
-
 G_END_DECLS
 
 #endif
diff --git a/src/x11/window-x11.h b/src/x11/window-x11.h
index 5581747ff4..f0e0b9a647 100644
--- a/src/x11/window-x11.h
+++ b/src/x11/window-x11.h
@@ -105,4 +105,6 @@ gboolean meta_window_x11_has_active_sync_alarms (MetaWindow *window);
 
 gboolean meta_window_x11_is_awaiting_sync_response (MetaWindow *window);
 
+void meta_window_x11_check_update_resize (MetaWindow *window);
+
 #endif


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