summaryrefslogtreecommitdiff
path: root/gdk/x11/gdktestutils-x11.c
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2009-07-08 18:40:05 +0200
committerAlexander Larsson <alexl@redhat.com>2009-07-08 18:47:43 +0200
commit9ef87ea11e7d2b50d5222e5429b8a65a0f665162 (patch)
tree39b7222a8e3ecbcf3a150f5f62aa725a5b4c6a48 /gdk/x11/gdktestutils-x11.c
parenta90d43bed605f6afb929672d8568be0afbf9408d (diff)
downloadgtk+-9ef87ea11e7d2b50d5222e5429b8a65a0f665162.tar.gz
Handle non-native windows in the gdk test utils
We need to add the non-native offset to the root coords when sending events.
Diffstat (limited to 'gdk/x11/gdktestutils-x11.c')
-rw-r--r--gdk/x11/gdktestutils-x11.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/gdk/x11/gdktestutils-x11.c b/gdk/x11/gdktestutils-x11.c
index 480da4d909..13677b6a42 100644
--- a/gdk/x11/gdktestutils-x11.c
+++ b/gdk/x11/gdktestutils-x11.c
@@ -86,6 +86,7 @@ gdk_test_simulate_key (GdkWindow *window,
{
GdkScreen *screen;
GdkKeymapKey *keys = NULL;
+ GdkWindowObject *priv;
gboolean success;
gint n_keys = 0;
XKeyEvent xev = {
@@ -104,6 +105,12 @@ gdk_test_simulate_key (GdkWindow *window,
x /= 2;
y /= 2;
}
+
+ priv = (GdkWindowObject *)window;
+ /* Convert to impl coordinates */
+ x = x + priv->abs_x;
+ y = y + priv->abs_y;
+
xev.type = key_pressrelease == GDK_KEY_PRESS ? KeyPress : KeyRelease;
xev.display = GDK_DRAWABLE_XDISPLAY (window);
xev.window = GDK_WINDOW_XID (window);
@@ -190,6 +197,7 @@ gdk_test_simulate_button (GdkWindow *window,
1, /* send_event */
};
gboolean success;
+ GdkWindowObject *priv;
g_return_val_if_fail (button_pressrelease == GDK_BUTTON_PRESS || button_pressrelease == GDK_BUTTON_RELEASE, FALSE);
g_return_val_if_fail (window != NULL, FALSE);
@@ -203,6 +211,12 @@ gdk_test_simulate_button (GdkWindow *window,
x /= 2;
y /= 2;
}
+
+ priv = (GdkWindowObject *)window;
+ /* Convert to impl coordinates */
+ x = x + priv->abs_x;
+ y = y + priv->abs_y;
+
xev.type = button_pressrelease == GDK_BUTTON_PRESS ? ButtonPress : ButtonRelease;
xev.display = GDK_DRAWABLE_XDISPLAY (window);
xev.window = GDK_WINDOW_XID (window);