]> git.mdlowis.com Git - proto/labwc.git/commitdiff
include: move a few types from labwc.h to better locations
authorJohn Lindgren <john@jlindgren.net>
Sat, 26 Jul 2025 20:23:02 +0000 (16:23 -0400)
committerJohan Malm <johanmalm@users.noreply.github.com>
Wed, 30 Jul 2025 20:04:31 +0000 (21:04 +0100)
include/input/input.h
include/input/keyboard.h
include/labwc.h
include/osd.h
src/input/cursor.c
src/input/ime.c

index 37758e0e48893faa3d910bce7b348daacb8b9686..520216b674247b633c5eff98441fdad479c0b6dc 100644 (file)
@@ -2,7 +2,16 @@
 #ifndef LABWC_INPUT_H
 #define LABWC_INPUT_H
 
-struct seat;
+#include <wayland-server-core.h>
+
+struct input {
+       struct wlr_input_device *wlr_input_device;
+       struct seat *seat;
+       /* Set for pointer/touch devices */
+       double scroll_factor;
+       struct wl_listener destroy;
+       struct wl_list link; /* seat.inputs */
+};
 
 void input_handlers_init(struct seat *seat);
 void input_handlers_finish(struct seat *seat);
index d080d30a94f954a7754066ccf040bc3774dc94d4..6836d9bcd9129ce1141467c1330203f2b0cdb8c9 100644 (file)
@@ -4,10 +4,25 @@
 
 #include <stdbool.h>
 #include <xkbcommon/xkbcommon.h>
+#include "input/input.h"
 
-struct seat;
-struct keyboard;
-struct wlr_keyboard;
+/*
+ * Virtual keyboards should not belong to seat->keyboard_group. As a result we
+ * need to be able to ascertain which wlr_keyboard key/modifier events come from
+ * and we achieve that by using `struct keyboard` which inherits `struct input`
+ * and adds keyboard specific listeners and a wlr_keyboard pointer.
+ */
+struct keyboard {
+       struct input base;
+       struct wlr_keyboard *wlr_keyboard;
+       bool is_virtual;
+       struct wl_listener modifiers;
+       struct wl_listener key;
+       /* key repeat for compositor keybinds */
+       uint32_t keybind_repeat_keycode;
+       int32_t keybind_repeat_rate;
+       struct wl_event_source *keybind_repeat;
+};
 
 void keyboard_reset_current_keybind(void);
 void keyboard_configure(struct seat *seat, struct wlr_keyboard *kb,
index b05d519d42b62a8eb73173009afe08c92541431f..feae372ef32b2f1e94aabca8efdfed8e8ef4bcd3 100644 (file)
@@ -27,33 +27,6 @@ enum input_mode {
        LAB_INPUT_STATE_WINDOW_SWITCHER,
 };
 
-struct input {
-       struct wlr_input_device *wlr_input_device;
-       struct seat *seat;
-       /* Set for pointer/touch devices */
-       double scroll_factor;
-       struct wl_listener destroy;
-       struct wl_list link; /* seat.inputs */
-};
-
-/*
- * Virtual keyboards should not belong to seat->keyboard_group. As a result we
- * need to be able to ascertain which wlr_keyboard key/modifier events come from
- * and we achieve that by using `struct keyboard` which inherits `struct input`
- * and adds keyboard specific listeners and a wlr_keyboard pointer.
- */
-struct keyboard {
-       struct input base;
-       struct wlr_keyboard *wlr_keyboard;
-       bool is_virtual;
-       struct wl_listener modifiers;
-       struct wl_listener key;
-       /* key repeat for compositor keybinds */
-       uint32_t keybind_repeat_keycode;
-       int32_t keybind_repeat_rate;
-       struct wl_event_source *keybind_repeat;
-};
-
 struct seat {
        struct wlr_seat *seat;
        struct server *server;
@@ -181,15 +154,6 @@ struct seat {
        struct wl_listener new_virtual_keyboard;
 };
 
-struct lab_data_buffer;
-struct workspace;
-
-enum lab_cycle_dir {
-       LAB_CYCLE_DIR_NONE,
-       LAB_CYCLE_DIR_FORWARD,
-       LAB_CYCLE_DIR_BACKWARD,
-};
-
 struct server {
        struct wl_display *wl_display;
        struct wl_event_loop *wl_event_loop;  /* Can be used for timer events */
@@ -362,12 +326,6 @@ struct server {
        pid_t primary_client_pid;
 };
 
-struct constraint {
-       struct seat *seat;
-       struct wlr_pointer_constraint_v1 *constraint;
-       struct wl_listener destroy;
-};
-
 void xdg_popup_create(struct view *view, struct wlr_xdg_popup *wlr_popup);
 void xdg_shell_init(struct server *server);
 void xdg_shell_finish(struct server *server);
index 971389d27589e5a6adbeb6f7a7093eafe6d69dbb..39a73b8bf464807e5294876bb8f093c3208d8d63 100644 (file)
@@ -5,6 +5,12 @@
 #include <stdbool.h>
 #include <wayland-server-core.h>
 
+enum lab_cycle_dir {
+       LAB_CYCLE_DIR_NONE,
+       LAB_CYCLE_DIR_FORWARD,
+       LAB_CYCLE_DIR_BACKWARD,
+};
+
 /* TODO: add field with keyboard layout? */
 enum window_switcher_field_content {
        LAB_FIELD_NONE = 0,
index 852eca3f2aa9800bfb6368dd75c1bdd95e3fe236..0fc2bbd087d9cd3a42f5428e417e4c56d6b7d464 100644 (file)
 
 #define LAB_CURSOR_SHAPE_V1_VERSION 1
 
+struct constraint {
+       struct seat *seat;
+       struct wlr_pointer_constraint_v1 *constraint;
+       struct wl_listener destroy;
+};
+
 static const char * const *cursor_names = NULL;
 
 /* Usual cursor names */
index bbb8723a650014751e940d5615994de9b0064b67..350374df72f401e91aaba36f4216d53e6d022fad 100644 (file)
@@ -7,6 +7,7 @@
 #include <wlr/types/wlr_virtual_keyboard_v1.h>
 #include <wlr/types/wlr_xdg_shell.h>
 #include "common/mem.h"
+#include "input/keyboard.h"
 #include "node.h"
 #include "output.h"
 #include "view.h"