clutter: Shuffle handling of IM reset on button presses

Unfortunately we cannot do this generically since the target of the
button/touch press does matter, e.g. tapping on the OSK, or clicking
the IBus candidates window. These situations should not trigger a
reset.

So be more selective about the situations where button/touch presses
trigger an IM reset, in the case of ClutterText these are still clicks
inside the actor, for Wayland's text-input it is when clicking the
surface that has text_input focus.

For all other situations where clicking anywhere else might make
sense to trigger an IM reset are covered by the focus changing paths,
that also ensure a reset before changing focus between surfaces/actors.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1961
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2384>
This commit is contained in:
Carlos Garnacho
2022-04-22 18:11:36 +02:00
parent 39ff8d15e2
commit cd0c47a25a
3 changed files with 24 additions and 9 deletions

View File

@ -25,6 +25,7 @@
#include <wayland-server.h>
#include "compositor/meta-surface-actor-wayland.h"
#include "wayland/meta-wayland-private.h"
#include "wayland/meta-wayland-seat.h"
#include "wayland/meta-wayland-versions.h"
@ -788,7 +789,28 @@ meta_wayland_text_input_handle_event (MetaWaylandTextInput *text_input,
if (event->type == CLUTTER_BUTTON_PRESS ||
event->type == CLUTTER_TOUCH_BEGIN)
meta_wayland_text_input_focus_flush_done (text_input->input_focus);
{
MetaWaylandSurface *surface = NULL;
ClutterActor *actor;
actor = clutter_stage_get_device_actor (clutter_event_get_stage (event),
clutter_event_get_device (event),
clutter_event_get_event_sequence (event));
if (META_IS_SURFACE_ACTOR_WAYLAND (actor))
{
MetaSurfaceActorWayland *actor_wayland =
META_SURFACE_ACTOR_WAYLAND (actor);
surface = meta_surface_actor_wayland_get_surface (actor_wayland);
if (surface == text_input->surface)
{
clutter_input_focus_reset (text_input->input_focus);
meta_wayland_text_input_focus_flush_done (text_input->input_focus);
}
}
}
return retval;
}