This commit is contained in:
Scott Leggett 2026-06-03 13:19:26 +02:00 committed by GitHub
commit 4fc260e480
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -126,6 +126,17 @@ static bool container_is_focused(struct sway_container *con, void *data) {
return con->current.focused; return con->current.focused;
} }
static bool container_is_current_floating(struct sway_container *container) {
if (!container->current.parent && container->current.workspace &&
list_find(container->current.workspace->floating, container) != -1) {
return true;
}
if (container->scratchpad) {
return true;
}
return false;
}
static bool container_has_focused_child(struct sway_container *con) { static bool container_has_focused_child(struct sway_container *con) {
return container_find_child(con, container_is_focused, NULL); return container_find_child(con, container_is_focused, NULL);
} }
@ -134,7 +145,7 @@ static bool container_is_current_parent_focused(struct sway_container *con) {
if (con->current.parent) { if (con->current.parent) {
struct sway_container *parent = con->current.parent; struct sway_container *parent = con->current.parent;
return parent->current.focused || container_is_current_parent_focused(parent); return parent->current.focused || container_is_current_parent_focused(parent);
} else if (con->current.workspace) { } else if (con->current.workspace && !container_is_current_floating(con)) {
struct sway_workspace *ws = con->current.workspace; struct sway_workspace *ws = con->current.workspace;
return ws->current.focused; return ws->current.focused;
} }
@ -173,17 +184,6 @@ static struct border_colors *container_get_current_colors(
return colors; return colors;
} }
static bool container_is_current_floating(struct sway_container *container) {
if (!container->current.parent && container->current.workspace &&
list_find(container->current.workspace->floating, container) != -1) {
return true;
}
if (container->scratchpad) {
return true;
}
return false;
}
// scene rect wants premultiplied colors // scene rect wants premultiplied colors
static void scene_rect_set_color(struct wlr_scene_rect *rect, static void scene_rect_set_color(struct wlr_scene_rect *rect,
const float color[4], float opacity) { const float color[4], float opacity) {