diff options
Diffstat (limited to 'sway/desktop/output.c')
-rw-r--r-- | sway/desktop/output.c | 52 |
1 files changed, 49 insertions, 3 deletions
diff --git a/sway/desktop/output.c b/sway/desktop/output.c index 31b53213..4c9d978c 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c | |||
@@ -119,7 +119,7 @@ static void output_for_each_surface_iterator(struct wlr_surface *surface, | |||
119 | data->user_data); | 119 | data->user_data); |
120 | } | 120 | } |
121 | 121 | ||
122 | static void output_surface_for_each_surface(struct sway_output *output, | 122 | void output_surface_for_each_surface(struct sway_output *output, |
123 | struct wlr_surface *surface, double ox, double oy, | 123 | struct wlr_surface *surface, double ox, double oy, |
124 | sway_surface_iterator_func_t iterator, void *user_data) { | 124 | sway_surface_iterator_func_t iterator, void *user_data) { |
125 | struct surface_iterator_data data = { | 125 | struct surface_iterator_data data = { |
@@ -155,6 +155,23 @@ void output_view_for_each_surface(struct sway_output *output, | |||
155 | output_for_each_surface_iterator, &data); | 155 | output_for_each_surface_iterator, &data); |
156 | } | 156 | } |
157 | 157 | ||
158 | void output_view_for_each_popup(struct sway_output *output, | ||
159 | struct sway_view *view, sway_surface_iterator_func_t iterator, | ||
160 | void *user_data) { | ||
161 | struct surface_iterator_data data = { | ||
162 | .user_iterator = iterator, | ||
163 | .user_data = user_data, | ||
164 | .output = output, | ||
165 | .ox = view->swayc->current.view_x - output->swayc->current.swayc_x, | ||
166 | .oy = view->swayc->current.view_y - output->swayc->current.swayc_y, | ||
167 | .width = view->swayc->current.view_width, | ||
168 | .height = view->swayc->current.view_height, | ||
169 | .rotation = 0, // TODO | ||
170 | }; | ||
171 | |||
172 | view_for_each_popup(view, output_for_each_surface_iterator, &data); | ||
173 | } | ||
174 | |||
158 | void output_layer_for_each_surface(struct sway_output *output, | 175 | void output_layer_for_each_surface(struct sway_output *output, |
159 | struct wl_list *layer_surfaces, sway_surface_iterator_func_t iterator, | 176 | struct wl_list *layer_surfaces, sway_surface_iterator_func_t iterator, |
160 | void *user_data) { | 177 | void *user_data) { |
@@ -295,8 +312,9 @@ static void send_frame_done_container_iterator(struct sway_container *con, | |||
295 | return; | 312 | return; |
296 | } | 313 | } |
297 | 314 | ||
298 | output_view_for_each_surface(data->output, con->sway_view, | 315 | // Toplevels only |
299 | send_frame_done_iterator, data->when); | 316 | output_surface_for_each_surface(data->output, con->sway_view->surface, |
317 | con->x, con->y, send_frame_done_iterator, data->when); | ||
300 | } | 318 | } |
301 | 319 | ||
302 | static void send_frame_done_container(struct sway_output *output, | 320 | static void send_frame_done_container(struct sway_output *output, |
@@ -309,6 +327,27 @@ static void send_frame_done_container(struct sway_output *output, | |||
309 | send_frame_done_container_iterator, &data); | 327 | send_frame_done_container_iterator, &data); |
310 | } | 328 | } |
311 | 329 | ||
330 | static void send_frame_done_popup_iterator(struct sway_output *output, | ||
331 | struct wlr_surface *surface, struct wlr_box *box, float rotation, | ||
332 | void *data) { | ||
333 | // Send frame done to this popup's surface | ||
334 | send_frame_done_iterator(output, surface, box, rotation, data); | ||
335 | |||
336 | // Send frame done to this popup's child toplevels | ||
337 | output_surface_for_each_surface(output, surface, box->x, box->y, | ||
338 | send_frame_done_iterator, data); | ||
339 | } | ||
340 | |||
341 | static void send_frame_done_popups(struct sway_output *output, | ||
342 | struct sway_view *view, struct timespec *when) { | ||
343 | struct send_frame_done_data data = { | ||
344 | .output = output, | ||
345 | .when = when, | ||
346 | }; | ||
347 | output_view_for_each_popup(output, view, | ||
348 | send_frame_done_popup_iterator, &data); | ||
349 | } | ||
350 | |||
312 | static void send_frame_done(struct sway_output *output, struct timespec *when) { | 351 | static void send_frame_done(struct sway_output *output, struct timespec *when) { |
313 | if (output_has_opaque_overlay_layer_surface(output)) { | 352 | if (output_has_opaque_overlay_layer_surface(output)) { |
314 | goto send_frame_overlay; | 353 | goto send_frame_overlay; |
@@ -346,6 +385,13 @@ static void send_frame_done(struct sway_output *output, struct timespec *when) { | |||
346 | &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP], when); | 385 | &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP], when); |
347 | } | 386 | } |
348 | 387 | ||
388 | struct sway_seat *seat = input_manager_current_seat(input_manager); | ||
389 | struct sway_container *focus = seat_get_focus(seat); | ||
390 | if (focus && focus->type == C_VIEW) { | ||
391 | send_frame_done_popups(output, focus->sway_view, when); | ||
392 | } | ||
393 | |||
394 | |||
349 | send_frame_overlay: | 395 | send_frame_overlay: |
350 | send_frame_done_layer(output, | 396 | send_frame_done_layer(output, |
351 | &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY], when); | 397 | &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY], when); |