diff options
Diffstat (limited to 'sway/desktop/xwayland.c')
-rw-r--r-- | sway/desktop/xwayland.c | 50 |
1 files changed, 26 insertions, 24 deletions
diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c index 94a30239..0d192b76 100644 --- a/sway/desktop/xwayland.c +++ b/sway/desktop/xwayland.c | |||
@@ -59,8 +59,7 @@ static void unmanaged_handle_map(struct wl_listener *listener, void *data) { | |||
59 | wl_container_of(listener, surface, map); | 59 | wl_container_of(listener, surface, map); |
60 | struct wlr_xwayland_surface *xsurface = surface->wlr_xwayland_surface; | 60 | struct wlr_xwayland_surface *xsurface = surface->wlr_xwayland_surface; |
61 | 61 | ||
62 | wl_list_insert(root_container.sway_root->xwayland_unmanaged.prev, | 62 | wl_list_insert(root->xwayland_unmanaged.prev, &surface->link); |
63 | &surface->link); | ||
64 | 63 | ||
65 | wl_signal_add(&xsurface->surface->events.commit, &surface->commit); | 64 | wl_signal_add(&xsurface->surface->events.commit, &surface->commit); |
66 | surface->commit.notify = unmanaged_handle_commit; | 65 | surface->commit.notify = unmanaged_handle_commit; |
@@ -90,11 +89,10 @@ static void unmanaged_handle_unmap(struct wl_listener *listener, void *data) { | |||
90 | if (seat->wlr_seat->keyboard_state.focused_surface == | 89 | if (seat->wlr_seat->keyboard_state.focused_surface == |
91 | xsurface->surface) { | 90 | xsurface->surface) { |
92 | // Restore focus | 91 | // Restore focus |
93 | struct sway_container *previous = | 92 | struct sway_node *previous = seat_get_focus_inactive(seat, &root->node); |
94 | seat_get_focus_inactive(seat, &root_container); | ||
95 | if (previous) { | 93 | if (previous) { |
96 | // Hack to get seat to re-focus the return value of get_focus | 94 | // Hack to get seat to re-focus the return value of get_focus |
97 | seat_set_focus(seat, previous->parent); | 95 | seat_set_focus(seat, NULL); |
98 | seat_set_focus(seat, previous); | 96 | seat_set_focus(seat, previous); |
99 | } | 97 | } |
100 | } | 98 | } |
@@ -299,7 +297,7 @@ static void handle_commit(struct wl_listener *listener, void *data) { | |||
299 | struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface; | 297 | struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface; |
300 | struct wlr_surface_state *state = &xsurface->surface->current; | 298 | struct wlr_surface_state *state = &xsurface->surface->current; |
301 | 299 | ||
302 | if (view->swayc->instruction) { | 300 | if (view->container->node.instruction) { |
303 | get_geometry(view, &view->geometry); | 301 | get_geometry(view, &view->geometry); |
304 | transaction_notify_view_ready_by_size(view, | 302 | transaction_notify_view_ready_by_size(view, |
305 | state->width, state->height); | 303 | state->width, state->height); |
@@ -308,7 +306,7 @@ static void handle_commit(struct wl_listener *listener, void *data) { | |||
308 | get_geometry(view, &new_geo); | 306 | get_geometry(view, &new_geo); |
309 | 307 | ||
310 | if ((new_geo.width != view->width || new_geo.height != view->height) && | 308 | if ((new_geo.width != view->width || new_geo.height != view->height) && |
311 | container_is_floating(view->swayc)) { | 309 | container_is_floating(view->container)) { |
312 | // A floating view has unexpectedly sent a new size | 310 | // A floating view has unexpectedly sent a new size |
313 | // eg. The Firefox "Save As" dialog when downloading a file | 311 | // eg. The Firefox "Save As" dialog when downloading a file |
314 | desktop_damage_view(view); | 312 | desktop_damage_view(view); |
@@ -391,11 +389,14 @@ static void handle_map(struct wl_listener *listener, void *data) { | |||
391 | view_map(view, xsurface->surface); | 389 | view_map(view, xsurface->surface); |
392 | 390 | ||
393 | if (xsurface->fullscreen) { | 391 | if (xsurface->fullscreen) { |
394 | container_set_fullscreen(view->swayc, true); | 392 | container_set_fullscreen(view->container, true); |
395 | struct sway_container *ws = container_parent(view->swayc, C_WORKSPACE); | 393 | arrange_workspace(view->container->workspace); |
396 | arrange_windows(ws); | ||
397 | } else { | 394 | } else { |
398 | arrange_windows(view->swayc->parent); | 395 | if (view->container->parent) { |
396 | arrange_container(view->container->parent); | ||
397 | } else { | ||
398 | arrange_workspace(view->container->workspace); | ||
399 | } | ||
399 | } | 400 | } |
400 | transaction_commit_dirty(); | 401 | transaction_commit_dirty(); |
401 | } | 402 | } |
@@ -411,13 +412,14 @@ static void handle_request_configure(struct wl_listener *listener, void *data) { | |||
411 | ev->width, ev->height); | 412 | ev->width, ev->height); |
412 | return; | 413 | return; |
413 | } | 414 | } |
414 | if (container_is_floating(view->swayc)) { | 415 | if (container_is_floating(view->container)) { |
415 | configure(view, view->swayc->current.view_x, | 416 | configure(view, view->container->current.view_x, |
416 | view->swayc->current.view_y, ev->width, ev->height); | 417 | view->container->current.view_y, ev->width, ev->height); |
417 | } else { | 418 | } else { |
418 | configure(view, view->swayc->current.view_x, | 419 | configure(view, view->container->current.view_x, |
419 | view->swayc->current.view_y, view->swayc->current.view_width, | 420 | view->container->current.view_y, |
420 | view->swayc->current.view_height); | 421 | view->container->current.view_width, |
422 | view->container->current.view_height); | ||
421 | } | 423 | } |
422 | } | 424 | } |
423 | 425 | ||
@@ -429,10 +431,9 @@ static void handle_request_fullscreen(struct wl_listener *listener, void *data) | |||
429 | if (!xsurface->mapped) { | 431 | if (!xsurface->mapped) { |
430 | return; | 432 | return; |
431 | } | 433 | } |
432 | container_set_fullscreen(view->swayc, xsurface->fullscreen); | 434 | container_set_fullscreen(view->container, xsurface->fullscreen); |
433 | 435 | ||
434 | struct sway_container *output = container_parent(view->swayc, C_OUTPUT); | 436 | arrange_workspace(view->container->workspace); |
435 | arrange_windows(output); | ||
436 | transaction_commit_dirty(); | 437 | transaction_commit_dirty(); |
437 | } | 438 | } |
438 | 439 | ||
@@ -444,11 +445,11 @@ static void handle_request_move(struct wl_listener *listener, void *data) { | |||
444 | if (!xsurface->mapped) { | 445 | if (!xsurface->mapped) { |
445 | return; | 446 | return; |
446 | } | 447 | } |
447 | if (!container_is_floating(view->swayc)) { | 448 | if (!container_is_floating(view->container)) { |
448 | return; | 449 | return; |
449 | } | 450 | } |
450 | struct sway_seat *seat = input_manager_current_seat(input_manager); | 451 | struct sway_seat *seat = input_manager_current_seat(input_manager); |
451 | seat_begin_move(seat, view->swayc, seat->last_button); | 452 | seat_begin_move(seat, view->container, seat->last_button); |
452 | } | 453 | } |
453 | 454 | ||
454 | static void handle_request_resize(struct wl_listener *listener, void *data) { | 455 | static void handle_request_resize(struct wl_listener *listener, void *data) { |
@@ -459,12 +460,13 @@ static void handle_request_resize(struct wl_listener *listener, void *data) { | |||
459 | if (!xsurface->mapped) { | 460 | if (!xsurface->mapped) { |
460 | return; | 461 | return; |
461 | } | 462 | } |
462 | if (!container_is_floating(view->swayc)) { | 463 | if (!container_is_floating(view->container)) { |
463 | return; | 464 | return; |
464 | } | 465 | } |
465 | struct wlr_xwayland_resize_event *e = data; | 466 | struct wlr_xwayland_resize_event *e = data; |
466 | struct sway_seat *seat = input_manager_current_seat(input_manager); | 467 | struct sway_seat *seat = input_manager_current_seat(input_manager); |
467 | seat_begin_resize_floating(seat, view->swayc, seat->last_button, e->edges); | 468 | seat_begin_resize_floating(seat, view->container, |
469 | seat->last_button, e->edges); | ||
468 | } | 470 | } |
469 | 471 | ||
470 | static void handle_request_activate(struct wl_listener *listener, void *data) { | 472 | static void handle_request_activate(struct wl_listener *listener, void *data) { |