diff options
author | vil <vil@vil.lv> | 2018-06-17 17:37:58 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-17 17:37:58 -0400 |
commit | 8884a063c1c11cb1e2370c3f172fcb9ebd59c991 (patch) | |
tree | 7f2fc2f6cd4ba948df2e9e119e2e109973f638db /sway/desktop | |
parent | 54a5ee2747c3eae35e4fec400d1efc6ee7509a38 (diff) | |
parent | 7c44ca95f9aef526c6cfa8c2d3704af39755f38b (diff) |
Merge branch 'master' into mark-pool-buffers-busy
Diffstat (limited to 'sway/desktop')
-rw-r--r-- | sway/desktop/output.c | 40 |
1 files changed, 37 insertions, 3 deletions
diff --git a/sway/desktop/output.c b/sway/desktop/output.c index bd1d760d..d4115be8 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; @@ -225,7 +240,8 @@ static void render_surface_iterator(struct wlr_surface *surface, int sx, int sy, pixman_region32_t *output_damage = data->damage; float alpha = data->alpha; - if (!wlr_surface_has_buffer(surface)) { + struct wlr_texture *texture = wlr_surface_get_texture(surface); + if (texture == NULL) { return; } @@ -244,8 +260,7 @@ static void render_surface_iterator(struct wlr_surface *surface, int sx, int sy, wlr_matrix_project_box(matrix, &box, transform, rotation, wlr_output->transform_matrix); - render_texture(wlr_output, output_damage, surface->texture, &box, matrix, - alpha); + render_texture(wlr_output, output_damage, texture, &box, matrix, alpha); } static void render_layer(struct sway_output *output, @@ -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) { |