mirror of
https://github.com/swaywm/sway.git
synced 2025-11-02 09:01:40 -05:00
Fix popups
Fixes the render and container_at order for popups. Fixes #2210 For rendering: * render_view_surfaces has been renamed to render_view_toplevels * render_view_toplevels now uses output_surface_for_each_surface (which is now public), as that function uses wlr_surface_for_each_surface which doesn't descend into popups * Views now have a for_each_popup iterator, which is used by the renderer to render the focused view's popups * When rendering a popup, toplevels (xdg subsurfaces) of that popup are also rendered For sending frame done, the logic has been updated to match the rendering logic: * send_frame_done_container no longer descends into popups * for_each_popup is used to send frame done to the focused view's popups and their child toplevels For container_at: * floating_container_at is now static, which means it had to be moved higher in the file. * container_at now considers popups for the focused view before checking containers. * tiling_container_at has been introduced, so that it doesn't call container_at recursively (it would check popups recursively if it did)
This commit is contained in:
parent
f19add2702
commit
de86d65627
10 changed files with 228 additions and 57 deletions
|
|
@ -186,13 +186,36 @@ static void premultiply_alpha(float color[4], float opacity) {
|
|||
color[2] *= color[3];
|
||||
}
|
||||
|
||||
static void render_view_surfaces(struct sway_view *view,
|
||||
static void render_view_toplevels(struct sway_view *view,
|
||||
struct sway_output *output, pixman_region32_t *damage, float alpha) {
|
||||
struct render_data data = {
|
||||
.damage = damage,
|
||||
.alpha = alpha,
|
||||
};
|
||||
output_view_for_each_surface(output, view, render_surface_iterator, &data);
|
||||
// Render all toplevels without descending into popups
|
||||
output_surface_for_each_surface(output, view->surface,
|
||||
view->swayc->current.view_x, view->swayc->current.view_y,
|
||||
render_surface_iterator, &data);
|
||||
}
|
||||
|
||||
static void render_popup_iterator(struct sway_output *output,
|
||||
struct wlr_surface *surface, struct wlr_box *box, float rotation,
|
||||
void *data) {
|
||||
// Render this popup's surface
|
||||
render_surface_iterator(output, surface, box, rotation, data);
|
||||
|
||||
// Render this popup's child toplevels
|
||||
output_surface_for_each_surface(output, surface, box->x, box->y,
|
||||
render_surface_iterator, data);
|
||||
}
|
||||
|
||||
static void render_view_popups(struct sway_view *view,
|
||||
struct sway_output *output, pixman_region32_t *damage, float alpha) {
|
||||
struct render_data data = {
|
||||
.damage = damage,
|
||||
.alpha = alpha,
|
||||
};
|
||||
output_view_for_each_popup(output, view, render_popup_iterator, &data);
|
||||
}
|
||||
|
||||
static void render_saved_view(struct sway_view *view,
|
||||
|
|
@ -241,7 +264,7 @@ static void render_view(struct sway_output *output, pixman_region32_t *damage,
|
|||
if (view->swayc->instructions->length) {
|
||||
render_saved_view(view, output, damage, view->swayc->alpha);
|
||||
} else {
|
||||
render_view_surfaces(view, output, damage, view->swayc->alpha);
|
||||
render_view_toplevels(view, output, damage, view->swayc->alpha);
|
||||
}
|
||||
|
||||
if (view->using_csd) {
|
||||
|
|
@ -845,7 +868,7 @@ void output_render(struct sway_output *output, struct timespec *when,
|
|||
render_saved_view(fullscreen_con->sway_view,
|
||||
output, damage, 1.0f);
|
||||
} else {
|
||||
render_view_surfaces(fullscreen_con->sway_view,
|
||||
render_view_toplevels(fullscreen_con->sway_view,
|
||||
output, damage, 1.0f);
|
||||
}
|
||||
} else {
|
||||
|
|
@ -881,6 +904,12 @@ void output_render(struct sway_output *output, struct timespec *when,
|
|||
&output->layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]);
|
||||
}
|
||||
|
||||
struct sway_seat *seat = input_manager_current_seat(input_manager);
|
||||
struct sway_container *focus = seat_get_focus(seat);
|
||||
if (focus && focus->type == C_VIEW) {
|
||||
render_view_popups(focus->sway_view, output, damage, focus->alpha);
|
||||
}
|
||||
|
||||
render_overlay:
|
||||
render_layer(output, damage,
|
||||
&output->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue