compositor: Remove meta_compositor_window_[un]mapped

We no longer unmap the toplevel windows during normal operation. The
toplevel state is tied to the window's lifetime.

Call meta_compositor_add_window / meta_compositor_remove_window instead...
This commit is contained in:
Jasper St. Pierre 2014-01-21 15:58:12 -05:00
parent 8e6f8087e8
commit bfc906cbc4
5 changed files with 16 additions and 118 deletions

View File

@ -96,8 +96,6 @@ meta_compositor_hide_window
meta_compositor_switch_workspace meta_compositor_switch_workspace
meta_compositor_maximize_window meta_compositor_maximize_window
meta_compositor_unmaximize_window meta_compositor_unmaximize_window
meta_compositor_window_mapped
meta_compositor_window_unmapped
meta_compositor_sync_window_geometry meta_compositor_sync_window_geometry
meta_compositor_set_updates_frozen meta_compositor_set_updates_frozen
meta_compositor_queue_frame_drawn meta_compositor_queue_frame_drawn

View File

@ -42,15 +42,6 @@
* the call, so it may be necessary to readjust the display based on the * the call, so it may be necessary to readjust the display based on the
* old_rect to start the animation. * old_rect to start the animation.
* *
* meta_compositor_window_mapped() and meta_compositor_window_unmapped() are
* notifications when the toplevel window (frame or client window) is mapped or
* unmapped. That is, when the result of meta_window_toplevel_is_mapped()
* changes. The main use of this is to drop resources when a window is unmapped.
* A window will always be mapped before meta_compositor_show_window()
* is called and will not be unmapped until after meta_compositor_hide_window()
* is called. If the live_hidden_windows preference is set, windows will never
* be unmapped.
*
* # Containers # * # Containers #
* *
* There's two containers in the stage that are used to place window actors, here * There's two containers in the stage that are used to place window actors, here
@ -1402,30 +1393,6 @@ meta_compositor_sync_stack (MetaCompositor *compositor,
sync_actor_stacking (info); sync_actor_stacking (info);
} }
void
meta_compositor_window_mapped (MetaCompositor *compositor,
MetaWindow *window)
{
MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
DEBUG_TRACE ("meta_compositor_window_mapped\n");
if (!window_actor)
return;
meta_window_actor_mapped (window_actor);
}
void
meta_compositor_window_unmapped (MetaCompositor *compositor,
MetaWindow *window)
{
MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
DEBUG_TRACE ("meta_compositor_window_unmapped\n");
if (!window_actor)
return;
meta_window_actor_unmapped (window_actor);
}
void void
meta_compositor_sync_window_geometry (MetaCompositor *compositor, meta_compositor_sync_window_geometry (MetaCompositor *compositor,
MetaWindow *window, MetaWindow *window,

View File

@ -106,7 +106,6 @@ struct _MetaWindowActorPrivate
Damage damage; /* Not used in wayland compositor mode */ Damage damage; /* Not used in wayland compositor mode */
guint visible : 1; guint visible : 1;
guint mapped : 1;
guint argb32 : 1; guint argb32 : 1;
guint disposed : 1; guint disposed : 1;
guint redecorating : 1; guint redecorating : 1;
@ -984,7 +983,7 @@ meta_window_actor_damage_all (MetaWindowActor *self)
if (!priv->needs_damage_all) if (!priv->needs_damage_all)
return; return;
if (!priv->mapped || priv->needs_pixmap) if (priv->needs_pixmap)
return; return;
unobscured_region = unobscured_region =
@ -1074,7 +1073,7 @@ meta_window_actor_queue_frame_drawn (MetaWindowActor *self,
{ {
queue_send_frame_messages_timeout (self); queue_send_frame_messages_timeout (self);
} }
else if (priv->mapped && (!meta_is_wayland_compositor () || !priv->needs_pixmap)) else
{ {
const cairo_rectangle_int_t clip = { 0, 0, 1, 1 }; const cairo_rectangle_int_t clip = { 0, 0, 1, 1 };
clutter_actor_queue_redraw_with_clip (CLUTTER_ACTOR (priv->surface), &clip); clutter_actor_queue_redraw_with_clip (CLUTTER_ACTOR (priv->surface), &clip);
@ -1106,9 +1105,6 @@ meta_window_actor_queue_create_x11_pixmap (MetaWindowActor *self)
priv->needs_pixmap = TRUE; priv->needs_pixmap = TRUE;
if (!priv->mapped)
return;
if (is_frozen (self)) if (is_frozen (self))
return; return;
@ -1206,9 +1202,6 @@ meta_window_actor_after_effects (MetaWindowActor *self)
if (!meta_is_wayland_compositor ()) if (!meta_is_wayland_compositor ())
{ {
if (!priv->mapped)
meta_window_actor_detach_x11_pixmap (self);
if (priv->needs_pixmap) if (priv->needs_pixmap)
clutter_actor_queue_redraw (CLUTTER_ACTOR (priv->surface)); clutter_actor_queue_redraw (CLUTTER_ACTOR (priv->surface));
} }
@ -1630,18 +1623,11 @@ meta_window_actor_new (MetaWindow *window)
priv = self->priv; priv = self->priv;
/* We know that when the compositor first adds our window, it will
* be before the toplevel window is mapped. */
priv->mapped = FALSE;
if (!meta_is_wayland_compositor ()) if (!meta_is_wayland_compositor ())
{ {
priv->last_width = -1; priv->last_width = -1;
priv->last_height = -1; priv->last_height = -1;
if (priv->mapped)
meta_window_actor_queue_create_x11_pixmap (self);
meta_window_actor_set_updates_frozen (self, meta_window_actor_set_updates_frozen (self,
meta_window_updates_are_frozen (priv->window)); meta_window_updates_are_frozen (priv->window));
@ -1676,38 +1662,6 @@ meta_window_actor_new (MetaWindow *window)
return self; return self;
} }
void
meta_window_actor_mapped (MetaWindowActor *self)
{
MetaWindowActorPrivate *priv = self->priv;
g_return_if_fail (!priv->mapped);
priv->mapped = TRUE;
if (!meta_is_wayland_compositor ())
meta_window_actor_queue_create_x11_pixmap (self);
}
void
meta_window_actor_unmapped (MetaWindowActor *self)
{
MetaWindowActorPrivate *priv = self->priv;
g_return_if_fail (priv->mapped);
priv->mapped = FALSE;
if (meta_window_actor_effect_in_progress (self))
return;
if (!meta_is_wayland_compositor ())
{
meta_window_actor_detach_x11_pixmap (self);
priv->needs_pixmap = FALSE;
}
}
#if 0 #if 0
/* Print out a region; useful for debugging */ /* Print out a region; useful for debugging */
static void static void
@ -1860,9 +1814,6 @@ check_needs_x11_pixmap (MetaWindowActor *self)
if (!priv->needs_pixmap) if (!priv->needs_pixmap)
return; return;
if (!priv->mapped)
return;
if (xwindow == meta_screen_get_xroot (screen) || if (xwindow == meta_screen_get_xroot (screen) ||
xwindow == clutter_x11_get_stage_window (CLUTTER_STAGE (info->stage))) xwindow == clutter_x11_get_stage_window (CLUTTER_STAGE (info->stage)))
return; return;
@ -1936,9 +1887,6 @@ check_needs_shadow (MetaWindowActor *self)
gboolean should_have_shadow; gboolean should_have_shadow;
gboolean appears_focused; gboolean appears_focused;
if (!priv->mapped)
return;
/* Calling meta_window_actor_has_shadow() here at every pre-paint is cheap /* Calling meta_window_actor_has_shadow() here at every pre-paint is cheap
* and avoids the need to explicitly handle window type changes, which * and avoids the need to explicitly handle window type changes, which
* we would do if tried to keep track of when we might be adding or removing * we would do if tried to keep track of when we might be adding or removing
@ -2043,7 +1991,7 @@ meta_window_actor_process_x11_damage (MetaWindowActor *self,
return; return;
} }
if (!priv->mapped || priv->needs_pixmap) if (priv->needs_pixmap)
return; return;
unobscured_region = unobscured_region =
@ -2322,9 +2270,6 @@ check_needs_reshape (MetaWindowActor *self)
MetaFrameBorders borders; MetaFrameBorders borders;
cairo_rectangle_int_t client_area; cairo_rectangle_int_t client_area;
if (!priv->mapped)
return;
if (!priv->needs_reshape) if (!priv->needs_reshape)
return; return;

View File

@ -812,17 +812,11 @@ sync_client_window_mapped (MetaWindow *window)
if (should_be_mapped) if (should_be_mapped)
{ {
XMapWindow (window->display->xdisplay, window->xwindow); XMapWindow (window->display->xdisplay, window->xwindow);
if (window->display->compositor)
meta_compositor_window_mapped (window->display->compositor, window);
} }
else else
{ {
XUnmapWindow (window->display->xdisplay, window->xwindow); XUnmapWindow (window->display->xdisplay, window->xwindow);
window->unmaps_pending ++; window->unmaps_pending ++;
if (window->display->compositor)
meta_compositor_window_unmapped (window->display->compositor, window);
} }
meta_error_trap_pop (window->display); meta_error_trap_pop (window->display);
} }
@ -1322,9 +1316,6 @@ meta_window_new_shared (MetaDisplay *display,
set_net_wm_state (window); set_net_wm_state (window);
} }
if (screen->display->compositor)
meta_compositor_add_window (screen->display->compositor, window);
/* Sync stack changes */ /* Sync stack changes */
meta_stack_thaw (window->screen->stack); meta_stack_thaw (window->screen->stack);
@ -1797,10 +1788,13 @@ meta_window_unmanage (MetaWindow *window,
if (window->display->compositor) if (window->display->compositor)
{ {
if (window->visible_to_compositor) if (window->visible_to_compositor)
meta_compositor_hide_window (window->display->compositor, window, {
META_COMP_EFFECT_DESTROY); meta_compositor_hide_window (window->display->compositor, window,
META_COMP_EFFECT_DESTROY);
meta_compositor_remove_window (window->display->compositor, window); /* XXX - support destroy effects better */
meta_compositor_remove_window (window->display->compositor, window);
}
} }
if (window->display->window_with_menu == window) if (window->display->window_with_menu == window)
@ -3177,8 +3171,8 @@ meta_window_show (MetaWindow *window)
break; break;
} }
meta_compositor_show_window (window->display->compositor, meta_compositor_add_window (window->display->compositor, window);
window, effect); meta_compositor_show_window (window->display->compositor, window, effect);
} }
} }
@ -3270,8 +3264,7 @@ meta_window_hide (MetaWindow *window)
break; break;
} }
meta_compositor_hide_window (window->display->compositor, meta_compositor_hide_window (window->display->compositor, window, effect);
window, effect);
} }
} }

