[mutter] Add meta_window_get_transient_for() method



commit 08c5095ad7d09261743a4d527850fd33b00160ad
Author: Davyd Madeley <davyd madeley id au>
Date:   Wed Jun 10 11:28:21 2009 +0800

    Add meta_window_get_transient_for() method

 src/core/window.c    |   26 ++++++++++++++++++++++++++
 src/include/window.h |    1 +
 2 files changed, 27 insertions(+), 0 deletions(-)
---
diff --git a/src/core/window.c b/src/core/window.c
index 9c83546..3027b2b 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -8754,3 +8754,29 @@ meta_window_get_layer (MetaWindow *window)
 {
   return window->layer;
 }
+
+/**
+ * meta_window_get_transient_for:
+ * @window: a #MetaWindow
+ *
+ * Returns the #MetaWindow for the window that is pointed to by the
+ * WM_TRANSIENT_FOR hint on this window (see XGetTransientForHint()
+ * or XSetTransientForHint()). Metacity keeps transient windows above their
+ * parents. A typical usage of this hint is for a dialog that wants to stay
+ * above its associated window.
+ *
+ * Return value: (transfer none): the window this window is transient for, or
+ * %NULL if the WM_TRANSIENT_FOR hint is unset or does not point to a toplevel
+ * window that Metacity knows about.
+ */
+MetaWindow *
+meta_window_get_transient_for (MetaWindow *window)
+{
+  g_return_val_if_fail (META_IS_WINDOW (window), NULL);
+
+  if (window->xtransient_for)
+    return meta_display_lookup_x_window (window->display,
+                                         window->xtransient_for);
+  else
+    return NULL;
+}
diff --git a/src/include/window.h b/src/include/window.h
index 372fea2..258cb27 100644
--- a/src/include/window.h
+++ b/src/include/window.h
@@ -109,5 +109,6 @@ void meta_window_unmaximize (MetaWindow        *window,
 void        meta_window_minimize           (MetaWindow  *window);
 void        meta_window_unminimize         (MetaWindow  *window);
 const char *meta_window_get_title (MetaWindow *window);
+MetaWindow *meta_window_get_transient_for (MetaWindow *window);
 
 #endif



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]