aboutsummaryrefslogtreecommitdiffstats
path: root/sway/desktop/xdg_shell_v6.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/desktop/xdg_shell_v6.c')
-rw-r--r--sway/desktop/xdg_shell_v6.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/sway/desktop/xdg_shell_v6.c b/sway/desktop/xdg_shell_v6.c
index 175416f3..b23d4577 100644
--- a/sway/desktop/xdg_shell_v6.c
+++ b/sway/desktop/xdg_shell_v6.c
@@ -10,10 +10,12 @@
10#include "sway/desktop/transaction.h" 10#include "sway/desktop/transaction.h"
11#include "sway/input/input-manager.h" 11#include "sway/input/input-manager.h"
12#include "sway/input/seat.h" 12#include "sway/input/seat.h"
13#include "sway/output.h"
13#include "sway/server.h" 14#include "sway/server.h"
14#include "sway/tree/arrange.h" 15#include "sway/tree/arrange.h"
15#include "sway/tree/container.h" 16#include "sway/tree/container.h"
16#include "sway/tree/view.h" 17#include "sway/tree/view.h"
18#include "sway/tree/workspace.h"
17 19
18static const struct sway_view_child_impl popup_impl; 20static const struct sway_view_child_impl popup_impl;
19 21
@@ -51,15 +53,15 @@ static void popup_unconstrain(struct sway_xdg_popup_v6 *popup) {
51 struct sway_view *view = popup->child.view; 53 struct sway_view *view = popup->child.view;
52 struct wlr_xdg_popup_v6 *wlr_popup = popup->wlr_xdg_surface_v6->popup; 54 struct wlr_xdg_popup_v6 *wlr_popup = popup->wlr_xdg_surface_v6->popup;
53 55
54 struct sway_container *output = container_parent(view->swayc, C_OUTPUT); 56 struct sway_output *output = view->container->workspace->output;
55 57
56 // the output box expressed in the coordinate system of the toplevel parent 58 // the output box expressed in the coordinate system of the toplevel parent
57 // of the popup 59 // of the popup
58 struct wlr_box output_toplevel_sx_box = { 60 struct wlr_box output_toplevel_sx_box = {
59 .x = output->x - view->x, 61 .x = output->wlr_output->lx - view->x,
60 .y = output->y - view->y, 62 .y = output->wlr_output->ly - view->y,
61 .width = output->width, 63 .width = output->wlr_output->width,
62 .height = output->height, 64 .height = output->wlr_output->height,
63 }; 65 };
64 66
65 wlr_xdg_popup_v6_unconstrain_from_box(wlr_popup, &output_toplevel_sx_box); 67 wlr_xdg_popup_v6_unconstrain_from_box(wlr_popup, &output_toplevel_sx_box);
@@ -249,11 +251,7 @@ static void handle_commit(struct wl_listener *listener, void *data) {
249 struct sway_view *view = &xdg_shell_v6_view->view; 251 struct sway_view *view = &xdg_shell_v6_view->view;
250 struct wlr_xdg_surface_v6 *xdg_surface_v6 = view->wlr_xdg_surface_v6; 252 struct wlr_xdg_surface_v6 *xdg_surface_v6 = view->wlr_xdg_surface_v6;
251 253
252 if (!view->swayc) { 254 if (view->container->node.instruction) {
253 return;
254 }
255
256 if (view->swayc->instruction) {
257 wlr_xdg_surface_v6_get_geometry(xdg_surface_v6, &view->geometry); 255 wlr_xdg_surface_v6_get_geometry(xdg_surface_v6, &view->geometry);
258 transaction_notify_view_ready_by_serial(view, 256 transaction_notify_view_ready_by_serial(view,
259 xdg_surface_v6->configure_serial); 257 xdg_surface_v6->configure_serial);
@@ -262,7 +260,7 @@ static void handle_commit(struct wl_listener *listener, void *data) {
262 wlr_xdg_surface_v6_get_geometry(xdg_surface_v6, &new_geo); 260 wlr_xdg_surface_v6_get_geometry(xdg_surface_v6, &new_geo);
263 261
264 if ((new_geo.width != view->width || new_geo.height != view->height) && 262 if ((new_geo.width != view->width || new_geo.height != view->height) &&
265 container_is_floating(view->swayc)) { 263 container_is_floating(view->container)) {
266 // A floating view has unexpectedly sent a new size 264 // A floating view has unexpectedly sent a new size
267 desktop_damage_view(view); 265 desktop_damage_view(view);
268 view_update_size(view, new_geo.width, new_geo.height); 266 view_update_size(view, new_geo.width, new_geo.height);
@@ -316,10 +314,9 @@ static void handle_request_fullscreen(struct wl_listener *listener, void *data)
316 return; 314 return;
317 } 315 }
318 316
319 container_set_fullscreen(view->swayc, e->fullscreen); 317 container_set_fullscreen(view->container, e->fullscreen);
320 318
321 struct sway_container *output = container_parent(view->swayc, C_OUTPUT); 319 arrange_workspace(view->container->workspace);
322 arrange_windows(output);
323 transaction_commit_dirty(); 320 transaction_commit_dirty();
324} 321}
325 322
@@ -327,13 +324,13 @@ static void handle_request_move(struct wl_listener *listener, void *data) {
327 struct sway_xdg_shell_v6_view *xdg_shell_v6_view = 324 struct sway_xdg_shell_v6_view *xdg_shell_v6_view =
328 wl_container_of(listener, xdg_shell_v6_view, request_move); 325 wl_container_of(listener, xdg_shell_v6_view, request_move);
329 struct sway_view *view = &xdg_shell_v6_view->view; 326 struct sway_view *view = &xdg_shell_v6_view->view;
330 if (!container_is_floating(view->swayc)) { 327 if (!container_is_floating(view->container)) {
331 return; 328 return;
332 } 329 }
333 struct wlr_xdg_toplevel_v6_move_event *e = data; 330 struct wlr_xdg_toplevel_v6_move_event *e = data;
334 struct sway_seat *seat = e->seat->seat->data; 331 struct sway_seat *seat = e->seat->seat->data;
335 if (e->serial == seat->last_button_serial) { 332 if (e->serial == seat->last_button_serial) {
336 seat_begin_move(seat, view->swayc, seat->last_button); 333 seat_begin_move(seat, view->container, seat->last_button);
337 } 334 }
338} 335}
339 336
@@ -341,13 +338,13 @@ static void handle_request_resize(struct wl_listener *listener, void *data) {
341 struct sway_xdg_shell_v6_view *xdg_shell_v6_view = 338 struct sway_xdg_shell_v6_view *xdg_shell_v6_view =
342 wl_container_of(listener, xdg_shell_v6_view, request_resize); 339 wl_container_of(listener, xdg_shell_v6_view, request_resize);
343 struct sway_view *view = &xdg_shell_v6_view->view; 340 struct sway_view *view = &xdg_shell_v6_view->view;
344 if (!container_is_floating(view->swayc)) { 341 if (!container_is_floating(view->container)) {
345 return; 342 return;
346 } 343 }
347 struct wlr_xdg_toplevel_v6_resize_event *e = data; 344 struct wlr_xdg_toplevel_v6_resize_event *e = data;
348 struct sway_seat *seat = e->seat->seat->data; 345 struct sway_seat *seat = e->seat->seat->data;
349 if (e->serial == seat->last_button_serial) { 346 if (e->serial == seat->last_button_serial) {
350 seat_begin_resize_floating(seat, view->swayc, 347 seat_begin_resize_floating(seat, view->container,
351 seat->last_button, e->edges); 348 seat->last_button, e->edges);
352 } 349 }
353} 350}
@@ -396,11 +393,14 @@ static void handle_map(struct wl_listener *listener, void *data) {
396 view_map(view, view->wlr_xdg_surface_v6->surface); 393 view_map(view, view->wlr_xdg_surface_v6->surface);
397 394
398 if (xdg_surface->toplevel->client_pending.fullscreen) { 395 if (xdg_surface->toplevel->client_pending.fullscreen) {
399 container_set_fullscreen(view->swayc, true); 396 container_set_fullscreen(view->container, true);
400 struct sway_container *ws = container_parent(view->swayc, C_WORKSPACE); 397 arrange_workspace(view->container->workspace);
401 arrange_windows(ws);
402 } else { 398 } else {
403 arrange_windows(view->swayc->parent); 399 if (view->container->parent) {
400 arrange_container(view->container->parent);
401 } else {
402 arrange_workspace(view->container->workspace);
403 }
404 } 404 }
405 transaction_commit_dirty(); 405 transaction_commit_dirty();
406 406