From 41cf9134a6f0c6fdbdfa0a9286a944ce91b9c185 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Fri, 14 Aug 2009 06:18:28 -0400 Subject: [PATCH] Add meta_window_is_mapped, remove usage of window-private.h from mutter-window.c mutter-window.c originally grew an #include "window-private.h" for window->override_redirect, but that was just fixed. However since then it also ended up relying on a few other minor private bits. To fix that, add meta_window_is_mapped, promote meta_window_toplevel_is_mapped to public, and use the public MetaDisplay accessor. --- src/compositor/mutter-window.c | 7 +++---- src/core/window-private.h | 2 -- src/core/window.c | 12 ++++++++++++ src/include/window.h | 2 ++ 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/compositor/mutter-window.c b/src/compositor/mutter-window.c index bfa6e2916..83080f83e 100644 --- a/src/compositor/mutter-window.c +++ b/src/compositor/mutter-window.c @@ -10,7 +10,6 @@ #include -#include "../core/window-private.h" /* FIXME: add meta_window_is_override_redirect */ #include "display.h" #include "errors.h" #include "frame.h" @@ -844,7 +843,7 @@ mutter_window_after_effects (MutterWindow *self) mutter_window_sync_visibility (self); mutter_window_sync_actor_position (self); - if (!priv->window->mapped) + if (!meta_window_is_mapped (priv->window)) mutter_window_detach (self); if (priv->needs_repair) @@ -1183,7 +1182,7 @@ mutter_window_new (MetaWindow *window) /* FIXME: Remove the redundant data we store in self->priv->attrs, and * simply query metacity core for the data. */ - if (!XGetWindowAttributes (display->xdisplay, top_window, &attrs)) + if (!XGetWindowAttributes (meta_display_get_xdisplay (display), top_window, &attrs)) return NULL; self = g_object_new (MUTTER_TYPE_COMP_WINDOW, @@ -1633,7 +1632,7 @@ check_needs_reshape (MutterWindow *self) #ifdef HAVE_SHAPE if (priv->shaped) { - Display *xdisplay = meta_display_get_xdisplay (priv->window->display); + Display *xdisplay = meta_display_get_xdisplay (meta_window_get_display (priv->window)); XRectangle *rects; int n_rects, ordering; diff --git a/src/core/window-private.h b/src/core/window-private.h index cb003f98f..044acbe4f 100644 --- a/src/core/window-private.h +++ b/src/core/window-private.h @@ -456,8 +456,6 @@ void meta_window_resize_with_gravity (MetaWindow *window, /* Return whether the window should be currently mapped */ gboolean meta_window_should_be_showing (MetaWindow *window); -gboolean meta_window_toplevel_is_mapped (MetaWindow *window); - /* See warning in window.c about this function */ gboolean __window_is_terminal (MetaWindow *window); diff --git a/src/core/window.c b/src/core/window.c index 1302d16e9..92706c8ec 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -2321,6 +2321,18 @@ unmap_client_window (MetaWindow *window, return FALSE; } +/** + * meta_window_is_mapped: + * @window: a #MetaWindow + * + * Determines whether the X window for the MetaWindow is mapped. + */ +gboolean +meta_window_is_mapped (MetaWindow *window) +{ + return window->mapped; +} + /** * meta_window_toplevel_is_mapped: * @window: a #MetaWindow diff --git a/src/include/window.h b/src/include/window.h index 1d0053a35..fb7c0772b 100644 --- a/src/include/window.h +++ b/src/include/window.h @@ -103,6 +103,8 @@ MetaStackLayer meta_window_get_layer (MetaWindow *window); MetaWindow* meta_window_find_root_ancestor (MetaWindow *window); gboolean meta_window_is_ancestor_of_transient (MetaWindow *window, MetaWindow *transient); +gboolean meta_window_is_mapped (MetaWindow *window); +gboolean meta_window_toplevel_is_mapped (MetaWindow *window); gboolean meta_window_get_icon_geometry (MetaWindow *window, MetaRectangle *rect); void meta_window_maximize (MetaWindow *window,