aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Tony Crisci <tony@dubstepdish.com>2018-04-02 08:45:37 -0400
committerLibravatar Tony Crisci <tony@dubstepdish.com>2018-04-02 08:45:37 -0400
commite677c5b204971af00d71f9a50a89206d01b46a36 (patch)
treefa94a13e95119bdd3083fb7839889f2ce3a0fca0
parentMerge pull request #1684 from swaywm/follow-warp (diff)
downloadsway-e677c5b204971af00d71f9a50a89206d01b46a36.tar.gz
sway-e677c5b204971af00d71f9a50a89206d01b46a36.tar.zst
sway-e677c5b204971af00d71f9a50a89206d01b46a36.zip
rename seat functions
-rw-r--r--include/sway/input/seat.h24
-rw-r--r--sway/commands.c2
-rw-r--r--sway/commands/focus.c4
-rw-r--r--sway/commands/workspace.c2
-rw-r--r--sway/config.c2
-rw-r--r--sway/desktop/output.c2
-rw-r--r--sway/desktop/wl_shell.c2
-rw-r--r--sway/desktop/xdg_shell_v6.c2
-rw-r--r--sway/desktop/xwayland.c2
-rw-r--r--sway/input/cursor.c10
-rw-r--r--sway/input/input-manager.c28
-rw-r--r--sway/input/seat.c58
-rw-r--r--sway/ipc-json.c4
-rw-r--r--sway/ipc-server.c4
-rw-r--r--sway/tree/container.c2
-rw-r--r--sway/tree/layout.c8
-rw-r--r--sway/tree/workspace.c14
17 files changed, 85 insertions, 85 deletions
diff --git a/include/sway/input/seat.h b/include/sway/input/seat.h
index 31210a5a..38a6379c 100644
--- a/include/sway/input/seat.h
+++ b/include/sway/input/seat.h
@@ -38,28 +38,28 @@ struct sway_seat {
38 struct wl_list link; // input_manager::seats 38 struct wl_list link; // input_manager::seats
39}; 39};
40 40
41struct sway_seat *sway_seat_create(struct sway_input_manager *input, 41struct sway_seat *seat_create(struct sway_input_manager *input,
42 const char *seat_name); 42 const char *seat_name);
43 43
44void sway_seat_destroy(struct sway_seat *seat); 44void seat_destroy(struct sway_seat *seat);
45 45
46void sway_seat_add_device(struct sway_seat *seat, 46void seat_add_device(struct sway_seat *seat,
47 struct sway_input_device *device); 47 struct sway_input_device *device);
48 48
49void sway_seat_configure_device(struct sway_seat *seat, 49void seat_configure_device(struct sway_seat *seat,
50 struct sway_input_device *device); 50 struct sway_input_device *device);
51 51
52void sway_seat_remove_device(struct sway_seat *seat, 52void seat_remove_device(struct sway_seat *seat,
53 struct sway_input_device *device); 53 struct sway_input_device *device);
54 54
55void sway_seat_configure_xcursor(struct sway_seat *seat); 55void seat_configure_xcursor(struct sway_seat *seat);
56 56
57void sway_seat_set_focus(struct sway_seat *seat, struct sway_container *container); 57void seat_set_focus(struct sway_seat *seat, struct sway_container *container);
58 58
59void sway_seat_set_focus_warp(struct sway_seat *seat, 59void seat_set_focus_warp(struct sway_seat *seat,
60 struct sway_container *container, bool warp); 60 struct sway_container *container, bool warp);
61 61
62struct sway_container *sway_seat_get_focus(struct sway_seat *seat); 62struct sway_container *seat_get_focus(struct sway_seat *seat);
63 63
64/** 64/**
65 * Return the last container to be focused for the seat (or the most recently 65 * Return the last container to be focused for the seat (or the most recently
@@ -70,12 +70,12 @@ struct sway_container *sway_seat_get_focus(struct sway_seat *seat);
70 * is destroyed, or focus moves to a container with children and we need to 70 * is destroyed, or focus moves to a container with children and we need to
71 * descend into the next leaf in focus order. 71 * descend into the next leaf in focus order.
72 */ 72 */
73struct sway_container *sway_seat_get_focus_inactive(struct sway_seat *seat, 73struct sway_container *seat_get_focus_inactive(struct sway_seat *seat,
74 struct sway_container *container); 74 struct sway_container *container);
75 75
76struct sway_container *sway_seat_get_focus_by_type(struct sway_seat *seat, 76struct sway_container *seat_get_focus_by_type(struct sway_seat *seat,
77 enum sway_container_type type); 77 enum sway_container_type type);
78 78
79void sway_seat_set_config(struct sway_seat *seat, struct seat_config *seat_config); 79void seat_set_config(struct sway_seat *seat, struct seat_config *seat_config);
80 80
81#endif 81#endif
diff --git a/sway/commands.c b/sway/commands.c
index 90544220..91b44fbf 100644
--- a/sway/commands.c
+++ b/sway/commands.c
@@ -340,7 +340,7 @@ struct cmd_results *execute_command(char *_exec, struct sway_seat *seat) {
340 // without criteria, the command acts upon the focused 340 // without criteria, the command acts upon the focused
341 // container 341 // container
342 config->handler_context.current_container = 342 config->handler_context.current_container =
343 sway_seat_get_focus_inactive(seat, &root_container); 343 seat_get_focus_inactive(seat, &root_container);
344 if (!sway_assert(config->handler_context.current_container, 344 if (!sway_assert(config->handler_context.current_container,
345 "could not get focus-inactive for root container")) { 345 "could not get focus-inactive for root container")) {
346 return NULL; 346 return NULL;
diff --git a/sway/commands/focus.c b/sway/commands/focus.c
index 64f079f4..4fb732dd 100644
--- a/sway/commands/focus.c
+++ b/sway/commands/focus.c
@@ -40,7 +40,7 @@ struct cmd_results *cmd_focus(int argc, char **argv) {
40 } 40 }
41 41
42 if (argc == 0) { 42 if (argc == 0) {
43 sway_seat_set_focus(seat, con); 43 seat_set_focus(seat, con);
44 return cmd_results_new(CMD_SUCCESS, NULL, NULL); 44 return cmd_results_new(CMD_SUCCESS, NULL, NULL);
45 } 45 }
46 46
@@ -53,7 +53,7 @@ struct cmd_results *cmd_focus(int argc, char **argv) {
53 53
54 struct sway_container *next_focus = container_get_in_direction(con, seat, direction); 54 struct sway_container *next_focus = container_get_in_direction(con, seat, direction);
55 if (next_focus) { 55 if (next_focus) {
56 sway_seat_set_focus(seat, next_focus); 56 seat_set_focus(seat, next_focus);
57 } 57 }
58 58
59 return cmd_results_new(CMD_SUCCESS, NULL, NULL); 59 return cmd_results_new(CMD_SUCCESS, NULL, NULL);
diff --git a/sway/commands/workspace.c b/sway/commands/workspace.c
index 8f39e5fc..aa4096f7 100644
--- a/sway/commands/workspace.c
+++ b/sway/commands/workspace.c
@@ -91,7 +91,7 @@ struct cmd_results *cmd_workspace(int argc, char **argv) {
91 } 91 }
92 workspace_switch(ws); 92 workspace_switch(ws);
93 current_container = 93 current_container =
94 sway_seat_get_focus(config->handler_context.seat); 94 seat_get_focus(config->handler_context.seat);
95 struct sway_container *new_output = container_parent(current_container, C_OUTPUT); 95 struct sway_container *new_output = container_parent(current_container, C_OUTPUT);
96 96
97 if (config->mouse_warping && old_output != new_output) { 97 if (config->mouse_warping && old_output != new_output) {
diff --git a/sway/config.c b/sway/config.c
index 0eecf7f6..90b833ab 100644
--- a/sway/config.c
+++ b/sway/config.c
@@ -125,7 +125,7 @@ static void destroy_removed_seats(struct sway_config *old_config,
125 seat_name_cmp, seat_config->name) < 0) { 125 seat_name_cmp, seat_config->name) < 0) {
126 seat = input_manager_get_seat(input_manager, 126 seat = input_manager_get_seat(input_manager,
127 seat_config->name); 127 seat_config->name);
128 sway_seat_destroy(seat); 128 seat_destroy(seat);
129 } 129 }
130 } 130 }
131} 131}
diff --git a/sway/desktop/output.c b/sway/desktop/output.c
index 0d706c52..86b023cb 100644
--- a/sway/desktop/output.c
+++ b/sway/desktop/output.c
@@ -228,7 +228,7 @@ static void render_output(struct sway_output *output, struct timespec *when,
228 228
229 struct sway_seat *seat = input_manager_current_seat(input_manager); 229 struct sway_seat *seat = input_manager_current_seat(input_manager);
230 struct sway_container *focus = 230 struct sway_container *focus =
231 sway_seat_get_focus_inactive(seat, output->swayc); 231 seat_get_focus_inactive(seat, output->swayc);
232 struct sway_container *workspace = (focus->type == C_WORKSPACE ? 232 struct sway_container *workspace = (focus->type == C_WORKSPACE ?
233 focus : 233 focus :
234 container_parent(focus, C_WORKSPACE)); 234 container_parent(focus, C_WORKSPACE));
diff --git a/sway/desktop/wl_shell.c b/sway/desktop/wl_shell.c
index 4fcc6317..3e275f2b 100644
--- a/sway/desktop/wl_shell.c
+++ b/sway/desktop/wl_shell.c
@@ -133,7 +133,7 @@ void handle_wl_shell_surface(struct wl_listener *listener, void *data) {
133 wl_signal_add(&shell_surface->events.destroy, &sway_surface->destroy); 133 wl_signal_add(&shell_surface->events.destroy, &sway_surface->destroy);
134 134
135 struct sway_seat *seat = input_manager_current_seat(input_manager); 135 struct sway_seat *seat = input_manager_current_seat(input_manager);
136 struct sway_container *focus = sway_seat_get_focus_inactive(seat, &root_container); 136 struct sway_container *focus = seat_get_focus_inactive(seat, &root_container);
137 struct sway_container *cont = container_view_create(focus, sway_view); 137 struct sway_container *cont = container_view_create(focus, sway_view);
138 sway_view->swayc = cont; 138 sway_view->swayc = cont;
139 139
diff --git a/sway/desktop/xdg_shell_v6.c b/sway/desktop/xdg_shell_v6.c
index 713437f2..286d52cc 100644
--- a/sway/desktop/xdg_shell_v6.c
+++ b/sway/desktop/xdg_shell_v6.c
@@ -98,7 +98,7 @@ static void handle_map(struct wl_listener *listener, void *data) {
98 container_view_destroy(view->swayc); 98 container_view_destroy(view->swayc);
99 99
100 struct sway_seat *seat = input_manager_current_seat(input_manager); 100 struct sway_seat *seat = input_manager_current_seat(input_manager);
101 struct sway_container *focus = sway_seat_get_focus_inactive(seat, &root_container); 101 struct sway_container *focus = seat_get_focus_inactive(seat, &root_container);
102 struct sway_container *cont = container_view_create(focus, view); 102 struct sway_container *cont = container_view_create(focus, view);
103 view->swayc = cont; 103 view->swayc = cont;
104 arrange_windows(cont->parent, -1, -1); 104 arrange_windows(cont->parent, -1, -1);
diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c
index 273ca2bf..8fb6cb52 100644
--- a/sway/desktop/xwayland.c
+++ b/sway/desktop/xwayland.c
@@ -143,7 +143,7 @@ static void handle_map(struct wl_listener *listener, void *data) {
143 wlr_xwayland_surface_set_maximized(xsurface, true); 143 wlr_xwayland_surface_set_maximized(xsurface, true);
144 144
145 struct sway_seat *seat = input_manager_current_seat(input_manager); 145 struct sway_seat *seat = input_manager_current_seat(input_manager);
146 struct sway_container *focus = sway_seat_get_focus_inactive(seat, 146 struct sway_container *focus = seat_get_focus_inactive(seat,
147 &root_container); 147 &root_container);
148 struct sway_container *cont = container_view_create(focus, view); 148 struct sway_container *cont = container_view_create(focus, view);
149 view->swayc = cont; 149 view->swayc = cont;
diff --git a/sway/input/cursor.c b/sway/input/cursor.c
index d608a9cf..7d05e942 100644
--- a/sway/input/cursor.c
+++ b/sway/input/cursor.c
@@ -84,7 +84,7 @@ static struct sway_container *container_at_cursor(struct sway_cursor *cursor,
84 84
85 // find the focused workspace on the output for this seat 85 // find the focused workspace on the output for this seat
86 struct sway_container *ws = 86 struct sway_container *ws =
87 sway_seat_get_focus_inactive(cursor->seat, output->swayc); 87 seat_get_focus_inactive(cursor->seat, output->swayc);
88 if (ws && ws->type != C_WORKSPACE) { 88 if (ws && ws->type != C_WORKSPACE) {
89 ws = container_parent(ws, C_WORKSPACE); 89 ws = container_parent(ws, C_WORKSPACE);
90 } 90 }
@@ -129,7 +129,7 @@ static void cursor_send_pointer_motion(struct sway_cursor *cursor,
129 double sx, sy; 129 double sx, sy;
130 struct sway_container *c = container_at_cursor(cursor, &surface, &sx, &sy); 130 struct sway_container *c = container_at_cursor(cursor, &surface, &sx, &sy);
131 if (c && config->focus_follows_mouse) { 131 if (c && config->focus_follows_mouse) {
132 sway_seat_set_focus_warp(cursor->seat, c, false); 132 seat_set_focus_warp(cursor->seat, c, false);
133 } 133 }
134 134
135 // reset cursor if switching between clients 135 // reset cursor if switching between clients
@@ -191,15 +191,15 @@ static void handle_cursor_button(struct wl_listener *listener, void *data) {
191 if (new_ws && new_ws->type != C_WORKSPACE) { 191 if (new_ws && new_ws->type != C_WORKSPACE) {
192 new_ws = container_parent(new_ws, C_WORKSPACE); 192 new_ws = container_parent(new_ws, C_WORKSPACE);
193 } 193 }
194 struct sway_container *old_ws = sway_seat_get_focus(cursor->seat); 194 struct sway_container *old_ws = seat_get_focus(cursor->seat);
195 if (old_ws && old_ws->type != C_WORKSPACE) { 195 if (old_ws && old_ws->type != C_WORKSPACE) {
196 old_ws = container_parent(old_ws, C_WORKSPACE); 196 old_ws = container_parent(old_ws, C_WORKSPACE);
197 } 197 }
198 if (new_ws != old_ws) { 198 if (new_ws != old_ws) {
199 sway_seat_set_focus(cursor->seat, cont); 199 seat_set_focus(cursor->seat, cont);
200 } 200 }
201 } else { 201 } else {
202 sway_seat_set_focus(cursor->seat, cont); 202 seat_set_focus(cursor->seat, cont);
203 } 203 }
204 204
205 wlr_seat_pointer_notify_button(cursor->seat->wlr_seat, event->time_msec, 205 wlr_seat_pointer_notify_button(cursor->seat->wlr_seat, event->time_msec,
diff --git a/sway/input/input-manager.c b/sway/input/input-manager.c
index d421a03f..66ade685 100644
--- a/sway/input/input-manager.c
+++ b/sway/input/input-manager.c
@@ -40,7 +40,7 @@ struct sway_seat *input_manager_get_seat(
40 } 40 }
41 } 41 }
42 42
43 return sway_seat_create(input, seat_name); 43 return seat_create(input, seat_name);
44} 44}
45 45
46static char *get_device_identifier(struct wlr_input_device *device) { 46static char *get_device_identifier(struct wlr_input_device *device) {
@@ -175,7 +175,7 @@ static void handle_device_destroy(struct wl_listener *listener, void *data) {
175 175
176 struct sway_seat *seat = NULL; 176 struct sway_seat *seat = NULL;
177 wl_list_for_each(seat, &input_manager->seats, link) { 177 wl_list_for_each(seat, &input_manager->seats, link) {
178 sway_seat_remove_device(seat, input_device); 178 seat_remove_device(seat, input_device);
179 } 179 }
180 180
181 wl_list_remove(&input_device->link); 181 wl_list_remove(&input_device->link);
@@ -221,7 +221,7 @@ static void handle_new_input(struct wl_listener *listener, void *data) {
221 if (!input_has_seat_configuration(input)) { 221 if (!input_has_seat_configuration(input)) {
222 wlr_log(L_DEBUG, "no seat configuration, using default seat"); 222 wlr_log(L_DEBUG, "no seat configuration, using default seat");
223 seat = input_manager_get_seat(input, default_seat); 223 seat = input_manager_get_seat(input, default_seat);
224 sway_seat_add_device(seat, input_device); 224 seat_add_device(seat, input_device);
225 return; 225 return;
226 } 226 }
227 227
@@ -232,7 +232,7 @@ static void handle_new_input(struct wl_listener *listener, void *data) {
232 seat_config_get_attachment(seat->config, "*")); 232 seat_config_get_attachment(seat->config, "*"));
233 233
234 if (has_attachment) { 234 if (has_attachment) {
235 sway_seat_add_device(seat, input_device); 235 seat_add_device(seat, input_device);
236 added = true; 236 added = true;
237 } 237 }
238 } 238 }
@@ -240,7 +240,7 @@ static void handle_new_input(struct wl_listener *listener, void *data) {
240 if (!added) { 240 if (!added) {
241 wl_list_for_each(seat, &input->seats, link) { 241 wl_list_for_each(seat, &input->seats, link) {
242 if (seat->config && seat->config->fallback == 1) { 242 if (seat->config && seat->config->fallback == 1) {
243 sway_seat_add_device(seat, input_device); 243 seat_add_device(seat, input_device);
244 added = true; 244 added = true;
245 } 245 }
246 } 246 }
@@ -281,7 +281,7 @@ bool sway_input_manager_has_focus(struct sway_input_manager *input,
281 struct sway_container *container) { 281 struct sway_container *container) {
282 struct sway_seat *seat = NULL; 282 struct sway_seat *seat = NULL;
283 wl_list_for_each(seat, &input->seats, link) { 283 wl_list_for_each(seat, &input->seats, link) {
284 if (sway_seat_get_focus(seat) == container) { 284 if (seat_get_focus(seat) == container) {
285 return true; 285 return true;
286 } 286 }
287 } 287 }
@@ -293,7 +293,7 @@ void sway_input_manager_set_focus(struct sway_input_manager *input,
293 struct sway_container *container) { 293 struct sway_container *container) {
294 struct sway_seat *seat ; 294 struct sway_seat *seat ;
295 wl_list_for_each(seat, &input->seats, link) { 295 wl_list_for_each(seat, &input->seats, link) {
296 sway_seat_set_focus(seat, container); 296 seat_set_focus(seat, container);
297 } 297 }
298} 298}
299 299
@@ -311,7 +311,7 @@ void sway_input_manager_apply_input_config(struct sway_input_manager *input,
311 311
312 struct sway_seat *seat = NULL; 312 struct sway_seat *seat = NULL;
313 wl_list_for_each(seat, &input->seats, link) { 313 wl_list_for_each(seat, &input->seats, link) {
314 sway_seat_configure_device(seat, input_device); 314 seat_configure_device(seat, input_device);
315 } 315 }
316 } 316 }
317 } 317 }
@@ -326,7 +326,7 @@ void sway_input_manager_apply_seat_config(struct sway_input_manager *input,
326 return; 326 return;
327 } 327 }
328 328
329 sway_seat_set_config(seat, seat_config); 329 seat_set_config(seat, seat_config);
330 330
331 // for every device, try to add it to a seat and if no seat has it 331 // for every device, try to add it to a seat and if no seat has it
332 // attached, add it to the fallback seats. 332 // attached, add it to the fallback seats.
@@ -355,17 +355,17 @@ void sway_input_manager_apply_seat_config(struct sway_input_manager *input,
355 } 355 }
356 } 356 }
357 if (attached) { 357 if (attached) {
358 sway_seat_add_device(seat, input_device); 358 seat_add_device(seat, input_device);
359 } else { 359 } else {
360 sway_seat_remove_device(seat, input_device); 360 seat_remove_device(seat, input_device);
361 } 361 }
362 } 362 }
363 } else { 363 } else {
364 wl_list_for_each(seat, &input->seats, link) { 364 wl_list_for_each(seat, &input->seats, link) {
365 if (seat->config && seat->config->fallback == 1) { 365 if (seat->config && seat->config->fallback == 1) {
366 sway_seat_add_device(seat, input_device); 366 seat_add_device(seat, input_device);
367 } else { 367 } else {
368 sway_seat_remove_device(seat, input_device); 368 seat_remove_device(seat, input_device);
369 } 369 }
370 } 370 }
371 } 371 }
@@ -376,7 +376,7 @@ void sway_input_manager_apply_seat_config(struct sway_input_manager *input,
376void sway_input_manager_configure_xcursor(struct sway_input_manager *input) { 376void sway_input_manager_configure_xcursor(struct sway_input_manager *input) {
377 struct sway_seat *seat = NULL; 377 struct sway_seat *seat = NULL;
378 wl_list_for_each(seat, &input->seats, link) { 378 wl_list_for_each(seat, &input->seats, link) {
379 sway_seat_configure_xcursor(seat); 379 seat_configure_xcursor(seat);
380 } 380 }
381} 381}
382 382
diff --git a/sway/input/seat.c b/sway/input/seat.c
index 9aa34aca..70395144 100644
--- a/sway/input/seat.c
+++ b/sway/input/seat.c
@@ -25,7 +25,7 @@ static void seat_device_destroy(struct sway_seat_device *seat_device) {
25 free(seat_device); 25 free(seat_device);
26} 26}
27 27
28void sway_seat_destroy(struct sway_seat *seat) { 28void seat_destroy(struct sway_seat *seat) {
29 struct sway_seat_device *seat_device, *next; 29 struct sway_seat_device *seat_device, *next;
30 wl_list_for_each_safe(seat_device, next, &seat->devices, link) { 30 wl_list_for_each_safe(seat_device, next, &seat->devices, link) {
31 seat_device_destroy(seat_device); 31 seat_device_destroy(seat_device);
@@ -42,18 +42,18 @@ static void handle_seat_container_destroy(struct wl_listener *listener,
42 struct sway_seat *seat = seat_con->seat; 42 struct sway_seat *seat = seat_con->seat;
43 struct sway_container *con = seat_con->container; 43 struct sway_container *con = seat_con->container;
44 44
45 bool is_focus = (sway_seat_get_focus(seat) == con); 45 bool is_focus = (seat_get_focus(seat) == con);
46 46
47 wl_list_remove(&seat_con->link); 47 wl_list_remove(&seat_con->link);
48 48
49 if (is_focus) { 49 if (is_focus) {
50 // pick next focus 50 // pick next focus
51 sway_seat_set_focus(seat, NULL); 51 seat_set_focus(seat, NULL);
52 struct sway_container *next = sway_seat_get_focus_inactive(seat, con->parent); 52 struct sway_container *next = seat_get_focus_inactive(seat, con->parent);
53 if (next == NULL) { 53 if (next == NULL) {
54 next = con->parent; 54 next = con->parent;
55 } 55 }
56 sway_seat_set_focus(seat, next); 56 seat_set_focus(seat, next);
57 } 57 }
58 58
59 wl_list_remove(&seat_con->destroy.link); 59 wl_list_remove(&seat_con->destroy.link);
@@ -110,7 +110,7 @@ static void collect_focus_iter(struct sway_container *con, void *data) {
110 wl_list_insert(&seat->focus_stack, &seat_con->link); 110 wl_list_insert(&seat->focus_stack, &seat_con->link);
111} 111}
112 112
113struct sway_seat *sway_seat_create(struct sway_input_manager *input, 113struct sway_seat *seat_create(struct sway_input_manager *input,
114 const char *seat_name) { 114 const char *seat_name) {
115 struct sway_seat *seat = calloc(1, sizeof(struct sway_seat)); 115 struct sway_seat *seat = calloc(1, sizeof(struct sway_seat));
116 if (!seat) { 116 if (!seat) {
@@ -147,7 +147,7 @@ struct sway_seat *sway_seat_create(struct sway_input_manager *input,
147 WL_SEAT_CAPABILITY_POINTER | 147 WL_SEAT_CAPABILITY_POINTER |
148 WL_SEAT_CAPABILITY_TOUCH); 148 WL_SEAT_CAPABILITY_TOUCH);
149 149
150 sway_seat_configure_xcursor(seat); 150 seat_configure_xcursor(seat);
151 151
152 wl_list_insert(&input->seats, &seat->link); 152 wl_list_insert(&input->seats, &seat->link);
153 153
@@ -169,7 +169,7 @@ static void seat_configure_keyboard(struct sway_seat *seat,
169 sway_keyboard_configure(seat_device->keyboard); 169 sway_keyboard_configure(seat_device->keyboard);
170 wlr_seat_set_keyboard(seat->wlr_seat, 170 wlr_seat_set_keyboard(seat->wlr_seat,
171 seat_device->input_device->wlr_device); 171 seat_device->input_device->wlr_device);
172 struct sway_container *focus = sway_seat_get_focus(seat); 172 struct sway_container *focus = seat_get_focus(seat);
173 if (focus && focus->type == C_VIEW) { 173 if (focus && focus->type == C_VIEW) {
174 // force notify reenter to pick up the new configuration 174 // force notify reenter to pick up the new configuration
175 wlr_seat_keyboard_clear_focus(seat->wlr_seat); 175 wlr_seat_keyboard_clear_focus(seat->wlr_seat);
@@ -179,7 +179,7 @@ static void seat_configure_keyboard(struct sway_seat *seat,
179 } 179 }
180} 180}
181 181
182static struct sway_seat_device *sway_seat_get_device(struct sway_seat *seat, 182static struct sway_seat_device *seat_get_device(struct sway_seat *seat,
183 struct sway_input_device *input_device) { 183 struct sway_input_device *input_device) {
184 struct sway_seat_device *seat_device = NULL; 184 struct sway_seat_device *seat_device = NULL;
185 wl_list_for_each(seat_device, &seat->devices, link) { 185 wl_list_for_each(seat_device, &seat->devices, link) {
@@ -191,10 +191,10 @@ static struct sway_seat_device *sway_seat_get_device(struct sway_seat *seat,
191 return NULL; 191 return NULL;
192} 192}
193 193
194void sway_seat_configure_device(struct sway_seat *seat, 194void seat_configure_device(struct sway_seat *seat,
195 struct sway_input_device *input_device) { 195 struct sway_input_device *input_device) {
196 struct sway_seat_device *seat_device = 196 struct sway_seat_device *seat_device =
197 sway_seat_get_device(seat, input_device); 197 seat_get_device(seat, input_device);
198 if (!seat_device) { 198 if (!seat_device) {
199 return; 199 return;
200 } 200 }
@@ -219,10 +219,10 @@ void sway_seat_configure_device(struct sway_seat *seat,
219 } 219 }
220} 220}
221 221
222void sway_seat_add_device(struct sway_seat *seat, 222void seat_add_device(struct sway_seat *seat,
223 struct sway_input_device *input_device) { 223 struct sway_input_device *input_device) {
224 if (sway_seat_get_device(seat, input_device)) { 224 if (seat_get_device(seat, input_device)) {
225 sway_seat_configure_device(seat, input_device); 225 seat_configure_device(seat, input_device);
226 return; 226 return;
227 } 227 }
228 228
@@ -240,13 +240,13 @@ void sway_seat_add_device(struct sway_seat *seat,
240 seat_device->input_device = input_device; 240 seat_device->input_device = input_device;
241 wl_list_insert(&seat->devices, &seat_device->link); 241 wl_list_insert(&seat->devices, &seat_device->link);
242 242
243 sway_seat_configure_device(seat, input_device); 243 seat_configure_device(seat, input_device);
244} 244}
245 245
246void sway_seat_remove_device(struct sway_seat *seat, 246void seat_remove_device(struct sway_seat *seat,
247 struct sway_input_device *input_device) { 247 struct sway_input_device *input_device) {
248 struct sway_seat_device *seat_device = 248 struct sway_seat_device *seat_device =
249 sway_seat_get_device(seat, input_device); 249 seat_get_device(seat, input_device);
250 250
251 if (!seat_device) { 251 if (!seat_device) {
252 return; 252 return;
@@ -258,7 +258,7 @@ void sway_seat_remove_device(struct sway_seat *seat,
258 seat_device_destroy(seat_device); 258 seat_device_destroy(seat_device);
259} 259}
260 260
261void sway_seat_configure_xcursor(struct sway_seat *seat) { 261void seat_configure_xcursor(struct sway_seat *seat) {
262 // TODO configure theme and size 262 // TODO configure theme and size
263 const char *cursor_theme = NULL; 263 const char *cursor_theme = NULL;
264 264
@@ -292,9 +292,9 @@ void sway_seat_configure_xcursor(struct sway_seat *seat) {
292 seat->cursor->cursor->y); 292 seat->cursor->cursor->y);
293} 293}
294 294
295void sway_seat_set_focus_warp(struct sway_seat *seat, 295void seat_set_focus_warp(struct sway_seat *seat,
296 struct sway_container *container, bool warp) { 296 struct sway_container *container, bool warp) {
297 struct sway_container *last_focus = sway_seat_get_focus(seat); 297 struct sway_container *last_focus = seat_get_focus(seat);
298 298
299 if (container && last_focus == container) { 299 if (container && last_focus == container) {
300 return; 300 return;
@@ -372,12 +372,12 @@ void sway_seat_set_focus_warp(struct sway_seat *seat,
372 seat->has_focus = (container != NULL); 372 seat->has_focus = (container != NULL);
373} 373}
374 374
375void sway_seat_set_focus(struct sway_seat *seat, 375void seat_set_focus(struct sway_seat *seat,
376 struct sway_container *container) { 376 struct sway_container *container) {
377 sway_seat_set_focus_warp(seat, container, true); 377 seat_set_focus_warp(seat, container, true);
378} 378}
379 379
380struct sway_container *sway_seat_get_focus_inactive(struct sway_seat *seat, struct sway_container *container) { 380struct sway_container *seat_get_focus_inactive(struct sway_seat *seat, struct sway_container *container) {
381 struct sway_seat_container *current = NULL; 381 struct sway_seat_container *current = NULL;
382 struct sway_container *parent = NULL; 382 struct sway_container *parent = NULL;
383 wl_list_for_each(current, &seat->focus_stack, link) { 383 wl_list_for_each(current, &seat->focus_stack, link) {
@@ -398,16 +398,16 @@ struct sway_container *sway_seat_get_focus_inactive(struct sway_seat *seat, stru
398 return NULL; 398 return NULL;
399} 399}
400 400
401struct sway_container *sway_seat_get_focus(struct sway_seat *seat) { 401struct sway_container *seat_get_focus(struct sway_seat *seat) {
402 if (!seat->has_focus) { 402 if (!seat->has_focus) {
403 return NULL; 403 return NULL;
404 } 404 }
405 return sway_seat_get_focus_inactive(seat, &root_container); 405 return seat_get_focus_inactive(seat, &root_container);
406} 406}
407 407
408struct sway_container *sway_seat_get_focus_by_type(struct sway_seat *seat, 408struct sway_container *seat_get_focus_by_type(struct sway_seat *seat,
409 enum sway_container_type type) { 409 enum sway_container_type type) {
410 struct sway_container *focus = sway_seat_get_focus_inactive(seat, &root_container); 410 struct sway_container *focus = seat_get_focus_inactive(seat, &root_container);
411 if (focus->type == type) { 411 if (focus->type == type) {
412 return focus; 412 return focus;
413 } 413 }
@@ -415,7 +415,7 @@ struct sway_container *sway_seat_get_focus_by_type(struct sway_seat *seat,
415 return container_parent(focus, type); 415 return container_parent(focus, type);
416} 416}
417 417
418void sway_seat_set_config(struct sway_seat *seat, 418void seat_set_config(struct sway_seat *seat,
419 struct seat_config *seat_config) { 419 struct seat_config *seat_config) {
420 // clear configs 420 // clear configs
421 free_seat_config(seat->config); 421 free_seat_config(seat->config);
@@ -434,6 +434,6 @@ void sway_seat_set_config(struct sway_seat *seat,
434 seat->config = copy_seat_config(seat_config); 434 seat->config = copy_seat_config(seat_config);
435 435
436 wl_list_for_each(seat_device, &seat->devices, link) { 436 wl_list_for_each(seat_device, &seat->devices, link) {
437 sway_seat_configure_device(seat, seat_device->input_device); 437 seat_configure_device(seat, seat_device->input_device);
438 } 438 }
439} 439}
diff --git a/sway/ipc-json.c b/sway/ipc-json.c
index 7c5f7304..1b906e6f 100644
--- a/sway/ipc-json.c
+++ b/sway/ipc-json.c
@@ -92,7 +92,7 @@ static void ipc_json_describe_output(struct sway_container *container, json_obje
92 const char *ws = NULL; 92 const char *ws = NULL;
93 if (seat) { 93 if (seat) {
94 struct sway_container *focus = 94 struct sway_container *focus =
95 sway_seat_get_focus_inactive(seat, container); 95 seat_get_focus_inactive(seat, container);
96 if (focus && focus->type != C_WORKSPACE) { 96 if (focus && focus->type != C_WORKSPACE) {
97 focus = container_parent(focus, C_WORKSPACE); 97 focus = container_parent(focus, C_WORKSPACE);
98 } 98 }
@@ -140,7 +140,7 @@ json_object *ipc_json_describe_container(struct sway_container *c) {
140 } 140 }
141 141
142 struct sway_seat *seat = sway_input_manager_get_default_seat(input_manager); 142 struct sway_seat *seat = sway_input_manager_get_default_seat(input_manager);
143 bool focused = sway_seat_get_focus(seat) == c; 143 bool focused = seat_get_focus(seat) == c;
144 144
145 json_object *object = json_object_new_object(); 145 json_object *object = json_object_new_object();
146 146
diff --git a/sway/ipc-server.c b/sway/ipc-server.c
index 869f1ed0..8c06f71b 100644
--- a/sway/ipc-server.c
+++ b/sway/ipc-server.c
@@ -389,7 +389,7 @@ static void ipc_get_workspaces_callback(struct sway_container *workspace,
389 // it's set differently for the get_workspaces reply 389 // it's set differently for the get_workspaces reply
390 struct sway_seat *seat = 390 struct sway_seat *seat =
391 sway_input_manager_get_default_seat(input_manager); 391 sway_input_manager_get_default_seat(input_manager);
392 struct sway_container *focused_ws = sway_seat_get_focus(seat); 392 struct sway_container *focused_ws = seat_get_focus(seat);
393 if (focused_ws != NULL && focused_ws->type != C_WORKSPACE) { 393 if (focused_ws != NULL && focused_ws->type != C_WORKSPACE) {
394 focused_ws = container_parent(focused_ws, C_WORKSPACE); 394 focused_ws = container_parent(focused_ws, C_WORKSPACE);
395 } 395 }
@@ -399,7 +399,7 @@ static void ipc_get_workspaces_callback(struct sway_container *workspace,
399 json_object_new_boolean(focused)); 399 json_object_new_boolean(focused));
400 json_object_array_add((json_object *)data, workspace_json); 400 json_object_array_add((json_object *)data, workspace_json);
401 401
402 focused_ws = sway_seat_get_focus_inactive(seat, workspace->parent); 402 focused_ws = seat_get_focus_inactive(seat, workspace->parent);
403 if (focused_ws->type != C_WORKSPACE) { 403 if (focused_ws->type != C_WORKSPACE) {
404 focused_ws = container_parent(focused_ws, C_WORKSPACE); 404 focused_ws = container_parent(focused_ws, C_WORKSPACE);
405 } 405 }
diff --git a/sway/tree/container.c b/sway/tree/container.c
index 746dbf1f..2d752862 100644
--- a/sway/tree/container.c
+++ b/sway/tree/container.c
@@ -144,7 +144,7 @@ struct sway_container *container_output_create(
144 struct sway_seat *seat = NULL; 144 struct sway_seat *seat = NULL;
145 wl_list_for_each(seat, &input_manager->seats, link) { 145 wl_list_for_each(seat, &input_manager->seats, link) {
146 if (!seat->has_focus) { 146 if (!seat->has_focus) {
147 sway_seat_set_focus(seat, ws); 147 seat_set_focus(seat, ws);
148 } 148 }
149 } 149 }
150 150
diff --git a/sway/tree/layout.c b/sway/tree/layout.c
index ce0682dc..0a766b22 100644
--- a/sway/tree/layout.c
+++ b/sway/tree/layout.c
@@ -404,7 +404,7 @@ static struct sway_container *get_swayc_in_output_direction(
404 return NULL; 404 return NULL;
405 } 405 }
406 406
407 struct sway_container *ws = sway_seat_get_focus_inactive(seat, output); 407 struct sway_container *ws = seat_get_focus_inactive(seat, output);
408 if (ws->type != C_WORKSPACE) { 408 if (ws->type != C_WORKSPACE) {
409 ws = container_parent(ws, C_WORKSPACE); 409 ws = container_parent(ws, C_WORKSPACE);
410 } 410 }
@@ -425,7 +425,7 @@ static struct sway_container *get_swayc_in_output_direction(
425 case MOVE_UP: 425 case MOVE_UP:
426 case MOVE_DOWN: { 426 case MOVE_DOWN: {
427 struct sway_container *focused = 427 struct sway_container *focused =
428 sway_seat_get_focus_inactive(seat, ws); 428 seat_get_focus_inactive(seat, ws);
429 if (focused && focused->parent) { 429 if (focused && focused->parent) {
430 struct sway_container *parent = focused->parent; 430 struct sway_container *parent = focused->parent;
431 if (parent->layout == L_VERT) { 431 if (parent->layout == L_VERT) {
@@ -509,7 +509,7 @@ static struct sway_container *get_swayc_in_direction_under(
509 struct sway_container *container, enum movement_direction dir, 509 struct sway_container *container, enum movement_direction dir,
510 struct sway_seat *seat, struct sway_container *limit) { 510 struct sway_seat *seat, struct sway_container *limit) {
511 if (dir == MOVE_CHILD) { 511 if (dir == MOVE_CHILD) {
512 return sway_seat_get_focus_inactive(seat, container); 512 return seat_get_focus_inactive(seat, container);
513 } 513 }
514 514
515 struct sway_container *parent = container->parent; 515 struct sway_container *parent = container->parent;
@@ -589,7 +589,7 @@ static struct sway_container *get_swayc_in_direction_under(
589 } 589 }
590 if (next->children && next->children->length) { 590 if (next->children && next->children->length) {
591 // TODO consider floating children as well 591 // TODO consider floating children as well
592 return sway_seat_get_focus_inactive(seat, next); 592 return seat_get_focus_inactive(seat, next);
593 } else { 593 } else {
594 return next; 594 return next;
595 } 595 }
diff --git a/sway/tree/workspace.c b/sway/tree/workspace.c
index c629f1f1..c47bab33 100644
--- a/sway/tree/workspace.c
+++ b/sway/tree/workspace.c
@@ -158,7 +158,7 @@ static bool _workspace_by_name(struct sway_container *view, void *data) {
158struct sway_container *workspace_by_name(const char *name) { 158struct sway_container *workspace_by_name(const char *name) {
159 struct sway_seat *seat = input_manager_current_seat(input_manager); 159 struct sway_seat *seat = input_manager_current_seat(input_manager);
160 struct sway_container *current_workspace = NULL, *current_output = NULL; 160 struct sway_container *current_workspace = NULL, *current_output = NULL;
161 struct sway_container *focus = sway_seat_get_focus(seat); 161 struct sway_container *focus = seat_get_focus(seat);
162 if (focus) { 162 if (focus) {
163 current_workspace = container_parent(focus, C_WORKSPACE); 163 current_workspace = container_parent(focus, C_WORKSPACE);
164 current_output = container_parent(focus, C_OUTPUT); 164 current_output = container_parent(focus, C_OUTPUT);
@@ -200,7 +200,7 @@ struct sway_container *workspace_create(const char *name) {
200 // Otherwise create a new one 200 // Otherwise create a new one
201 struct sway_seat *seat = input_manager_current_seat(input_manager); 201 struct sway_seat *seat = input_manager_current_seat(input_manager);
202 struct sway_container *focus = 202 struct sway_container *focus =
203 sway_seat_get_focus_inactive(seat, &root_container); 203 seat_get_focus_inactive(seat, &root_container);
204 parent = focus; 204 parent = focus;
205 parent = container_parent(parent, C_OUTPUT); 205 parent = container_parent(parent, C_OUTPUT);
206 struct sway_container *new_ws = container_workspace_create(parent, name); 206 struct sway_container *new_ws = container_workspace_create(parent, name);
@@ -260,7 +260,7 @@ struct sway_container *workspace_output_prev_next_impl(
260 } 260 }
261 261
262 struct sway_seat *seat = input_manager_current_seat(input_manager); 262 struct sway_seat *seat = input_manager_current_seat(input_manager);
263 struct sway_container *focus = sway_seat_get_focus_inactive(seat, output); 263 struct sway_container *focus = seat_get_focus_inactive(seat, output);
264 struct sway_container *workspace = (focus->type == C_WORKSPACE ? 264 struct sway_container *workspace = (focus->type == C_WORKSPACE ?
265 focus : 265 focus :
266 container_parent(focus, C_WORKSPACE)); 266 container_parent(focus, C_WORKSPACE));
@@ -345,7 +345,7 @@ bool workspace_switch(struct sway_container *workspace) {
345 } 345 }
346 struct sway_seat *seat = input_manager_current_seat(input_manager); 346 struct sway_seat *seat = input_manager_current_seat(input_manager);
347 struct sway_container *focus = 347 struct sway_container *focus =
348 sway_seat_get_focus_inactive(seat, &root_container); 348 seat_get_focus_inactive(seat, &root_container);
349 if (!seat || !focus) { 349 if (!seat || !focus) {
350 return false; 350 return false;
351 } 351 }
@@ -376,11 +376,11 @@ bool workspace_switch(struct sway_container *workspace) {
376 376
377 wlr_log(L_DEBUG, "Switching to workspace %p:%s", 377 wlr_log(L_DEBUG, "Switching to workspace %p:%s",
378 workspace, workspace->name); 378 workspace, workspace->name);
379 struct sway_container *next = sway_seat_get_focus_inactive(seat, workspace); 379 struct sway_container *next = seat_get_focus_inactive(seat, workspace);
380 if (next == NULL) { 380 if (next == NULL) {
381 next = workspace; 381 next = workspace;
382 } 382 }
383 sway_seat_set_focus(seat, next); 383 seat_set_focus(seat, next);
384 struct sway_container *output = container_parent(workspace, C_OUTPUT); 384 struct sway_container *output = container_parent(workspace, C_OUTPUT);
385 arrange_windows(output, -1, -1); 385 arrange_windows(output, -1, -1);
386 return true; 386 return true;
@@ -389,7 +389,7 @@ bool workspace_switch(struct sway_container *workspace) {
389bool workspace_is_visible(struct sway_container *ws) { 389bool workspace_is_visible(struct sway_container *ws) {
390 struct sway_container *output = container_parent(ws, C_OUTPUT); 390 struct sway_container *output = container_parent(ws, C_OUTPUT);
391 struct sway_seat *seat = input_manager_current_seat(input_manager); 391 struct sway_seat *seat = input_manager_current_seat(input_manager);
392 struct sway_container *focus = sway_seat_get_focus_inactive(seat, output); 392 struct sway_container *focus = seat_get_focus_inactive(seat, output);
393 if (focus->type != C_WORKSPACE) { 393 if (focus->type != C_WORKSPACE) {
394 focus = container_parent(focus, C_WORKSPACE); 394 focus = container_parent(focus, C_WORKSPACE);
395 } 395 }