aboutsummaryrefslogtreecommitdiffstats
path: root/sway/desktop/xdg_shell.c
diff options
context:
space:
mode:
authorLibravatar emersion <contact@emersion.fr>2018-07-29 18:31:10 +0100
committerLibravatar emersion <contact@emersion.fr>2018-08-06 15:20:30 +0100
commit9d578e0a0f08e053dfc1982e32d9fda172b0087f (patch)
tree941f76c80794a5665264bd65ea1467490b1d615e /sway/desktop/xdg_shell.c
parentListen to server-decoration mode changes (diff)
downloadsway-9d578e0a0f08e053dfc1982e32d9fda172b0087f.tar.gz
sway-9d578e0a0f08e053dfc1982e32d9fda172b0087f.tar.zst
sway-9d578e0a0f08e053dfc1982e32d9fda172b0087f.zip
Handle views created after decoration mode is sent for xdg-shell
Diffstat (limited to 'sway/desktop/xdg_shell.c')
-rw-r--r--sway/desktop/xdg_shell.c19
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 @@
6#include <wlr/types/wlr_xdg_shell.h> 6#include <wlr/types/wlr_xdg_shell.h>
7#include <wlr/util/edges.h> 7#include <wlr/util/edges.h>
8#include "log.h" 8#include "log.h"
9#include "sway/decoration.h"
9#include "sway/input/input-manager.h" 10#include "sway/input/input-manager.h"
10#include "sway/input/seat.h" 11#include "sway/input/seat.h"
11#include "sway/server.h" 12#include "sway/server.h"
@@ -170,6 +171,15 @@ static bool wants_floating(struct sway_view *view) {
170 || toplevel->parent; 171 || toplevel->parent;
171} 172}
172 173
174static bool has_client_side_decorations(struct sway_view *view) {
175 struct sway_xdg_shell_view *xdg_shell_view =
176 xdg_shell_view_from_view(view);
177 if (xdg_shell_view == NULL) {
178 return true;
179 }
180 return xdg_shell_view->deco_mode != WLR_SERVER_DECORATION_MANAGER_MODE_SERVER;
181}
182
173static void for_each_surface(struct sway_view *view, 183static void for_each_surface(struct sway_view *view,
174 wlr_surface_iterator_func_t iterator, void *user_data) { 184 wlr_surface_iterator_func_t iterator, void *user_data) {
175 if (xdg_shell_view_from_view(view) == NULL) { 185 if (xdg_shell_view_from_view(view) == NULL) {
@@ -226,6 +236,7 @@ static const struct sway_view_impl view_impl = {
226 .set_tiled = set_tiled, 236 .set_tiled = set_tiled,
227 .set_fullscreen = set_fullscreen, 237 .set_fullscreen = set_fullscreen,
228 .wants_floating = wants_floating, 238 .wants_floating = wants_floating,
239 .has_client_side_decorations = has_client_side_decorations,
229 .for_each_surface = for_each_surface, 240 .for_each_surface = for_each_surface,
230 .for_each_popup = for_each_popup, 241 .for_each_popup = for_each_popup,
231 .close = _close, 242 .close = _close,
@@ -357,6 +368,14 @@ static void handle_map(struct wl_listener *listener, void *data) {
357 view->natural_height = view->wlr_xdg_surface->surface->current.height; 368 view->natural_height = view->wlr_xdg_surface->surface->current.height;
358 } 369 }
359 370
371 struct sway_server_decoration *deco =
372 decoration_from_surface(xdg_surface->surface);
373 if (deco != NULL) {
374 xdg_shell_view->deco_mode = deco->wlr_server_decoration->mode;
375 } else {
376 xdg_shell_view->deco_mode = WLR_SERVER_DECORATION_MANAGER_MODE_CLIENT;
377 }
378
360 view_map(view, view->wlr_xdg_surface->surface); 379 view_map(view, view->wlr_xdg_surface->surface);
361 380
362 if (xdg_surface->toplevel->client_pending.fullscreen) { 381 if (xdg_surface->toplevel->client_pending.fullscreen) {