diff options
author | Drew DeVault <sir@cmpwn.com> | 2018-08-06 11:32:17 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-06 11:32:17 -0400 |
commit | d8b65193c493e5826383a08593395a598ce4b503 (patch) | |
tree | 97a1da416928ad8d7d3cca2e3e7dd72c39f924b6 /sway/desktop/xdg_shell.c | |
parent | 1a8bee68b40f641f57adc97d0f2ffcf5e2ed544d (diff) | |
parent | d2ac48f9206e9962ab47f337f824ce7f69ffb9c1 (diff) |
Merge pull request #2268 from emersion/server-decoration-borders
Enable borders on floating SSD xdg-shell views
Diffstat (limited to 'sway/desktop/xdg_shell.c')
-rw-r--r-- | sway/desktop/xdg_shell.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/sway/desktop/xdg_shell.c b/sway/desktop/xdg_shell.c index b364663d..3b73f99c 100644 --- a/sway/desktop/xdg_shell.c +++ b/sway/desktop/xdg_shell.c @@ -6,6 +6,7 @@ #include <wlr/types/wlr_xdg_shell.h> #include <wlr/util/edges.h> #include "log.h" +#include "sway/decoration.h" #include "sway/input/input-manager.h" #include "sway/input/seat.h" #include "sway/server.h" @@ -170,6 +171,15 @@ static bool wants_floating(struct sway_view *view) { || toplevel->parent; } +static bool has_client_side_decorations(struct sway_view *view) { + struct sway_xdg_shell_view *xdg_shell_view = + xdg_shell_view_from_view(view); + if (xdg_shell_view == NULL) { + return true; + } + return xdg_shell_view->deco_mode != WLR_SERVER_DECORATION_MANAGER_MODE_SERVER; +} + static void for_each_surface(struct sway_view *view, wlr_surface_iterator_func_t iterator, void *user_data) { if (xdg_shell_view_from_view(view) == NULL) { @@ -226,6 +236,7 @@ static const struct sway_view_impl view_impl = { .set_tiled = set_tiled, .set_fullscreen = set_fullscreen, .wants_floating = wants_floating, + .has_client_side_decorations = has_client_side_decorations, .for_each_surface = for_each_surface, .for_each_popup = for_each_popup, .close = _close, @@ -357,6 +368,14 @@ static void handle_map(struct wl_listener *listener, void *data) { view->natural_height = view->wlr_xdg_surface->surface->current.height; } + struct sway_server_decoration *deco = + decoration_from_surface(xdg_surface->surface); + if (deco != NULL) { + xdg_shell_view->deco_mode = deco->wlr_server_decoration->mode; + } else { + xdg_shell_view->deco_mode = WLR_SERVER_DECORATION_MANAGER_MODE_CLIENT; + } + view_map(view, view->wlr_xdg_surface->surface); if (xdg_surface->toplevel->client_pending.fullscreen) { |