Implement floating windows with pointer and keyboard controls
Add interactive move/resize operations using configurable pointer bindings (Mod4+BTN_LEFT to move, Mod4+BTN_RIGHT to resize). Tiled windows automatically float when dragged or resized. Add keyboard commands for floating windows: - move_up/down/left/right: move by pixel amount - resize_width/height: resize by pixel amount - swap_next/swap_prev: swap position in window stack Fix float dimension initialization when windows first become floating, and fix clamp crash when resizing windows larger than output bounds. Update example config with documented keybinds and new pointer_binds block.
This commit is contained in:
parent
6d4352a217
commit
07fbe91c13
7 changed files with 481 additions and 28 deletions
|
|
@ -110,6 +110,28 @@ fn manage_start(wm: *WindowManager) void {
|
|||
std.debug.assert(keybind.keysym != null);
|
||||
context.xkb_bindings.addBinding(river_seat_v1, keybind.keysym.?, keybind.modifiers, keybind.command);
|
||||
}
|
||||
|
||||
// Pointer bindings
|
||||
for (context.config.pointer_binds.items) |pointer_bind| {
|
||||
const binding = river_seat_v1.getPointerBinding(pointer_bind.button, pointer_bind.modifiers) catch {
|
||||
log.err("Failed to create pointer binding", .{});
|
||||
continue;
|
||||
};
|
||||
|
||||
switch (pointer_bind.action) {
|
||||
.move_window => {
|
||||
if (seat.move_pointer_binding) |old| old.destroy();
|
||||
binding.setListener(*Seat, Seat.movePointerBindingListener, seat);
|
||||
seat.move_pointer_binding = binding;
|
||||
},
|
||||
.resize_window => {
|
||||
if (seat.resize_pointer_binding) |old| old.destroy();
|
||||
binding.setListener(*Seat, Seat.resizePointerBindingListener, seat);
|
||||
seat.resize_pointer_binding = binding;
|
||||
},
|
||||
}
|
||||
binding.enable();
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue