Render active child last in linear tiling containers

This makes it so that if the "active" child has subsurfaces that extend
beyond the bounding box of the view, those are drawn above other
children. The idea is that you can interact with these subsurfaces
(such as GTK popovers) as long as the view is focused (or at least was
the last focused child in the container).

Relates to #4924
This commit is contained in:
Thayne McCombs 2020-03-08 22:33:42 -06:00
parent 3648b6dea2
commit f0d712840a

View file

@ -667,17 +667,9 @@ struct parent_data {
static void render_container(struct sway_output *output, static void render_container(struct sway_output *output,
pixman_region32_t *damage, struct sway_container *con, bool parent_focused); pixman_region32_t *damage, struct sway_container *con, bool parent_focused);
/** static void render_containers_linear_child(struct sway_container *child,
* Render a container's children using a L_HORIZ or L_VERT layout. struct sway_output *output, pixman_region32_t *damage,
* struct parent_data *parent) {
* Wrap child views in borders and leave child containers borderless because
* they'll apply their own borders to their children.
*/
static void render_containers_linear(struct sway_output *output,
pixman_region32_t *damage, struct parent_data *parent) {
for (int i = 0; i < parent->children->length; ++i) {
struct sway_container *child = parent->children->items[i];
if (child->view) { if (child->view) {
struct sway_view *view = child->view; struct sway_view *view = child->view;
struct border_colors *colors; struct border_colors *colors;
@ -716,6 +708,25 @@ static void render_containers_linear(struct sway_output *output,
parent->focused || child->current.focused); parent->focused || child->current.focused);
} }
} }
/**
* Render a container's children using a L_HORIZ or L_VERT layout.
*
* Wrap child views in borders and leave child containers borderless because
* they'll apply their own borders to their children.
*/
static void render_containers_linear(struct sway_output *output,
pixman_region32_t *damage, struct parent_data *parent) {
struct sway_container *active = parent->active_child;
for (int i = 0; i < parent->children->length; ++i) {
struct sway_container *child = parent->children->items[i];
if (child != active) {
render_containers_linear_child(child, output, damage, parent);
}
}
// Render the active child last, to make sure any subsurfaces for that container
// are rendered on top
render_containers_linear_child(active, output, damage, parent);
} }
/** /**