diff options
Diffstat (limited to 'sway/desktop/xdg_shell_v6.c')
-rw-r--r-- | sway/desktop/xdg_shell_v6.c | 48 |
1 files changed, 23 insertions, 25 deletions
diff --git a/sway/desktop/xdg_shell_v6.c b/sway/desktop/xdg_shell_v6.c index 6ffe334a..7ec9e6cb 100644 --- a/sway/desktop/xdg_shell_v6.c +++ b/sway/desktop/xdg_shell_v6.c | |||
@@ -3,9 +3,10 @@ | |||
3 | #include <stdlib.h> | 3 | #include <stdlib.h> |
4 | #include <wayland-server.h> | 4 | #include <wayland-server.h> |
5 | #include <wlr/types/wlr_xdg_shell_v6.h> | 5 | #include <wlr/types/wlr_xdg_shell_v6.h> |
6 | #include "sway/server.h" | ||
7 | #include "sway/tree/arrange.h" | ||
6 | #include "sway/tree/container.h" | 8 | #include "sway/tree/container.h" |
7 | #include "sway/tree/layout.h" | 9 | #include "sway/tree/layout.h" |
8 | #include "sway/server.h" | ||
9 | #include "sway/tree/view.h" | 10 | #include "sway/tree/view.h" |
10 | #include "sway/input/seat.h" | 11 | #include "sway/input/seat.h" |
11 | #include "sway/input/input-manager.h" | 12 | #include "sway/input/input-manager.h" |
@@ -86,18 +87,15 @@ static const char *get_string_prop(struct sway_view *view, enum sway_view_prop p | |||
86 | } | 87 | } |
87 | } | 88 | } |
88 | 89 | ||
89 | static void configure(struct sway_view *view, double lx, double ly, int width, | 90 | static uint32_t configure(struct sway_view *view, double lx, double ly, |
90 | int height) { | 91 | int width, int height) { |
91 | struct sway_xdg_shell_v6_view *xdg_shell_v6_view = | 92 | struct sway_xdg_shell_v6_view *xdg_shell_v6_view = |
92 | xdg_shell_v6_view_from_view(view); | 93 | xdg_shell_v6_view_from_view(view); |
93 | if (xdg_shell_v6_view == NULL) { | 94 | if (xdg_shell_v6_view == NULL) { |
94 | return; | 95 | return 0; |
95 | } | 96 | } |
96 | 97 | return wlr_xdg_toplevel_v6_set_size( | |
97 | xdg_shell_v6_view->pending_width = width; | 98 | view->wlr_xdg_surface_v6, width, height); |
98 | xdg_shell_v6_view->pending_height = height; | ||
99 | wlr_xdg_toplevel_v6_set_size(view->wlr_xdg_surface_v6, width, height); | ||
100 | view_update_position(view, lx, ly); | ||
101 | } | 99 | } |
102 | 100 | ||
103 | static void set_activated(struct sway_view *view, bool activated) { | 101 | static void set_activated(struct sway_view *view, bool activated) { |
@@ -173,18 +171,12 @@ static void handle_commit(struct wl_listener *listener, void *data) { | |||
173 | struct sway_xdg_shell_v6_view *xdg_shell_v6_view = | 171 | struct sway_xdg_shell_v6_view *xdg_shell_v6_view = |
174 | wl_container_of(listener, xdg_shell_v6_view, commit); | 172 | wl_container_of(listener, xdg_shell_v6_view, commit); |
175 | struct sway_view *view = &xdg_shell_v6_view->view; | 173 | struct sway_view *view = &xdg_shell_v6_view->view; |
176 | if (view->swayc && container_is_floating(view->swayc)) { | 174 | struct wlr_xdg_surface_v6 *xdg_surface_v6 = view->wlr_xdg_surface_v6; |
177 | int width = view->wlr_xdg_surface_v6->geometry.width; | 175 | |
178 | int height = view->wlr_xdg_surface_v6->geometry.height; | 176 | if (view->instructions->length) { |
179 | if (!width && !height) { | 177 | transaction_notify_view_ready(view, xdg_surface_v6->configure_serial); |
180 | width = view->wlr_xdg_surface_v6->surface->current->width; | ||
181 | height = view->wlr_xdg_surface_v6->surface->current->height; | ||
182 | } | ||
183 | view_update_size(view, width, height); | ||
184 | } else { | ||
185 | view_update_size(view, xdg_shell_v6_view->pending_width, | ||
186 | xdg_shell_v6_view->pending_height); | ||
187 | } | 178 | } |
179 | |||
188 | view_update_title(view, false); | 180 | view_update_title(view, false); |
189 | view_damage_from(view); | 181 | view_damage_from(view); |
190 | } | 182 | } |
@@ -218,8 +210,14 @@ static void handle_map(struct wl_listener *listener, void *data) { | |||
218 | view->natural_width = view->wlr_xdg_surface_v6->surface->current->width; | 210 | view->natural_width = view->wlr_xdg_surface_v6->surface->current->width; |
219 | view->natural_height = view->wlr_xdg_surface_v6->surface->current->height; | 211 | view->natural_height = view->wlr_xdg_surface_v6->surface->current->height; |
220 | } | 212 | } |
213 | |||
221 | view_map(view, view->wlr_xdg_surface_v6->surface); | 214 | view_map(view, view->wlr_xdg_surface_v6->surface); |
222 | 215 | ||
216 | if (xdg_surface->toplevel->client_pending.fullscreen) { | ||
217 | view_set_fullscreen(view, true); | ||
218 | } | ||
219 | arrange_and_commit(view->swayc->parent); | ||
220 | |||
223 | xdg_shell_v6_view->commit.notify = handle_commit; | 221 | xdg_shell_v6_view->commit.notify = handle_commit; |
224 | wl_signal_add(&xdg_surface->surface->events.commit, | 222 | wl_signal_add(&xdg_surface->surface->events.commit, |
225 | &xdg_shell_v6_view->commit); | 223 | &xdg_shell_v6_view->commit); |
@@ -227,10 +225,6 @@ static void handle_map(struct wl_listener *listener, void *data) { | |||
227 | xdg_shell_v6_view->new_popup.notify = handle_new_popup; | 225 | xdg_shell_v6_view->new_popup.notify = handle_new_popup; |
228 | wl_signal_add(&xdg_surface->events.new_popup, | 226 | wl_signal_add(&xdg_surface->events.new_popup, |
229 | &xdg_shell_v6_view->new_popup); | 227 | &xdg_shell_v6_view->new_popup); |
230 | |||
231 | if (xdg_surface->toplevel->client_pending.fullscreen) { | ||
232 | view_set_fullscreen(view, true); | ||
233 | } | ||
234 | } | 228 | } |
235 | 229 | ||
236 | static void handle_destroy(struct wl_listener *listener, void *data) { | 230 | static void handle_destroy(struct wl_listener *listener, void *data) { |
@@ -245,6 +239,7 @@ static void handle_request_fullscreen(struct wl_listener *listener, void *data) | |||
245 | struct wlr_xdg_toplevel_v6_set_fullscreen_event *e = data; | 239 | struct wlr_xdg_toplevel_v6_set_fullscreen_event *e = data; |
246 | struct wlr_xdg_surface_v6 *xdg_surface = | 240 | struct wlr_xdg_surface_v6 *xdg_surface = |
247 | xdg_shell_v6_view->view.wlr_xdg_surface_v6; | 241 | xdg_shell_v6_view->view.wlr_xdg_surface_v6; |
242 | struct sway_view *view = &xdg_shell_v6_view->view; | ||
248 | 243 | ||
249 | if (!sway_assert(xdg_surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL, | 244 | if (!sway_assert(xdg_surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL, |
250 | "xdg_shell_v6 requested fullscreen of surface with role %i", | 245 | "xdg_shell_v6 requested fullscreen of surface with role %i", |
@@ -255,7 +250,10 @@ static void handle_request_fullscreen(struct wl_listener *listener, void *data) | |||
255 | return; | 250 | return; |
256 | } | 251 | } |
257 | 252 | ||
258 | view_set_fullscreen(&xdg_shell_v6_view->view, e->fullscreen); | 253 | view_set_fullscreen(view, e->fullscreen); |
254 | |||
255 | struct sway_container *ws = container_parent(view->swayc, C_WORKSPACE); | ||
256 | arrange_and_commit(ws); | ||
259 | } | 257 | } |
260 | 258 | ||
261 | void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) { | 259 | void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) { |