From d147f26efa31cccf162b939c067ab3b6ed2842e2 Mon Sep 17 00:00:00 2001 From: tcmal Date: Thu, 4 Jul 2024 22:03:16 +0100 Subject: inherit monitor from parent for transient windows --- src/clients/hints.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/clients/hints.rs') 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 { + 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::()[0]) +} -- cgit v1.2.3