Add testWM: a minimal tiling WM built on wlroots++

Master/stack tiling with Alt as modifier: Alt+Enter spawns a terminal
(kitty), Alt+Q closes, Alt+J/Alt+K cycle focus, click-to-focus. Reads
~/.config/testwm/testwm.conf for terminal/modifier/layout. Verified
headless: two clients receive 640x720 master + 640x720 stack configures.

Wrapper additions: Cursor motion/button/axis/frame signal hooks,
Seat::keyboard_notify_enter, Toplevel::close().
This commit is contained in:
AstralZX
2026-08-29 09:31:18 +02:00
parent 89cbf733b3
commit 46fe232306
4 changed files with 351 additions and 0 deletions
+14
View File
@@ -27,8 +27,17 @@ public:
}
void warp(double x, double y) { wlr_cursor_warp(m_cursor, nullptr, x, y); }
void on_motion(std::function<void(void*)> cb) { m_motion.connect(&m_cursor->events.motion, std::move(cb)); }
void on_button(std::function<void(void*)> cb) { m_button.connect(&m_cursor->events.button, std::move(cb)); }
void on_axis(std::function<void(void*)> cb) { m_axis.connect(&m_cursor->events.axis, std::move(cb)); }
void on_frame(std::function<void(void*)> cb) { m_frame.connect(&m_cursor->events.frame, std::move(cb)); }
private:
struct wlr_cursor* m_cursor;
SignalSink m_motion;
SignalSink m_button;
SignalSink m_axis;
SignalSink m_frame;
};
class Keyboard {
@@ -71,6 +80,11 @@ public:
void keyboard_notify_key(uint32_t time, uint32_t keycode, enum wl_keyboard_key_state state) {
wlr_seat_keyboard_notify_key(m_seat, time, keycode, state);
}
void keyboard_notify_enter(struct wlr_surface* surface,
uint32_t* keycodes = nullptr, size_t num_keycodes = 0,
struct wlr_keyboard_modifiers* modifiers = nullptr) {
wlr_seat_keyboard_notify_enter(m_seat, surface, keycodes, num_keycodes, modifiers);
}
void pointer_notify_motion(uint32_t time, double sx, double sy) {
wlr_seat_pointer_notify_motion(m_seat, time, sx, sy);
}