From 017bb7d7521f68d37bfe656c10f45edbcc92dd61 Mon Sep 17 00:00:00 2001
From: Palanix <palanixyt@gmail.com>
Date: Wed, 31 Aug 2022 06:11:07 +0200
Subject: fix flickering when resizing/spawning windows

Fixes: https://github.com/djpohly/dwl/issues/306
---
 client.h | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

(limited to 'client.h')

diff --git a/client.h b/client.h
index c18d01a..4dc9e1a 100644
--- a/client.h
+++ b/client.h
@@ -197,6 +197,21 @@ client_is_mapped(Client *c)
 	return c->surface.xdg->mapped;
 }
 
+static inline int
+client_is_rendered_on_mon(Client *c, Monitor *m)
+{
+	/* This is needed for when you don't want to check formal assignment,
+	 * but rather actual displaying of the pixels.
+	 * Usually VISIBLEON suffices and is also faster. */
+	struct wlr_surface_output *s;
+	if (!c->scene->node.enabled)
+		return 0;
+	wl_list_for_each(s, &client_surface(c)->current_outputs, link)
+		if (s->output == m->wlr_output)
+			return 1;
+	return 0;
+}
+
 static inline int
 client_is_unmanaged(Client *c)
 {
-- 
cgit v1.2.1