diff options
author | 2023-11-21 19:55:47 -0500 | |
---|---|---|
committer | 2024-01-18 18:36:54 +0300 | |
commit | c640c3015f3a7ea2987bd7854d13ff282f90804f (patch) | |
tree | d292934709dcd71bdb244546b1684e690e0511f4 | |
parent | renderer: Render scene_graph (diff) | |
download | sway-c640c3015f3a7ea2987bd7854d13ff282f90804f.tar.gz sway-c640c3015f3a7ea2987bd7854d13ff282f90804f.tar.zst sway-c640c3015f3a7ea2987bd7854d13ff282f90804f.zip |
scene_graph: Port seat drag icons
-rw-r--r-- | include/sway/input/seat.h | 26 | ||||
-rw-r--r-- | include/sway/output.h | 4 | ||||
-rw-r--r-- | include/sway/scene_descriptor.h | 1 | ||||
-rw-r--r-- | include/sway/tree/root.h | 2 | ||||
-rw-r--r-- | sway/desktop/output.c | 16 | ||||
-rw-r--r-- | sway/desktop/render.c | 10 | ||||
-rw-r--r-- | sway/input/cursor.c | 10 | ||||
-rw-r--r-- | sway/input/seat.c | 98 | ||||
-rw-r--r-- | sway/input/seatop_default.c | 15 | ||||
-rw-r--r-- | sway/tree/root.c | 2 |
10 files changed, 53 insertions, 131 deletions
diff --git a/include/sway/input/seat.h b/include/sway/input/seat.h index 28a3ea37..3c81a713 100644 --- a/include/sway/input/seat.h +++ b/include/sway/input/seat.h | |||
@@ -3,6 +3,7 @@ | |||
3 | 3 | ||
4 | #include <wlr/types/wlr_keyboard_shortcuts_inhibit_v1.h> | 4 | #include <wlr/types/wlr_keyboard_shortcuts_inhibit_v1.h> |
5 | #include <wlr/types/wlr_layer_shell_v1.h> | 5 | #include <wlr/types/wlr_layer_shell_v1.h> |
6 | #include <wlr/types/wlr_scene.h> | ||
6 | #include <wlr/types/wlr_seat.h> | 7 | #include <wlr/types/wlr_seat.h> |
7 | #include <wlr/types/wlr_touch.h> | 8 | #include <wlr/types/wlr_touch.h> |
8 | #include <wlr/util/edges.h> | 9 | #include <wlr/util/edges.h> |
@@ -75,20 +76,6 @@ struct sway_seat_node { | |||
75 | struct wl_listener destroy; | 76 | struct wl_listener destroy; |
76 | }; | 77 | }; |
77 | 78 | ||
78 | struct sway_drag_icon { | ||
79 | struct sway_seat *seat; | ||
80 | struct wlr_drag_icon *wlr_drag_icon; | ||
81 | struct wl_list link; // sway_root::drag_icons | ||
82 | |||
83 | double x, y; // in layout-local coordinates | ||
84 | int dx, dy; // offset in surface-local coordinates | ||
85 | |||
86 | struct wl_listener surface_commit; | ||
87 | struct wl_listener map; | ||
88 | struct wl_listener unmap; | ||
89 | struct wl_listener destroy; | ||
90 | }; | ||
91 | |||
92 | struct sway_drag { | 79 | struct sway_drag { |
93 | struct sway_seat *seat; | 80 | struct sway_seat *seat; |
94 | struct wlr_drag *wlr_drag; | 81 | struct wlr_drag *wlr_drag; |
@@ -99,6 +86,15 @@ struct sway_seat { | |||
99 | struct wlr_seat *wlr_seat; | 86 | struct wlr_seat *wlr_seat; |
100 | struct sway_cursor *cursor; | 87 | struct sway_cursor *cursor; |
101 | 88 | ||
89 | // Seat scene tree structure | ||
90 | // - scene_tree | ||
91 | // - drag icons | ||
92 | // - drag icon 1 | ||
93 | // - drag icon 2 | ||
94 | // - seatop specific stuff | ||
95 | struct wlr_scene_tree *scene_tree; | ||
96 | struct wlr_scene_tree *drag_icons; | ||
97 | |||
102 | bool has_focus; | 98 | bool has_focus; |
103 | struct wl_list focus_stack; // list of containers in focus order | 99 | struct wl_list focus_stack; // list of containers in focus order |
104 | struct sway_workspace *workspace; | 100 | struct sway_workspace *workspace; |
@@ -257,7 +253,7 @@ void seat_idle_notify_activity(struct sway_seat *seat, | |||
257 | 253 | ||
258 | bool seat_is_input_allowed(struct sway_seat *seat, struct wlr_surface *surface); | 254 | bool seat_is_input_allowed(struct sway_seat *seat, struct wlr_surface *surface); |
259 | 255 | ||
260 | void drag_icon_update_position(struct sway_drag_icon *icon); | 256 | void drag_icons_update_position(struct sway_seat *seat); |
261 | 257 | ||
262 | enum wlr_edges find_resize_edge(struct sway_container *cont, | 258 | enum wlr_edges find_resize_edge(struct sway_container *cont, |
263 | struct wlr_surface *surface, struct sway_cursor *cursor); | 259 | struct wlr_surface *surface, struct sway_cursor *cursor); |
diff --git a/include/sway/output.h b/include/sway/output.h index b35f1366..28240819 100644 --- a/include/sway/output.h +++ b/include/sway/output.h | |||
@@ -167,10 +167,6 @@ void output_unmanaged_for_each_surface(struct sway_output *output, | |||
167 | void *user_data); | 167 | void *user_data); |
168 | #endif | 168 | #endif |
169 | 169 | ||
170 | void output_drag_icons_for_each_surface(struct sway_output *output, | ||
171 | struct wl_list *drag_icons, sway_surface_iterator_func_t iterator, | ||
172 | void *user_data); | ||
173 | |||
174 | void output_for_each_workspace(struct sway_output *output, | 170 | void output_for_each_workspace(struct sway_output *output, |
175 | void (*f)(struct sway_workspace *ws, void *data), void *data); | 171 | void (*f)(struct sway_workspace *ws, void *data), void *data); |
176 | 172 | ||
diff --git a/include/sway/scene_descriptor.h b/include/sway/scene_descriptor.h index 9761c2c0..057993ec 100644 --- a/include/sway/scene_descriptor.h +++ b/include/sway/scene_descriptor.h | |||
@@ -12,6 +12,7 @@ | |||
12 | 12 | ||
13 | enum sway_scene_descriptor_type { | 13 | enum sway_scene_descriptor_type { |
14 | SWAY_SCENE_DESC_BUFFER_TIMER, | 14 | SWAY_SCENE_DESC_BUFFER_TIMER, |
15 | SWAY_SCENE_DESC_DRAG_ICON, | ||
15 | }; | 16 | }; |
16 | 17 | ||
17 | bool scene_descriptor_assign(struct wlr_scene_node *node, | 18 | bool scene_descriptor_assign(struct wlr_scene_node *node, |
diff --git a/include/sway/tree/root.h b/include/sway/tree/root.h index 9cb3d7bf..4b48a651 100644 --- a/include/sway/tree/root.h +++ b/include/sway/tree/root.h | |||
@@ -40,12 +40,12 @@ struct sway_root { | |||
40 | struct wlr_scene_tree *floating; | 40 | struct wlr_scene_tree *floating; |
41 | struct wlr_scene_tree *fullscreen; | 41 | struct wlr_scene_tree *fullscreen; |
42 | struct wlr_scene_tree *fullscreen_global; | 42 | struct wlr_scene_tree *fullscreen_global; |
43 | struct wlr_scene_tree *seat; | ||
43 | } layers; | 44 | } layers; |
44 | 45 | ||
45 | #if HAVE_XWAYLAND | 46 | #if HAVE_XWAYLAND |
46 | struct wl_list xwayland_unmanaged; // sway_xwayland_unmanaged::link | 47 | struct wl_list xwayland_unmanaged; // sway_xwayland_unmanaged::link |
47 | #endif | 48 | #endif |
48 | struct wl_list drag_icons; // sway_drag_icon::link | ||
49 | 49 | ||
50 | // Includes disabled outputs | 50 | // Includes disabled outputs |
51 | struct wl_list all_outputs; // sway_output::link | 51 | struct wl_list all_outputs; // sway_output::link |
diff --git a/sway/desktop/output.c b/sway/desktop/output.c index 11de25fb..321e2a72 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c | |||
@@ -259,22 +259,6 @@ void output_unmanaged_for_each_surface(struct sway_output *output, | |||
259 | } | 259 | } |
260 | #endif | 260 | #endif |
261 | 261 | ||
262 | void output_drag_icons_for_each_surface(struct sway_output *output, | ||
263 | struct wl_list *drag_icons, sway_surface_iterator_func_t iterator, | ||
264 | void *user_data) { | ||
265 | struct sway_drag_icon *drag_icon; | ||
266 | wl_list_for_each(drag_icon, drag_icons, link) { | ||
267 | double ox = drag_icon->x - output->lx; | ||
268 | double oy = drag_icon->y - output->ly; | ||
269 | |||
270 | if (drag_icon->wlr_drag_icon->surface->mapped) { | ||
271 | output_surface_for_each_surface(output, | ||
272 | drag_icon->wlr_drag_icon->surface, ox, oy, | ||
273 | iterator, user_data); | ||
274 | } | ||
275 | } | ||
276 | } | ||
277 | |||
278 | static int scale_length(int length, int offset, float scale) { | 262 | static int scale_length(int length, int offset, float scale) { |
279 | return roundf((offset + length) * scale) - roundf(offset * scale); | 263 | return roundf((offset + length) * scale) - roundf(offset * scale); |
280 | } | 264 | } |
diff --git a/sway/desktop/render.c b/sway/desktop/render.c index 168c941b..735dddb8 100644 --- a/sway/desktop/render.c +++ b/sway/desktop/render.c | |||
@@ -184,15 +184,6 @@ static void render_unmanaged(struct render_context *ctx, struct wl_list *unmanag | |||
184 | } | 184 | } |
185 | #endif | 185 | #endif |
186 | 186 | ||
187 | static void render_drag_icons(struct render_context *ctx, struct wl_list *drag_icons) { | ||
188 | struct render_data data = { | ||
189 | .alpha = 1.0f, | ||
190 | .ctx = ctx, | ||
191 | }; | ||
192 | output_drag_icons_for_each_surface(ctx->output, drag_icons, | ||
193 | render_surface_iterator, &data); | ||
194 | } | ||
195 | |||
196 | // _box.x and .y are expected to be layout-local | 187 | // _box.x and .y are expected to be layout-local |
197 | // _box.width and .height are expected to be output-buffer-local | 188 | // _box.width and .height are expected to be output-buffer-local |
198 | void render_rect(struct render_context *ctx, const struct wlr_box *_box, | 189 | void render_rect(struct render_context *ctx, const struct wlr_box *_box, |
@@ -1131,7 +1122,6 @@ render_overlay: | |||
1131 | &output->shell_layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY]); | 1122 | &output->shell_layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY]); |
1132 | render_layer_popups(ctx, | 1123 | render_layer_popups(ctx, |
1133 | &output->shell_layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY]); | 1124 | &output->shell_layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY]); |
1134 | render_drag_icons(ctx, &root->drag_icons); | ||
1135 | 1125 | ||
1136 | renderer_end: | 1126 | renderer_end: |
1137 | pixman_region32_fini(&transformed_damage); | 1127 | pixman_region32_fini(&transformed_damage); |
diff --git a/sway/input/cursor.c b/sway/input/cursor.c index 73aef4b0..e8604193 100644 --- a/sway/input/cursor.c +++ b/sway/input/cursor.c | |||
@@ -19,12 +19,12 @@ | |||
19 | #include "log.h" | 19 | #include "log.h" |
20 | #include "util.h" | 20 | #include "util.h" |
21 | #include "sway/commands.h" | 21 | #include "sway/commands.h" |
22 | #include "sway/desktop.h" | ||
23 | #include "sway/input/cursor.h" | 22 | #include "sway/input/cursor.h" |
24 | #include "sway/input/keyboard.h" | 23 | #include "sway/input/keyboard.h" |
25 | #include "sway/input/tablet.h" | 24 | #include "sway/input/tablet.h" |
26 | #include "sway/layers.h" | 25 | #include "sway/layers.h" |
27 | #include "sway/output.h" | 26 | #include "sway/output.h" |
27 | #include "sway/scene_descriptor.h" | ||
28 | #include "sway/tree/container.h" | 28 | #include "sway/tree/container.h" |
29 | #include "sway/tree/root.h" | 29 | #include "sway/tree/root.h" |
30 | #include "sway/tree/view.h" | 30 | #include "sway/tree/view.h" |
@@ -543,12 +543,8 @@ static void handle_touch_motion(struct wl_listener *listener, void *data) { | |||
543 | if (seat->touch_id == event->touch_id) { | 543 | if (seat->touch_id == event->touch_id) { |
544 | seat->touch_x = lx; | 544 | seat->touch_x = lx; |
545 | seat->touch_y = ly; | 545 | seat->touch_y = ly; |
546 | struct sway_drag_icon *drag_icon; | 546 | |
547 | wl_list_for_each(drag_icon, &root->drag_icons, link) { | 547 | drag_icons_update_position(seat); |
548 | if (drag_icon->seat == seat) { | ||
549 | drag_icon_update_position(drag_icon); | ||
550 | } | ||
551 | } | ||
552 | } | 548 | } |
553 | 549 | ||
554 | if (cursor->simulating_pointer_from_touch) { | 550 | if (cursor->simulating_pointer_from_touch) { |
diff --git a/sway/input/seat.c b/sway/input/seat.c index cb8ac6a4..d2cd1ba4 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c | |||
@@ -18,7 +18,7 @@ | |||
18 | #include "list.h" | 18 | #include "list.h" |
19 | #include "log.h" | 19 | #include "log.h" |
20 | #include "sway/config.h" | 20 | #include "sway/config.h" |
21 | #include "sway/desktop.h" | 21 | #include "sway/scene_descriptor.h" |
22 | #include "sway/input/cursor.h" | 22 | #include "sway/input/cursor.h" |
23 | #include "sway/input/input-manager.h" | 23 | #include "sway/input/input-manager.h" |
24 | #include "sway/input/keyboard.h" | 24 | #include "sway/input/keyboard.h" |
@@ -92,6 +92,7 @@ void seat_destroy(struct sway_seat *seat) { | |||
92 | for (int i = 0; i < seat->deferred_bindings->length; i++) { | 92 | for (int i = 0; i < seat->deferred_bindings->length; i++) { |
93 | free_sway_binding(seat->deferred_bindings->items[i]); | 93 | free_sway_binding(seat->deferred_bindings->items[i]); |
94 | } | 94 | } |
95 | wlr_scene_node_destroy(&seat->scene_tree->node); | ||
95 | list_free(seat->deferred_bindings); | 96 | list_free(seat->deferred_bindings); |
96 | free(seat->prev_workspace_name); | 97 | free(seat->prev_workspace_name); |
97 | free(seat); | 98 | free(seat); |
@@ -353,25 +354,15 @@ static void handle_new_node(struct wl_listener *listener, void *data) { | |||
353 | seat_node_from_node(seat, node); | 354 | seat_node_from_node(seat, node); |
354 | } | 355 | } |
355 | 356 | ||
356 | static void drag_icon_damage_whole(struct sway_drag_icon *icon) { | 357 | static void drag_icon_update_position(struct sway_seat *seat, struct wlr_scene_node *node) { |
357 | if (!icon->wlr_drag_icon->surface->mapped) { | 358 | struct wlr_drag_icon *wlr_icon = scene_descriptor_try_get(node, SWAY_SCENE_DESC_DRAG_ICON); |
358 | return; | ||
359 | } | ||
360 | desktop_damage_surface(icon->wlr_drag_icon->surface, icon->x, icon->y, true); | ||
361 | } | ||
362 | |||
363 | void drag_icon_update_position(struct sway_drag_icon *icon) { | ||
364 | drag_icon_damage_whole(icon); | ||
365 | |||
366 | struct wlr_drag_icon *wlr_icon = icon->wlr_drag_icon; | ||
367 | struct sway_seat *seat = icon->seat; | ||
368 | struct wlr_cursor *cursor = seat->cursor->cursor; | 359 | struct wlr_cursor *cursor = seat->cursor->cursor; |
360 | |||
369 | switch (wlr_icon->drag->grab_type) { | 361 | switch (wlr_icon->drag->grab_type) { |
370 | case WLR_DRAG_GRAB_KEYBOARD: | 362 | case WLR_DRAG_GRAB_KEYBOARD: |
371 | return; | 363 | return; |
372 | case WLR_DRAG_GRAB_KEYBOARD_POINTER: | 364 | case WLR_DRAG_GRAB_KEYBOARD_POINTER: |
373 | icon->x = cursor->x + icon->dx; | 365 | wlr_scene_node_set_position(node, cursor->x, cursor->y); |
374 | icon->y = cursor->y + icon->dy; | ||
375 | break; | 366 | break; |
376 | case WLR_DRAG_GRAB_KEYBOARD_TOUCH:; | 367 | case WLR_DRAG_GRAB_KEYBOARD_TOUCH:; |
377 | struct wlr_touch_point *point = | 368 | struct wlr_touch_point *point = |
@@ -379,42 +370,15 @@ void drag_icon_update_position(struct sway_drag_icon *icon) { | |||
379 | if (point == NULL) { | 370 | if (point == NULL) { |
380 | return; | 371 | return; |
381 | } | 372 | } |
382 | icon->x = seat->touch_x + icon->dx; | 373 | wlr_scene_node_set_position(node, seat->touch_x, seat->touch_y); |
383 | icon->y = seat->touch_y + icon->dy; | ||
384 | } | 374 | } |
385 | |||
386 | drag_icon_damage_whole(icon); | ||
387 | } | ||
388 | |||
389 | static void drag_icon_handle_surface_commit(struct wl_listener *listener, | ||
390 | void *data) { | ||
391 | struct sway_drag_icon *icon = | ||
392 | wl_container_of(listener, icon, surface_commit); | ||
393 | struct wlr_drag_icon *wlr_icon = icon->wlr_drag_icon; | ||
394 | icon->dx += wlr_icon->surface->current.dx; | ||
395 | icon->dy += wlr_icon->surface->current.dy; | ||
396 | drag_icon_update_position(icon); | ||
397 | } | ||
398 | |||
399 | static void drag_icon_handle_map(struct wl_listener *listener, void *data) { | ||
400 | struct sway_drag_icon *icon = wl_container_of(listener, icon, map); | ||
401 | drag_icon_damage_whole(icon); | ||
402 | } | ||
403 | |||
404 | static void drag_icon_handle_unmap(struct wl_listener *listener, void *data) { | ||
405 | struct sway_drag_icon *icon = wl_container_of(listener, icon, unmap); | ||
406 | drag_icon_damage_whole(icon); | ||
407 | } | 375 | } |
408 | 376 | ||
409 | static void drag_icon_handle_destroy(struct wl_listener *listener, void *data) { | 377 | void drag_icons_update_position(struct sway_seat *seat) { |
410 | struct sway_drag_icon *icon = wl_container_of(listener, icon, destroy); | 378 | struct wlr_scene_node *node; |
411 | icon->wlr_drag_icon->data = NULL; | 379 | wl_list_for_each(node, &seat->drag_icons->children, link) { |
412 | wl_list_remove(&icon->link); | 380 | drag_icon_update_position(seat, node); |
413 | wl_list_remove(&icon->surface_commit.link); | 381 | } |
414 | wl_list_remove(&icon->unmap.link); | ||
415 | wl_list_remove(&icon->map.link); | ||
416 | wl_list_remove(&icon->destroy.link); | ||
417 | free(icon); | ||
418 | } | 382 | } |
419 | 383 | ||
420 | static void drag_handle_destroy(struct wl_listener *listener, void *data) { | 384 | static void drag_handle_destroy(struct wl_listener *listener, void *data) { |
@@ -486,27 +450,20 @@ static void handle_start_drag(struct wl_listener *listener, void *data) { | |||
486 | 450 | ||
487 | struct wlr_drag_icon *wlr_drag_icon = wlr_drag->icon; | 451 | struct wlr_drag_icon *wlr_drag_icon = wlr_drag->icon; |
488 | if (wlr_drag_icon != NULL) { | 452 | if (wlr_drag_icon != NULL) { |
489 | struct sway_drag_icon *icon = calloc(1, sizeof(struct sway_drag_icon)); | 453 | struct wlr_scene_tree *tree = wlr_scene_drag_icon_create(seat->drag_icons, wlr_drag_icon); |
490 | if (icon == NULL) { | 454 | if (!tree) { |
491 | sway_log(SWAY_ERROR, "Allocation failed"); | 455 | sway_log(SWAY_ERROR, "Failed to allocate a drag icon scene tree"); |
492 | return; | 456 | return; |
493 | } | 457 | } |
494 | icon->seat = seat; | ||
495 | icon->wlr_drag_icon = wlr_drag_icon; | ||
496 | wlr_drag_icon->data = icon; | ||
497 | |||
498 | icon->surface_commit.notify = drag_icon_handle_surface_commit; | ||
499 | wl_signal_add(&wlr_drag_icon->surface->events.commit, &icon->surface_commit); | ||
500 | icon->unmap.notify = drag_icon_handle_unmap; | ||
501 | wl_signal_add(&wlr_drag_icon->surface->events.unmap, &icon->unmap); | ||
502 | icon->map.notify = drag_icon_handle_map; | ||
503 | wl_signal_add(&wlr_drag_icon->surface->events.map, &icon->map); | ||
504 | icon->destroy.notify = drag_icon_handle_destroy; | ||
505 | wl_signal_add(&wlr_drag_icon->events.destroy, &icon->destroy); | ||
506 | 458 | ||
507 | wl_list_insert(&root->drag_icons, &icon->link); | 459 | if (!scene_descriptor_assign(&tree->node, SWAY_SCENE_DESC_DRAG_ICON, |
460 | wlr_drag_icon)) { | ||
461 | sway_log(SWAY_ERROR, "Failed to allocate a drag icon scene descriptor"); | ||
462 | wlr_scene_node_destroy(&tree->node); | ||
463 | return; | ||
464 | } | ||
508 | 465 | ||
509 | drag_icon_update_position(icon); | 466 | drag_icon_update_position(seat, &tree->node); |
510 | } | 467 | } |
511 | seatop_begin_default(seat); | 468 | seatop_begin_default(seat); |
512 | } | 469 | } |
@@ -553,8 +510,18 @@ struct sway_seat *seat_create(const char *seat_name) { | |||
553 | return NULL; | 510 | return NULL; |
554 | } | 511 | } |
555 | 512 | ||
513 | bool failed = false; | ||
514 | seat->scene_tree = alloc_scene_tree(root->layers.seat, &failed); | ||
515 | seat->drag_icons = alloc_scene_tree(seat->scene_tree, &failed); | ||
516 | if (failed) { | ||
517 | wlr_scene_node_destroy(&seat->scene_tree->node); | ||
518 | free(seat); | ||
519 | return NULL; | ||
520 | } | ||
521 | |||
556 | seat->wlr_seat = wlr_seat_create(server.wl_display, seat_name); | 522 | seat->wlr_seat = wlr_seat_create(server.wl_display, seat_name); |
557 | if (!sway_assert(seat->wlr_seat, "could not allocate seat")) { | 523 | if (!sway_assert(seat->wlr_seat, "could not allocate seat")) { |
524 | wlr_scene_node_destroy(&seat->scene_tree->node); | ||
558 | free(seat); | 525 | free(seat); |
559 | return NULL; | 526 | return NULL; |
560 | } | 527 | } |
@@ -562,6 +529,7 @@ struct sway_seat *seat_create(const char *seat_name) { | |||
562 | 529 | ||
563 | seat->cursor = sway_cursor_create(seat); | 530 | seat->cursor = sway_cursor_create(seat); |
564 | if (!seat->cursor) { | 531 | if (!seat->cursor) { |
532 | wlr_scene_node_destroy(&seat->scene_tree->node); | ||
565 | wlr_seat_destroy(seat->wlr_seat); | 533 | wlr_seat_destroy(seat->wlr_seat); |
566 | free(seat); | 534 | free(seat); |
567 | return NULL; | 535 | return NULL; |
diff --git a/sway/input/seatop_default.c b/sway/input/seatop_default.c index 1dce6dae..62261c77 100644 --- a/sway/input/seatop_default.c +++ b/sway/input/seatop_default.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include "sway/input/tablet.h" | 12 | #include "sway/input/tablet.h" |
13 | #include "sway/layers.h" | 13 | #include "sway/layers.h" |
14 | #include "sway/output.h" | 14 | #include "sway/output.h" |
15 | #include "sway/scene_descriptor.h" | ||
15 | #include "sway/tree/view.h" | 16 | #include "sway/tree/view.h" |
16 | #include "sway/tree/workspace.h" | 17 | #include "sway/tree/workspace.h" |
17 | #include "log.h" | 18 | #include "log.h" |
@@ -620,12 +621,7 @@ static void handle_pointer_motion(struct sway_seat *seat, uint32_t time_msec) { | |||
620 | wlr_seat_pointer_notify_clear_focus(seat->wlr_seat); | 621 | wlr_seat_pointer_notify_clear_focus(seat->wlr_seat); |
621 | } | 622 | } |
622 | 623 | ||
623 | struct sway_drag_icon *drag_icon; | 624 | drag_icons_update_position(seat); |
624 | wl_list_for_each(drag_icon, &root->drag_icons, link) { | ||
625 | if (drag_icon->seat == seat) { | ||
626 | drag_icon_update_position(drag_icon); | ||
627 | } | ||
628 | } | ||
629 | 625 | ||
630 | e->previous_node = node; | 626 | e->previous_node = node; |
631 | } | 627 | } |
@@ -655,12 +651,7 @@ static void handle_tablet_tool_motion(struct sway_seat *seat, | |||
655 | wlr_tablet_v2_tablet_tool_notify_proximity_out(tool->tablet_v2_tool); | 651 | wlr_tablet_v2_tablet_tool_notify_proximity_out(tool->tablet_v2_tool); |
656 | } | 652 | } |
657 | 653 | ||
658 | struct sway_drag_icon *drag_icon; | 654 | drag_icons_update_position(seat); |
659 | wl_list_for_each(drag_icon, &root->drag_icons, link) { | ||
660 | if (drag_icon->seat == seat) { | ||
661 | drag_icon_update_position(drag_icon); | ||
662 | } | ||
663 | } | ||
664 | 655 | ||
665 | e->previous_node = node; | 656 | e->previous_node = node; |
666 | } | 657 | } |
diff --git a/sway/tree/root.c b/sway/tree/root.c index 75fb63f1..38fcdb7c 100644 --- a/sway/tree/root.c +++ b/sway/tree/root.c | |||
@@ -49,6 +49,7 @@ struct sway_root *root_create(struct wl_display *wl_display) { | |||
49 | root->layers.floating = alloc_scene_tree(&root_scene->tree, &failed); | 49 | root->layers.floating = alloc_scene_tree(&root_scene->tree, &failed); |
50 | root->layers.fullscreen = alloc_scene_tree(&root_scene->tree, &failed); | 50 | root->layers.fullscreen = alloc_scene_tree(&root_scene->tree, &failed); |
51 | root->layers.fullscreen_global = alloc_scene_tree(&root_scene->tree, &failed); | 51 | root->layers.fullscreen_global = alloc_scene_tree(&root_scene->tree, &failed); |
52 | root->layers.seat = alloc_scene_tree(&root_scene->tree, &failed); | ||
52 | 53 | ||
53 | if (failed) { | 54 | if (failed) { |
54 | wlr_scene_node_destroy(&root_scene->tree.node); | 55 | wlr_scene_node_destroy(&root_scene->tree.node); |
@@ -63,7 +64,6 @@ struct sway_root *root_create(struct wl_display *wl_display) { | |||
63 | #if HAVE_XWAYLAND | 64 | #if HAVE_XWAYLAND |
64 | wl_list_init(&root->xwayland_unmanaged); | 65 | wl_list_init(&root->xwayland_unmanaged); |
65 | #endif | 66 | #endif |
66 | wl_list_init(&root->drag_icons); | ||
67 | wl_signal_init(&root->events.new_node); | 67 | wl_signal_init(&root->events.new_node); |
68 | root->outputs = create_list(); | 68 | root->outputs = create_list(); |
69 | root->non_desktop_outputs = create_list(); | 69 | root->non_desktop_outputs = create_list(); |