[mutter/wip/mult-window-actors: 3/8] window: Add a simple meta_window_get_toplevel_xwindow utility
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/mult-window-actors: 3/8] window: Add a simple meta_window_get_toplevel_xwindow utility
- Date: Fri, 6 Dec 2013 21:24:44 +0000 (UTC)
commit 057d8830e9374c590a503cae553bf6db85446781
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Fri Dec 6 00:57:11 2013 -0500
window: Add a simple meta_window_get_toplevel_xwindow utility
To replace all the places where we do:
window->frame ? window->frame->xwindow : window->xwindow
or similar...
src/compositor/meta-window-actor.c | 17 ++---------------
src/core/core.c | 3 +--
src/core/display.c | 2 +-
src/core/keybindings.c | 4 ++--
src/core/window-private.h | 2 ++
src/core/window.c | 6 ++++++
6 files changed, 14 insertions(+), 20 deletions(-)
---
diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c
index fc9126a..16ea6d3 100644
--- a/src/compositor/meta-window-actor.c
+++ b/src/compositor/meta-window-actor.c
@@ -283,11 +283,9 @@ window_decorated_notify (MetaWindow *mw,
{
MetaWindowActor *self = META_WINDOW_ACTOR (data);
MetaWindowActorPrivate *priv = self->priv;
- MetaFrame *frame = meta_window_get_frame (mw);
MetaScreen *screen = priv->screen;
MetaDisplay *display = meta_screen_get_display (screen);
Display *xdisplay = meta_display_get_xdisplay (display);
- Window new_xwindow;
/*
* Basically, we have to reconstruct the the internals of this object
@@ -295,11 +293,6 @@ window_decorated_notify (MetaWindow *mw,
*/
priv->redecorating = TRUE;
- if (frame)
- new_xwindow = meta_frame_get_xwindow (frame);
- else
- new_xwindow = meta_window_get_xwindow (mw);
-
meta_window_actor_detach (self);
/*
@@ -314,7 +307,7 @@ window_decorated_notify (MetaWindow *mw,
priv->damage = None;
}
- priv->xwindow = new_xwindow;
+ priv->xwindow = meta_window_get_toplevel_xwindow (priv->window);
/*
* Recreate the contents.
@@ -1538,16 +1531,10 @@ meta_window_actor_new (MetaWindow *window)
MetaCompScreen *info = meta_screen_get_compositor_data (screen);
MetaWindowActor *self;
MetaWindowActorPrivate *priv;
- MetaFrame *frame;
Window top_window;
ClutterActor *window_group;
- frame = meta_window_get_frame (window);
- if (frame)
- top_window = meta_frame_get_xwindow (frame);
- else
- top_window = meta_window_get_xwindow (window);
-
+ top_window = meta_window_get_toplevel_xwindow (window);
meta_verbose ("add window: Meta %p, xwin 0x%x\n", window, (guint)top_window);
self = g_object_new (META_TYPE_WINDOW_ACTOR,
diff --git a/src/core/core.c b/src/core/core.c
index 1808f4e..45f9330 100644
--- a/src/core/core.c
+++ b/src/core/core.c
@@ -280,8 +280,7 @@ meta_core_lower_beneath_grab_window (Display *xdisplay,
return;
changes.stack_mode = Below;
- changes.sibling = grab_window->frame ? grab_window->frame->xwindow
- : grab_window->xwindow;
+ changes.sibling = meta_window_get_toplevel_xwindow (grab_window);
meta_stack_tracker_record_lower_below (screen->stack_tracker,
xwindow,
diff --git a/src/core/display.c b/src/core/display.c
index c098da5..c9ffb47 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -4008,7 +4008,7 @@ meta_display_begin_grab_op (MetaDisplay *display,
* key grab on the RootWindow.
*/
if (grab_window)
- grab_xwindow = grab_window->frame ? grab_window->frame->xwindow : grab_window->xwindow;
+ grab_xwindow = meta_window_get_toplevel_xwindow (grab_window);
else
grab_xwindow = screen->xroot;
diff --git a/src/core/keybindings.c b/src/core/keybindings.c
index 35de8d5..7918a7c 100644
--- a/src/core/keybindings.c
+++ b/src/core/keybindings.c
@@ -1277,7 +1277,7 @@ meta_window_grab_keys (MetaWindow *window)
}
meta_window_change_keygrabs (window,
- window->frame ? window->frame->xwindow : window->xwindow,
+ meta_window_get_toplevel_xwindow (window),
TRUE);
window->keys_grabbed = TRUE;
@@ -1580,7 +1580,7 @@ meta_window_grab_all_keys (MetaWindow *window,
window->desc);
meta_window_focus (window, timestamp);
- grabwindow = window->frame ? window->frame->xwindow : window->xwindow;
+ grabwindow = meta_window_get_toplevel_xwindow (window);
meta_topic (META_DEBUG_KEYBINDINGS,
"Grabbing all keys on window %s\n", window->desc);
diff --git a/src/core/window-private.h b/src/core/window-private.h
index 4553d5f..cd29d98 100644
--- a/src/core/window-private.h
+++ b/src/core/window-private.h
@@ -696,4 +696,6 @@ void meta_window_set_shape_region (MetaWindow *window,
cairo_region_t *region);
void meta_window_update_shape_region_x11 (MetaWindow *window);
+Window meta_window_get_toplevel_xwindow (MetaWindow *window);
+
#endif
diff --git a/src/core/window.c b/src/core/window.c
index c4c5046..fef3ca8 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -11462,3 +11462,9 @@ meta_window_can_close (MetaWindow *window)
{
return window->has_close_func;
}
+
+Window
+meta_window_get_toplevel_xwindow (MetaWindow *window)
+{
+ return window->frame ? window->frame->xwindow : window->xwindow;
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]