summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/sway/commands.h15
-rw-r--r--include/sway/config.h33
-rw-r--r--include/sway/container.h8
-rw-r--r--include/sway/input/cursor.h30
-rw-r--r--include/sway/input/input-manager.h49
-rw-r--r--include/sway/input/keyboard.h18
-rw-r--r--include/sway/input/seat.h47
-rw-r--r--include/sway/server.h2
8 files changed, 200 insertions, 2 deletions
diff --git a/include/sway/commands.h b/include/sway/commands.h
index b1f0423d..61950d0d 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,
@@ -39,6 +42,9 @@ enum expected_args {
39 EXPECTED_EQUAL_TO 42 EXPECTED_EQUAL_TO
40}; 43};
41 44
45void input_cmd_apply(struct input_config *input);
46void seat_cmd_apply(struct seat_config *seat);
47
42struct cmd_results *checkarg(int argc, const char *name, 48struct cmd_results *checkarg(int argc, const char *name,
43 enum expected_args type, int val); 49 enum expected_args type, int val);
44 50
@@ -107,6 +113,7 @@ sway_cmd cmd_gaps;
107sway_cmd cmd_hide_edge_borders; 113sway_cmd cmd_hide_edge_borders;
108sway_cmd cmd_include; 114sway_cmd cmd_include;
109sway_cmd cmd_input; 115sway_cmd cmd_input;
116sway_cmd cmd_seat;
110sway_cmd cmd_ipc; 117sway_cmd cmd_ipc;
111sway_cmd cmd_kill; 118sway_cmd cmd_kill;
112sway_cmd cmd_layout; 119sway_cmd cmd_layout;
@@ -176,6 +183,7 @@ sway_cmd bar_colors_cmd_statusline;
176sway_cmd bar_colors_cmd_focused_statusline; 183sway_cmd bar_colors_cmd_focused_statusline;
177sway_cmd bar_colors_cmd_urgent_workspace; 184sway_cmd bar_colors_cmd_urgent_workspace;
178 185
186sway_cmd input_cmd_seat;
179sway_cmd input_cmd_accel_profile; 187sway_cmd input_cmd_accel_profile;
180sway_cmd input_cmd_click_method; 188sway_cmd input_cmd_click_method;
181sway_cmd input_cmd_drag_lock; 189sway_cmd input_cmd_drag_lock;
@@ -187,6 +195,13 @@ sway_cmd input_cmd_natural_scroll;
187sway_cmd input_cmd_pointer_accel; 195sway_cmd input_cmd_pointer_accel;
188sway_cmd input_cmd_scroll_method; 196sway_cmd input_cmd_scroll_method;
189sway_cmd input_cmd_tap; 197sway_cmd input_cmd_tap;
198sway_cmd input_cmd_xkb_layout;
199sway_cmd input_cmd_xkb_model;
200sway_cmd input_cmd_xkb_options;
201sway_cmd input_cmd_xkb_rules;
202sway_cmd input_cmd_xkb_variant;
203
204sway_cmd seat_cmd_attach;
190 205
191sway_cmd cmd_ipc_cmd; 206sway_cmd cmd_ipc_cmd;
192sway_cmd cmd_ipc_events; 207sway_cmd cmd_ipc_events;
diff --git a/include/sway/config.h b/include/sway/config.h
index 139d7800..777fb5a8 100644
--- a/include/sway/config.h
+++ b/include/sway/config.h
@@ -67,11 +67,33 @@ 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 */
83struct 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 */
91struct seat_config {
92 char *name;
93 list_t *attachments; // list of seat_attachment configs
94};
95
96/**
75 * Size and position configuration for a particular output. 97 * Size and position configuration for a particular output.
76 * 98 *
77 * This is set via the `output` command. 99 * This is set via the `output` command.
@@ -262,6 +284,7 @@ struct sway_config {
262 list_t *pid_workspaces; 284 list_t *pid_workspaces;
263 list_t *output_configs; 285 list_t *output_configs;
264 list_t *input_configs; 286 list_t *input_configs;
287 list_t *seat_configs;
265 list_t *criteria; 288 list_t *criteria;
266 list_t *no_focus; 289 list_t *no_focus;
267 list_t *active_bar_modifiers; 290 list_t *active_bar_modifiers;
@@ -358,10 +381,18 @@ char *do_var_replacement(char *str);
358struct cmd_results *check_security_config(); 381struct cmd_results *check_security_config();
359 382
360int input_identifier_cmp(const void *item, const void *data); 383int input_identifier_cmp(const void *item, const void *data);
384struct input_config *new_input_config(const char* identifier);
361void merge_input_config(struct input_config *dst, struct input_config *src); 385void merge_input_config(struct input_config *dst, struct input_config *src);
362void apply_input_config(struct input_config *ic, struct libinput_device *dev);
363void free_input_config(struct input_config *ic); 386void free_input_config(struct input_config *ic);
364 387
388int seat_name_cmp(const void *item, const void *data);
389struct seat_config *new_seat_config(const char* name);
390void merge_seat_config(struct seat_config *dst, struct seat_config *src);
391void free_seat_config(struct seat_config *ic);
392struct seat_attachment_config *seat_attachment_config_new();
393struct seat_attachment_config *seat_config_get_attachment(
394 struct seat_config *seat_config, char *identifier);
395
365int output_name_cmp(const void *item, const void *data); 396int output_name_cmp(const void *item, const void *data);
366struct output_config *new_output_config(); 397struct output_config *new_output_config();
367void merge_output_config(struct output_config *dst, struct output_config *src); 398void merge_output_config(struct output_config *dst, struct output_config *src);
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
8typedef struct sway_container swayc_t; 9typedef 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
128void swayc_descendants_of_type(swayc_t *root, enum swayc_types type, 133void swayc_descendants_of_type(swayc_t *root, enum swayc_types type,
@@ -137,4 +142,7 @@ swayc_t *destroy_view(swayc_t *view);
137 142
138swayc_t *swayc_parent_by_type(swayc_t *container, enum swayc_types type); 143swayc_t *swayc_parent_by_type(swayc_t *container, enum swayc_types type);
139 144
145swayc_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..cc529de6
--- /dev/null
+++ b/include/sway/input/cursor.h
@@ -0,0 +1,30 @@
1#ifndef _SWAY_CURSOR_H
2#define _SWAY_CURSOR_H
3
4#include "sway/input/seat.h"
5
6struct 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
28struct 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..cdcffab6
--- /dev/null
+++ b/include/sway/input/input-manager.h
@@ -0,0 +1,49 @@
1#ifndef _SWAY_INPUT_MANAGER_H
2#define _SWAY_INPUT_MANAGER_H
3#include <libinput.h>
4#include "sway/server.h"
5#include "sway/config.h"
6#include "list.h"
7
8extern struct input_config *current_input_config;
9extern struct seat_config *current_seat_config;
10
11/**
12 * The global singleton input manager
13 * TODO: make me not a global
14 */
15extern struct sway_input_manager *input_manager;
16
17struct 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
24struct 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
32struct sway_input_manager *sway_input_manager_create(
33 struct sway_server *server);
34
35bool sway_input_manager_has_focus(struct sway_input_manager *input,
36 swayc_t *container);
37
38void sway_input_manager_set_focus(struct sway_input_manager *input,
39 swayc_t *container);
40
41void sway_input_manager_configure_xcursor(struct sway_input_manager *input);
42
43void sway_input_manager_apply_input_config(struct sway_input_manager *input,
44 struct input_config *input_config);
45
46void 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..89cde3fa
--- /dev/null
+++ b/include/sway/input/keyboard.h
@@ -0,0 +1,18 @@
1#include "sway/input/seat.h"
2
3struct sway_keyboard {
4 struct sway_seat_device *seat_device;
5 struct wl_list link; // sway_seat::keyboards
6
7 struct xkb_keymap *keymap;
8
9 struct wl_listener keyboard_key;
10 struct wl_listener keyboard_modifiers;
11};
12
13struct sway_keyboard *sway_keyboard_create(struct sway_seat *seat,
14 struct sway_seat_device *device);
15
16void sway_keyboard_configure(struct sway_keyboard *keyboard);
17
18void sway_keyboard_destroy(struct sway_keyboard *keyboard);
diff --git a/include/sway/input/seat.h b/include/sway/input/seat.h
new file mode 100644
index 00000000..db69f83e
--- /dev/null
+++ b/include/sway/input/seat.h
@@ -0,0 +1,47 @@
1#ifndef _SWAY_SEAT_H
2#define _SWAY_SEAT_H
3
4#include <wlr/types/wlr_seat.h>
5#include "sway/input/input-manager.h"
6
7struct 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
15struct 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
29struct sway_seat *sway_seat_create(struct sway_input_manager *input,
30 const char *seat_name);
31
32void sway_seat_add_device(struct sway_seat *seat,
33 struct sway_input_device *device);
34
35void sway_seat_configure_device(struct sway_seat *seat,
36 struct sway_input_device *device);
37
38void sway_seat_remove_device(struct sway_seat *seat,
39 struct sway_input_device *device);
40
41void sway_seat_configure_xcursor(struct sway_seat *seat);
42
43void sway_seat_set_focus(struct sway_seat *seat, swayc_t *container);
44
45void 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;