[gnome-shell] shell_global: Use clutter_event_get_time rather then get_current_event_time



commit 8a22ea948f11fcf3e1b4f298367a9a15858508b8
Author: Adel Gadllah <adel gadllah gmail com>
Date:   Wed Feb 16 21:12:07 2011 +0100

    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

 src/shell-global.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/src/shell-global.c b/src/shell-global.c
index 14347ac..4271123 100644
--- a/src/shell-global.c
+++ b/src/shell-global.c
@@ -1628,6 +1628,7 @@ shell_global_get_current_time (ShellGlobal *global)
 {
   guint32 time;
   MetaDisplay *display;
+  const ClutterEvent *clutter_event;
 
   /* In case we have a xdnd timestamp use it */
   if (global->xdnd_timestamp != 0)
@@ -1650,8 +1651,16 @@ shell_global_get_current_time (ShellGlobal *global)
   time = meta_display_get_current_time (display);
   if (time != CLUTTER_CURRENT_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;
 }
 
 /**



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]