diff options
author | Benjamin Otte <otte@redhat.com> | 2010-12-27 18:03:38 +0100 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2010-12-27 18:46:41 +0100 |
commit | 0c285341a959ddbaad4ecc75e5f1a1ad66c5274e (patch) | |
tree | d45d750b9d721d21f614d8361a82bb745bf9dd87 /gdk/gdkdevice.c | |
parent | 586283ecbbfc0c5fb3354c07e978c680fe89f129 (diff) | |
download | gtk+-0c285341a959ddbaad4ecc75e5f1a1ad66c5274e.tar.gz |
API: gdk: gdk_display_get_device_state() => gdk_device_get_position()
The API was not display-specific, but belonged to the device. Also, we
didn't find a user of the modifier mask, so we dropped it.
Diffstat (limited to 'gdk/gdkdevice.c')
-rw-r--r-- | gdk/gdkdevice.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/gdk/gdkdevice.c b/gdk/gdkdevice.c index 714c8cd123..39af300213 100644 --- a/gdk/gdkdevice.c +++ b/gdk/gdkdevice.c @@ -399,6 +399,43 @@ gdk_device_get_state (GdkDevice *device, } /** + * gdk_device_get_position: + * @device: pointer device to query status about. + * @screen: (out) (transfer none) (allow-none): location to store the #GdkScreen + * the @device is on, or %NULL. + * @x: (out) (allow-none): location to store root window X coordinate of @device, or %NULL. + * @y: (out) (allow-none): location to store root window Y coordinate of @device, or %NULL. + * + * Gets the current location of @device. + * + * Since: 3.0 + **/ +void +gdk_device_get_position (GdkDevice *device, + GdkScreen **screen, + gint *x, + gint *y) +{ + GdkScreen *tmp_screen; + GdkDisplay *display; + gint tmp_x, tmp_y; + GdkModifierType tmp_mask; + + g_return_if_fail (GDK_IS_DEVICE (device)); + g_return_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD); + + display = gdk_device_get_display (device); + display->device_hooks->get_device_state (display, device, &tmp_screen, &tmp_x, &tmp_y, &tmp_mask); + + if (screen) + *screen = tmp_screen; + if (x) + *x = tmp_x; + if (y) + *y = tmp_y; +} + +/** * gdk_device_get_history: * @device: a #GdkDevice * @window: the window with respect to which which the event coordinates will be reported |