From db6447ed797fc5aa113d49e0da3130abcf58d2cf Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Fri, 27 Dec 2024 09:58:22 +0300 Subject: floating: Support default-column-width in most cases open-fullscreen + open-floating default width is still not supported in this commit. --- src/handlers/compositor.rs | 1 + src/handlers/xdg_shell.rs | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) (limited to 'src/handlers') diff --git a/src/handlers/compositor.rs b/src/handlers/compositor.rs index c0dc9428..058f8375 100644 --- a/src/handlers/compositor.rs +++ b/src/handlers/compositor.rs @@ -100,6 +100,7 @@ impl CompositorHandler for State { if let InitialConfigureState::Configured { rules, width, + floating_width: _, is_full_width, output, workspace_name, diff --git a/src/handlers/xdg_shell.rs b/src/handlers/xdg_shell.rs index a3559542..779612b6 100644 --- a/src/handlers/xdg_shell.rs +++ b/src/handlers/xdg_shell.rs @@ -494,6 +494,7 @@ impl XdgShellHandler for State { InitialConfigureState::Configured { rules, width, + floating_width, is_full_width, output, workspace_name, @@ -548,12 +549,14 @@ impl XdgShellHandler for State { state.states.unset(xdg_toplevel::State::Fullscreen); }); - let configure_width = if *is_full_width { + let is_floating = rules.compute_open_floating(&toplevel); + let configure_width = if is_floating { + *floating_width + } else if *is_full_width { Some(ColumnWidth::Proportion(1.)) } else { *width }; - let is_floating = rules.compute_open_floating(&toplevel); ws.configure_new_window( &unmapped.window, configure_width, @@ -836,6 +839,7 @@ impl State { let mon = mon.map(|(mon, _)| mon); let mut width = None; + let mut floating_width = None; let is_full_width = rules.open_maximized.unwrap_or(false); let is_floating = rules.compute_open_floating(toplevel); @@ -859,9 +863,12 @@ impl State { }); } - width = ws.resolve_default_width(rules.default_width, is_floating); + width = ws.resolve_default_width(rules.default_width, false); + floating_width = ws.resolve_default_width(rules.default_width, true); - let configure_width = if is_full_width { + let configure_width = if is_floating { + floating_width + } else if is_full_width { Some(ColumnWidth::Proportion(1.)) } else { width @@ -884,6 +891,7 @@ impl State { *state = InitialConfigureState::Configured { rules, width, + floating_width, is_full_width, output, workspace_name: ws.and_then(|w| w.name().cloned()), -- cgit