mirror of
https://github.com/brl/mutter.git
synced 2024-12-23 03:22:04 +00:00
clutter/stage: Only queue compressible events
Incompressible events already pass through unmodified, so queuing them just wasted time and memory. We would however like to keep the ordering of events so we can only apply this optimization if the queue is empty. This reduces the input latency of incompressible events like touchpad scrolling or drawing tablets by up to one frame. It also means the same series of events now arrives at the client more smoothly and not in bursts. https://gitlab.gnome.org/GNOME/mutter/merge_requests/711
This commit is contained in:
parent
bc08ad2fbb
commit
5c617ac286
@ -875,15 +875,6 @@ _clutter_stage_queue_event (ClutterStage *stage,
|
||||
if (copy_event)
|
||||
event = clutter_event_copy (event);
|
||||
|
||||
g_queue_push_tail (priv->event_queue, event);
|
||||
|
||||
if (first_event)
|
||||
{
|
||||
ClutterMasterClock *master_clock = _clutter_master_clock_get_default ();
|
||||
_clutter_master_clock_start_running (master_clock);
|
||||
_clutter_stage_schedule_update (stage);
|
||||
}
|
||||
|
||||
/* if needed, update the state of the input device of the event.
|
||||
* we do it here to avoid calling the same code from every backend
|
||||
* event processing function
|
||||
@ -904,6 +895,28 @@ _clutter_stage_queue_event (ClutterStage *stage,
|
||||
_clutter_input_device_set_state (device, event_state);
|
||||
_clutter_input_device_set_time (device, event_time);
|
||||
}
|
||||
|
||||
if (first_event)
|
||||
{
|
||||
gboolean compressible = event->type == CLUTTER_MOTION ||
|
||||
event->type == CLUTTER_TOUCH_UPDATE;
|
||||
|
||||
if (!compressible)
|
||||
{
|
||||
_clutter_process_event (event);
|
||||
clutter_event_free (event);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
g_queue_push_tail (priv->event_queue, event);
|
||||
|
||||
if (first_event)
|
||||
{
|
||||
ClutterMasterClock *master_clock = _clutter_master_clock_get_default ();
|
||||
_clutter_master_clock_start_running (master_clock);
|
||||
_clutter_stage_schedule_update (stage);
|
||||
}
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
Loading…
Reference in New Issue
Block a user