summaryrefslogtreecommitdiffstats
path: root/include/sway/tree/view.h
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2018-10-03 13:03:06 +0200
committerLibravatar GitHub <noreply@github.com>2018-10-03 13:03:06 +0200
commit06c214a800cab9119ae4b04371e3f6bbca8a0550 (patch)
treeeed325e37d02fa71858a33e71ef33961395dd16f /include/sway/tree/view.h
parentMerge pull request #2755 from RyanDwyer/fix-tiling-criteria (diff)
parentRemove server-decoration assumption if view supports xdg-decoration (diff)
downloadsway-06c214a800cab9119ae4b04371e3f6bbca8a0550.tar.gz
sway-06c214a800cab9119ae4b04371e3f6bbca8a0550.tar.zst
sway-06c214a800cab9119ae4b04371e3f6bbca8a0550.zip
Merge pull request #2703 from RyanDwyer/csd-border
Add CSD to border modes
Diffstat (limited to 'include/sway/tree/view.h')
-rw-r--r--include/sway/tree/view.h32
1 files changed, 26 insertions, 6 deletions
diff --git a/include/sway/tree/view.h b/include/sway/tree/view.h
index 56ccbc6c..028be536 100644
--- a/include/sway/tree/view.h
+++ b/include/sway/tree/view.h
@@ -11,6 +11,7 @@
11#include "sway/input/seat.h" 11#include "sway/input/seat.h"
12 12
13struct sway_container; 13struct sway_container;
14struct sway_xdg_decoration;
14 15
15enum sway_view_type { 16enum sway_view_type {
16 SWAY_VIEW_XDG_SHELL_V6, 17 SWAY_VIEW_XDG_SHELL_V6,
@@ -44,7 +45,6 @@ struct sway_view_impl {
44 void (*set_tiled)(struct sway_view *view, bool tiled); 45 void (*set_tiled)(struct sway_view *view, bool tiled);
45 void (*set_fullscreen)(struct sway_view *view, bool fullscreen); 46 void (*set_fullscreen)(struct sway_view *view, bool fullscreen);
46 bool (*wants_floating)(struct sway_view *view); 47 bool (*wants_floating)(struct sway_view *view);
47 bool (*has_client_side_decorations)(struct sway_view *view);
48 void (*for_each_surface)(struct sway_view *view, 48 void (*for_each_surface)(struct sway_view *view,
49 wlr_surface_iterator_func_t iterator, void *user_data); 49 wlr_surface_iterator_func_t iterator, void *user_data);
50 void (*for_each_popup)(struct sway_view *view, 50 void (*for_each_popup)(struct sway_view *view,
@@ -60,6 +60,7 @@ struct sway_view {
60 60
61 struct sway_container *container; // NULL if unmapped and transactions finished 61 struct sway_container *container; // NULL if unmapped and transactions finished
62 struct wlr_surface *surface; // NULL for unmapped views 62 struct wlr_surface *surface; // NULL for unmapped views
63 struct sway_xdg_decoration *xdg_decoration;
63 64
64 pid_t pid; 65 pid_t pid;
65 66
@@ -75,13 +76,24 @@ struct sway_view {
75 int natural_width, natural_height; 76 int natural_width, natural_height;
76 77
77 char *title_format; 78 char *title_format;
79
80 // Our border types are B_NONE, B_PIXEL, B_NORMAL and B_CSD. We normally
81 // just assign this to the border property and ignore the other two.
82 // However, when a view using CSD is tiled, we want to render our own
83 // borders as well. So in this case the border property becomes one of the
84 // first three, and using_csd is true.
85 // Lastly, views can change their decoration mode at any time. When an SSD
86 // view becomes CSD without our approval, we save the SSD border type so it
87 // can be restored if/when the view returns from CSD to SSD.
78 enum sway_container_border border; 88 enum sway_container_border border;
89 enum sway_container_border saved_border;
90 bool using_csd;
91
79 int border_thickness; 92 int border_thickness;
80 bool border_top; 93 bool border_top;
81 bool border_bottom; 94 bool border_bottom;
82 bool border_left; 95 bool border_left;
83 bool border_right; 96 bool border_right;
84 bool using_csd;
85 97
86 struct timespec urgent; 98 struct timespec urgent;
87 bool allow_request_urgent; 99 bool allow_request_urgent;
@@ -127,8 +139,6 @@ struct sway_view {
127struct sway_xdg_shell_v6_view { 139struct sway_xdg_shell_v6_view {
128 struct sway_view view; 140 struct sway_view view;
129 141
130 enum wlr_server_decoration_manager_mode deco_mode;
131
132 struct wl_listener commit; 142 struct wl_listener commit;
133 struct wl_listener request_move; 143 struct wl_listener request_move;
134 struct wl_listener request_resize; 144 struct wl_listener request_resize;
@@ -145,8 +155,6 @@ struct sway_xdg_shell_v6_view {
145struct sway_xdg_shell_view { 155struct sway_xdg_shell_view {
146 struct sway_view view; 156 struct sway_view view;
147 157
148 enum wlr_server_decoration_manager_mode deco_mode;
149
150 struct wl_listener commit; 158 struct wl_listener commit;
151 struct wl_listener request_move; 159 struct wl_listener request_move;
152 struct wl_listener request_resize; 160 struct wl_listener request_resize;
@@ -175,6 +183,7 @@ struct sway_xwayland_view {
175 struct wl_listener set_role; 183 struct wl_listener set_role;
176 struct wl_listener set_window_type; 184 struct wl_listener set_window_type;
177 struct wl_listener set_hints; 185 struct wl_listener set_hints;
186 struct wl_listener set_decorations;
178 struct wl_listener map; 187 struct wl_listener map;
179 struct wl_listener unmap; 188 struct wl_listener unmap;
180 struct wl_listener destroy; 189 struct wl_listener destroy;
@@ -275,6 +284,17 @@ void view_set_activated(struct sway_view *view, bool activated);
275 */ 284 */
276void view_request_activate(struct sway_view *view); 285void view_request_activate(struct sway_view *view);
277 286
287/**
288 * If possible, instructs the client to change their decoration mode.
289 */
290void view_set_csd_from_server(struct sway_view *view, bool enabled);
291
292/**
293 * Updates the view's border setting when the client unexpectedly changes their
294 * decoration mode.
295 */
296void view_update_csd_from_client(struct sway_view *view, bool enabled);
297
278void view_set_tiled(struct sway_view *view, bool tiled); 298void view_set_tiled(struct sway_view *view, bool tiled);
279 299
280void view_close(struct sway_view *view); 300void view_close(struct sway_view *view);