window/x11: Add always_update_shape() vfunc

To address the black shadows that sometimes show during resize with
Xwayland, we need to update the window shape regardless of the frozen
status of the window actor.

However, plain Xorg does not need this, as resized windows do not clear
to black, so add a new vfunc to window/x11 to indicate whether or not
the backing windowing system (either plain X11 or Xwayland) would
require the shape to be always updated.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/942
This commit is contained in:
Olivier Fourdan 2019-12-06 16:01:35 +01:00
parent d7a7af1ff2
commit 4d5a86327a
4 changed files with 33 additions and 0 deletions

View File

@ -219,6 +219,21 @@ meta_window_xwayland_thaw_commits (MetaWindow *window)
apply_allow_commits_x11_property (xwayland_window, TRUE);
}
static gboolean
meta_window_xwayland_always_update_shape (MetaWindow *window)
{
/*
* On Xwayland, resizing a window will clear the corresponding Wayland
* buffer to plain solid black.
*
* Therefore, to address the black shadows which sometimes show during
* resize with Xwayland, we need to always update the window shape
* regardless of the actual frozen state of the window actor.
*/
return TRUE;
}
static void
meta_window_xwayland_get_property (GObject *object,
guint prop_id,
@ -270,6 +285,7 @@ meta_window_xwayland_class_init (MetaWindowXwaylandClass *klass)
window_x11_class->freeze_commits = meta_window_xwayland_freeze_commits;
window_x11_class->thaw_commits = meta_window_xwayland_thaw_commits;
window_x11_class->always_update_shape = meta_window_xwayland_always_update_shape;
gobject_class->get_property = meta_window_xwayland_get_property;
gobject_class->set_property = meta_window_xwayland_set_property;

View File

@ -36,6 +36,7 @@ struct _MetaWindowX11Class
void (*freeze_commits) (MetaWindow *window);
void (*thaw_commits) (MetaWindow *window);
gboolean (*always_update_shape) (MetaWindow *window);
};
struct _MetaWindowX11

View File

@ -2014,6 +2014,12 @@ meta_window_x11_unmap (MetaWindow *window)
window->unmaps_pending ++;
}
static gboolean
meta_window_x11_impl_always_update_shape (MetaWindow *window)
{
return FALSE;
}
static void
meta_window_x11_class_init (MetaWindowX11Class *klass)
{
@ -2047,6 +2053,7 @@ meta_window_x11_class_init (MetaWindowX11Class *klass)
klass->freeze_commits = meta_window_x11_impl_freeze_commits;
klass->thaw_commits = meta_window_x11_impl_thaw_commits;
klass->always_update_shape = meta_window_x11_impl_always_update_shape;
}
void
@ -4051,3 +4058,11 @@ meta_window_x11_should_thaw_after_paint (MetaWindow *window)
return priv->thaw_after_paint;
}
gboolean
meta_window_x11_always_update_shape (MetaWindow *window)
{
MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
return META_WINDOW_X11_GET_CLASS (window_x11)->always_update_shape (window);
}

View File

@ -87,5 +87,6 @@ void meta_window_x11_thaw_commits (MetaWindow *window);
void meta_window_x11_set_thaw_after_paint (MetaWindow *window,
gboolean thaw_after_paint);
gboolean meta_window_x11_should_thaw_after_paint (MetaWindow *window);
gboolean meta_window_x11_always_update_shape (MetaWindow *window);
#endif