shell_global: Use clutter_event_get_time rather then get_current_event_time
Using clutter_get_current_event_time can result into too old timestamps when there is no current Clutter or Mutter event, since clutter_get_current_event_time() returns the timestamp of the last event delivered to Clutter. This can result in, for example, grabs failing. Use the event time of the current event (if any) and CurrentTime otherwise. https://bugzilla.gnome.org/show_bug.cgi?id=642188
This commit is contained in:
parent
b5cea80b54
commit
8a22ea948f
@ -1628,6 +1628,7 @@ shell_global_get_current_time (ShellGlobal *global)
|
|||||||
{
|
{
|
||||||
guint32 time;
|
guint32 time;
|
||||||
MetaDisplay *display;
|
MetaDisplay *display;
|
||||||
|
const ClutterEvent *clutter_event;
|
||||||
|
|
||||||
/* In case we have a xdnd timestamp use it */
|
/* In case we have a xdnd timestamp use it */
|
||||||
if (global->xdnd_timestamp != 0)
|
if (global->xdnd_timestamp != 0)
|
||||||
@ -1650,8 +1651,16 @@ shell_global_get_current_time (ShellGlobal *global)
|
|||||||
time = meta_display_get_current_time (display);
|
time = meta_display_get_current_time (display);
|
||||||
if (time != CLUTTER_CURRENT_TIME)
|
if (time != CLUTTER_CURRENT_TIME)
|
||||||
return time;
|
return time;
|
||||||
|
/*
|
||||||
|
* We don't use clutter_get_current_event_time as it can give us a
|
||||||
|
* too old timestamp if there is no current event.
|
||||||
|
*/
|
||||||
|
clutter_event = clutter_get_current_event ();
|
||||||
|
|
||||||
return clutter_get_current_event_time ();
|
if (clutter_event != NULL)
|
||||||
|
return clutter_event_get_time (clutter_event);
|
||||||
|
else
|
||||||
|
return CLUTTER_CURRENT_TIME;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user