Render border before view

This makes it so that if a subsurface of the view overlaps the border,
the border is drawn underneath.
This commit is contained in:
Thayne McCombs 2020-03-01 00:15:00 -07:00
parent f2a60d2d05
commit 3bb6cca045

View file

@ -307,22 +307,8 @@ static void render_saved_view(struct sway_view *view,
// https://github.com/swaywm/sway/pull/4465#discussion_r321082059
}
/**
* Render a view's surface and left/bottom/right borders.
*/
static void render_view(struct sway_output *output, pixman_region32_t *damage,
static void render_view_border(struct sway_output *output, pixman_region32_t *damage,
struct sway_container *con, struct border_colors *colors) {
struct sway_view *view = con->view;
if (view->saved_buffer) {
render_saved_view(view, output, damage, view->container->alpha);
} else if (view->surface) {
render_view_toplevels(view, output, damage, view->container->alpha);
}
if (con->current.border == B_NONE || con->current.border == B_CSD) {
return;
}
struct wlr_box box;
float output_scale = output->wlr_output->scale;
float color[4];
@ -374,6 +360,25 @@ static void render_view(struct sway_output *output, pixman_region32_t *damage,
}
}
/**
* Render a view's surface and left/bottom/right borders.
*/
static void render_view(struct sway_output *output, pixman_region32_t *damage,
struct sway_container *con, struct border_colors *colors) {
// Draw border first, so that if subsurfaces overlap the border is drawn under it
if (con->current.border != B_NONE && con->current.border != B_CSD) {
render_view_border(output, damage, con, colors);
}
struct sway_view *view = con->view;
if (view->saved_buffer) {
render_saved_view(view, output, damage, view->container->alpha);
} else if (view->surface) {
render_view_toplevels(view, output, damage, view->container->alpha);
}
}
/**
* Render a titlebar.
*