aboutsummaryrefslogtreecommitdiff
path: root/src/handlers
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2024-11-29 21:11:02 +0300
committerIvan Molodetskikh <yalterz@gmail.com>2024-12-30 20:12:37 +0300
commitc5fffd6e2c48aa7fb8b45b8bdcd972bbd8ce900b (patch)
treef4bf7c768d21cd72d81da6ca0d1b084631e71276 /src/handlers
parent951f63b6fd48b47ca60e8ed6aa91b4a7b47534f9 (diff)
downloadniri-c5fffd6e2c48aa7fb8b45b8bdcd972bbd8ce900b.tar.gz
niri-c5fffd6e2c48aa7fb8b45b8bdcd972bbd8ce900b.tar.bz2
niri-c5fffd6e2c48aa7fb8b45b8bdcd972bbd8ce900b.zip
Initial WIP floating window implementation
Diffstat (limited to 'src/handlers')
-rw-r--r--src/handlers/compositor.rs27
-rw-r--r--src/handlers/xdg_shell.rs13
2 files changed, 31 insertions, 9 deletions
diff --git a/src/handlers/compositor.rs b/src/handlers/compositor.rs
index fe9f8839..0e9397ee 100644
--- a/src/handlers/compositor.rs
+++ b/src/handlers/compositor.rs
@@ -119,6 +119,11 @@ impl CompositorHandler for State {
(ResolvedWindowRules::empty(), None, false, None, None)
};
+ // The GTK about dialog sets min/max size after the initial configure but
+ // before mapping, so we need to compute open_floating at the last possible
+ // moment, that is here.
+ let is_floating = rules.compute_open_floating(toplevel);
+
let parent = toplevel
.parent()
.and_then(|parent| self.niri.layout.find_window_and_output(&parent))
@@ -160,15 +165,20 @@ impl CompositorHandler for State {
//
// FIXME: do we want to use activate here? How do we want things to behave
// exactly?
- self.niri
- .layout
- .add_window_right_of(&p, mapped, width, is_full_width)
+ self.niri.layout.add_window_right_of(
+ &p,
+ mapped,
+ width,
+ is_full_width,
+ is_floating,
+ )
} else if let Some(workspace_name) = &workspace_name {
self.niri.layout.add_window_to_named_workspace(
workspace_name,
mapped,
width,
is_full_width,
+ is_floating,
activate,
)
} else if let Some(output) = &output {
@@ -177,13 +187,18 @@ impl CompositorHandler for State {
mapped,
width,
is_full_width,
+ is_floating,
activate,
);
Some(output)
} else {
- self.niri
- .layout
- .add_window(mapped, width, is_full_width, activate)
+ self.niri.layout.add_window(
+ mapped,
+ width,
+ is_full_width,
+ is_floating,
+ activate,
+ )
};
if let Some(output) = output.cloned() {
diff --git a/src/handlers/xdg_shell.rs b/src/handlers/xdg_shell.rs
index ae860e4a..869492a2 100644
--- a/src/handlers/xdg_shell.rs
+++ b/src/handlers/xdg_shell.rs
@@ -459,7 +459,7 @@ impl XdgShellHandler for State {
toplevel.with_pending_state(|state| {
state.states.set(xdg_toplevel::State::Fullscreen);
});
- ws.configure_new_window(&unmapped.window, None, rules);
+ ws.configure_new_window(&unmapped.window, None, false, rules);
}
// We already sent the initial configure, so we need to reconfigure.
@@ -553,7 +553,13 @@ impl XdgShellHandler for State {
} else {
*width
};
- ws.configure_new_window(&unmapped.window, configure_width, rules);
+ let is_floating = rules.compute_open_floating(&toplevel);
+ ws.configure_new_window(
+ &unmapped.window,
+ configure_width,
+ is_floating,
+ rules,
+ );
}
// We already sent the initial configure, so we need to reconfigure.
@@ -815,6 +821,7 @@ impl State {
let mut width = None;
let is_full_width = rules.open_maximized.unwrap_or(false);
+ let is_floating = rules.compute_open_floating(toplevel);
// Tell the surface the preferred size and bounds for its likely output.
let ws = rules
@@ -843,7 +850,7 @@ impl State {
} else {
width
};
- ws.configure_new_window(window, configure_width, &rules);
+ ws.configure_new_window(window, configure_width, is_floating, &rules);
}
// If the user prefers no CSD, it's a reasonable assumption that they would prefer to get