diff options
Diffstat (limited to 'src/clients/hints.rs')
-rw-r--r-- | src/clients/hints.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/clients/hints.rs b/src/clients/hints.rs index bd3ef76..f59794a 100644 --- a/src/clients/hints.rs +++ b/src/clients/hints.rs @@ -102,3 +102,23 @@ impl Ewm { } } } + +/// Gets the `WM_TRANSIENT_FOR` hint set on a window +pub fn transient_for(conn: &Connection, window: Window) -> Option<Window> { + let hints = conn + .wait_for_reply(conn.send_request(&GetProperty { + window, + delete: false, + property: x::ATOM_WM_TRANSIENT_FOR, + r#type: x::ATOM_WINDOW, + long_offset: 0, + long_length: 1, + })) + .ok()?; + + if hints.r#type() != x::ATOM_WINDOW || hints.length() < 1 || hints.format() != 32 { + return None; + } + + Some(hints.value::<Window>()[0]) +} |