summaryrefslogtreecommitdiff
path: root/src/clients
diff options
context:
space:
mode:
Diffstat (limited to 'src/clients')
-rw-r--r--src/clients/client.rs9
-rw-r--r--src/clients/hints.rs21
-rw-r--r--src/clients/mod.rs3
3 files changed, 29 insertions, 4 deletions
diff --git a/src/clients/client.rs b/src/clients/client.rs
index d4e2e88..6845e4e 100644
--- a/src/clients/client.rs
+++ b/src/clients/client.rs
@@ -114,7 +114,7 @@ impl Client {
/// Set the floating status.
pub fn set_floating(&mut self, conn: &Connection<'_>, floating: bool) {
- if floating != self.floating {
+ if floating && floating != self.floating {
conn.send_request(&ConfigureWindow {
window: self.window,
value_list: &[ConfigWindow::StackMode(StackMode::Above)],
@@ -177,6 +177,13 @@ impl Client {
})
}
+ pub fn update_window_type(&mut self, conn: &Connection<'_>) {
+ // TODO: Fullscreen from net_wm_state
+ if hints::is_dialog(conn, self.window) {
+ self.set_floating(conn, true);
+ }
+ }
+
pub fn set_urgent(&mut self, urgent: bool) {
self.urgent = urgent;
}
diff --git a/src/clients/hints.rs b/src/clients/hints.rs
index f59794a..182c655 100644
--- a/src/clients/hints.rs
+++ b/src/clients/hints.rs
@@ -1,5 +1,5 @@
use xcb::{
- x::{self, ChangeProperty, GetProperty, Pixmap, PropMode, Window},
+ x::{self, Atom, ChangeProperty, GetProperty, Gravity, Pixmap, PropMode, Window},
Xid, XidNew,
};
@@ -122,3 +122,22 @@ pub fn transient_for(conn: &Connection, window: Window) -> Option<Window> {
Some(hints.value::<Window>()[0])
}
+
+/// Check if the given window is flagged as a dialog with the `NET_WM_WINDOW_TYPE` property
+pub fn is_dialog(conn: &Connection, window: Window) -> bool {
+ let Ok(hints) = conn.wait_for_reply(conn.send_request(&GetProperty {
+ window,
+ delete: false,
+ property: conn.atoms.net_wm_window_type,
+ r#type: x::ATOM_ATOM,
+ long_offset: 0,
+ long_length: 1,
+ })) else {
+ return false;
+ };
+
+ hints.r#type() == x::ATOM_ATOM
+ && hints.length() == 1
+ && hints.format() == 32
+ && hints.value::<Atom>()[0] == conn.atoms.net_wm_window_type_dialog
+}
diff --git a/src/clients/mod.rs b/src/clients/mod.rs
index 86b42f9..8efa5b1 100644
--- a/src/clients/mod.rs
+++ b/src/clients/mod.rs
@@ -211,10 +211,9 @@ impl ClientState {
);
c.set_border(conn, conn.colours.border_normal());
c.set_floating(conn, floating);
+ c.update_window_type(conn);
c.ensure_mapped(conn);
- // TODO: updatewindowtype
- // TODO: updatesizehints
c.sync_properties(conn, true);
c.set_event_mask(