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:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ public:
|
||||
uint32_t set_size(int w, int h) { return wlr_xdg_toplevel_set_size(m_toplevel, w, h); }
|
||||
uint32_t set_activated(bool activated) { return wlr_xdg_toplevel_set_activated(m_toplevel, activated); }
|
||||
uint32_t set_maximized(bool maximized) { return wlr_xdg_toplevel_set_maximized(m_toplevel, maximized); }
|
||||
void close() { wlr_xdg_toplevel_send_close(m_toplevel); }
|
||||
|
||||
void on_request_move(std::function<void(void*)> cb) {
|
||||
m_requestMove.connect(&m_toplevel->events.request_move, std::move(cb));
|
||||
|
||||
Reference in New Issue
Block a user