[gtk+/client-side-windows] Implement offscreen get_pointer with offscreen signals
- From: Alexander Larsson <alexl src gnome org>
- To: svn-commits-list gnome org
- Subject: [gtk+/client-side-windows] Implement offscreen get_pointer with offscreen signals
- Date: Mon, 8 Jun 2009 14:13:56 -0400 (EDT)
commit f195fbc2218e1f476238ab06e76ebe762cf5f25b
Author: Alexander Larsson <alexl redhat com>
Date: Mon Jun 8 19:38:15 2009 +0200
Implement offscreen get_pointer with offscreen signals
---
gdk/gdkoffscreenwindow.c | 60 +++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 59 insertions(+), 1 deletions(-)
diff --git a/gdk/gdkoffscreenwindow.c b/gdk/gdkoffscreenwindow.c
index beeb3d1..5682b22 100644
--- a/gdk/gdkoffscreenwindow.c
+++ b/gdk/gdkoffscreenwindow.c
@@ -698,13 +698,71 @@ gdk_offscreen_window_get_origin (GdkWindow *window,
return TRUE;
}
+static GdkWindow *
+get_offscreen_parent (GdkWindow *window)
+{
+ GdkWindowObject *private;
+ GdkWindow *res;
+
+ private = (GdkWindowObject *)window;
+
+ res = NULL;
+ g_signal_emit_by_name (private->impl_window,
+ "get-offscreen-parent",
+ &res);
+
+ return res;
+}
+
+static void
+from_parent (GdkWindow *window,
+ double parent_x, double parent_y,
+ double *offscreen_x, double *offscreen_y)
+{
+ GdkWindowObject *private;
+
+ private = (GdkWindowObject *)window;
+
+ g_signal_emit_by_name (private->impl_window,
+ "from_parent",
+ parent_x, parent_y,
+ offscreen_x, offscreen_y,
+ NULL);
+}
+
+
static gboolean
gdk_offscreen_window_get_pointer (GdkWindow *window,
gint *x,
gint *y,
GdkModifierType *mask)
{
- /* TODO: Base on signals */
+ int tmpx, tmpy;
+ double dtmpx, dtmpy;
+ GdkModifierType tmpmask;
+ GdkWindow *parent;
+
+ tmpx = 0;
+ tmpy = 0;
+ tmpmask = 0;
+
+ parent = get_offscreen_parent (window);
+ if (parent != NULL)
+ {
+ gdk_window_get_pointer (parent, &tmpx, &tmpy, &tmpmask);
+ from_parent (window,
+ tmpx, tmpy,
+ &dtmpx, &dtmpy);
+ tmpx = floor (dtmpx + 0.5);
+ tmpy = floor (dtmpy + 0.5);
+ }
+
+ if (x)
+ *x = tmpx;
+ if (y)
+ *y = tmpy;
+ if (mask)
+ *mask = tmpmask;
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]