compositor/x11: Move unredirect logic to helper

It makes it clearer what is required for unredirecting a window.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/734
This commit is contained in:
Jonas Ådahl 2019-08-17 09:46:55 +02:00
parent f059466337
commit 9ac52f0340

View File

@ -229,27 +229,36 @@ set_unredirected_window (MetaCompositorX11 *compositor_x11,
}
}
static void
maybe_unredirect_top_window (MetaCompositorX11 *compositor_x11)
{
MetaCompositor *compositor = META_COMPOSITOR (compositor_x11);
MetaWindow *window_to_unredirect = NULL;
MetaWindowActor *window_actor;
if (meta_compositor_is_unredirect_inhibited (compositor))
goto out;
window_actor = meta_compositor_get_top_window_actor (compositor);
if (!window_actor)
goto out;
if (!meta_window_actor_should_unredirect (window_actor))
goto out;
window_to_unredirect = meta_window_actor_get_meta_window (window_actor);
out:
set_unredirected_window (compositor_x11, window_to_unredirect);
}
static void
meta_compositor_x11_pre_paint (MetaCompositor *compositor)
{
MetaCompositorX11 *compositor_x11 = META_COMPOSITOR_X11 (compositor);
MetaWindowActor *top_window_actor;
MetaCompositorClass *parent_class;
top_window_actor = meta_compositor_get_top_window_actor (compositor);
if (!meta_compositor_is_unredirect_inhibited (compositor) &&
top_window_actor &&
meta_window_actor_should_unredirect (top_window_actor))
{
MetaWindow *top_window;
top_window = meta_window_actor_get_meta_window (top_window_actor);
set_unredirected_window (compositor_x11, top_window);
}
else
{
set_unredirected_window (compositor_x11, NULL);
}
maybe_unredirect_top_window (compositor_x11);
parent_class = META_COMPOSITOR_CLASS (meta_compositor_x11_parent_class);
parent_class->pre_paint (compositor);