diff options
Diffstat (limited to 'sway/desktop')
-rw-r--r-- | sway/desktop/layer_shell.c | 5 | ||||
-rw-r--r-- | sway/desktop/output.c | 19 | ||||
-rw-r--r-- | sway/desktop/xwayland.c | 15 |
3 files changed, 39 insertions, 0 deletions
diff --git a/sway/desktop/layer_shell.c b/sway/desktop/layer_shell.c index b60aa487..2d355b74 100644 --- a/sway/desktop/layer_shell.c +++ b/sway/desktop/layer_shell.c @@ -257,6 +257,11 @@ static void unmap(struct sway_layer_surface *sway_layer) { } output_damage_surface(output, sway_layer->geo.x, sway_layer->geo.y, sway_layer->layer_surface->surface, true); + + struct sway_seat *seat = input_manager_current_seat(input_manager); + if (seat->focused_layer == sway_layer->layer_surface) { + seat_set_focus_layer(seat, NULL); + } } static void handle_destroy(struct wl_listener *listener, void *data) { diff --git a/sway/desktop/output.c b/sway/desktop/output.c index a9ff9782..acc9caae 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c @@ -846,11 +846,24 @@ static void render_output(struct sway_output *output, struct timespec *when, wlr_renderer_begin(renderer, wlr_output->width, wlr_output->height); + bool damage_whole_before_swap = false; if (!pixman_region32_not_empty(damage)) { // Output isn't damaged but needs buffer swap goto renderer_end; } + const char *damage_debug = getenv("SWAY_DAMAGE_DEBUG"); + if (damage_debug != NULL) { + if (strcmp(damage_debug, "highlight") == 0) { + wlr_renderer_clear(renderer, (float[]){1, 1, 0, 1}); + damage_whole_before_swap = true; + } else if (strcmp(damage_debug, "rerender") == 0) { + int width, height; + wlr_output_transformed_resolution(wlr_output, &width, &height); + pixman_region32_union_rect(damage, damage, 0, 0, width, height); + } + } + struct sway_container *workspace = output_get_active_workspace(output); if (workspace->sway_workspace->fullscreen) { @@ -905,6 +918,12 @@ renderer_end: wlr_output->transform_matrix, 0, 0, 1); } + if (damage_whole_before_swap || root_container.sway_root->debug_tree) { + int width, height; + wlr_output_transformed_resolution(wlr_output, &width, &height); + pixman_region32_union_rect(damage, damage, 0, 0, width, height); + } + wlr_renderer_scissor(renderer, NULL); wlr_renderer_end(renderer); if (!wlr_output_damage_swap_buffers(output->damage, when, damage)) { diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c index 75bfb7b2..6447b711 100644 --- a/sway/desktop/xwayland.c +++ b/sway/desktop/xwayland.c @@ -77,6 +77,21 @@ static void unmanaged_handle_unmap(struct wl_listener *listener, void *data) { desktop_damage_surface(xsurface->surface, xsurface->x, xsurface->y, true); wl_list_remove(&surface->link); wl_list_remove(&surface->commit.link); + + if (!wlr_xwayland_surface_is_unmanaged(xsurface)) { + struct sway_seat *seat = input_manager_current_seat(input_manager); + if (seat->wlr_seat->keyboard_state.focused_surface == + xsurface->surface) { + // Restore focus + struct sway_container *previous = + seat_get_focus_inactive(seat, &root_container); + if (previous) { + // Hack to get seat to re-focus the return value of get_focus + seat_set_focus(seat, previous->parent); + seat_set_focus(seat, previous); + } + } + } } static void unmanaged_handle_destroy(struct wl_listener *listener, void *data) { |