[gtk+/broadway: 224/246] broadway: Get query_state window coords from browser side



commit 6713fe9ca41ae0b69aae63857cb343fb08914d20
Author: Alexander Larsson <alexl redhat com>
Date:   Fri Mar 11 21:39:11 2011 +0100

    broadway: Get query_state window coords from browser side

 gdk/broadway/broadway.js          |    4 +++-
 gdk/broadway/gdkdevice-broadway.c |   31 ++++++++++++++++++++++++++-----
 2 files changed, 29 insertions(+), 6 deletions(-)
---
diff --git a/gdk/broadway/broadway.js b/gdk/broadway/broadway.js
index bed889f..17fb6a1 100644
--- a/gdk/broadway/broadway.js
+++ b/gdk/broadway/broadway.js
@@ -247,7 +247,9 @@ function handleCommands(cmd_obj)
         var id = base64_16(cmd, i);
         i = i + 3;
 
-	send_input ("q", [last_x, last_y]);
+	var pos = getPositionsFromAbsCoord(last_x, last_y, id);
+
+	send_input ("q", [pos.root_x, pos.root_y, pos.win_x, pos.win_x, window_with_mouse]);
 	break;
 
       default:
diff --git a/gdk/broadway/gdkdevice-broadway.c b/gdk/broadway/gdkdevice-broadway.c
index b222d68..e0a4dad 100644
--- a/gdk/broadway/gdkdevice-broadway.c
+++ b/gdk/broadway/gdkdevice-broadway.c
@@ -159,7 +159,7 @@ gdk_broadway_device_query_state (GdkDevice        *device,
   guint32 serial;
   GdkScreen *screen;
   char *reply;
-  gint device_root_x, device_root_y;
+  gint device_root_x, device_root_y, device_win_x, device_win_y, id;
 
   if (gdk_device_get_source (device) != GDK_SOURCE_MOUSE)
     return FALSE;
@@ -176,9 +176,6 @@ gdk_broadway_device_query_state (GdkDevice        *device,
   if (mask)
     *mask = 0; /* TODO */
 
-  device_root_x = broadway_display->last_x;
-  device_root_y = broadway_display->last_y;
-
   if (broadway_display->output)
     {
       impl = GDK_WINDOW_IMPL_BROADWAY (window->impl);
@@ -203,13 +200,37 @@ gdk_broadway_device_query_state (GdkDevice        *device,
 	  p++; /* Skip , */
 	  device_root_y = strtol(p, &p, 10);
 	  p++; /* Skip , */
-
+	  device_win_x = strtol(p, &p, 10);
+	  p++; /* Skip , */
+	  device_win_y = strtol(p, &p, 10);
+	  p++; /* Skip , */
+	  id = strtol(p, &p, 10);
+
+	  if (root_x)
+	    *root_x = device_root_x;
+	  if (root_y)
+	    *root_y = device_root_y;
+	  if (win_x)
+	    *win_x = device_win_x;
+	  if (win_y)
+	    *win_y = device_win_y;
+	  if (child_window)
+	    {
+	      if (gdk_window_get_window_type (window) == GDK_WINDOW_ROOT)
+		*child_window = g_hash_table_lookup (broadway_display->id_ht, GINT_TO_POINTER (id));
+	      else
+		*child_window = window; /* No native children */
+	    }
 	  g_free (reply);
+	  return TRUE;
 	}
     }
 
   /* Fallback when unconnected */
 
+  device_root_x = broadway_display->last_x;
+  device_root_y = broadway_display->last_y;
+
   if (root_x)
     *root_x = device_root_x;
   if (root_y)



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