Skip to content

Commit 4f47c5b

Browse files
Davyd Madeleyvkareh
authored andcommitted
Add meta_window_get_transient_for() method
NOTE: Patch copied from mutter and adapted for metacity.
1 parent a47f178 commit 4f47c5b

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

src/core/window.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8630,6 +8630,29 @@ meta_window_get_xwindow (MetaWindow *window)
86308630
return window->xwindow;
86318631
}
86328632

8633+
/**
8634+
* meta_window_get_transient_for:
8635+
* @window: a #MetaWindow
8636+
*
8637+
* Returns the #MetaWindow for the window that is pointed to by the
8638+
* WM_TRANSIENT_FOR hint on this window (see XGetTransientForHint()
8639+
* or XSetTransientForHint()). Metacity keeps transient windows above their
8640+
* parents. A typical usage of this hint is for a dialog that wants to stay
8641+
* above its associated window.
8642+
*
8643+
* Return value: (transfer none): the window this window is transient for, or
8644+
* %NULL if the WM_TRANSIENT_FOR hint is unset or does not point to a toplevel
8645+
* window that Metacity knows about.
8646+
*/
8647+
MetaWindow *
8648+
meta_window_get_transient_for (MetaWindow *window)
8649+
{
8650+
if (window->xtransient_for)
8651+
return meta_display_lookup_x_window (window->display, window->xtransient_for);
8652+
else
8653+
return NULL;
8654+
}
8655+
86338656
gboolean
86348657
meta_window_is_maximized (MetaWindow *window)
86358658
{

src/include/window.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ MetaRectangle *meta_window_get_rect (MetaWindow *window);
3535
MetaScreen *meta_window_get_screen (MetaWindow *window);
3636
MetaDisplay *meta_window_get_display (MetaWindow *window);
3737
Window meta_window_get_xwindow (MetaWindow *window);
38+
MetaWindow *meta_window_get_transient_for (MetaWindow *window);
3839
gboolean meta_window_is_maximized (MetaWindow *window);
3940

4041
#endif

0 commit comments

Comments
 (0)