-
Notifications
You must be signed in to change notification settings - Fork 35
Fix strict monitor stack z-ordering #229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
36d872b
7bb50cf
8952605
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -258,13 +258,21 @@ impl<'a> WmCtx<'a> { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// Use this for interactive operations (move/resize drags) so later | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// restacks do not drop the dragged floating window behind others. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| pub fn raise_interactive(&mut self, win: WindowId) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| let mut mid_to_restack = None; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if let Some(mid) = self.g().clients.get(&win).map(|c| c.monitor_id) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if let Some(mon) = self.g_mut().monitor_mut(mid) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| mon.stack.retain(|&w| w != win); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| mon.stack.push(win); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| mid_to_restack = Some(mid); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| self.backend().raise_window(win); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if let Some(mid) = mid_to_restack { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| crate::layouts::restack(self, mid); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| self.backend().raise_window(win); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| self.flush(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
258
to
276
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion (bug_risk): Calling Previously this only updated the monitor’s
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| pub fn restack(&self, wins: &[WindowId]) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -199,20 +199,16 @@ impl<'a> FocusBackendOps for WaylandFocusBackend<'a> { | |
| return; | ||
| } | ||
|
|
||
| // Only explicitly restack if the focused window is tiled. | ||
| // Floating windows should not automatically pop to the top just | ||
| // from being hovered, otherwise they flicker rapidly when overlapping. | ||
| if core.g.clients.get(¤t).is_some_and(|c| c.is_floating) { | ||
| return; | ||
| } | ||
|
|
||
| let mut stack = Vec::new(); | ||
| let mut floating = Vec::new(); | ||
| let mut tiled_stack = Vec::new(); | ||
| let mut floating_stack = Vec::new(); | ||
| let Some(monitor) = core.g.monitor(monitor_id) else { | ||
| return; | ||
| }; | ||
| let selected_tags = monitor.selected_tags(); | ||
| let bar_win = monitor.bar_win; | ||
|
|
||
| let is_tiling = monitor.current_layout().is_tiling(); | ||
|
|
||
| for &win in &monitor.stack { | ||
| let Some(client) = core.g.clients.get(&win) else { | ||
| continue; | ||
|
|
@@ -221,17 +217,22 @@ impl<'a> FocusBackendOps for WaylandFocusBackend<'a> { | |
| continue; | ||
| } | ||
| if client.is_floating { | ||
| floating.push(win); | ||
| floating_stack.push(win); | ||
| } else { | ||
| stack.push(win); | ||
| tiled_stack.push(win); | ||
| } | ||
| } | ||
| if let Some(idx) = stack.iter().position(|&win| win == current) { | ||
| let selected = stack.remove(idx); | ||
| stack.push(selected); | ||
|
|
||
| if is_tiling { | ||
| if let Some(idx) = tiled_stack.iter().position(|&win| win == current) { | ||
| let selected = tiled_stack.remove(idx); | ||
| tiled_stack.push(selected); | ||
| } | ||
| } | ||
|
|
||
| let mut stack = tiled_stack; | ||
| stack.push(bar_win); | ||
| stack.extend(floating); | ||
| stack.extend(floating_stack); | ||
| self.wayland.backend.restack(&stack); | ||
|
Comment on lines
+233
to
236
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Check if Wayland backend restack implementation handles flushing internally
rg -n -A10 'fn restack' src/backend/wayland/Repository: instantOS/instantWM Length of output: 1702 🏁 Script executed: #!/bin/bash
# Check flush patterns in Wayland backend after space/element modifications
rg -n 'flush' src/backend/wayland/Repository: instantOS/instantWM Length of output: 371 🏁 Script executed: #!/bin/bash
# Check X11 backend restack implementation for comparison
rg -n -A10 'fn restack' src/backend/x11/Repository: instantOS/instantWM Length of output: 699 🏁 Script executed: #!/bin/bash
# Check manager.rs line 176 mentioned in the original comment to see context
sed -n '170,185p' src/manager.rsRepository: instantOS/instantWM Length of output: 120 🏁 Script executed: #!/bin/bash
# Find layouts::restack mentioned in the original comment
find . -name "*.rs" | xargs rg -l 'fn restack' | head -20Repository: instantOS/instantWM Length of output: 222 🏁 Script executed: #!/bin/bash
# Check where layouts module is and search for restack
rg -n 'layouts::restack' src/Repository: instantOS/instantWM Length of output: 415 🏁 Script executed: #!/bin/bash
# Look at focus.rs line 355 mentioned in the original comment
wc -l src/focus.rs
sed -n '350,360p' src/focus.rsRepository: instantOS/instantWM Length of output: 341 🏁 Script executed: #!/bin/bash
# Find the layouts::restack implementation in manager.rs
rg -n -A20 'fn restack' src/layouts/manager.rsRepository: instantOS/instantWM Length of output: 770 🏁 Script executed: #!/bin/bash
# Get full layouts::restack implementation to find where it flushes
sed -n '127,200p' src/layouts/manager.rsRepository: instantOS/instantWM Length of output: 2416 🏁 Script executed: #!/bin/bash
# Check what ctx.restack() does - find WmCtx restack method
rg -n 'fn restack' src/contexts.rsRepository: instantOS/instantWM Length of output: 113 🏁 Script executed: #!/bin/bash
# Get the implementation of ctx.restack
rg -n -A5 'fn restack' src/contexts.rsRepository: instantOS/instantWM Length of output: 305 🏁 Script executed: #!/bin/bash
# Look at the full context around the code in question (focus.rs lines 225-245)
sed -n '225,245p' src/focus.rsRepository: instantOS/instantWM Length of output: 653 🏁 Script executed: #!/bin/bash
# Check the full function containing lines 233-236 to see if flush is called elsewhere
sed -n '200,250p' src/focus.rs | head -60Repository: instantOS/instantWM Length of output: 1520 🏁 Script executed: #!/bin/bash
# Find the function name containing the reviewed code (around lines 200-240)
sed -n '190,210p' src/focus.rsRepository: instantOS/instantWM Length of output: 693 🏁 Script executed: #!/bin/bash
# Find function name - go further back
sed -n '160,200p' src/focus.rsRepository: instantOS/instantWM Length of output: 1168 🏁 Script executed: #!/bin/bash
# Get the full post_state_update function to see if flush is called anywhere
sed -n '185,250p' src/focus.rsRepository: instantOS/instantWM Length of output: 1931 Add flush after restack call. The 🤖 Prompt for AI Agents |
||
| } | ||
| } | ||
|
|
@@ -326,8 +327,10 @@ pub(crate) fn focus_soft_x11( | |
| /// handlers where focus failures should not abort the operation. | ||
| pub fn focus_soft(ctx: &mut crate::contexts::WmCtx, win: Option<WindowId>) { | ||
| use crate::contexts::WmCtx::*; | ||
| let previous_sel = ctx.selected_client(); | ||
|
|
||
| match ctx { | ||
| X11(x11_ctx) => { | ||
| X11(ref mut x11_ctx) => { | ||
| let systray = x11_ctx.systray.as_deref(); | ||
| if let Err(e) = focus_x11( | ||
| &mut x11_ctx.core, | ||
|
|
@@ -339,12 +342,18 @@ pub fn focus_soft(ctx: &mut crate::contexts::WmCtx, win: Option<WindowId>) { | |
| log::warn!("focus_soft X11({:?}) failed: {}", win, e); | ||
| } | ||
| } | ||
| Wayland(wayland_ctx) => { | ||
| Wayland(ref mut wayland_ctx) => { | ||
| if let Err(e) = focus_wayland(&mut wayland_ctx.core, &wayland_ctx.wayland, win) { | ||
| log::warn!("focus_soft Wayland({:?}) failed: {}", win, e); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| let current_sel = ctx.selected_client(); | ||
| if previous_sel != current_sel { | ||
| let monitor_id = ctx.g().selected_monitor_id(); | ||
| crate::layouts::restack(ctx, monitor_id); | ||
| } | ||
| } | ||
|
|
||
| /// Backend-agnostic unfocus - does match internally. | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.