Skip to content

Commit

Permalink
layer-shell: refocus active output when kb interactive lsurface is un…
Browse files Browse the repository at this point in the history
…mapped
  • Loading branch information
ammen99 committed Sep 14, 2023
1 parent adebe70 commit b14032c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ void wf::compositor_core_impl_t::focus_output(wf::output_t *wo)

if (wo)
{
LOGD("focus output: ", wo->handle->name);
LOGC(KBD, "focus output: ", wo->handle->name);
/* Move to the middle of the output if this is the first output */
wo->ensure_pointer((active_output == nullptr));
}
Expand Down
1 change: 1 addition & 0 deletions src/core/seat/seat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@ void wf::seat_t::impl::set_keyboard_focus(wf::scene::node_ptr new_focus)
return;
}

LOGC(KBD, "Setting keyboard focus node to ", new_focus.get());
if (this->keyboard_focus)
{
this->keyboard_focus->keyboard_interaction().handle_keyboard_leave(wf::get_core().seat.get());
Expand Down
8 changes: 8 additions & 0 deletions src/view/layer-shell/layer-shell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,14 @@ struct wf_layer_shell_manager
view->remove_anchored(false);
remove_view_from_layer(view, view->lsurface->current.layer);
arrange_layers(view->get_output());

// We refocus the active output when a layer-shell view is destroyed. This is because grabbing
// keyboard input works across all outputs, but the unmap/disappear signal is sent on the grabbing
// layer surface's output - which might not be the actually focused output (#1741)
if (view->lsurface->current.keyboard_interactive)
{
wf::get_core().get_active_output()->refocus();
}
}

layer_t filter_views(wf::output_t *output, int layer)
Expand Down

0 comments on commit b14032c

Please sign in to comment.