1
0
Fork 0

clutter/device-manager-evdev: Update device modifiers before queuing

Until now we would:

  1. Enqueue modifier key event on the stage.
  2. Update device modifier state.
  3. Dequeue and process modifier key event with NEW device modifier state.

But if we consider optimizing out the queuing in some cases then there
will become a problem:

  1. Process modifier key event with OLD device modifier state.
  2. Update device modifier state.

To correct the above we now do:

  1. Update device modifier state.
  2. Queue/process modifier key event with NEW device modifier state.

It appears commit dd940a71 which introduced the old behaviour was correct
in the need to update the device modifier state, but is at least no longer
correct (if it ever was) that it should be done after queuing the event.
If queuing is working, as it is right now, then it makes no difference
whether the device modifier state is updated before or after. Because both
cases will come before the dequeing and processing.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/711
This commit is contained in:
Daniel van Vugt 2019-08-06 19:04:51 +08:00 committed by Marco Trevisan
parent 0947bc37d3
commit bc08ad2fbb

View file

@ -701,14 +701,14 @@ clutter_event_dispatch (GSource *g_source,
if (!_clutter_input_device_get_stage (input_device))
goto out;
/* forward the event into clutter for emission etc. */
_clutter_stage_queue_event (event->any.stage, event, FALSE);
/* update the device states *after* the event */
/* update the device states *before* the event */
event_state = seat->button_state |
xkb_state_serialize_mods (seat->xkb, XKB_STATE_MODS_EFFECTIVE);
_clutter_input_device_set_state (seat->core_pointer, event_state);
_clutter_input_device_set_state (seat->core_keyboard, event_state);
/* forward the event into clutter for emission etc. */
_clutter_stage_queue_event (event->any.stage, event, FALSE);
}
out: