summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2022-09-16 13:06:23 +0200
committerMarge Bot <marge-bot@gnome.org>2022-12-01 20:10:53 +0000
commit20bf7f5cebafeb52adf66016043f010b0afab859 (patch)
tree8a50ac078425a108d69d40d022dedc58977d0b1a
parent9feac5ce62bc0bf6f1960576a53082addd4d516a (diff)
downloadmutter-20bf7f5cebafeb52adf66016043f010b0afab859.tar.gz
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. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2175>
-rw-r--r--src/compositor/meta-window-actor-x11.c8
-rw-r--r--src/x11/meta-sync-counter.c27
-rw-r--r--src/x11/window-x11-private.h2
-rw-r--r--src/x11/window-x11.h2
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 e48d21d6a..efa8c8ee0 100644
--- a/src/compositor/meta-window-actor-x11.c
+++ b/src/compositor/meta-window-actor-x11.c
@@ -1243,6 +1243,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 f6df167b0..39aca58a1 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 0809c795a..5c738a83f 100644
--- a/src/x11/window-x11-private.h
+++ b/src/x11/window-x11-private.h
@@ -97,8 +97,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 5581747ff..f0e0b9a64 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