Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

im-relay: fix text inputs created while a non-wlr node is focused #2188

Merged
merged 1 commit into from
Mar 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions src/core/seat/input-method-relay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@ wf::input_method_relay::input_method_relay()
auto& seat = wf::get_core_impl().seat;
if (auto focus = seat->priv->keyboard_focus)
{
auto surface = wf::node_to_view(focus)->get_keyboard_focus_surface();

if (surface && (wl_resource_get_client(wlr_text_input->resource) ==
wl_resource_get_client(surface->resource)))
if (auto view = wf::node_to_view(focus))
{
wlr_text_input_v3_send_enter(wlr_text_input, surface);
auto surface = wf::node_to_view(focus)->get_keyboard_focus_surface();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this resolve wf::node_to_view(focus) twice? Can't this second invocation be:

auto surface = view->get_keyboard_focus_surface();

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes it could, I missed that

if (surface && (wl_resource_get_client(wlr_text_input->resource) ==
wl_resource_get_client(surface->resource)))
{
wlr_text_input_v3_send_enter(wlr_text_input, surface);
}
}
}
});
Expand Down
Loading