Clicking a window raises it: go through the WM's Activate so stacking order changes
CI / test (push) Failing after 34s
CI / test (push) Failing after 34s
Window clicks, title-bar drags, resize grabs and focus handoff after close emitted Focus/Raise directly; Raise only marked damage, so the WM's floating order never changed and a focused window could stay drawn under another. They now use handle_request(Activate) (activate_window). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
69a163bc08
commit
4b99b0063e
2 files changed
+33
-7
No files matched your search
@@ -756,7 +756,7 @@ fn MoonPlasmaCompositor::press_title_button(
|
|||||||
let order = self.wm.stacking_order()
|
let order = self.wm.stacking_order()
|
||||||
if order.length() > 0 {
|
if order.length() > 0 {
|
||||||
let top = order[order.length() - 1]
|
let top = order[order.length() - 1]
|
||||||
self.apply_actions([@wm.WmAction::Focus(top), @wm.WmAction::Raise(top)])
|
self.activate_window(top)
|
||||||
} else {
|
} else {
|
||||||
self.set_kbd_focus(None)
|
self.set_kbd_focus(None)
|
||||||
}
|
}
|
||||||
@@ -764,6 +764,14 @@ fn MoonPlasmaCompositor::press_title_button(
|
|||||||
self.damage.mark_full()
|
self.damage.mark_full()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///| Focus a window and bring it to the front through the window manager, so its stacking
|
||||||
|
/// order (not just the drawing) changes.
|
||||||
|
fn MoonPlasmaCompositor::activate_window(self : MoonPlasmaCompositor, wid : UInt64) -> Unit {
|
||||||
|
self.apply_actions(
|
||||||
|
self.wm.handle_request(wid, @wm.WindowRequest::Activate, self.work_area),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
///| Restore a minimized window (or focus a visible one) from its task-bar pill.
|
///| Restore a minimized window (or focus a visible one) from its task-bar pill.
|
||||||
fn MoonPlasmaCompositor::activate_task(self : MoonPlasmaCompositor, wid : UInt64) -> Unit {
|
fn MoonPlasmaCompositor::activate_task(self : MoonPlasmaCompositor, wid : UInt64) -> Unit {
|
||||||
let minimized = match self.wm.windows.get(wid) {
|
let minimized = match self.wm.windows.get(wid) {
|
||||||
@@ -999,7 +1007,7 @@ pub fn MoonPlasmaCompositor::handle_input(
|
|||||||
if button == 272U && self.resize_at(xi, yi) is None {
|
if button == 272U && self.resize_at(xi, yi) is None {
|
||||||
// Drag the window by its title bar; a tiled window becomes floating first.
|
// Drag the window by its title bar; a tiled window becomes floating first.
|
||||||
self.leave_pointer()
|
self.leave_pointer()
|
||||||
self.apply_actions([@wm.WmAction::Focus(wid), @wm.WmAction::Raise(wid)])
|
self.activate_window(wid)
|
||||||
self.apply_actions(self.wm.float_window(wid, self.work_area))
|
self.apply_actions(self.wm.float_window(wid, self.work_area))
|
||||||
ignore(self.wm.start_drag(wid, @wm.DragMode::Move, xi, yi))
|
ignore(self.wm.start_drag(wid, @wm.DragMode::Move, xi, yi))
|
||||||
return
|
return
|
||||||
@@ -1011,7 +1019,7 @@ pub fn MoonPlasmaCompositor::handle_input(
|
|||||||
match self.resize_at(xi, yi) {
|
match self.resize_at(xi, yi) {
|
||||||
Some((wid, mode)) => {
|
Some((wid, mode)) => {
|
||||||
self.leave_pointer()
|
self.leave_pointer()
|
||||||
self.apply_actions([@wm.WmAction::Focus(wid), @wm.WmAction::Raise(wid)])
|
self.activate_window(wid)
|
||||||
ignore(self.wm.start_drag(wid, mode, xi, yi))
|
ignore(self.wm.start_drag(wid, mode, xi, yi))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -1032,10 +1040,7 @@ pub fn MoonPlasmaCompositor::handle_input(
|
|||||||
}
|
}
|
||||||
match self.window_at(xi, yi) {
|
match self.window_at(xi, yi) {
|
||||||
Some((wid, _)) => {
|
Some((wid, _)) => {
|
||||||
self.apply_actions([
|
self.activate_window(wid)
|
||||||
@wm.WmAction::Focus(wid),
|
|
||||||
@wm.WmAction::Raise(wid),
|
|
||||||
])
|
|
||||||
}
|
}
|
||||||
None => ()
|
None => ()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -922,3 +922,24 @@ test "the desktop card position is saved when dropped and restored" {
|
|||||||
assert_eq(b.shell.desk_y, a.shell.desk_y)
|
assert_eq(b.shell.desk_y, a.shell.desk_y)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
test "clicking a floating window brings it in front of the others" {
|
||||||
|
let socket_path = "/tmp/wayland-moon-z-" + @sys.getpid().to_string() + ".sock"
|
||||||
|
let theme = @scene.ThemeTokens::moon_night()
|
||||||
|
let comp = @host.MoonPlasmaCompositor::new(socket_path, theme, 1280, 720).unwrap()
|
||||||
|
ignore(open_and_configure_client(comp, socket_path, "A", "a"))
|
||||||
|
ignore(open_and_configure_client(comp, socket_path, "B", "b"))
|
||||||
|
comp.set_layout_mode(@wm.LayoutMode::Floating)
|
||||||
|
ignore(comp.compose_frame())
|
||||||
|
let order = comp.wm.stacking_order()
|
||||||
|
assert_eq(order.length(), 2)
|
||||||
|
let (back, front) = (order[0], order[1])
|
||||||
|
// Click the window in back (its title bar, away from any overlap): it comes to the front.
|
||||||
|
let g = comp.windows.get(back).unwrap().geometry
|
||||||
|
click_at(comp, g.x + 20, g.y - 16, 1U)
|
||||||
|
ignore(comp.compose_frame())
|
||||||
|
let after = comp.wm.stacking_order()
|
||||||
|
assert_eq(after[1], back)
|
||||||
|
assert_eq(after[0], front)
|
||||||
|
}
|
||||||
Reference in new issue
Block a user