Windows: on a handset, apps open maximized and dialogs float above
Deploy to the handset / build-and-deploy (push) Successful in 2m7s
CI / test (push) Failing after 2m42s

- Apps open maximized on a touchscreen whose short side is under 720px. Restore gives a floating window that fits the screen.
- Maximized windows can't be dragged or resized.
- Dialogs (xdg_toplevel.set_parent) open floating and centered, and stay above their app when it is activated.
- Under tiling, the last used app is drawn on top.
- Add transient_for to WmState and make inner_work_area and fit_rect public for the compositor.
- Tests cover maximized opening, dialog stacking, drag suppression and restore.
- Document the handset window behavior in docs/handset.md.
This commit is contained in:
nandi committed 2026-11-29 23:11:34 -08:00
1 parent 7029c92e6e
commit 5c83cdaa22
5 files changed
+148 -10

No files matched your search

+66
View File
@@ -205,3 +205,69 @@ test "a finger scrolls the launcher's list: a drag moves it, a flick keeps it go
assert_eq((st.scroll, st.offset), (0, 0))
comp.close()
}
///|
test "on a handset apps open maximized, dialogs float above their app, and a drag leaves them be" {
let (comp, _, _, _) = touch_setup("maximized", false)
let one = comp.windows.get(1UL).unwrap()
assert_true(one.maximized)
assert_true(one.geometry.w > 500 && one.geometry.h > 900)
// Opened with its one size: the client was never asked for another.
let path = "/tmp/wayland-moon-touch-maximized-" + @sys.getpid().to_string() + ".sock"
let (c2, shm, surf, xdg, top, _) = open_and_configure_client(comp, path, "U", "u")
let two = comp.windows.get(2UL).unwrap()
assert_true(two.maximized)
assert_eq((c2.configured_w, c2.configured_h), (two.geometry.w, two.geometry.h))
commit_shm_frame(comp, c2, shm, surf, xdg, 2UL)
assert_eq(comp.wm.stacking_order(), [1UL, 2UL])
// A drag on the title bar doesn't move it.
let g = two.geometry
let (tx, ty) = ((g.x + 60).to_double(), (g.y - 12).to_double())
comp.handle_input(Touch(Down(0, tx, ty)), 10U)
comp.handle_input(Touch(Motion(0, tx, ty + 90.0)), 20U)
comp.handle_input(Touch(Up(0)), 30U)
assert_eq(two.geometry, g)
// A dialog of the second: same client, set_parent before its first commit.
let objs = fn(target : UInt, op : UInt, arg : UInt?) {
let id = c2.alloc_id()
let w = @wayland.WireWriter::new()
w.u32(id)
match arg {
Some(a) => w.u32(a)
None => ()
}
c2.send(w.finish_msg(target, op))
id
}
let reg = objs(1U, 1U, None)
let dsurf = objs(bind_global(c2, reg, "wl_compositor", 5U), 0U, None)
let dxdg = objs(bind_global(c2, reg, "xdg_wm_base", 5U), 2U, Some(dsurf))
let dtop = objs(dxdg, 1U, None)
let w = @wayland.WireWriter::new()
w.u32(top)
c2.send(w.finish_msg(dtop, 1U))
c2.send(@wayland.WireWriter::new().finish_msg(dsurf, 6U))
for _i = 0; _i < 5; _i = _i + 1 {
comp.step()
@sys.sleep_ms(2)
}
let d = comp.windows.get(3UL).unwrap()
assert_false(d.maximized)
assert_true(d.geometry.x >= 0 && d.geometry.x + d.geometry.w <= 540)
// Switching apps raises the app, and going back brings the dialog along.
ignore(comp.wm.handle_request(1UL, @wm.WindowRequest::Activate, comp.work_area))
assert_eq(comp.wm.stacking_order(), [2UL, 3UL, 1UL])
ignore(comp.wm.handle_request(2UL, @wm.WindowRequest::Activate, comp.work_area))
assert_eq(comp.wm.stacking_order(), [1UL, 2UL, 3UL])
// Restore: a floating window inside the screen.
ignore(comp.wm.handle_request(2UL, @wm.WindowRequest::Maximize(false), comp.work_area))
let r = comp.wm.windows.get(2UL).unwrap().geometry
assert_true(r.x >= 0 && r.x + r.w <= 540 && r.h < g.h)
// Under Tiling too (the windows go into the tree), the last used app is on top.
ignore(comp.wm.handle_request(2UL, @wm.WindowRequest::Maximize(true), comp.work_area))
comp.set_layout_mode(@wm.LayoutMode::Floating)
comp.set_layout_mode(@wm.LayoutMode::Tiling)
ignore(comp.wm.handle_request(1UL, @wm.WindowRequest::Activate, comp.work_area))
assert_eq(comp.wm.stacking_order(), [3UL, 2UL, 1UL])
comp.close()
}