[gtk+/client-side-windows] Move destroyed check to common code for get_origin & get_root_coords
- From: Alexander Larsson <alexl src gnome org>
- To: svn-commits-list gnome org
- Subject: [gtk+/client-side-windows] Move destroyed check to common code for get_origin & get_root_coords
- Date: Tue, 30 Jun 2009 10:43:10 +0000 (UTC)
commit 3b6cf72f395b40c61a8eaddb6e56ff6869ef14cf
Author: Alexander Larsson <alexl redhat com>
Date: Tue Jun 30 09:30:53 2009 +0200
Move destroyed check to common code for get_origin & get_root_coords
Also remove weird return value from get_root_coords
gdk/gdkwindow.c | 22 +++++++++++++++++++---
gdk/gdkwindow.h | 2 +-
gdk/x11/gdkwindow-x11.c | 19 +++++++------------
3 files changed, 27 insertions(+), 16 deletions(-)
---
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index 56b8974..f635a07 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -6990,6 +6990,15 @@ gdk_window_get_origin (GdkWindow *window,
g_return_val_if_fail (GDK_IS_WINDOW (window), 0);
+ if (GDK_WINDOW_DESTROYED (window))
+ {
+ if (x)
+ *x = 0;
+ if (y)
+ *y = 0;
+ return 0;
+ }
+
private = (GdkWindowObject *) window;
GDK_WINDOW_IMPL_GET_IFACE (private->impl)->get_root_coords (window,
@@ -7012,10 +7021,8 @@ gdk_window_get_origin (GdkWindow *window,
* window coordinates. This is similar to
* gdk_window_get_origin() but allows you go pass
* in any position in the window, not just the origin.
- *
- * Return value: not meaningful, ignore
*/
-gint
+void
gdk_window_get_root_coords (GdkWindow *window,
gint x,
gint y,
@@ -7028,6 +7035,15 @@ gdk_window_get_root_coords (GdkWindow *window,
private = (GdkWindowObject *) window;
+ if (GDK_WINDOW_DESTROYED (window))
+ {
+ if (x)
+ *root_x = x;
+ if (y)
+ *root_y = y;
+ return;
+ }
+
GDK_WINDOW_IMPL_GET_IFACE (private->impl)->get_root_coords (window,
x + private->abs_x,
y + private->abs_y,
diff --git a/gdk/gdkwindow.h b/gdk/gdkwindow.h
index 752f6b6..df3c911 100644
--- a/gdk/gdkwindow.h
+++ b/gdk/gdkwindow.h
@@ -531,7 +531,7 @@ void gdk_window_get_position (GdkWindow *window,
gint gdk_window_get_origin (GdkWindow *window,
gint *x,
gint *y);
-gint gdk_window_get_root_coords (GdkWindow *window,
+void gdk_window_get_root_coords (GdkWindow *window,
gint x,
gint y,
gint *root_x,
diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c
index 1c7c669..9cd453b 100644
--- a/gdk/x11/gdkwindow-x11.c
+++ b/gdk/x11/gdkwindow-x11.c
@@ -2788,19 +2788,14 @@ gdk_window_x11_get_root_coords (GdkWindow *window,
{
gint return_val;
Window child;
- gint tx = 0;
- gint ty = 0;
+ gint tx;
+ gint ty;
- if (!GDK_WINDOW_DESTROYED (window))
- {
- return_val = XTranslateCoordinates (GDK_WINDOW_XDISPLAY (window),
- GDK_WINDOW_XID (window),
- GDK_WINDOW_XROOTWIN (window),
- x, y, &tx, &ty,
- &child);
- }
- else
- return_val = 0;
+ return_val = XTranslateCoordinates (GDK_WINDOW_XDISPLAY (window),
+ GDK_WINDOW_XID (window),
+ GDK_WINDOW_XROOTWIN (window),
+ x, y, &tx, &ty,
+ &child);
if (root_x)
*root_x = tx;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]