aboutsummaryrefslogtreecommitdiff
path: root/sway/desktop/render.c
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2018-08-02 09:46:53 -0400
committerGitHub <noreply@github.com>2018-08-02 09:46:53 -0400
commit3eda76de4869984eed7b9476b9e011b6981ecbe5 (patch)
treebecf792130769384e5a104cef540b1f2d7da00b4 /sway/desktop/render.c
parentea14ef40955a94e21a5198d2469e54fe1e6056e5 (diff)
parent787f08da7ff9ecb325def2e3a44dc5043d7e2753 (diff)
Merge pull request #2407 from RyanDwyer/fix-popups-v3
Fix popups v3
Diffstat (limited to 'sway/desktop/render.c')
-rw-r--r--sway/desktop/render.c38
1 files changed, 34 insertions, 4 deletions
diff --git a/sway/desktop/render.c b/sway/desktop/render.c
index f0e47c95..cdac9c72 100644
--- a/sway/desktop/render.c
+++ b/sway/desktop/render.c
@@ -186,13 +186,37 @@ 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 - output->wlr_output->lx,
+ view->swayc->current.view_y - output->wlr_output->ly,
+ 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,
@@ -239,7 +263,7 @@ static void render_view(struct sway_output *output, pixman_region32_t *damage,
if (view->saved_buffer) {
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) {
@@ -843,7 +867,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 {
@@ -879,6 +903,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]);