From b809023f4d911f2e4e022ec7abe62c524c3c12c2 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Thu, 3 Aug 2023 12:33:33 +0200 Subject: [PATCH] clutter: Create full event copy when handling unfiltered IM key events We need to change at least event flags in the event we reinject after it was let through by the IM, in order to avoid doubly handling. Create a full event copy from the original event parameters. Part-of: --- clutter/clutter/clutter-input-method.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/clutter/clutter/clutter-input-method.c b/clutter/clutter/clutter-input-method.c index d92805bbd..881a3f0a0 100644 --- a/clutter/clutter/clutter-input-method.c +++ b/clutter/clutter/clutter-input-method.c @@ -363,10 +363,16 @@ clutter_input_method_notify_key_event (ClutterInputMethod *im, /* XXX: we rely on the IM implementation to notify back of * key events in the exact same order they were given. */ - copy = clutter_event_copy (event); - clutter_event_set_flags (copy, clutter_event_get_flags (event) | - CLUTTER_EVENT_FLAG_INPUT_METHOD); - clutter_event_set_source_device (copy, clutter_event_get_device (copy)); + copy = clutter_event_key_new (clutter_event_type (event), + clutter_event_get_flags (event) | + CLUTTER_EVENT_FLAG_INPUT_METHOD, + ms2us (clutter_event_get_time (event)), + clutter_event_get_device (event), + clutter_event_get_state (event), + clutter_event_get_key_symbol (event), + clutter_event_get_event_code (event), + clutter_event_get_key_code (event), + clutter_event_get_key_unicode (event)); clutter_event_put (copy); clutter_event_free (copy); }