View File

@ -75,11 +75,10 @@ gboolean meta_compositor_filter_keybinding (MetaCompositor *compositor,
MetaScreen *screen, MetaScreen *screen,
MetaKeyBinding *binding); MetaKeyBinding *binding);
void meta_compositor_add_window (MetaCompositor *compositor, void meta_compositor_add_window (MetaCompositor *compositor,
MetaWindow *window); MetaWindow *window);
void meta_compositor_remove_window (MetaCompositor *compositor, void meta_compositor_remove_window (MetaCompositor *compositor,
MetaWindow *window); MetaWindow *window);
void meta_compositor_show_window (MetaCompositor *compositor, void meta_compositor_show_window (MetaCompositor *compositor,
MetaWindow *window, MetaWindow *window,
MetaCompEffect effect); MetaCompEffect effect);
@ -101,10 +100,6 @@ void meta_compositor_unmaximize_window (MetaCompositor *compositor,
MetaRectangle *old_rect, MetaRectangle *old_rect,
MetaRectangle *new_rect); MetaRectangle *new_rect);
void meta_compositor_window_mapped (MetaCompositor *compositor,
MetaWindow *window);
void meta_compositor_window_unmapped (MetaCompositor *compositor,
MetaWindow *window);
void meta_compositor_sync_window_geometry (MetaCompositor *compositor, void meta_compositor_sync_window_geometry (MetaCompositor *compositor,
MetaWindow *window, MetaWindow *window,
gboolean did_placement); gboolean did_placement);