clutter/event: Set logical input device for IM events

So far, we expected all events to have input devices set on them, IM events
lost theirs with commit 6aa42d6dad. This somewhat made sense, because IM
events are not backed by any actual device, they are generated by us in
response to eg. an OSK key press.

To fullfil the assumption that all devices at least have a logical input
device set, pass the seat to the clutter_event_im_new() constructor and then
set the device to the logical keyboard device. The source_device we leave
empty, since there is no actual physical device that this event came from.

Fixes: 6aa42d6dad
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3236>
This commit is contained in:
Jonas Dreßler 2023-09-02 11:14:08 +02:00 committed by Marge Bot
parent e0ccbcb44d
commit aa6888e6bd
3 changed files with 8 additions and 0 deletions

View File

@ -145,6 +145,7 @@ CLUTTER_EXPORT
ClutterEvent * clutter_event_im_new (ClutterEventType type,
ClutterEventFlags flags,
int64_t timestamp_us,
ClutterSeat *seat,
const char *text,
int32_t offset,
int32_t anchor,

View File

@ -2383,6 +2383,7 @@ ClutterEvent *
clutter_event_im_new (ClutterEventType type,
ClutterEventFlags flags,
int64_t timestamp_us,
ClutterSeat *seat,
const char *text,
int32_t offset,
int32_t anchor,
@ -2405,6 +2406,8 @@ clutter_event_im_new (ClutterEventType type,
event->im.len = len;
event->im.mode = mode;
g_set_object (&event->im.device, clutter_seat_get_keyboard (seat));
return event;
}

View File

@ -279,11 +279,15 @@ clutter_input_method_put_im_event (ClutterInputMethod *im,
uint32_t len,
ClutterPreeditResetMode mode)
{
ClutterSeat *seat;
ClutterEvent *event;
seat = clutter_backend_get_default_seat (clutter_get_default_backend ());
event = clutter_event_im_new (event_type,
CLUTTER_EVENT_FLAG_INPUT_METHOD,
CLUTTER_CURRENT_TIME,
seat,
text,
offset,
anchor,