diff options
author | emersion <contact@emersion.fr> | 2018-06-09 13:26:03 +0100 |
---|---|---|
committer | emersion <contact@emersion.fr> | 2018-06-09 13:26:03 +0100 |
commit | cfd02918c0d5dc539bc8858c7d0fab378145b38c (patch) | |
tree | 97e8b185ec52b576c7411fe74bacb9f727583ecd /sway/desktop/output.c | |
parent | Merge pull request #2123 from emersion/fix-disabled-outputs (diff) | |
download | sway-cfd02918c0d5dc539bc8858c7d0fab378145b38c.tar.gz sway-cfd02918c0d5dc539bc8858c7d0fab378145b38c.tar.zst sway-cfd02918c0d5dc539bc8858c7d0fab378145b38c.zip |
Render drag icons
Diffstat (limited to 'sway/desktop/output.c')
-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, | |||
161 | } | 161 | } |
162 | } | 162 | } |
163 | 163 | ||
164 | static void drag_icons_for_each_surface(struct wl_list *drag_icons, | ||
165 | struct sway_output *output, struct root_geometry *geo, | ||
166 | wlr_surface_iterator_func_t iterator, void *user_data) { | ||
167 | struct sway_drag_icon *drag_icon; | ||
168 | wl_list_for_each(drag_icon, drag_icons, link) { | ||
169 | double ox = drag_icon->x - output->swayc->x; | ||
170 | double oy = drag_icon->y - output->swayc->y; | ||
171 | |||
172 | if (drag_icon->wlr_drag_icon->mapped) { | ||
173 | surface_for_each_surface(drag_icon->wlr_drag_icon->surface, | ||
174 | ox, oy, geo, iterator, user_data); | ||
175 | } | ||
176 | } | ||
177 | } | ||
178 | |||
164 | static void scale_box(struct wlr_box *box, float scale) { | 179 | static void scale_box(struct wlr_box *box, float scale) { |
165 | box->x *= scale; | 180 | box->x *= scale; |
166 | box->y *= scale; | 181 | box->y *= scale; |
@@ -270,6 +285,17 @@ static void render_unmanaged(struct sway_output *output, | |||
270 | render_surface_iterator, &data); | 285 | render_surface_iterator, &data); |
271 | } | 286 | } |
272 | 287 | ||
288 | static void render_drag_icons(struct sway_output *output, | ||
289 | pixman_region32_t *damage, struct wl_list *drag_icons) { | ||
290 | struct render_data data = { | ||
291 | .output = output, | ||
292 | .damage = damage, | ||
293 | .alpha = 1.0f, | ||
294 | }; | ||
295 | drag_icons_for_each_surface(drag_icons, output, &data.root_geo, | ||
296 | render_surface_iterator, &data); | ||
297 | } | ||
298 | |||
273 | static void render_rect(struct wlr_output *wlr_output, | 299 | static void render_rect(struct wlr_output *wlr_output, |
274 | pixman_region32_t *output_damage, const struct wlr_box *_box, | 300 | pixman_region32_t *output_damage, const struct wlr_box *_box, |
275 | float color[static 4]) { | 301 | float color[static 4]) { |
@@ -911,6 +937,7 @@ static void render_output(struct sway_output *output, struct timespec *when, | |||
911 | } | 937 | } |
912 | render_layer(output, damage, | 938 | render_layer(output, damage, |
913 | &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY]); | 939 | &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY]); |
940 | render_drag_icons(output, damage, &root_container.sway_root->drag_icons); | ||
914 | 941 | ||
915 | renderer_end: | 942 | renderer_end: |
916 | if (root_container.sway_root->debug_tree) { | 943 | if (root_container.sway_root->debug_tree) { |
@@ -961,6 +988,12 @@ static void send_frame_done_unmanaged(struct send_frame_done_data *data, | |||
961 | send_frame_done_iterator, data); | 988 | send_frame_done_iterator, data); |
962 | } | 989 | } |
963 | 990 | ||
991 | static void send_frame_done_drag_icons(struct send_frame_done_data *data, | ||
992 | struct wl_list *drag_icons) { | ||
993 | drag_icons_for_each_surface(drag_icons, data->output, &data->root_geo, | ||
994 | send_frame_done_iterator, data); | ||
995 | } | ||
996 | |||
964 | static void send_frame_done_container_iterator(struct sway_container *con, | 997 | static void send_frame_done_container_iterator(struct sway_container *con, |
965 | void *_data) { | 998 | void *_data) { |
966 | struct send_frame_done_data *data = _data; | 999 | struct send_frame_done_data *data = _data; |
@@ -1014,6 +1047,7 @@ static void send_frame_done(struct sway_output *output, struct timespec *when) { | |||
1014 | 1047 | ||
1015 | send_frame_done_layer(&data, | 1048 | send_frame_done_layer(&data, |
1016 | &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY]); | 1049 | &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY]); |
1050 | send_frame_done_drag_icons(&data, &root_container.sway_root->drag_icons); | ||
1017 | } | 1051 | } |
1018 | 1052 | ||
1019 | static void damage_handle_frame(struct wl_listener *listener, void *data) { | 1053 | static void damage_handle_frame(struct wl_listener *listener, void *data) { |