aboutsummaryrefslogtreecommitdiff
path: root/include/sway/input
diff options
context:
space:
mode:
Diffstat (limited to 'include/sway/input')
-rw-r--r--include/sway/input/cursor.h30
-rw-r--r--include/sway/input/input-manager.h49
-rw-r--r--include/sway/input/keyboard.h22
-rw-r--r--include/sway/input/seat.h47
4 files changed, 148 insertions, 0 deletions
diff --git a/include/sway/input/cursor.h b/include/sway/input/cursor.h
new file mode 100644
index 00000000..2f70cf4b
--- /dev/null
+++ b/include/sway/input/cursor.h
@@ -0,0 +1,30 @@
+#ifndef _SWAY_INPUT_CURSOR_H
+#define _SWAY_INPUT_CURSOR_H
+
+#include "sway/input/seat.h"
+
+struct sway_cursor {
+ struct sway_seat *seat;
+ struct wlr_cursor *cursor;
+ struct wlr_xcursor_manager *xcursor_manager;
+
+ double x, y;
+
+ struct wl_listener motion;
+ struct wl_listener motion_absolute;
+ struct wl_listener button;
+ struct wl_listener axis;
+
+ struct wl_listener touch_down;
+ struct wl_listener touch_up;
+ struct wl_listener touch_motion;
+
+ struct wl_listener tool_axis;
+ struct wl_listener tool_tip;
+
+ struct wl_listener request_set_cursor;
+};
+
+struct sway_cursor *sway_cursor_create(struct sway_seat *seat);
+
+#endif
diff --git a/include/sway/input/input-manager.h b/include/sway/input/input-manager.h
new file mode 100644
index 00000000..53064eed
--- /dev/null
+++ b/include/sway/input/input-manager.h
@@ -0,0 +1,49 @@
+#ifndef _SWAY_INPUT_INPUT_MANAGER_H
+#define _SWAY_INPUT_INPUT_MANAGER_H
+#include <libinput.h>
+#include "sway/server.h"
+#include "sway/config.h"
+#include "list.h"
+
+extern struct input_config *current_input_config;
+extern struct seat_config *current_seat_config;
+
+/**
+ * The global singleton input manager
+ * TODO: make me not a global
+ */
+extern struct sway_input_manager *input_manager;
+
+struct sway_input_device {
+ char *identifier;
+ struct wlr_input_device *wlr_device;
+ struct input_config *config;
+ struct wl_list link;
+};
+
+struct sway_input_manager {
+ struct wl_listener input_add;
+ struct wl_listener input_remove;
+ struct sway_server *server;
+ struct wl_list devices;
+ struct wl_list seats;
+};
+
+struct sway_input_manager *sway_input_manager_create(
+ struct sway_server *server);
+
+bool sway_input_manager_has_focus(struct sway_input_manager *input,
+ swayc_t *container);
+
+void sway_input_manager_set_focus(struct sway_input_manager *input,
+ swayc_t *container);
+
+void sway_input_manager_configure_xcursor(struct sway_input_manager *input);
+
+void sway_input_manager_apply_input_config(struct sway_input_manager *input,
+ struct input_config *input_config);
+
+void sway_input_manager_apply_seat_config(struct sway_input_manager *input,
+ struct seat_config *seat_config);
+
+#endif
diff --git a/include/sway/input/keyboard.h b/include/sway/input/keyboard.h
new file mode 100644
index 00000000..d9251f4c
--- /dev/null
+++ b/include/sway/input/keyboard.h
@@ -0,0 +1,22 @@
+#ifndef _SWAY_INPUT_KEYBOARD_H
+#define _SWAY_INPUT_KEYBOARD_H
+
+#include "sway/input/seat.h"
+
+struct sway_keyboard {
+ struct sway_seat_device *seat_device;
+
+ struct xkb_keymap *keymap;
+
+ struct wl_listener keyboard_key;
+ struct wl_listener keyboard_modifiers;
+};
+
+struct sway_keyboard *sway_keyboard_create(struct sway_seat *seat,
+ struct sway_seat_device *device);
+
+void sway_keyboard_configure(struct sway_keyboard *keyboard);
+
+void sway_keyboard_destroy(struct sway_keyboard *keyboard);
+
+#endif
diff --git a/include/sway/input/seat.h b/include/sway/input/seat.h
new file mode 100644
index 00000000..d703f94c
--- /dev/null
+++ b/include/sway/input/seat.h
@@ -0,0 +1,47 @@
+#ifndef _SWAY_INPUT_SEAT_H
+#define _SWAY_INPUT_SEAT_H
+
+#include <wlr/types/wlr_seat.h>
+#include "sway/input/input-manager.h"
+
+struct sway_seat_device {
+ struct sway_seat *sway_seat;
+ struct sway_input_device *input_device;
+ struct sway_keyboard *keyboard;
+ struct seat_attachment_config *attachment_config;
+ struct wl_list link; // sway_seat::devices
+};
+
+struct sway_seat {
+ struct wlr_seat *wlr_seat;
+ struct seat_config *config;
+ struct sway_cursor *cursor;
+ struct sway_input_manager *input;
+ swayc_t *focus;
+
+ struct wl_listener focus_destroy;
+
+ struct wl_list devices; // sway_seat_device::link
+
+ struct wl_list link; // input_manager::seats
+};
+
+struct sway_seat *sway_seat_create(struct sway_input_manager *input,
+ const char *seat_name);
+
+void sway_seat_add_device(struct sway_seat *seat,
+ struct sway_input_device *device);
+
+void sway_seat_configure_device(struct sway_seat *seat,
+ struct sway_input_device *device);
+
+void sway_seat_remove_device(struct sway_seat *seat,
+ struct sway_input_device *device);
+
+void sway_seat_configure_xcursor(struct sway_seat *seat);
+
+void sway_seat_set_focus(struct sway_seat *seat, swayc_t *container);
+
+void sway_seat_set_config(struct sway_seat *seat, struct seat_config *seat_config);
+
+#endif