[gtk+/broadway: 31/71] [broadway] clean up input sending js



commit 8f9c6eb1a93f581050f24b8735ded01530694c8b
Author: Alexander Larsson <alexl redhat com>
Date:   Sat Nov 20 22:25:54 2010 +0100

    [broadway] clean up input sending js

 gdk/broadway/broadway.js |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)
---
diff --git a/gdk/broadway/broadway.js b/gdk/broadway/broadway.js
index c3d4d80..79a9fe7 100644
--- a/gdk/broadway/broadway.js
+++ b/gdk/broadway/broadway.js
@@ -296,22 +296,23 @@ function handleLoad(event)
   }
 }
 
-function on_mouse_move (ev) {
+function send_input(cmd, args)
+{
   if (input_socket != null) {
-    input_socket.send("m" + ev.pageX + "," + ev.pageY + "," + ev.timeStamp);
+      input_socket.send(cmd + args.join(","));
   }
 }
 
+function on_mouse_move (ev) {
+  send_input ("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 + "," + ev.timeStamp);
-  }
+  send_input ("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 + "," + ev.timeStamp);
-  }
+  send_input ("B", [ev.pageX, ev.pageY, ev.button, ev.timeStamp])
 }
 
 function connect()



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