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>
This commit is contained in:
Carlos Garnacho 2022-09-16 13:06:23 +02:00 committed by Marge Bot
parent 9feac5ce62
commit 20bf7f5ceb
4 changed files with 15 additions and 24 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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