Support client initiated window resizing

Closes #185
This commit is contained in:
Shawn Wallace 2025-09-06 13:28:54 -04:00
parent 0b94ae1eb8
commit 970728d0d9
4 changed files with 155 additions and 52 deletions

View file

@ -2053,3 +2053,33 @@ fn client_init_move() {
let data = f.testwl.get_surface_data(surface).unwrap();
assert!(data.moving);
}
#[test]
fn client_init_resize() {
let mut f = Fixture::new();
let mut connection = Connection::new(&f.display);
let win_toplevel = connection.new_window(connection.root, 0, 0, 20, 20, false);
let surface = f.map_as_toplevel(&mut connection, win_toplevel);
f.testwl.move_pointer_to(surface, 10., 10.);
let ptr = f.testwl.pointer();
ptr.motion(10, 10.0, 10.0);
ptr.frame();
ptr.button(10, 20, BTN_LEFT, wl_pointer::ButtonState::Pressed);
ptr.frame();
f.testwl.dispatch();
connection.send_client_message(&x::ClientMessageEvent::new(
win_toplevel,
connection.atoms.moveresize,
x::ClientMessageData::Data32([0, 0, MoveResizeDirection::SizeBottomRight.into(), 1, 0]),
));
f.wait_and_dispatch();
let data = f.testwl.get_surface_data(surface).unwrap();
assert!(
matches!(data.resizing, Some(xdg_toplevel::ResizeEdge::BottomRight)),
"Got wrong resizing edge: {:?}",
data.resizing
);
}