[gtk+/broadway: 30/71] [broadway] Send event timestamps from client



commit 65d4edbd5bacefee551b5bf85116dc700552ff9b
Author: Alexander Larsson <alexl redhat com>
Date:   Sat Nov 20 22:11:54 2010 +0100

    [broadway] Send event timestamps from client

 gdk/broadway/broadway.js           |    6 +++---
 gdk/broadway/gdkdisplay-broadway.c |   11 ++++++++---
 2 files changed, 11 insertions(+), 6 deletions(-)
---
diff --git a/gdk/broadway/broadway.js b/gdk/broadway/broadway.js
index 21561bb..c3d4d80 100644
--- a/gdk/broadway/broadway.js
+++ b/gdk/broadway/broadway.js
@@ -298,19 +298,19 @@ function handleLoad(event)
 
 function on_mouse_move (ev) {
   if (input_socket != null) {
-    input_socket.send("m" + ev.pageX + "," + ev.pageY);
+    input_socket.send("m" + ev.pageX + "," + ev.pageY + "," + ev.timeStamp);
   }
 }
 
 function on_mouse_down (ev) {
   if (input_socket != null) {
-    input_socket.send("b" + ev.pageX + "," + ev.pageY + "," + ev.button);
+    input_socket.send("b" + ev.pageX + "," + ev.pageY + "," + ev.button + "," + ev.timeStamp);
   }
 }
 
 function on_mouse_up (ev) {
   if (input_socket != null) {
-    input_socket.send("B" + ev.pageX + "," + ev.pageY + "," + ev.button);
+    input_socket.send("B" + ev.pageX + "," + ev.pageY + "," + ev.button + "," + ev.timeStamp);
   }
 }
 
diff --git a/gdk/broadway/gdkdisplay-broadway.c b/gdk/broadway/gdkdisplay-broadway.c
index c3f0fa0..d4fc91c 100644
--- a/gdk/broadway/gdkdisplay-broadway.c
+++ b/gdk/broadway/gdkdisplay-broadway.c
@@ -181,6 +181,7 @@ got_input (GInputStream *stream,
   gsize len;
   GError *error = NULL;
   int x, y, button;
+  guint64 time;
   GdkEvent *event = NULL;
   char cmd;
   GList *node;
@@ -205,6 +206,8 @@ got_input (GInputStream *stream,
     x = strtol(p, &p, 10);
     p++; /* Skip , */
     y = strtol(p, &p, 10);
+    p++; /* Skip , */
+    time = strtol(p, &p, 10);
 
     window = _gdk_window_find_child_at (root, x, y);
 
@@ -242,7 +245,7 @@ got_input (GInputStream *stream,
 	  {
 	    event = gdk_event_new (GDK_ENTER_NOTIFY);
 	    event->crossing.window = g_object_ref (window);
-	    event->crossing.time = g_get_monotonic_time () / 1000;
+	    event->crossing.time = time;
 	    event->crossing.x = x - GDK_WINDOW_OBJECT (window)->x;
 	    event->crossing.y = y - GDK_WINDOW_OBJECT (window)->y;
 	    event->crossing.x_root = x;
@@ -269,7 +272,7 @@ got_input (GInputStream *stream,
       {
 	event = gdk_event_new (GDK_MOTION_NOTIFY);
 	event->motion.window = g_object_ref (window);
-	event->motion.time = g_get_monotonic_time () / 1000;
+	event->motion.time = time;
 	event->motion.x = x - GDK_WINDOW_OBJECT (window)->x;
 	event->motion.y = y - GDK_WINDOW_OBJECT (window)->y;
 	event->motion.x_root = x;
@@ -288,6 +291,8 @@ got_input (GInputStream *stream,
     y = strtol(p, &p, 10);
     p++; /* Skip , */
     button = strtol(p, &p, 10);
+    p++; /* Skip , */
+    time = strtol(p, &p, 10);
 
     window = _gdk_window_find_child_at (root, x, y);
 
@@ -295,7 +300,7 @@ got_input (GInputStream *stream,
       {
 	event = gdk_event_new (cmd == 'b' ? GDK_BUTTON_PRESS : GDK_BUTTON_RELEASE);
 	event->button.window = g_object_ref (window);
-	event->button.time = g_get_monotonic_time () / 1000;
+	event->button.time = time;
 	event->button.x = x - GDK_WINDOW_OBJECT (window)->x;
 	event->button.y = y - GDK_WINDOW_OBJECT (window)->y;
 	event->button.x_root = x;



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