window: Move _NET_WM_SYNC_REQUEST and family to MetaWindowX11

The code to react to _NET_WM_SYNC_REQUEST and family (counter,
alarm, etc) currently lives in MetaWindow, even though most of
its management is done by MetaWindowX11.

In an ideal Wayland-as-default world, MetaWindow is completely
agnostic to the display server implementation, delegating to
MetaWindowX11 and MetaWindowWayland their respective display
server internals.

To help this goal, move the X11-specific code to deal with
_NET_WM_SYNC_REQUEST to MetaWindowX11.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/372
This commit is contained in:
Georges Basile Stavracas Neto
2018-12-22 17:27:32 -02:00
committed by Jonas Ådahl
parent f798912cbd
commit b4d55325d7
7 changed files with 199 additions and 111 deletions

View File

@@ -999,11 +999,6 @@ _meta_window_shared_new (MetaDisplay *display,
window->workspace = NULL;
window->sync_request_counter = None;
window->sync_request_serial = 0;
window->sync_request_timeout_id = 0;
window->sync_request_alarm = None;
meta_window_update_sandboxed_app_id (window);
meta_window_update_desc (window);
@@ -1083,7 +1078,6 @@ _meta_window_shared_new (MetaDisplay *display,
window->calc_placement = FALSE;
window->shaken_loose = FALSE;
window->have_focus_click_grab = FALSE;
window->disable_sync = FALSE;
window->unmaps_pending = 0;
@@ -1528,12 +1522,6 @@ meta_window_unmanage (MetaWindow *window,
invalidate_work_areas (window);
}
if (window->sync_request_timeout_id)
{
g_source_remove (window->sync_request_timeout_id);
window->sync_request_timeout_id = 0;
}
if (window->display->grab_window == window)
meta_display_end_grab_op (window->display, timestamp);
@@ -5948,8 +5936,8 @@ check_moveresize_frequency (MetaWindow *window,
/* If we are throttling via _NET_WM_SYNC_REQUEST, we don't need
* an artificial timeout-based throttled */
if (!window->disable_sync &&
window->sync_request_alarm != None)
if (window->client_type == META_WINDOW_CLIENT_TYPE_X11 &&
meta_window_x11_has_sync_request_alarm (META_WINDOW_X11 (window)))
return TRUE;
elapsed = time_diff (&current_time, &window->display->grab_last_moveresize_time);
@@ -6311,7 +6299,8 @@ update_resize (MetaWindow *window,
* resize the window when the window responds, or when we time
* the response out.
*/
if (window->sync_request_timeout_id != 0)
if (window->client_type == META_WINDOW_CLIENT_TYPE_X11 &&
meta_window_x11_is_sync_request_scheduled (META_WINDOW_X11 (window)))
return;
if (!check_moveresize_frequency (window, &remaining) && !force)