diff options
author | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-09-24 20:54:57 +1000 |
---|---|---|
committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-09-27 22:51:37 +1000 |
commit | 7b138e5ef0f679c9bb0078019d7c9c63fef36273 (patch) | |
tree | 2cdbeb394889065e0606a1fcbe38c1e99e25d260 /sway/desktop/xdg_shell.c | |
parent | Merge pull request #2717 from ianyfan/tablet-config (diff) | |
download | sway-7b138e5ef0f679c9bb0078019d7c9c63fef36273.tar.gz sway-7b138e5ef0f679c9bb0078019d7c9c63fef36273.tar.zst sway-7b138e5ef0f679c9bb0078019d7c9c63fef36273.zip |
Add CSD to border modes
This replaces view.using_csd with a new border mode: B_CSD. This also
removes sway_xdg_shell{_v6}_view.deco_mode and
view->has_client_side_decorations as we can now get these from the
border.
You can use `border toggle` to cycle through the modes including CSD, or
use `border csd` to set it directly. The client must support the
xdg-decoration protocol, and the only client I know of that does is the
example in wlroots.
If the client switches from SSD to CSD without us expecting it (via the
server-decoration protocol), we stash the previous border type into
view.saved_border so we can restore it if the client returns to SSD. I
haven't found a way to test this though.
Diffstat (limited to 'sway/desktop/xdg_shell.c')
-rw-r--r-- | sway/desktop/xdg_shell.c | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/sway/desktop/xdg_shell.c b/sway/desktop/xdg_shell.c index 6d1ccdd7..d563edae 100644 --- a/sway/desktop/xdg_shell.c +++ b/sway/desktop/xdg_shell.c | |||
@@ -175,15 +175,6 @@ static bool wants_floating(struct sway_view *view) { | |||
175 | || toplevel->parent; | 175 | || toplevel->parent; |
176 | } | 176 | } |
177 | 177 | ||
178 | static bool has_client_side_decorations(struct sway_view *view) { | ||
179 | struct sway_xdg_shell_view *xdg_shell_view = | ||
180 | xdg_shell_view_from_view(view); | ||
181 | if (xdg_shell_view == NULL) { | ||
182 | return true; | ||
183 | } | ||
184 | return xdg_shell_view->deco_mode != WLR_SERVER_DECORATION_MANAGER_MODE_SERVER; | ||
185 | } | ||
186 | |||
187 | static void for_each_surface(struct sway_view *view, | 178 | static void for_each_surface(struct sway_view *view, |
188 | wlr_surface_iterator_func_t iterator, void *user_data) { | 179 | wlr_surface_iterator_func_t iterator, void *user_data) { |
189 | if (xdg_shell_view_from_view(view) == NULL) { | 180 | if (xdg_shell_view_from_view(view) == NULL) { |
@@ -240,7 +231,6 @@ static const struct sway_view_impl view_impl = { | |||
240 | .set_tiled = set_tiled, | 231 | .set_tiled = set_tiled, |
241 | .set_fullscreen = set_fullscreen, | 232 | .set_fullscreen = set_fullscreen, |
242 | .wants_floating = wants_floating, | 233 | .wants_floating = wants_floating, |
243 | .has_client_side_decorations = has_client_side_decorations, | ||
244 | .for_each_surface = for_each_surface, | 234 | .for_each_surface = for_each_surface, |
245 | .for_each_popup = for_each_popup, | 235 | .for_each_popup = for_each_popup, |
246 | .close = _close, | 236 | .close = _close, |
@@ -385,15 +375,13 @@ static void handle_map(struct wl_listener *listener, void *data) { | |||
385 | view->natural_height = view->wlr_xdg_surface->surface->current.height; | 375 | view->natural_height = view->wlr_xdg_surface->surface->current.height; |
386 | } | 376 | } |
387 | 377 | ||
378 | view_map(view, view->wlr_xdg_surface->surface); | ||
379 | |||
388 | struct sway_server_decoration *deco = | 380 | struct sway_server_decoration *deco = |
389 | decoration_from_surface(xdg_surface->surface); | 381 | decoration_from_surface(xdg_surface->surface); |
390 | if (deco != NULL) { | 382 | bool csd = !deco || deco->wlr_server_decoration->mode == |
391 | xdg_shell_view->deco_mode = deco->wlr_server_decoration->mode; | 383 | WLR_SERVER_DECORATION_MANAGER_MODE_CLIENT; |
392 | } else { | 384 | view_set_csd_from_client(view, csd); |
393 | xdg_shell_view->deco_mode = WLR_SERVER_DECORATION_MANAGER_MODE_CLIENT; | ||
394 | } | ||
395 | |||
396 | view_map(view, view->wlr_xdg_surface->surface); | ||
397 | 385 | ||
398 | if (xdg_surface->toplevel->client_pending.fullscreen) { | 386 | if (xdg_surface->toplevel->client_pending.fullscreen) { |
399 | container_set_fullscreen(view->container, true); | 387 | container_set_fullscreen(view->container, true); |