diff options
author | Tony Crisci <tony@dubstepdish.com> | 2018-04-02 08:45:37 -0400 |
---|---|---|
committer | Tony Crisci <tony@dubstepdish.com> | 2018-04-02 08:45:37 -0400 |
commit | e677c5b204971af00d71f9a50a89206d01b46a36 (patch) | |
tree | fa94a13e95119bdd3083fb7839889f2ce3a0fca0 /sway/input/seat.c | |
parent | Merge pull request #1684 from swaywm/follow-warp (diff) | |
download | sway-e677c5b204971af00d71f9a50a89206d01b46a36.tar.gz sway-e677c5b204971af00d71f9a50a89206d01b46a36.tar.zst sway-e677c5b204971af00d71f9a50a89206d01b46a36.zip |
rename seat functions
Diffstat (limited to 'sway/input/seat.c')
-rw-r--r-- | sway/input/seat.c | 58 |
1 files changed, 29 insertions, 29 deletions
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 | ||
28 | void sway_seat_destroy(struct sway_seat *seat) { | 28 | void 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 | ||
113 | struct sway_seat *sway_seat_create(struct sway_input_manager *input, | 113 | struct 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 | ||
182 | static struct sway_seat_device *sway_seat_get_device(struct sway_seat *seat, | 182 | static 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 | ||
194 | void sway_seat_configure_device(struct sway_seat *seat, | 194 | void 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 | ||
222 | void sway_seat_add_device(struct sway_seat *seat, | 222 | void 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 | ||
246 | void sway_seat_remove_device(struct sway_seat *seat, | 246 | void 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 | ||
261 | void sway_seat_configure_xcursor(struct sway_seat *seat) { | 261 | void 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 | ||
295 | void sway_seat_set_focus_warp(struct sway_seat *seat, | 295 | void 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 | ||
375 | void sway_seat_set_focus(struct sway_seat *seat, | 375 | void 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 | ||
380 | struct sway_container *sway_seat_get_focus_inactive(struct sway_seat *seat, struct sway_container *container) { | 380 | struct 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 | ||
401 | struct sway_container *sway_seat_get_focus(struct sway_seat *seat) { | 401 | struct 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 | ||
408 | struct sway_container *sway_seat_get_focus_by_type(struct sway_seat *seat, | 408 | struct 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 | ||
418 | void sway_seat_set_config(struct sway_seat *seat, | 418 | void 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 | } |