From 21ff87d72b44604d348cf71da3175b85ac5b2f75 Mon Sep 17 00:00:00 2001
From: Ryan Dwyer <ryandwyer1@gmail.com>
Date: Thu, 27 Sep 2018 22:44:57 +1000
Subject: Improve CSD logic

This does the following:

* Removes the xdg-decoration surface_commit listener. I was under the
impression the client could ignore the server's preference and set
whatever decoration they like using this protocol, but I don't think
that's right.
* Adds a listener for the xdg-decoration request_mode signal. The
protocol states that the server should respond to this with its
preference. We'll always respond with SSD here.
* Makes it so tiled views which use CSD will still have sway decorations
rendered. To do this, using_csd had to be added back to the view struct,
and the border is changed when floating or unfloating a view.
---
 include/sway/tree/view.h | 11 +++++++++++
 1 file changed, 11 insertions(+)

(limited to 'include/sway/tree')

diff --git a/include/sway/tree/view.h b/include/sway/tree/view.h
index e7aaffd7..2c7b4c2b 100644
--- a/include/sway/tree/view.h
+++ b/include/sway/tree/view.h
@@ -76,8 +76,19 @@ struct sway_view {
 	int natural_width, natural_height;
 
 	char *title_format;
+
+	// Our border types are B_NONE, B_PIXEL, B_NORMAL and B_CSD. We normally
+	// just assign this to the border property and ignore the other two.
+	// However, when a view using CSD is tiled, we want to render our own
+	// borders as well. So in this case the border property becomes one of the
+	// first three, and using_csd is true.
+	// Lastly, views can change their decoration mode at any time. When an SSD
+	// view becomes CSD without our approval, we save the SSD border type so it
+	// can be restored if/when the view returns from CSD to SSD.
 	enum sway_container_border border;
 	enum sway_container_border saved_border;
+	bool using_csd;
+
 	int border_thickness;
 	bool border_top;
 	bool border_bottom;
-- 
cgit v1.2.3