compositor: Simplify the unredirected window management code
https://bugzilla.gnome.org/show_bug.cgi?id=720631
This commit is contained in:
parent
60d9bee3bf
commit
d6282716b2
@ -47,7 +47,7 @@ struct _MetaCompScreen
|
||||
|
||||
/* Used for unredirecting fullscreen windows */
|
||||
guint disable_unredirect_count;
|
||||
MetaWindowActor *unredirected_window;
|
||||
MetaWindow *unredirected_window;
|
||||
|
||||
/* Before we create the output window */
|
||||
XserverRegion pending_input_region;
|
||||
|
@ -863,6 +863,30 @@ meta_shape_cow_for_window (MetaScreen *screen,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
set_unredirected_window (MetaCompScreen *info,
|
||||
MetaWindow *window)
|
||||
{
|
||||
if (info->unredirected_window == window)
|
||||
return;
|
||||
|
||||
if (info->unredirected_window != NULL)
|
||||
{
|
||||
MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (info->unredirected_window));
|
||||
meta_window_actor_set_redirected (window_actor, TRUE);
|
||||
}
|
||||
|
||||
info->unredirected_window = window;
|
||||
|
||||
if (info->unredirected_window != NULL)
|
||||
{
|
||||
MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (info->unredirected_window));
|
||||
meta_window_actor_set_redirected (window_actor, FALSE);
|
||||
}
|
||||
|
||||
meta_shape_cow_for_window (info->screen, info->unredirected_window);
|
||||
}
|
||||
|
||||
void
|
||||
meta_compositor_add_window (MetaCompositor *compositor,
|
||||
MetaWindow *window)
|
||||
@ -891,19 +915,11 @@ meta_compositor_remove_window (MetaCompositor *compositor,
|
||||
if (!window_actor)
|
||||
return;
|
||||
|
||||
if (!meta_is_wayland_compositor ())
|
||||
{
|
||||
screen = meta_window_get_screen (window);
|
||||
info = meta_screen_get_compositor_data (screen);
|
||||
|
||||
if (window_actor == info->unredirected_window)
|
||||
{
|
||||
meta_window_actor_set_redirected (window_actor, TRUE);
|
||||
meta_shape_cow_for_window (meta_window_get_screen (meta_window_actor_get_meta_window (info->unredirected_window)),
|
||||
NULL);
|
||||
info->unredirected_window = NULL;
|
||||
}
|
||||
}
|
||||
if (info->unredirected_window == window)
|
||||
set_unredirected_window (info, NULL);
|
||||
|
||||
meta_window_actor_destroy (window_actor);
|
||||
}
|
||||
@ -1533,7 +1549,6 @@ pre_paint_windows (MetaCompScreen *info)
|
||||
{
|
||||
GList *l;
|
||||
MetaWindowActor *top_window;
|
||||
MetaWindowActor *expected_unredirected_window = NULL;
|
||||
|
||||
if (info->onscreen == NULL)
|
||||
{
|
||||
@ -1547,33 +1562,13 @@ pre_paint_windows (MetaCompScreen *info)
|
||||
if (info->windows == NULL)
|
||||
return;
|
||||
|
||||
if (!meta_is_wayland_compositor ())
|
||||
{
|
||||
top_window = g_list_last (info->windows)->data;
|
||||
|
||||
if (meta_window_actor_should_unredirect (top_window) &&
|
||||
info->disable_unredirect_count == 0)
|
||||
expected_unredirected_window = top_window;
|
||||
|
||||
if (info->unredirected_window != expected_unredirected_window)
|
||||
{
|
||||
if (info->unredirected_window != NULL)
|
||||
{
|
||||
meta_window_actor_set_redirected (info->unredirected_window, TRUE);
|
||||
meta_shape_cow_for_window (meta_window_get_screen (meta_window_actor_get_meta_window (info->unredirected_window)),
|
||||
NULL);
|
||||
}
|
||||
|
||||
if (expected_unredirected_window != NULL)
|
||||
{
|
||||
meta_shape_cow_for_window (meta_window_get_screen (meta_window_actor_get_meta_window (top_window)),
|
||||
meta_window_actor_get_meta_window (top_window));
|
||||
meta_window_actor_set_redirected (top_window, FALSE);
|
||||
}
|
||||
|
||||
info->unredirected_window = expected_unredirected_window;
|
||||
}
|
||||
}
|
||||
set_unredirected_window (info, meta_window_actor_get_meta_window (top_window));
|
||||
else
|
||||
set_unredirected_window (info, NULL);
|
||||
|
||||
for (l = info->windows; l; l = l->next)
|
||||
meta_window_actor_pre_paint (l->data);
|
||||
|
@ -184,9 +184,8 @@ meta_window_group_paint (ClutterActor *actor)
|
||||
if (info->unredirected_window != NULL)
|
||||
{
|
||||
cairo_rectangle_int_t unredirected_rect;
|
||||
MetaWindow *window = meta_window_actor_get_meta_window (info->unredirected_window);
|
||||
|
||||
meta_window_get_frame_rect (window, (MetaRectangle *)&unredirected_rect);
|
||||
meta_window_get_frame_rect (info->unredirected_window, (MetaRectangle *)&unredirected_rect);
|
||||
cairo_region_subtract_rectangle (unobscured_region, &unredirected_rect);
|
||||
cairo_region_subtract_rectangle (clip_region, &unredirected_rect);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user