diff options
Diffstat (limited to 'sway/desktop')
-rw-r--r-- | sway/desktop/output.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/sway/desktop/output.c b/sway/desktop/output.c index bd1d760d..29666c00 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c @@ -161,6 +161,21 @@ static void unmanaged_for_each_surface(struct wl_list *unmanaged, } } +static void drag_icons_for_each_surface(struct wl_list *drag_icons, + struct sway_output *output, struct root_geometry *geo, + wlr_surface_iterator_func_t iterator, void *user_data) { + struct sway_drag_icon *drag_icon; + wl_list_for_each(drag_icon, drag_icons, link) { + double ox = drag_icon->x - output->swayc->x; + double oy = drag_icon->y - output->swayc->y; + + if (drag_icon->wlr_drag_icon->mapped) { + surface_for_each_surface(drag_icon->wlr_drag_icon->surface, + ox, oy, geo, iterator, user_data); + } + } +} + static void scale_box(struct wlr_box *box, float scale) { box->x *= scale; box->y *= scale; @@ -270,6 +285,17 @@ static void render_unmanaged(struct sway_output *output, render_surface_iterator, &data); } +static void render_drag_icons(struct sway_output *output, + pixman_region32_t *damage, struct wl_list *drag_icons) { + struct render_data data = { + .output = output, + .damage = damage, + .alpha = 1.0f, + }; + drag_icons_for_each_surface(drag_icons, output, &data.root_geo, + render_surface_iterator, &data); +} + static void render_rect(struct wlr_output *wlr_output, pixman_region32_t *output_damage, const struct wlr_box *_box, float color[static 4]) { @@ -911,6 +937,7 @@ static void render_output(struct sway_output *output, struct timespec *when, } render_layer(output, damage, &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY]); + render_drag_icons(output, damage, &root_container.sway_root->drag_icons); renderer_end: if (root_container.sway_root->debug_tree) { @@ -961,6 +988,12 @@ static void send_frame_done_unmanaged(struct send_frame_done_data *data, send_frame_done_iterator, data); } +static void send_frame_done_drag_icons(struct send_frame_done_data *data, + struct wl_list *drag_icons) { + drag_icons_for_each_surface(drag_icons, data->output, &data->root_geo, + send_frame_done_iterator, data); +} + static void send_frame_done_container_iterator(struct sway_container *con, void *_data) { struct send_frame_done_data *data = _data; @@ -1014,6 +1047,7 @@ static void send_frame_done(struct sway_output *output, struct timespec *when) { send_frame_done_layer(&data, &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY]); + send_frame_done_drag_icons(&data, &root_container.sway_root->drag_icons); } static void damage_handle_frame(struct wl_listener *listener, void *data) { |