From 2c917a8c3453ec54a80581d82bc8a520e822bd56 Mon Sep 17 00:00:00 2001
From: Kenny Levinsen <kl@kl.wtf>
Date: Mon, 22 Feb 2021 19:33:08 +0100
Subject: container: Add container_is_current_floating

Needed to check if containers are currently floating from render code,
as container_is_floating checks pending state.
---
 sway/tree/container.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

(limited to 'sway/tree')

diff --git a/sway/tree/container.c b/sway/tree/container.c
index 8c8dfb3b..79c23274 100644
--- a/sway/tree/container.c
+++ b/sway/tree/container.c
@@ -858,6 +858,17 @@ bool container_is_floating(struct sway_container *container) {
 	return false;
 }
 
+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;
+}
+
 void container_get_box(struct sway_container *container, struct wlr_box *box) {
 	box->x = container->pending.x;
 	box->y = container->pending.y;
-- 
cgit v1.2.3