diff options
Diffstat (limited to 'sway/desktop/xwayland.c')
-rw-r--r-- | sway/desktop/xwayland.c | 63 |
1 files changed, 30 insertions, 33 deletions
diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c index e1a2e463..66cb3b02 100644 --- a/sway/desktop/xwayland.c +++ b/sway/desktop/xwayland.c | |||
@@ -105,14 +105,10 @@ static void unmanaged_handle_unmap(struct wl_listener *listener, void *data) { | |||
105 | if (seat->wlr_seat->keyboard_state.focused_surface == xsurface->surface) { | 105 | if (seat->wlr_seat->keyboard_state.focused_surface == xsurface->surface) { |
106 | // This simply returns focus to the parent surface if there's one available. | 106 | // This simply returns focus to the parent surface if there's one available. |
107 | // This seems to handle JetBrains issues. | 107 | // This seems to handle JetBrains issues. |
108 | if (xsurface->parent && xsurface->parent->surface && | 108 | if (xsurface->parent && xsurface->parent->surface |
109 | wlr_surface_is_xwayland_surface(xsurface->parent->surface)) { | 109 | && wlr_xwayland_or_surface_wants_focus(xsurface->parent)) { |
110 | struct wlr_xwayland_surface *next_surface = | 110 | seat_set_focus_surface(seat, xsurface->parent->surface, false); |
111 | wlr_xwayland_surface_from_wlr_surface(xsurface->parent->surface); | 111 | return; |
112 | if (wlr_xwayland_or_surface_wants_focus(next_surface)) { | ||
113 | seat_set_focus_surface(seat, xsurface->parent->surface, false); | ||
114 | return; | ||
115 | } | ||
116 | } | 112 | } |
117 | 113 | ||
118 | // Restore focus | 114 | // Restore focus |
@@ -399,30 +395,31 @@ static void handle_commit(struct wl_listener *listener, void *data) { | |||
399 | struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface; | 395 | struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface; |
400 | struct wlr_surface_state *state = &xsurface->surface->current; | 396 | struct wlr_surface_state *state = &xsurface->surface->current; |
401 | 397 | ||
398 | struct wlr_box new_geo; | ||
399 | get_geometry(view, &new_geo); | ||
400 | bool new_size = new_geo.width != view->geometry.width || | ||
401 | new_geo.height != view->geometry.height || | ||
402 | new_geo.x != view->geometry.x || | ||
403 | new_geo.y != view->geometry.y; | ||
404 | |||
405 | if (new_size) { | ||
406 | // The client changed its surface size in this commit. For floating | ||
407 | // containers, we resize the container to match. For tiling containers, | ||
408 | // we only recenter the surface. | ||
409 | desktop_damage_view(view); | ||
410 | memcpy(&view->geometry, &new_geo, sizeof(struct wlr_box)); | ||
411 | if (container_is_floating(view->container)) { | ||
412 | view_update_size(view); | ||
413 | transaction_commit_dirty_client(); | ||
414 | } else { | ||
415 | view_center_surface(view); | ||
416 | } | ||
417 | desktop_damage_view(view); | ||
418 | } | ||
419 | |||
402 | if (view->container->node.instruction) { | 420 | if (view->container->node.instruction) { |
403 | get_geometry(view, &view->geometry); | ||
404 | transaction_notify_view_ready_by_geometry(view, | 421 | transaction_notify_view_ready_by_geometry(view, |
405 | xsurface->x, xsurface->y, state->width, state->height); | 422 | xsurface->x, xsurface->y, state->width, state->height); |
406 | } else { | ||
407 | struct wlr_box new_geo; | ||
408 | get_geometry(view, &new_geo); | ||
409 | |||
410 | if ((new_geo.width != view->geometry.width || | ||
411 | new_geo.height != view->geometry.height || | ||
412 | new_geo.x != view->geometry.x || | ||
413 | new_geo.y != view->geometry.y)) { | ||
414 | // The view has unexpectedly sent a new size | ||
415 | // eg. The Firefox "Save As" dialog when downloading a file | ||
416 | desktop_damage_view(view); | ||
417 | view_update_size(view, new_geo.width, new_geo.height); | ||
418 | memcpy(&view->geometry, &new_geo, sizeof(struct wlr_box)); | ||
419 | desktop_damage_view(view); | ||
420 | transaction_commit_dirty(); | ||
421 | transaction_notify_view_ready_by_geometry(view, | ||
422 | xsurface->x, xsurface->y, new_geo.width, new_geo.height); | ||
423 | } else { | ||
424 | memcpy(&view->geometry, &new_geo, sizeof(struct wlr_box)); | ||
425 | } | ||
426 | } | 423 | } |
427 | 424 | ||
428 | view_damage_from(view); | 425 | view_damage_from(view); |
@@ -527,10 +524,10 @@ static void handle_request_configure(struct wl_listener *listener, void *data) { | |||
527 | view->natural_height = ev->height; | 524 | view->natural_height = ev->height; |
528 | container_floating_resize_and_center(view->container); | 525 | container_floating_resize_and_center(view->container); |
529 | 526 | ||
530 | configure(view, view->container->content_x, | 527 | configure(view, view->container->pending.content_x, |
531 | view->container->content_y, | 528 | view->container->pending.content_y, |
532 | view->container->content_width, | 529 | view->container->pending.content_width, |
533 | view->container->content_height); | 530 | view->container->pending.content_height); |
534 | node_set_dirty(&view->container->node); | 531 | node_set_dirty(&view->container->node); |
535 | } else { | 532 | } else { |
536 | configure(view, view->container->current.content_x, | 533 | configure(view, view->container->current.content_x, |