diff options
author | emersion <contact@emersion.fr> | 2018-08-06 15:28:33 +0100 |
---|---|---|
committer | emersion <contact@emersion.fr> | 2018-08-06 15:28:33 +0100 |
commit | d2ac48f9206e9962ab47f337f824ce7f69ffb9c1 (patch) | |
tree | e5214f71eb4cfd5f7be4f249e75ac6e6bfc85695 | |
parent | Handle views created after decoration mode is sent for xdg-shell (diff) | |
download | sway-d2ac48f9206e9962ab47f337f824ce7f69ffb9c1.tar.gz sway-d2ac48f9206e9962ab47f337f824ce7f69ffb9c1.tar.zst sway-d2ac48f9206e9962ab47f337f824ce7f69ffb9c1.zip |
Handle views created after decoration mode is sent for xdg-shell-v6
-rw-r--r-- | sway/desktop/xdg_shell_v6.c | 25 |
1 files changed, 22 insertions, 3 deletions
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) { |