diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/sway/commands.h | 13 | ||||
-rw-r--r-- | include/sway/config.h | 36 | ||||
-rw-r--r-- | include/sway/container.h | 8 | ||||
-rw-r--r-- | include/sway/input/cursor.h | 30 | ||||
-rw-r--r-- | include/sway/input/input-manager.h | 49 | ||||
-rw-r--r-- | include/sway/input/keyboard.h | 22 | ||||
-rw-r--r-- | include/sway/input/seat.h | 47 | ||||
-rw-r--r-- | include/sway/server.h | 2 |
8 files changed, 205 insertions, 2 deletions
diff --git a/include/sway/commands.h b/include/sway/commands.h index b1f0423d..4ee7af2a 100644 --- a/include/sway/commands.h +++ b/include/sway/commands.h | |||
@@ -1,6 +1,8 @@ | |||
1 | #ifndef _SWAY_COMMANDS_H | 1 | #ifndef _SWAY_COMMANDS_H |
2 | #define _SWAY_COMMANDS_H | 2 | #define _SWAY_COMMANDS_H |
3 | 3 | ||
4 | #include "config.h" | ||
5 | |||
4 | /** | 6 | /** |
5 | * Indicates the result of a command's execution. | 7 | * Indicates the result of a command's execution. |
6 | */ | 8 | */ |
@@ -15,6 +17,7 @@ enum cmd_status { | |||
15 | CMD_BLOCK_BAR, | 17 | CMD_BLOCK_BAR, |
16 | CMD_BLOCK_BAR_COLORS, | 18 | CMD_BLOCK_BAR_COLORS, |
17 | CMD_BLOCK_INPUT, | 19 | CMD_BLOCK_INPUT, |
20 | CMD_BLOCK_SEAT, | ||
18 | CMD_BLOCK_COMMANDS, | 21 | CMD_BLOCK_COMMANDS, |
19 | CMD_BLOCK_IPC, | 22 | CMD_BLOCK_IPC, |
20 | CMD_BLOCK_IPC_EVENTS, | 23 | CMD_BLOCK_IPC_EVENTS, |
@@ -107,6 +110,7 @@ sway_cmd cmd_gaps; | |||
107 | sway_cmd cmd_hide_edge_borders; | 110 | sway_cmd cmd_hide_edge_borders; |
108 | sway_cmd cmd_include; | 111 | sway_cmd cmd_include; |
109 | sway_cmd cmd_input; | 112 | sway_cmd cmd_input; |
113 | sway_cmd cmd_seat; | ||
110 | sway_cmd cmd_ipc; | 114 | sway_cmd cmd_ipc; |
111 | sway_cmd cmd_kill; | 115 | sway_cmd cmd_kill; |
112 | sway_cmd cmd_layout; | 116 | sway_cmd cmd_layout; |
@@ -176,6 +180,7 @@ sway_cmd bar_colors_cmd_statusline; | |||
176 | sway_cmd bar_colors_cmd_focused_statusline; | 180 | sway_cmd bar_colors_cmd_focused_statusline; |
177 | sway_cmd bar_colors_cmd_urgent_workspace; | 181 | sway_cmd bar_colors_cmd_urgent_workspace; |
178 | 182 | ||
183 | sway_cmd input_cmd_seat; | ||
179 | sway_cmd input_cmd_accel_profile; | 184 | sway_cmd input_cmd_accel_profile; |
180 | sway_cmd input_cmd_click_method; | 185 | sway_cmd input_cmd_click_method; |
181 | sway_cmd input_cmd_drag_lock; | 186 | sway_cmd input_cmd_drag_lock; |
@@ -187,6 +192,14 @@ sway_cmd input_cmd_natural_scroll; | |||
187 | sway_cmd input_cmd_pointer_accel; | 192 | sway_cmd input_cmd_pointer_accel; |
188 | sway_cmd input_cmd_scroll_method; | 193 | sway_cmd input_cmd_scroll_method; |
189 | sway_cmd input_cmd_tap; | 194 | sway_cmd input_cmd_tap; |
195 | sway_cmd input_cmd_xkb_layout; | ||
196 | sway_cmd input_cmd_xkb_model; | ||
197 | sway_cmd input_cmd_xkb_options; | ||
198 | sway_cmd input_cmd_xkb_rules; | ||
199 | sway_cmd input_cmd_xkb_variant; | ||
200 | |||
201 | sway_cmd seat_cmd_fallback; | ||
202 | sway_cmd seat_cmd_attach; | ||
190 | 203 | ||
191 | sway_cmd cmd_ipc_cmd; | 204 | sway_cmd cmd_ipc_cmd; |
192 | sway_cmd cmd_ipc_events; | 205 | sway_cmd cmd_ipc_events; |
diff --git a/include/sway/config.h b/include/sway/config.h index afff2738..83ded720 100644 --- a/include/sway/config.h +++ b/include/sway/config.h | |||
@@ -67,11 +67,34 @@ struct input_config { | |||
67 | int send_events; | 67 | int send_events; |
68 | int tap; | 68 | int tap; |
69 | 69 | ||
70 | char *xkb_layout; | ||
71 | char *xkb_model; | ||
72 | char *xkb_options; | ||
73 | char *xkb_rules; | ||
74 | char *xkb_variant; | ||
75 | |||
70 | bool capturable; | 76 | bool capturable; |
71 | struct wlr_box region; | 77 | struct wlr_box region; |
72 | }; | 78 | }; |
73 | 79 | ||
74 | /** | 80 | /** |
81 | * Options for misc device configurations that happen in the seat block | ||
82 | */ | ||
83 | struct seat_attachment_config { | ||
84 | char *identifier; | ||
85 | // TODO other things are configured here for some reason | ||
86 | }; | ||
87 | |||
88 | /** | ||
89 | * Options for multiseat and other misc device configurations | ||
90 | */ | ||
91 | struct seat_config { | ||
92 | char *name; | ||
93 | int fallback; // -1 means not set | ||
94 | list_t *attachments; // list of seat_attachment configs | ||
95 | }; | ||
96 | |||
97 | /** | ||
75 | * Size and position configuration for a particular output. | 98 | * Size and position configuration for a particular output. |
76 | * | 99 | * |
77 | * This is set via the `output` command. | 100 | * This is set via the `output` command. |
@@ -262,6 +285,7 @@ struct sway_config { | |||
262 | list_t *pid_workspaces; | 285 | list_t *pid_workspaces; |
263 | list_t *output_configs; | 286 | list_t *output_configs; |
264 | list_t *input_configs; | 287 | list_t *input_configs; |
288 | list_t *seat_configs; | ||
265 | list_t *criteria; | 289 | list_t *criteria; |
266 | list_t *no_focus; | 290 | list_t *no_focus; |
267 | list_t *active_bar_modifiers; | 291 | list_t *active_bar_modifiers; |
@@ -358,9 +382,19 @@ char *do_var_replacement(char *str); | |||
358 | struct cmd_results *check_security_config(); | 382 | struct cmd_results *check_security_config(); |
359 | 383 | ||
360 | int input_identifier_cmp(const void *item, const void *data); | 384 | int input_identifier_cmp(const void *item, const void *data); |
385 | struct input_config *new_input_config(const char* identifier); | ||
361 | void merge_input_config(struct input_config *dst, struct input_config *src); | 386 | void merge_input_config(struct input_config *dst, struct input_config *src); |
362 | void apply_input_config(struct input_config *ic, struct libinput_device *dev); | ||
363 | void free_input_config(struct input_config *ic); | 387 | void free_input_config(struct input_config *ic); |
388 | void apply_input_config(struct input_config *input); | ||
389 | |||
390 | int seat_name_cmp(const void *item, const void *data); | ||
391 | struct seat_config *new_seat_config(const char* name); | ||
392 | void merge_seat_config(struct seat_config *dst, struct seat_config *src); | ||
393 | void free_seat_config(struct seat_config *ic); | ||
394 | struct seat_attachment_config *seat_attachment_config_new(); | ||
395 | struct seat_attachment_config *seat_config_get_attachment( | ||
396 | struct seat_config *seat_config, char *identifier); | ||
397 | void apply_seat_config(struct seat_config *seat); | ||
364 | 398 | ||
365 | int output_name_cmp(const void *item, const void *data); | 399 | int output_name_cmp(const void *item, const void *data); |
366 | struct output_config *new_output_config(); | 400 | struct output_config *new_output_config(); |
diff --git a/include/sway/container.h b/include/sway/container.h index b15e0428..9a5e312b 100644 --- a/include/sway/container.h +++ b/include/sway/container.h | |||
@@ -3,6 +3,7 @@ | |||
3 | #include <stdint.h> | 3 | #include <stdint.h> |
4 | #include <sys/types.h> | 4 | #include <sys/types.h> |
5 | #include <wlr/types/wlr_box.h> | 5 | #include <wlr/types/wlr_box.h> |
6 | #include <wlr/types/wlr_surface.h> | ||
6 | #include "list.h" | 7 | #include "list.h" |
7 | 8 | ||
8 | typedef struct sway_container swayc_t; | 9 | typedef struct sway_container swayc_t; |
@@ -123,6 +124,10 @@ struct sway_container { | |||
123 | * Marks applied to the container, list_t of char*. | 124 | * Marks applied to the container, list_t of char*. |
124 | */ | 125 | */ |
125 | list_t *marks; | 126 | list_t *marks; |
127 | |||
128 | struct { | ||
129 | struct wl_signal destroy; | ||
130 | } events; | ||
126 | }; | 131 | }; |
127 | 132 | ||
128 | void swayc_descendants_of_type(swayc_t *root, enum swayc_types type, | 133 | void swayc_descendants_of_type(swayc_t *root, enum swayc_types type, |
@@ -137,4 +142,7 @@ swayc_t *destroy_view(swayc_t *view); | |||
137 | 142 | ||
138 | swayc_t *swayc_parent_by_type(swayc_t *container, enum swayc_types type); | 143 | swayc_t *swayc_parent_by_type(swayc_t *container, enum swayc_types type); |
139 | 144 | ||
145 | swayc_t *swayc_at(swayc_t *parent, double lx, double ly, | ||
146 | struct wlr_surface **surface, double *sx, double *sy); | ||
147 | |||
140 | #endif | 148 | #endif |
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 @@ | |||
1 | #ifndef _SWAY_INPUT_CURSOR_H | ||
2 | #define _SWAY_INPUT_CURSOR_H | ||
3 | |||
4 | #include "sway/input/seat.h" | ||
5 | |||
6 | struct sway_cursor { | ||
7 | struct sway_seat *seat; | ||
8 | struct wlr_cursor *cursor; | ||
9 | struct wlr_xcursor_manager *xcursor_manager; | ||
10 | |||
11 | double x, y; | ||
12 | |||
13 | struct wl_listener motion; | ||
14 | struct wl_listener motion_absolute; | ||
15 | struct wl_listener button; | ||
16 | struct wl_listener axis; | ||
17 | |||
18 | struct wl_listener touch_down; | ||
19 | struct wl_listener touch_up; | ||
20 | struct wl_listener touch_motion; | ||
21 | |||
22 | struct wl_listener tool_axis; | ||
23 | struct wl_listener tool_tip; | ||
24 | |||
25 | struct wl_listener request_set_cursor; | ||
26 | }; | ||
27 | |||
28 | struct sway_cursor *sway_cursor_create(struct sway_seat *seat); | ||
29 | |||
30 | #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 @@ | |||
1 | #ifndef _SWAY_INPUT_INPUT_MANAGER_H | ||
2 | #define _SWAY_INPUT_INPUT_MANAGER_H | ||
3 | #include <libinput.h> | ||
4 | #include "sway/server.h" | ||
5 | #include "sway/config.h" | ||
6 | #include "list.h" | ||
7 | |||
8 | extern struct input_config *current_input_config; | ||
9 | extern struct seat_config *current_seat_config; | ||
10 | |||
11 | /** | ||
12 | * The global singleton input manager | ||
13 | * TODO: make me not a global | ||
14 | */ | ||
15 | extern struct sway_input_manager *input_manager; | ||
16 | |||
17 | struct sway_input_device { | ||
18 | char *identifier; | ||
19 | struct wlr_input_device *wlr_device; | ||
20 | struct input_config *config; | ||
21 | struct wl_list link; | ||
22 | }; | ||
23 | |||
24 | struct sway_input_manager { | ||
25 | struct wl_listener input_add; | ||
26 | struct wl_listener input_remove; | ||
27 | struct sway_server *server; | ||
28 | struct wl_list devices; | ||
29 | struct wl_list seats; | ||
30 | }; | ||
31 | |||
32 | struct sway_input_manager *sway_input_manager_create( | ||
33 | struct sway_server *server); | ||
34 | |||
35 | bool sway_input_manager_has_focus(struct sway_input_manager *input, | ||
36 | swayc_t *container); | ||
37 | |||
38 | void sway_input_manager_set_focus(struct sway_input_manager *input, | ||
39 | swayc_t *container); | ||
40 | |||
41 | void sway_input_manager_configure_xcursor(struct sway_input_manager *input); | ||
42 | |||
43 | void sway_input_manager_apply_input_config(struct sway_input_manager *input, | ||
44 | struct input_config *input_config); | ||
45 | |||
46 | void sway_input_manager_apply_seat_config(struct sway_input_manager *input, | ||
47 | struct seat_config *seat_config); | ||
48 | |||
49 | #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 @@ | |||
1 | #ifndef _SWAY_INPUT_KEYBOARD_H | ||
2 | #define _SWAY_INPUT_KEYBOARD_H | ||
3 | |||
4 | #include "sway/input/seat.h" | ||
5 | |||
6 | struct sway_keyboard { | ||
7 | struct sway_seat_device *seat_device; | ||
8 | |||
9 | struct xkb_keymap *keymap; | ||
10 | |||
11 | struct wl_listener keyboard_key; | ||
12 | struct wl_listener keyboard_modifiers; | ||
13 | }; | ||
14 | |||
15 | struct sway_keyboard *sway_keyboard_create(struct sway_seat *seat, | ||
16 | struct sway_seat_device *device); | ||
17 | |||
18 | void sway_keyboard_configure(struct sway_keyboard *keyboard); | ||
19 | |||
20 | void sway_keyboard_destroy(struct sway_keyboard *keyboard); | ||
21 | |||
22 | #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 @@ | |||
1 | #ifndef _SWAY_INPUT_SEAT_H | ||
2 | #define _SWAY_INPUT_SEAT_H | ||
3 | |||
4 | #include <wlr/types/wlr_seat.h> | ||
5 | #include "sway/input/input-manager.h" | ||
6 | |||
7 | struct sway_seat_device { | ||
8 | struct sway_seat *sway_seat; | ||
9 | struct sway_input_device *input_device; | ||
10 | struct sway_keyboard *keyboard; | ||
11 | struct seat_attachment_config *attachment_config; | ||
12 | struct wl_list link; // sway_seat::devices | ||
13 | }; | ||
14 | |||
15 | struct sway_seat { | ||
16 | struct wlr_seat *wlr_seat; | ||
17 | struct seat_config *config; | ||
18 | struct sway_cursor *cursor; | ||
19 | struct sway_input_manager *input; | ||
20 | swayc_t *focus; | ||
21 | |||
22 | struct wl_listener focus_destroy; | ||
23 | |||
24 | struct wl_list devices; // sway_seat_device::link | ||
25 | |||
26 | struct wl_list link; // input_manager::seats | ||
27 | }; | ||
28 | |||
29 | struct sway_seat *sway_seat_create(struct sway_input_manager *input, | ||
30 | const char *seat_name); | ||
31 | |||
32 | void sway_seat_add_device(struct sway_seat *seat, | ||
33 | struct sway_input_device *device); | ||
34 | |||
35 | void sway_seat_configure_device(struct sway_seat *seat, | ||
36 | struct sway_input_device *device); | ||
37 | |||
38 | void sway_seat_remove_device(struct sway_seat *seat, | ||
39 | struct sway_input_device *device); | ||
40 | |||
41 | void sway_seat_configure_xcursor(struct sway_seat *seat); | ||
42 | |||
43 | void sway_seat_set_focus(struct sway_seat *seat, swayc_t *container); | ||
44 | |||
45 | void sway_seat_set_config(struct sway_seat *seat, struct seat_config *seat_config); | ||
46 | |||
47 | #endif | ||
diff --git a/include/sway/server.h b/include/sway/server.h index 3fa72e84..76a05476 100644 --- a/include/sway/server.h +++ b/include/sway/server.h | |||
@@ -22,7 +22,7 @@ struct sway_server { | |||
22 | struct wlr_compositor *compositor; | 22 | struct wlr_compositor *compositor; |
23 | struct wlr_data_device_manager *data_device_manager; | 23 | struct wlr_data_device_manager *data_device_manager; |
24 | 24 | ||
25 | struct sway_input *input; | 25 | struct sway_input_manager *input; |
26 | 26 | ||
27 | struct wl_listener output_add; | 27 | struct wl_listener output_add; |
28 | struct wl_listener output_remove; | 28 | struct wl_listener output_remove; |