aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Brian Ashworth <bosrsf04@gmail.com>2019-04-23 23:40:00 -0400
committerLibravatar Drew DeVault <sir@cmpwn.com>2019-04-24 07:16:37 -0600
commitdc7a3930a7ffd4435c9215c7cce0afa37d06c91f (patch)
tree1b5f0bbbd832c7dc6b4407cd16dbc4ece26a666b
parentswaybar: hide mode visibility improvements (diff)
downloadsway-dc7a3930a7ffd4435c9215c7cce0afa37d06c91f.tar.gz
sway-dc7a3930a7ffd4435c9215c7cce0afa37d06c91f.tar.zst
sway-dc7a3930a7ffd4435c9215c7cce0afa37d06c91f.zip
swaybar: add multiseat support
This just adds multiseat support to swaybar
-rw-r--r--include/swaybar/bar.h4
-rw-r--r--include/swaybar/input.h13
-rw-r--r--swaybar/bar.c56
-rw-r--r--swaybar/input.c115
4 files changed, 131 insertions, 57 deletions
diff --git a/include/swaybar/bar.h b/include/swaybar/bar.h
index 84619237..10984ab0 100644
--- a/include/swaybar/bar.h
+++ b/include/swaybar/bar.h
@@ -31,11 +31,8 @@ struct swaybar {
31 struct zwlr_layer_shell_v1 *layer_shell; 31 struct zwlr_layer_shell_v1 *layer_shell;
32 struct zxdg_output_manager_v1 *xdg_output_manager; 32 struct zxdg_output_manager_v1 *xdg_output_manager;
33 struct wl_shm *shm; 33 struct wl_shm *shm;
34 struct wl_seat *seat;
35 34
36 struct swaybar_config *config; 35 struct swaybar_config *config;
37 struct swaybar_pointer pointer;
38 struct swaybar_touch touch;
39 struct status_line *status; 36 struct status_line *status;
40 37
41 struct loop *eventloop; 38 struct loop *eventloop;
@@ -44,6 +41,7 @@ struct swaybar {
44 int ipc_socketfd; 41 int ipc_socketfd;
45 42
46 struct wl_list outputs; // swaybar_output::link 43 struct wl_list outputs; // swaybar_output::link
44 struct wl_list seats; // swaybar_seat::link
47 45
48#if HAVE_TRAY 46#if HAVE_TRAY
49 struct swaybar_tray *tray; 47 struct swaybar_tray *tray;
diff --git a/include/swaybar/input.h b/include/swaybar/input.h
index 88e5abc5..2d38f7a7 100644
--- a/include/swaybar/input.h
+++ b/include/swaybar/input.h
@@ -50,12 +50,23 @@ struct swaybar_hotspot {
50 void *data; 50 void *data;
51}; 51};
52 52
53struct swaybar_seat {
54 struct swaybar *bar;
55 uint32_t wl_name;
56 struct wl_seat *wl_seat;
57 struct swaybar_pointer pointer;
58 struct swaybar_touch touch;
59 struct wl_list link; // swaybar_seat:link
60};
61
53extern const struct wl_seat_listener seat_listener; 62extern const struct wl_seat_listener seat_listener;
54 63
55void update_cursor(struct swaybar *bar); 64void update_cursor(struct swaybar_seat *seat);
56 65
57uint32_t event_to_x11_button(uint32_t event); 66uint32_t event_to_x11_button(uint32_t event);
58 67
59void free_hotspots(struct wl_list *list); 68void free_hotspots(struct wl_list *list);
60 69
70void swaybar_seat_free(struct swaybar_seat *seat);
71
61#endif 72#endif
diff --git a/swaybar/bar.c b/swaybar/bar.c
index a95464f5..35e1662b 100644
--- a/swaybar/bar.c
+++ b/swaybar/bar.c
@@ -216,8 +216,16 @@ static void output_scale(void *data, struct wl_output *wl_output,
216 int32_t factor) { 216 int32_t factor) {
217 struct swaybar_output *output = data; 217 struct swaybar_output *output = data;
218 output->scale = factor; 218 output->scale = factor;
219 if (output == output->bar->pointer.current) { 219
220 update_cursor(output->bar); 220 bool render = false;
221 struct swaybar_seat *seat;
222 wl_list_for_each(seat, &output->bar->seats, link) {
223 if (output == seat->pointer.current) {
224 update_cursor(seat);
225 render = true;
226 }
227 };
228 if (render) {
221 render_frame(output); 229 render_frame(output);
222 } 230 }
223} 231}
@@ -318,9 +326,16 @@ static void handle_global(void *data, struct wl_registry *registry,
318 bar->compositor = wl_registry_bind(registry, name, 326 bar->compositor = wl_registry_bind(registry, name,
319 &wl_compositor_interface, 4); 327 &wl_compositor_interface, 4);
320 } else if (strcmp(interface, wl_seat_interface.name) == 0) { 328 } else if (strcmp(interface, wl_seat_interface.name) == 0) {
321 bar->seat = wl_registry_bind(registry, name, 329 struct swaybar_seat *seat = calloc(1, sizeof(struct swaybar_seat));
322 &wl_seat_interface, 3); 330 if (!seat) {
323 wl_seat_add_listener(bar->seat, &seat_listener, bar); 331 sway_abort("Failed to allocate swaybar_seat");
332 return;
333 }
334 seat->bar = bar;
335 seat->wl_name = name;
336 seat->wl_seat = wl_registry_bind(registry, name, &wl_seat_interface, 3);
337 wl_seat_add_listener(seat->wl_seat, &seat_listener, seat);
338 wl_list_insert(&bar->seats, &seat->link);
324 } else if (strcmp(interface, wl_shm_interface.name) == 0) { 339 } else if (strcmp(interface, wl_shm_interface.name) == 0) {
325 bar->shm = wl_registry_bind(registry, name, 340 bar->shm = wl_registry_bind(registry, name,
326 &wl_shm_interface, 1); 341 &wl_shm_interface, 1);
@@ -355,7 +370,14 @@ static void handle_global_remove(void *data, struct wl_registry *registry,
355 wl_list_for_each_safe(output, tmp, &bar->outputs, link) { 370 wl_list_for_each_safe(output, tmp, &bar->outputs, link) {
356 if (output->wl_name == name) { 371 if (output->wl_name == name) {
357 swaybar_output_free(output); 372 swaybar_output_free(output);
358 break; 373 return;
374 }
375 }
376 struct swaybar_seat *seat, *tmp_seat;
377 wl_list_for_each_safe(seat, tmp_seat, &bar->seats, link) {
378 if (seat->wl_name == name) {
379 swaybar_seat_free(seat);
380 return;
359 } 381 }
360 } 382 }
361} 383}
@@ -369,6 +391,7 @@ bool bar_setup(struct swaybar *bar, const char *socket_path) {
369 bar->visible = true; 391 bar->visible = true;
370 bar->config = init_config(); 392 bar->config = init_config();
371 wl_list_init(&bar->outputs); 393 wl_list_init(&bar->outputs);
394 wl_list_init(&bar->seats);
372 bar->eventloop = loop_create(); 395 bar->eventloop = loop_create();
373 396
374 bar->ipc_socketfd = ipc_open_socket(socket_path); 397 bar->ipc_socketfd = ipc_open_socket(socket_path);
@@ -397,9 +420,16 @@ bool bar_setup(struct swaybar *bar, const char *socket_path) {
397 // Second roundtrip for xdg-output 420 // Second roundtrip for xdg-output
398 wl_display_roundtrip(bar->display); 421 wl_display_roundtrip(bar->display);
399 422
400 struct swaybar_pointer *pointer = &bar->pointer; 423 struct swaybar_seat *seat;
401 pointer->cursor_surface = wl_compositor_create_surface(bar->compositor); 424 wl_list_for_each(seat, &bar->seats, link) {
402 assert(pointer->cursor_surface); 425 struct swaybar_pointer *pointer = &seat->pointer;
426 if (!pointer) {
427 continue;
428 }
429 pointer->cursor_surface =
430 wl_compositor_create_surface(bar->compositor);
431 assert(pointer->cursor_surface);
432 }
403 433
404#if HAVE_TRAY 434#if HAVE_TRAY
405 if (!bar->config->tray_hidden) { 435 if (!bar->config->tray_hidden) {
@@ -468,11 +498,19 @@ static void free_outputs(struct wl_list *list) {
468 } 498 }
469} 499}
470 500
501static void free_seats(struct wl_list *list) {
502 struct swaybar_seat *seat, *tmp;
503 wl_list_for_each_safe(seat, tmp, list, link) {
504 swaybar_seat_free(seat);
505 }
506}
507
471void bar_teardown(struct swaybar *bar) { 508void bar_teardown(struct swaybar *bar) {
472#if HAVE_TRAY 509#if HAVE_TRAY
473 destroy_tray(bar->tray); 510 destroy_tray(bar->tray);
474#endif 511#endif
475 free_outputs(&bar->outputs); 512 free_outputs(&bar->outputs);
513 free_seats(&bar->seats);
476 if (bar->config) { 514 if (bar->config) {
477 free_config(bar->config); 515 free_config(bar->config);
478 } 516 }
diff --git a/swaybar/input.c b/swaybar/input.c
index c83d8c33..92972146 100644
--- a/swaybar/input.c
+++ b/swaybar/input.c
@@ -59,13 +59,17 @@ static uint32_t wl_axis_to_button(uint32_t axis, wl_fixed_t value) {
59 } 59 }
60} 60}
61 61
62void update_cursor(struct swaybar *bar) { 62void update_cursor(struct swaybar_seat *seat) {
63 struct swaybar_pointer *pointer = &bar->pointer; 63 struct swaybar_pointer *pointer = &seat->pointer;
64 if (!pointer || !pointer->cursor_surface) {
65 return;
66 }
64 if (pointer->cursor_theme) { 67 if (pointer->cursor_theme) {
65 wl_cursor_theme_destroy(pointer->cursor_theme); 68 wl_cursor_theme_destroy(pointer->cursor_theme);
66 } 69 }
67 int scale = pointer->current ? pointer->current->scale : 1; 70 int scale = pointer->current ? pointer->current->scale : 1;
68 pointer->cursor_theme = wl_cursor_theme_load(NULL, 24 * scale, bar->shm); 71 pointer->cursor_theme = wl_cursor_theme_load(NULL, 24 * scale,
72 seat->bar->shm);
69 struct wl_cursor *cursor; 73 struct wl_cursor *cursor;
70 cursor = wl_cursor_theme_get_cursor(pointer->cursor_theme, "left_ptr"); 74 cursor = wl_cursor_theme_get_cursor(pointer->cursor_theme, "left_ptr");
71 pointer->cursor_image = cursor->images[0]; 75 pointer->cursor_image = cursor->images[0];
@@ -84,30 +88,30 @@ void update_cursor(struct swaybar *bar) {
84static void wl_pointer_enter(void *data, struct wl_pointer *wl_pointer, 88static void wl_pointer_enter(void *data, struct wl_pointer *wl_pointer,
85 uint32_t serial, struct wl_surface *surface, 89 uint32_t serial, struct wl_surface *surface,
86 wl_fixed_t surface_x, wl_fixed_t surface_y) { 90 wl_fixed_t surface_x, wl_fixed_t surface_y) {
87 struct swaybar *bar = data; 91 struct swaybar_seat *seat = data;
88 struct swaybar_pointer *pointer = &bar->pointer; 92 struct swaybar_pointer *pointer = &seat->pointer;
89 pointer->serial = serial; 93 pointer->serial = serial;
90 struct swaybar_output *output; 94 struct swaybar_output *output;
91 wl_list_for_each(output, &bar->outputs, link) { 95 wl_list_for_each(output, &seat->bar->outputs, link) {
92 if (output->surface == surface) { 96 if (output->surface == surface) {
93 pointer->current = output; 97 pointer->current = output;
94 break; 98 break;
95 } 99 }
96 } 100 }
97 update_cursor(bar); 101 update_cursor(seat);
98} 102}
99 103
100static void wl_pointer_leave(void *data, struct wl_pointer *wl_pointer, 104static void wl_pointer_leave(void *data, struct wl_pointer *wl_pointer,
101 uint32_t serial, struct wl_surface *surface) { 105 uint32_t serial, struct wl_surface *surface) {
102 struct swaybar *bar = data; 106 struct swaybar_seat *seat = data;
103 bar->pointer.current = NULL; 107 seat->pointer.current = NULL;
104} 108}
105 109
106static void wl_pointer_motion(void *data, struct wl_pointer *wl_pointer, 110static void wl_pointer_motion(void *data, struct wl_pointer *wl_pointer,
107 uint32_t time, wl_fixed_t surface_x, wl_fixed_t surface_y) { 111 uint32_t time, wl_fixed_t surface_x, wl_fixed_t surface_y) {
108 struct swaybar *bar = data; 112 struct swaybar_seat *seat = data;
109 bar->pointer.x = wl_fixed_to_int(surface_x); 113 seat->pointer.x = wl_fixed_to_int(surface_x);
110 bar->pointer.y = wl_fixed_to_int(surface_y); 114 seat->pointer.y = wl_fixed_to_int(surface_y);
111} 115}
112 116
113static bool check_bindings(struct swaybar *bar, uint32_t button, 117static bool check_bindings(struct swaybar *bar, uint32_t button,
@@ -142,14 +146,14 @@ static void process_hotspots(struct swaybar_output *output,
142 146
143static void wl_pointer_button(void *data, struct wl_pointer *wl_pointer, 147static void wl_pointer_button(void *data, struct wl_pointer *wl_pointer,
144 uint32_t serial, uint32_t time, uint32_t button, uint32_t state) { 148 uint32_t serial, uint32_t time, uint32_t button, uint32_t state) {
145 struct swaybar *bar = data; 149 struct swaybar_seat *seat = data;
146 struct swaybar_pointer *pointer = &bar->pointer; 150 struct swaybar_pointer *pointer = &seat->pointer;
147 struct swaybar_output *output = pointer->current; 151 struct swaybar_output *output = pointer->current;
148 if (!sway_assert(output, "button with no active output")) { 152 if (!sway_assert(output, "button with no active output")) {
149 return; 153 return;
150 } 154 }
151 155
152 if (check_bindings(bar, button, state)) { 156 if (check_bindings(seat->bar, button, state)) {
153 return; 157 return;
154 } 158 }
155 159
@@ -199,8 +203,8 @@ static void workspace_next(struct swaybar *bar, struct swaybar_output *output,
199 203
200static void wl_pointer_axis(void *data, struct wl_pointer *wl_pointer, 204static void wl_pointer_axis(void *data, struct wl_pointer *wl_pointer,
201 uint32_t time, uint32_t axis, wl_fixed_t value) { 205 uint32_t time, uint32_t axis, wl_fixed_t value) {
202 struct swaybar *bar = data; 206 struct swaybar_seat *seat = data;
203 struct swaybar_pointer *pointer = &bar->pointer; 207 struct swaybar_pointer *pointer = &seat->pointer;
204 struct swaybar_output *output = pointer->current; 208 struct swaybar_output *output = pointer->current;
205 if (!sway_assert(output, "axis with no active output")) { 209 if (!sway_assert(output, "axis with no active output")) {
206 return; 210 return;
@@ -209,8 +213,8 @@ static void wl_pointer_axis(void *data, struct wl_pointer *wl_pointer,
209 // If there is a button press binding, execute it, skip default behavior, 213 // If there is a button press binding, execute it, skip default behavior,
210 // and check button release bindings 214 // and check button release bindings
211 uint32_t button = wl_axis_to_button(axis, value); 215 uint32_t button = wl_axis_to_button(axis, value);
212 if (check_bindings(bar, button, WL_POINTER_BUTTON_STATE_PRESSED)) { 216 if (check_bindings(seat->bar, button, WL_POINTER_BUTTON_STATE_PRESSED)) {
213 check_bindings(bar, button, WL_POINTER_BUTTON_STATE_RELEASED); 217 check_bindings(seat->bar, button, WL_POINTER_BUTTON_STATE_RELEASED);
214 return; 218 return;
215 } 219 }
216 220
@@ -229,10 +233,10 @@ static void wl_pointer_axis(void *data, struct wl_pointer *wl_pointer,
229 } 233 }
230 } 234 }
231 235
232 struct swaybar_config *config = bar->config; 236 struct swaybar_config *config = seat->bar->config;
233 double amt = wl_fixed_to_double(value); 237 double amt = wl_fixed_to_double(value);
234 if (amt == 0.0 || !config->workspace_buttons) { 238 if (amt == 0.0 || !config->workspace_buttons) {
235 check_bindings(bar, button, WL_POINTER_BUTTON_STATE_RELEASED); 239 check_bindings(seat->bar, button, WL_POINTER_BUTTON_STATE_RELEASED);
236 return; 240 return;
237 } 241 }
238 242
@@ -240,10 +244,10 @@ static void wl_pointer_axis(void *data, struct wl_pointer *wl_pointer,
240 return; 244 return;
241 } 245 }
242 246
243 workspace_next(bar, output, amt < 0.0); 247 workspace_next(seat->bar, output, amt < 0.0);
244 248
245 // Check button release bindings 249 // Check button release bindings
246 check_bindings(bar, button, WL_POINTER_BUTTON_STATE_RELEASED); 250 check_bindings(seat->bar, button, WL_POINTER_BUTTON_STATE_RELEASED);
247} 251}
248 252
249static void wl_pointer_frame(void *data, struct wl_pointer *wl_pointer) { 253static void wl_pointer_frame(void *data, struct wl_pointer *wl_pointer) {
@@ -297,9 +301,9 @@ static struct touch_slot *get_touch_slot(struct swaybar_touch *touch, int32_t id
297static void wl_touch_down(void *data, struct wl_touch *wl_touch, 301static void wl_touch_down(void *data, struct wl_touch *wl_touch,
298 uint32_t serial, uint32_t time, struct wl_surface *surface, 302 uint32_t serial, uint32_t time, struct wl_surface *surface,
299 int32_t id, wl_fixed_t _x, wl_fixed_t _y) { 303 int32_t id, wl_fixed_t _x, wl_fixed_t _y) {
300 struct swaybar *bar = data; 304 struct swaybar_seat *seat = data;
301 struct swaybar_output *_output = NULL, *output = NULL; 305 struct swaybar_output *_output = NULL, *output = NULL;
302 wl_list_for_each(_output, &bar->outputs, link) { 306 wl_list_for_each(_output, &seat->bar->outputs, link) {
303 if (_output->surface == surface) { 307 if (_output->surface == surface) {
304 output = _output; 308 output = _output;
305 break; 309 break;
@@ -309,7 +313,7 @@ static void wl_touch_down(void *data, struct wl_touch *wl_touch,
309 sway_log(SWAY_DEBUG, "Got touch event for unknown surface"); 313 sway_log(SWAY_DEBUG, "Got touch event for unknown surface");
310 return; 314 return;
311 } 315 }
312 struct touch_slot *slot = get_touch_slot(&bar->touch, id); 316 struct touch_slot *slot = get_touch_slot(&seat->touch, id);
313 if (!slot) { 317 if (!slot) {
314 return; 318 return;
315 } 319 }
@@ -322,8 +326,8 @@ static void wl_touch_down(void *data, struct wl_touch *wl_touch,
322 326
323static void wl_touch_up(void *data, struct wl_touch *wl_touch, 327static void wl_touch_up(void *data, struct wl_touch *wl_touch,
324 uint32_t serial, uint32_t time, int32_t id) { 328 uint32_t serial, uint32_t time, int32_t id) {
325 struct swaybar *bar = data; 329 struct swaybar_seat *seat = data;
326 struct touch_slot *slot = get_touch_slot(&bar->touch, id); 330 struct touch_slot *slot = get_touch_slot(&seat->touch, id);
327 if (!slot) { 331 if (!slot) {
328 return; 332 return;
329 } 333 }
@@ -336,8 +340,8 @@ static void wl_touch_up(void *data, struct wl_touch *wl_touch,
336 340
337static void wl_touch_motion(void *data, struct wl_touch *wl_touch, 341static void wl_touch_motion(void *data, struct wl_touch *wl_touch,
338 uint32_t time, int32_t id, wl_fixed_t x, wl_fixed_t y) { 342 uint32_t time, int32_t id, wl_fixed_t x, wl_fixed_t y) {
339 struct swaybar *bar = data; 343 struct swaybar_seat *seat = data;
340 struct touch_slot *slot = get_touch_slot(&bar->touch, id); 344 struct touch_slot *slot = get_touch_slot(&seat->touch, id);
341 if (!slot) { 345 if (!slot) {
342 return; 346 return;
343 } 347 }
@@ -351,7 +355,7 @@ static void wl_touch_motion(void *data, struct wl_touch *wl_touch,
351 int progress = (int)((slot->x - slot->start_x) 355 int progress = (int)((slot->x - slot->start_x)
352 / slot->output->width * 100); 356 / slot->output->width * 100);
353 if (abs(progress) / 20 != abs(prev_progress) / 20) { 357 if (abs(progress) / 20 != abs(prev_progress) / 20) {
354 workspace_next(bar, slot->output, progress - prev_progress < 0); 358 workspace_next(seat->bar, slot->output, progress - prev_progress < 0);
355 } 359 }
356} 360}
357 361
@@ -360,8 +364,8 @@ static void wl_touch_frame(void *data, struct wl_touch *wl_touch) {
360} 364}
361 365
362static void wl_touch_cancel(void *data, struct wl_touch *wl_touch) { 366static void wl_touch_cancel(void *data, struct wl_touch *wl_touch) {
363 struct swaybar *bar = data; 367 struct swaybar_seat *seat = data;
364 struct swaybar_touch *touch = &bar->touch; 368 struct swaybar_touch *touch = &seat->touch;
365 for (size_t i = 0; i < sizeof(touch->slots) / sizeof(*touch->slots); ++i) { 369 for (size_t i = 0; i < sizeof(touch->slots) / sizeof(*touch->slots); ++i) {
366 touch->slots[i].output = NULL; 370 touch->slots[i].output = NULL;
367 } 371 }
@@ -389,22 +393,27 @@ static const struct wl_touch_listener touch_listener = {
389 393
390static void seat_handle_capabilities(void *data, struct wl_seat *wl_seat, 394static void seat_handle_capabilities(void *data, struct wl_seat *wl_seat,
391 enum wl_seat_capability caps) { 395 enum wl_seat_capability caps) {
392 struct swaybar *bar = data; 396 struct swaybar_seat *seat = data;
393 if (bar->pointer.pointer != NULL) { 397 if (seat->pointer.pointer != NULL) {
394 wl_pointer_release(bar->pointer.pointer); 398 wl_pointer_release(seat->pointer.pointer);
395 bar->pointer.pointer = NULL; 399 seat->pointer.pointer = NULL;
396 } 400 }
397 if (bar->touch.touch != NULL) { 401 if (seat->touch.touch != NULL) {
398 wl_touch_release(bar->touch.touch); 402 wl_touch_release(seat->touch.touch);
399 bar->touch.touch = NULL; 403 seat->touch.touch = NULL;
400 } 404 }
401 if ((caps & WL_SEAT_CAPABILITY_POINTER)) { 405 if ((caps & WL_SEAT_CAPABILITY_POINTER)) {
402 bar->pointer.pointer = wl_seat_get_pointer(wl_seat); 406 seat->pointer.pointer = wl_seat_get_pointer(wl_seat);
403 wl_pointer_add_listener(bar->pointer.pointer, &pointer_listener, bar); 407 if (seat->bar->running && !seat->pointer.cursor_surface) {
408 seat->pointer.cursor_surface =
409 wl_compositor_create_surface(seat->bar->compositor);
410 assert(seat->pointer.cursor_surface);
411 }
412 wl_pointer_add_listener(seat->pointer.pointer, &pointer_listener, seat);
404 } 413 }
405 if ((caps & WL_SEAT_CAPABILITY_TOUCH)) { 414 if ((caps & WL_SEAT_CAPABILITY_TOUCH)) {
406 bar->touch.touch = wl_seat_get_touch(wl_seat); 415 seat->touch.touch = wl_seat_get_touch(wl_seat);
407 wl_touch_add_listener(bar->touch.touch, &touch_listener, bar); 416 wl_touch_add_listener(seat->touch.touch, &touch_listener, seat);
408 } 417 }
409} 418}
410 419
@@ -417,3 +426,21 @@ const struct wl_seat_listener seat_listener = {
417 .capabilities = seat_handle_capabilities, 426 .capabilities = seat_handle_capabilities,
418 .name = seat_handle_name, 427 .name = seat_handle_name,
419}; 428};
429
430void swaybar_seat_free(struct swaybar_seat *seat) {
431 if (!seat) {
432 return;
433 }
434 if (seat->pointer.pointer != NULL) {
435 wl_pointer_release(seat->pointer.pointer);
436 }
437 if (seat->pointer.cursor_surface != NULL) {
438 wl_surface_destroy(seat->pointer.cursor_surface);
439 }
440 if (seat->touch.touch != NULL) {
441 wl_touch_release(seat->touch.touch);
442 }
443 wl_seat_destroy(seat->wl_seat);
444 wl_list_remove(&seat->link);
445 free(seat);
446}