diff options
Diffstat (limited to 'sway/input/seat.c')
-rw-r--r-- | sway/input/seat.c | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/sway/input/seat.c b/sway/input/seat.c index 76d29b52..648e7914 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c | |||
@@ -1,13 +1,13 @@ | |||
1 | #define _XOPEN_SOURCE 700 | 1 | #define _XOPEN_SOURCE 700 |
2 | #include <wlr/types/wlr_cursor.h> | 2 | #include <wlr/types/wlr_cursor.h> |
3 | #include <wlr/types/wlr_xcursor_manager.h> | 3 | #include <wlr/types/wlr_xcursor_manager.h> |
4 | #include "sway/tree/container.h" | 4 | #include "sway/container.h" |
5 | #include "sway/input/seat.h" | 5 | #include "sway/input/seat.h" |
6 | #include "sway/input/cursor.h" | 6 | #include "sway/input/cursor.h" |
7 | #include "sway/input/input-manager.h" | 7 | #include "sway/input/input-manager.h" |
8 | #include "sway/input/keyboard.h" | 8 | #include "sway/input/keyboard.h" |
9 | #include "sway/output.h" | 9 | #include "sway/output.h" |
10 | #include "sway/tree/view.h" | 10 | #include "sway/view.h" |
11 | #include "log.h" | 11 | #include "log.h" |
12 | 12 | ||
13 | static void seat_device_destroy(struct sway_seat_device *seat_device) { | 13 | static void seat_device_destroy(struct sway_seat_device *seat_device) { |
@@ -37,7 +37,7 @@ static void handle_seat_container_destroy(struct wl_listener *listener, | |||
37 | struct sway_seat_container *seat_con = | 37 | struct sway_seat_container *seat_con = |
38 | wl_container_of(listener, seat_con, destroy); | 38 | wl_container_of(listener, seat_con, destroy); |
39 | struct sway_seat *seat = seat_con->seat; | 39 | struct sway_seat *seat = seat_con->seat; |
40 | struct sway_container *con = seat_con->container; | 40 | swayc_t *con = seat_con->container; |
41 | 41 | ||
42 | bool is_focus = (sway_seat_get_focus(seat) == con); | 42 | bool is_focus = (sway_seat_get_focus(seat) == con); |
43 | 43 | ||
@@ -46,7 +46,7 @@ static void handle_seat_container_destroy(struct wl_listener *listener, | |||
46 | if (is_focus) { | 46 | if (is_focus) { |
47 | // pick next focus | 47 | // pick next focus |
48 | sway_seat_set_focus(seat, NULL); | 48 | sway_seat_set_focus(seat, NULL); |
49 | struct sway_container *next = sway_seat_get_focus_inactive(seat, con->parent); | 49 | swayc_t *next = sway_seat_get_focus_inactive(seat, con->parent); |
50 | if (next == NULL) { | 50 | if (next == NULL) { |
51 | next = con->parent; | 51 | next = con->parent; |
52 | } | 52 | } |
@@ -59,7 +59,7 @@ static void handle_seat_container_destroy(struct wl_listener *listener, | |||
59 | } | 59 | } |
60 | 60 | ||
61 | static struct sway_seat_container *seat_container_from_container( | 61 | static struct sway_seat_container *seat_container_from_container( |
62 | struct sway_seat *seat, struct sway_container *con) { | 62 | struct sway_seat *seat, swayc_t *con) { |
63 | if (con->type < C_WORKSPACE) { | 63 | if (con->type < C_WORKSPACE) { |
64 | // these don't get seat containers ever | 64 | // these don't get seat containers ever |
65 | return NULL; | 65 | return NULL; |
@@ -89,11 +89,11 @@ static struct sway_seat_container *seat_container_from_container( | |||
89 | 89 | ||
90 | static void handle_new_container(struct wl_listener *listener, void *data) { | 90 | static void handle_new_container(struct wl_listener *listener, void *data) { |
91 | struct sway_seat *seat = wl_container_of(listener, seat, new_container); | 91 | struct sway_seat *seat = wl_container_of(listener, seat, new_container); |
92 | struct sway_container *con = data; | 92 | swayc_t *con = data; |
93 | seat_container_from_container(seat, con); | 93 | seat_container_from_container(seat, con); |
94 | } | 94 | } |
95 | 95 | ||
96 | static void collect_focus_iter(struct sway_container *con, void *data) { | 96 | static void collect_focus_iter(swayc_t *con, void *data) { |
97 | struct sway_seat *seat = data; | 97 | struct sway_seat *seat = data; |
98 | if (con->type > C_WORKSPACE) { | 98 | if (con->type > C_WORKSPACE) { |
99 | return; | 99 | return; |
@@ -130,7 +130,7 @@ struct sway_seat *sway_seat_create(struct sway_input_manager *input, | |||
130 | // init the focus stack | 130 | // init the focus stack |
131 | wl_list_init(&seat->focus_stack); | 131 | wl_list_init(&seat->focus_stack); |
132 | 132 | ||
133 | container_for_each_descendent(&root_container, collect_focus_iter, seat); | 133 | container_for_each_bfs(&root_container, collect_focus_iter, seat); |
134 | 134 | ||
135 | wl_signal_add(&root_container.sway_root->events.new_container, | 135 | wl_signal_add(&root_container.sway_root->events.new_container, |
136 | &seat->new_container); | 136 | &seat->new_container); |
@@ -166,7 +166,7 @@ static void seat_configure_keyboard(struct sway_seat *seat, | |||
166 | sway_keyboard_configure(seat_device->keyboard); | 166 | sway_keyboard_configure(seat_device->keyboard); |
167 | wlr_seat_set_keyboard(seat->wlr_seat, | 167 | wlr_seat_set_keyboard(seat->wlr_seat, |
168 | seat_device->input_device->wlr_device); | 168 | seat_device->input_device->wlr_device); |
169 | struct sway_container *focus = sway_seat_get_focus(seat); | 169 | swayc_t *focus = sway_seat_get_focus(seat); |
170 | if (focus && focus->type == C_VIEW) { | 170 | if (focus && focus->type == C_VIEW) { |
171 | // force notify reenter to pick up the new configuration | 171 | // force notify reenter to pick up the new configuration |
172 | wlr_seat_keyboard_clear_focus(seat->wlr_seat); | 172 | wlr_seat_keyboard_clear_focus(seat->wlr_seat); |
@@ -270,7 +270,7 @@ void sway_seat_configure_xcursor(struct sway_seat *seat) { | |||
270 | } | 270 | } |
271 | 271 | ||
272 | for (int i = 0; i < root_container.children->length; ++i) { | 272 | for (int i = 0; i < root_container.children->length; ++i) { |
273 | struct sway_container *output_container = root_container.children->items[i]; | 273 | swayc_t *output_container = root_container.children->items[i]; |
274 | struct wlr_output *output = | 274 | struct wlr_output *output = |
275 | output_container->sway_output->wlr_output; | 275 | output_container->sway_output->wlr_output; |
276 | bool result = | 276 | bool result = |
@@ -289,8 +289,8 @@ void sway_seat_configure_xcursor(struct sway_seat *seat) { | |||
289 | seat->cursor->cursor->y); | 289 | seat->cursor->cursor->y); |
290 | } | 290 | } |
291 | 291 | ||
292 | void sway_seat_set_focus(struct sway_seat *seat, struct sway_container *container) { | 292 | void sway_seat_set_focus(struct sway_seat *seat, swayc_t *container) { |
293 | struct sway_container *last_focus = sway_seat_get_focus(seat); | 293 | swayc_t *last_focus = sway_seat_get_focus(seat); |
294 | 294 | ||
295 | if (container && last_focus == container) { | 295 | if (container && last_focus == container) { |
296 | return; | 296 | return; |
@@ -330,9 +330,9 @@ void sway_seat_set_focus(struct sway_seat *seat, struct sway_container *containe | |||
330 | seat->has_focus = (container != NULL); | 330 | seat->has_focus = (container != NULL); |
331 | } | 331 | } |
332 | 332 | ||
333 | struct sway_container *sway_seat_get_focus_inactive(struct sway_seat *seat, struct sway_container *container) { | 333 | swayc_t *sway_seat_get_focus_inactive(struct sway_seat *seat, swayc_t *container) { |
334 | struct sway_seat_container *current = NULL; | 334 | struct sway_seat_container *current = NULL; |
335 | struct sway_container *parent = NULL; | 335 | swayc_t *parent = NULL; |
336 | wl_list_for_each(current, &seat->focus_stack, link) { | 336 | wl_list_for_each(current, &seat->focus_stack, link) { |
337 | parent = current->container->parent; | 337 | parent = current->container->parent; |
338 | 338 | ||
@@ -351,21 +351,21 @@ struct sway_container *sway_seat_get_focus_inactive(struct sway_seat *seat, stru | |||
351 | return NULL; | 351 | return NULL; |
352 | } | 352 | } |
353 | 353 | ||
354 | struct sway_container *sway_seat_get_focus(struct sway_seat *seat) { | 354 | swayc_t *sway_seat_get_focus(struct sway_seat *seat) { |
355 | if (!seat->has_focus) { | 355 | if (!seat->has_focus) { |
356 | return NULL; | 356 | return NULL; |
357 | } | 357 | } |
358 | return sway_seat_get_focus_inactive(seat, &root_container); | 358 | return sway_seat_get_focus_inactive(seat, &root_container); |
359 | } | 359 | } |
360 | 360 | ||
361 | struct sway_container *sway_seat_get_focus_by_type(struct sway_seat *seat, | 361 | swayc_t *sway_seat_get_focus_by_type(struct sway_seat *seat, |
362 | enum sway_container_type type) { | 362 | enum swayc_types type) { |
363 | struct sway_container *focus = sway_seat_get_focus_inactive(seat, &root_container); | 363 | swayc_t *focus = sway_seat_get_focus_inactive(seat, &root_container); |
364 | if (focus->type == type) { | 364 | if (focus->type == type) { |
365 | return focus; | 365 | return focus; |
366 | } | 366 | } |
367 | 367 | ||
368 | return container_parent(focus, type); | 368 | return swayc_parent_by_type(focus, type); |
369 | } | 369 | } |
370 | 370 | ||
371 | void sway_seat_set_config(struct sway_seat *seat, | 371 | void sway_seat_set_config(struct sway_seat *seat, |