diff options
author | Olivier Fourdan <ofourdan@redhat.com> | 2019-11-19 14:08:45 +0100 |
---|---|---|
committer | Olivier Fourdan <ofourdan@redhat.com> | 2020-01-16 09:22:25 +0100 |
commit | 845157c11138ed189221f5c8164fb17945d1d493 (patch) | |
tree | e8f5b312a97a64db8698ba90e372db73c47398e4 /src/x11 | |
parent | bac188b568f8948a41c1d6fda0fcd3e2c4033743 (diff) | |
download | mutter-845157c11138ed189221f5c8164fb17945d1d493.tar.gz |
window/x11: Add `freeze_commits()/thaw_commits()`
Xwayland may post damages for an X11 window as soon as the frame
callback is triggered, while the X11 window manager/compositor has not
yet finished updating the windows.
If Xwayland becomes compliant enough to not permit updates after the
buffer has been committed (see [1]), then the partial redraw of the X11
window at the time it was posted will show on screen.
To avoid that issue, the X11 window manager can use the X11 property
`_XWAYLAND_ALLOW_COMMITS` to control when Xwayland should be allowed to
post the pending damages.
Add `freeze_commits()` and `thaw_commits()` methods to `MetaWindowX11`
which are a no-op on plain X11, but sets `_XWAYLAND_ALLOW_COMMITS` on
the toplevel X11 windows running on Xwayland.
[1] https://gitlab.freedesktop.org/xorg/xserver/merge_requests/316
See-also: https://gitlab.gnome.org/GNOME/mutter/merge_requests/855
https://gitlab.gnome.org/GNOME/mutter/merge_requests/942
Diffstat (limited to 'src/x11')
-rw-r--r-- | src/x11/atomnames.h | 1 | ||||
-rw-r--r-- | src/x11/window-x11-private.h | 3 | ||||
-rw-r--r-- | src/x11/window-x11.c | 27 | ||||
-rw-r--r-- | src/x11/window-x11.h | 3 |
4 files changed, 34 insertions, 0 deletions
diff --git a/src/x11/atomnames.h b/src/x11/atomnames.h index 4099d5d31..4c1b49ede 100644 --- a/src/x11/atomnames.h +++ b/src/x11/atomnames.h @@ -82,6 +82,7 @@ item(_XKB_RULES_NAMES) item(WL_SURFACE_ID) item(_XWAYLAND_MAY_GRAB_KEYBOARD) item(_XWAYLAND_RANDR_EMU_MONITOR_RECTS) +item(_XWAYLAND_ALLOW_COMMITS) /* Oddities: These are used, and we need atoms for them, * but when we need all _NET_WM hints (i.e. when we're making diff --git a/src/x11/window-x11-private.h b/src/x11/window-x11-private.h index c582118c7..a073a5b8a 100644 --- a/src/x11/window-x11-private.h +++ b/src/x11/window-x11-private.h @@ -33,6 +33,9 @@ typedef struct _MetaWindowX11Private MetaWindowX11Private; struct _MetaWindowX11Class { MetaWindowClass parent_class; + + void (*freeze_commits) (MetaWindow *window); + void (*thaw_commits) (MetaWindow *window); }; struct _MetaWindowX11 diff --git a/src/x11/window-x11.c b/src/x11/window-x11.c index 6378111b5..9caf75ad6 100644 --- a/src/x11/window-x11.c +++ b/src/x11/window-x11.c @@ -1974,6 +1974,16 @@ meta_window_x11_calculate_layer (MetaWindow *window) } static void +meta_window_x11_impl_freeze_commits (MetaWindow *window) +{ +} + +static void +meta_window_x11_impl_thaw_commits (MetaWindow *window) +{ +} + +static void meta_window_x11_map (MetaWindow *window) { MetaX11Display *x11_display = window->display->x11_display; @@ -2024,6 +2034,9 @@ meta_window_x11_class_init (MetaWindowX11Class *klass) window_class->calculate_layer = meta_window_x11_calculate_layer; window_class->map = meta_window_x11_map; window_class->unmap = meta_window_x11_unmap; + + klass->freeze_commits = meta_window_x11_impl_freeze_commits; + klass->thaw_commits = meta_window_x11_impl_thaw_commits; } void @@ -3995,3 +4008,17 @@ meta_window_x11_get_toplevel_xwindow (MetaWindow *window) { return window->frame ? window->frame->xwindow : window->xwindow; } + +void +meta_window_x11_freeze_commits (MetaWindow *window) +{ + MetaWindowX11 *window_x11 = META_WINDOW_X11 (window); + META_WINDOW_X11_GET_CLASS (window_x11)->freeze_commits (window); +} + +void +meta_window_x11_thaw_commits (MetaWindow *window) +{ + MetaWindowX11 *window_x11 = META_WINDOW_X11 (window); + META_WINDOW_X11_GET_CLASS (window_x11)->thaw_commits (window); +} diff --git a/src/x11/window-x11.h b/src/x11/window-x11.h index f3f3f1de1..2180ce976 100644 --- a/src/x11/window-x11.h +++ b/src/x11/window-x11.h @@ -81,4 +81,7 @@ void meta_window_x11_configure_notify (MetaWindow *window, Window meta_window_x11_get_toplevel_xwindow (MetaWindow *window); +void meta_window_x11_freeze_commits (MetaWindow *window); +void meta_window_x11_thaw_commits (MetaWindow *window); + #endif |