diff --git a/include/rootston/input.h b/include/rootston/input.h index 20b73c8a..6d07de43 100644 --- a/include/rootston/input.h +++ b/include/rootston/input.h @@ -1,6 +1,5 @@ #ifndef _ROOTSTON_INPUT_H #define _ROOTSTON_INPUT_H -#include #include #include #include @@ -10,41 +9,6 @@ #include "rootston/view.h" #include "rootston/server.h" -#define ROOTS_KEYBOARD_PRESSED_KEYSYMS_CAP 32 - -struct roots_keyboard { - struct roots_input *input; - struct wlr_input_device *device; - struct wl_listener key; - struct wl_listener modifiers; - struct wl_list link; - - xkb_keysym_t pressed_keysyms[ROOTS_KEYBOARD_PRESSED_KEYSYMS_CAP]; -}; - -struct roots_pointer { - struct roots_input *input; - struct wlr_input_device *device; - struct wl_list link; -}; - -struct roots_touch { - struct roots_input *input; - struct wlr_input_device *device; - struct wl_list link; -}; - -// TODO: tablet pad -struct roots_tablet_tool { - struct roots_input *input; - struct wlr_input_device *device; - struct wl_listener axis; - struct wl_listener proximity; - struct wl_listener tip; - struct wl_listener button; - struct wl_list link; -}; - enum roots_cursor_mode { ROOTS_CURSOR_PASSTHROUGH = 0, ROOTS_CURSOR_MOVE = 1, @@ -77,13 +41,6 @@ struct roots_drag_icon { struct wl_listener surface_commit; }; -struct roots_touch_point { - struct roots_touch *device; - int32_t slot; - double x, y; - struct wl_list link; -}; - struct roots_input { struct roots_config *config; struct roots_server *server; @@ -138,15 +95,6 @@ struct roots_input *input_create(struct roots_server *server, struct roots_config *config); void input_destroy(struct roots_input *input); -void pointer_add(struct wlr_input_device *device, struct roots_input *input); -void pointer_remove(struct wlr_input_device *device, struct roots_input *input); -void keyboard_add(struct wlr_input_device *device, struct roots_input *input); -void keyboard_remove(struct wlr_input_device *device, struct roots_input *input); -void touch_add(struct wlr_input_device *device, struct roots_input *input); -void touch_remove(struct wlr_input_device *device, struct roots_input *input); -void tablet_tool_add(struct wlr_input_device *device, struct roots_input *input); -void tablet_tool_remove(struct wlr_input_device *device, struct roots_input *input); - void cursor_initialize(struct roots_input *input); void cursor_load_config(struct roots_config *config, struct wlr_cursor *cursor, diff --git a/include/rootston/keyboard.h b/include/rootston/keyboard.h new file mode 100644 index 00000000..33017b56 --- /dev/null +++ b/include/rootston/keyboard.h @@ -0,0 +1,22 @@ +#ifndef _ROOTSTON_KEYBOARD_H +#define _ROOTSTON_KEYBOARD_H + +#include +#include "rootston/input.h" + +#define ROOTS_KEYBOARD_PRESSED_KEYSYMS_CAP 32 + +struct roots_keyboard { + struct roots_input *input; + struct wlr_input_device *device; + struct wl_listener key; + struct wl_listener modifiers; + struct wl_list link; + + xkb_keysym_t pressed_keysyms[ROOTS_KEYBOARD_PRESSED_KEYSYMS_CAP]; +}; + +void keyboard_add(struct wlr_input_device *device, struct roots_input *input); +void keyboard_remove(struct wlr_input_device *device, struct roots_input *input); + +#endif diff --git a/include/rootston/pointer.h b/include/rootston/pointer.h new file mode 100644 index 00000000..b3fc8c3a --- /dev/null +++ b/include/rootston/pointer.h @@ -0,0 +1,16 @@ +#ifndef _ROOTSTON_POINTER_H +#define _ROOTSTON_POINTER_H + +#include +#include + +struct roots_pointer { + struct roots_input *input; + struct wlr_input_device *device; + struct wl_list link; +}; + +void pointer_add(struct wlr_input_device *device, struct roots_input *input); +void pointer_remove(struct wlr_input_device *device, struct roots_input *input); + +#endif diff --git a/include/rootston/tablet_tool.h b/include/rootston/tablet_tool.h new file mode 100644 index 00000000..72ebf6d8 --- /dev/null +++ b/include/rootston/tablet_tool.h @@ -0,0 +1,20 @@ +#ifndef _ROOTSTON_TABLET_TOOL_H +#define _ROOTSTON_TABLET_TOOL_H + +#include +#include "rootston/input.h" + +struct roots_tablet_tool { + struct roots_input *input; + struct wlr_input_device *device; + struct wl_listener axis; + struct wl_listener proximity; + struct wl_listener tip; + struct wl_listener button; + struct wl_list link; +}; + +void tablet_tool_add(struct wlr_input_device *device, struct roots_input *input); +void tablet_tool_remove(struct wlr_input_device *device, struct roots_input *input); + +#endif diff --git a/include/rootston/touch.h b/include/rootston/touch.h new file mode 100644 index 00000000..1624c3ad --- /dev/null +++ b/include/rootston/touch.h @@ -0,0 +1,22 @@ +#ifndef _ROOTSTON_TOUCH_H +#define _ROOTSTON_TOUCH_H + +#include + +struct roots_touch { + struct roots_input *input; + struct wlr_input_device *device; + struct wl_list link; +}; + +struct roots_touch_point { + struct roots_touch *device; + int32_t slot; + double x, y; + struct wl_list link; +}; + +void touch_add(struct wlr_input_device *device, struct roots_input *input); +void touch_remove(struct wlr_input_device *device, struct roots_input *input); + +#endif diff --git a/rootston/config.c b/rootston/config.c index dc7a4b1d..a3ae78be 100644 --- a/rootston/config.c +++ b/rootston/config.c @@ -13,6 +13,7 @@ #include #include "rootston/config.h" #include "rootston/input.h" +#include "rootston/keyboard.h" #include "rootston/ini.h" static void usage(const char *name, int ret) { diff --git a/rootston/cursor.c b/rootston/cursor.c index 31001a9f..61dcae7a 100644 --- a/rootston/cursor.c +++ b/rootston/cursor.c @@ -18,6 +18,10 @@ #include "rootston/input.h" #include "rootston/desktop.h" #include "rootston/view.h" +#include "rootston/keyboard.h" +#include "rootston/pointer.h" +#include "rootston/tablet_tool.h" +#include "rootston/touch.h" const struct roots_input_event *get_input_event(struct roots_input *input, uint32_t serial) { diff --git a/rootston/input.c b/rootston/input.c index 5d367a5e..c8d46a69 100644 --- a/rootston/input.c +++ b/rootston/input.c @@ -8,6 +8,10 @@ #include "rootston/server.h" #include "rootston/config.h" #include "rootston/input.h" +#include "rootston/tablet_tool.h" +#include "rootston/keyboard.h" +#include "rootston/pointer.h" +#include "rootston/touch.h" static const char *device_type(enum wlr_input_device_type type) { switch (type) { diff --git a/rootston/keyboard.c b/rootston/keyboard.c index e174b731..9458a05c 100644 --- a/rootston/keyboard.c +++ b/rootston/keyboard.c @@ -10,6 +10,7 @@ #include #include #include "rootston/input.h" +#include "rootston/keyboard.h" static ssize_t keyboard_pressed_keysym_index(struct roots_keyboard *keyboard, xkb_keysym_t keysym) { diff --git a/rootston/pointer.c b/rootston/pointer.c index 299ecdfc..cb099264 100644 --- a/rootston/pointer.c +++ b/rootston/pointer.c @@ -3,6 +3,7 @@ #include #include #include "rootston/input.h" +#include "rootston/pointer.h" void pointer_add(struct wlr_input_device *device, struct roots_input *input) { struct roots_pointer *pointer = calloc(sizeof(struct roots_pointer), 1); diff --git a/rootston/tablet_tool.c b/rootston/tablet_tool.c index a612e683..3327115d 100644 --- a/rootston/tablet_tool.c +++ b/rootston/tablet_tool.c @@ -4,6 +4,7 @@ #include #include #include "rootston/input.h" +#include "rootston/tablet_tool.h" void tablet_tool_add(struct wlr_input_device *device, struct roots_input *input) { struct roots_tablet_tool *tool = calloc(sizeof(struct roots_tablet_tool), 1); diff --git a/rootston/touch.c b/rootston/touch.c index f6d9b11a..069853ab 100644 --- a/rootston/touch.c +++ b/rootston/touch.c @@ -3,6 +3,7 @@ #include #include #include "rootston/input.h" +#include "rootston/touch.h" // TODO: we'll likely want touch events to both control the cursor *and* be // submitted directly to the seat.