diff options
Diffstat (limited to 'sway/desktop')
-rw-r--r-- | sway/desktop/xdg_shell.c | 19 | ||||
-rw-r--r-- | sway/desktop/xdg_shell_v6.c | 25 |
2 files changed, 41 insertions, 3 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 | ||
174 | static 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 | |||
173 | static void for_each_surface(struct sway_view *view, | 183 | static 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) { |
diff --git a/sway/desktop/xdg_shell_v6.c b/sway/desktop/xdg_shell_v6.c index ffea03ad..a947fb35 100644 --- a/sway/desktop/xdg_shell_v6.c +++ b/sway/desktop/xdg_shell_v6.c | |||
@@ -4,14 +4,15 @@ | |||
4 | #include <stdlib.h> | 4 | #include <stdlib.h> |
5 | #include <wayland-server.h> | 5 | #include <wayland-server.h> |
6 | #include <wlr/types/wlr_xdg_shell_v6.h> | 6 | #include <wlr/types/wlr_xdg_shell_v6.h> |
7 | #include "log.h" | ||
8 | #include "sway/decoration.h" | ||
9 | #include "sway/input/input-manager.h" | ||
10 | #include "sway/input/seat.h" | ||
7 | #include "sway/server.h" | 11 | #include "sway/server.h" |
8 | #include "sway/tree/arrange.h" | 12 | #include "sway/tree/arrange.h" |
9 | #include "sway/tree/container.h" | 13 | #include "sway/tree/container.h" |
10 | #include "sway/tree/layout.h" | 14 | #include "sway/tree/layout.h" |
11 | #include "sway/tree/view.h" | 15 | #include "sway/tree/view.h" |
12 | #include "sway/input/seat.h" | ||
13 | #include "sway/input/input-manager.h" | ||
14 | #include "log.h" | ||
15 | 16 | ||
16 | static const struct sway_view_child_impl popup_impl; | 17 | static const struct sway_view_child_impl popup_impl; |
17 | 18 | ||
@@ -166,6 +167,15 @@ static bool wants_floating(struct sway_view *view) { | |||
166 | || toplevel->parent; | 167 | || toplevel->parent; |
167 | } | 168 | } |
168 | 169 | ||
170 | static bool has_client_side_decorations(struct sway_view *view) { | ||
171 | struct sway_xdg_shell_v6_view *xdg_shell_v6_view = | ||
172 | xdg_shell_v6_view_from_view(view); | ||
173 | if (xdg_shell_v6_view == NULL) { | ||
174 | return true; | ||
175 | } | ||
176 | return xdg_shell_v6_view->deco_mode != WLR_SERVER_DECORATION_MANAGER_MODE_SERVER; | ||
177 | } | ||
178 | |||
169 | static void for_each_surface(struct sway_view *view, | 179 | static void for_each_surface(struct sway_view *view, |
170 | wlr_surface_iterator_func_t iterator, void *user_data) { | 180 | wlr_surface_iterator_func_t iterator, void *user_data) { |
171 | if (xdg_shell_v6_view_from_view(view) == NULL) { | 181 | if (xdg_shell_v6_view_from_view(view) == NULL) { |
@@ -223,6 +233,7 @@ static const struct sway_view_impl view_impl = { | |||
223 | .set_tiled = set_tiled, | 233 | .set_tiled = set_tiled, |
224 | .set_fullscreen = set_fullscreen, | 234 | .set_fullscreen = set_fullscreen, |
225 | .wants_floating = wants_floating, | 235 | .wants_floating = wants_floating, |
236 | .has_client_side_decorations = has_client_side_decorations, | ||
226 | .for_each_surface = for_each_surface, | 237 | .for_each_surface = for_each_surface, |
227 | .for_each_popup = for_each_popup, | 238 | .for_each_popup = for_each_popup, |
228 | .close = _close, | 239 | .close = _close, |
@@ -353,6 +364,14 @@ static void handle_map(struct wl_listener *listener, void *data) { | |||
353 | view->natural_height = view->wlr_xdg_surface_v6->surface->current.height; | 364 | view->natural_height = view->wlr_xdg_surface_v6->surface->current.height; |
354 | } | 365 | } |
355 | 366 | ||
367 | struct sway_server_decoration *deco = | ||
368 | decoration_from_surface(xdg_surface->surface); | ||
369 | if (deco != NULL) { | ||
370 | xdg_shell_v6_view->deco_mode = deco->wlr_server_decoration->mode; | ||
371 | } else { | ||
372 | xdg_shell_v6_view->deco_mode = WLR_SERVER_DECORATION_MANAGER_MODE_CLIENT; | ||
373 | } | ||
374 | |||
356 | view_map(view, view->wlr_xdg_surface_v6->surface); | 375 | view_map(view, view->wlr_xdg_surface_v6->surface); |
357 | 376 | ||
358 | if (xdg_surface->toplevel->client_pending.fullscreen) { | 377 | if (xdg_surface->toplevel->client_pending.fullscreen) { |