[gtk+/wip/mir2: 283/310] mir: add timestamps to generated GdkEvents



commit 9d0fb4f4dee34889458b5942a9e47d4231107a7f
Author: William Hua <william attente ca>
Date:   Mon Dec 1 16:27:29 2014 -0500

    mir: add timestamps to generated GdkEvents
    
    We need this because it fixes menu activation. The menu activation code
    looks at the time between events to determine if mouse clicks happen too
    quickly.

 gdk/mir/gdkmireventsource.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/gdk/mir/gdkmireventsource.c b/gdk/mir/gdkmireventsource.c
index 20b7972..6857012 100644
--- a/gdk/mir/gdkmireventsource.c
+++ b/gdk/mir/gdkmireventsource.c
@@ -127,6 +127,7 @@ generate_key_event (GdkWindow *window, GdkEventType type, guint state, guint key
   event->key.keyval = keyval;
   event->key.hardware_keycode = keycode + 8;
   event->key.is_modifier = is_modifier;
+  event->key.time = g_get_monotonic_time () / 1000;
   set_key_event_string (&event->key);
 
   send_event (window, _gdk_mir_device_manager_get_keyboard (gdk_display_get_device_manager 
(gdk_window_get_display (window))), event);
@@ -148,6 +149,7 @@ generate_button_event (GdkWindow *window, GdkEventType type, gdouble x, gdouble
   event->button.y = y;
   event->button.state = state;
   event->button.button = button;
+  event->button.time = g_get_monotonic_time () / 1000;
 
   send_event (window, get_pointer (window), event);
 }
@@ -164,6 +166,7 @@ generate_scroll_event (GdkWindow *window, gdouble x, gdouble y, gdouble delta_x,
   event->scroll.direction = GDK_SCROLL_SMOOTH;
   event->scroll.delta_x = -delta_x;
   event->scroll.delta_y = -delta_y;
+  event->scroll.time = g_get_monotonic_time () / 1000;
 
   send_event (window, get_pointer (window), event);
 }
@@ -178,6 +181,7 @@ generate_motion_event (GdkWindow *window, gdouble x, gdouble y, guint state)
   event->motion.y = y;
   event->motion.state = state;
   event->motion.is_hint = FALSE;
+  event->motion.time = g_get_monotonic_time () / 1000;
 
   send_event (window, get_pointer (window), event);
 }
@@ -193,6 +197,7 @@ generate_crossing_event (GdkWindow *window, GdkEventType type, gdouble x, gdoubl
   event->crossing.mode = GDK_CROSSING_NORMAL;
   event->crossing.detail = GDK_NOTIFY_ANCESTOR;
   event->crossing.focus = TRUE;
+  event->crossing.time = g_get_monotonic_time () / 1000;
 
   send_event (window, get_pointer (window), event);
 }


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