[metacity] Add meta_window_get_transient_for() method



commit 542cc51dd6483a5eb3baa98b7ddcf7688cc14ac3
Author: Davyd Madeley <davyd madeley id au>
Date:   Sat Sep 27 17:40:10 2014 +0300

    Add meta_window_get_transient_for() method
    
    NOTE: Patch copied from mutter and adapted for metacity.

 src/core/window.c    |   23 +++++++++++++++++++++++
 src/include/window.h |    1 +
 2 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/src/core/window.c b/src/core/window.c
index 4223150..5c613d1 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -8466,3 +8466,26 @@ meta_window_get_xwindow (MetaWindow *window)
 {
   return window->xwindow;
 }
+
+/**
+ * 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)
+{
+  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 87330de..de43579 100644
--- a/src/include/window.h
+++ b/src/include/window.h
@@ -33,5 +33,6 @@ MetaRectangle *meta_window_get_rect (MetaWindow *window);
 MetaScreen *meta_window_get_screen (MetaWindow *window);
 MetaDisplay *meta_window_get_display (MetaWindow *window);
 Window meta_window_get_xwindow (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]