forked from AuroraMiddleware/gtk
gdk: Convert mouse position to doubles, add new getters
We've long had double precision mouse coordinates on wayland (e.g. when rotating a window) but with the new scaling we even have it on X (and, its also in Xinput2), so convert all the internal mouse/device position getters to use doubles and add new accessors for the public APIs that take doubles instead of ints.
This commit is contained in:
parent
867ba1df27
commit
e8b38fedbd
@ -38,16 +38,16 @@ static void gdk_broadway_device_set_window_cursor (GdkDevice *device,
|
|||||||
GdkCursor *cursor);
|
GdkCursor *cursor);
|
||||||
static void gdk_broadway_device_warp (GdkDevice *device,
|
static void gdk_broadway_device_warp (GdkDevice *device,
|
||||||
GdkScreen *screen,
|
GdkScreen *screen,
|
||||||
gint x,
|
gdouble x,
|
||||||
gint y);
|
gdouble y);
|
||||||
static void gdk_broadway_device_query_state (GdkDevice *device,
|
static void gdk_broadway_device_query_state (GdkDevice *device,
|
||||||
GdkWindow *window,
|
GdkWindow *window,
|
||||||
GdkWindow **root_window,
|
GdkWindow **root_window,
|
||||||
GdkWindow **child_window,
|
GdkWindow **child_window,
|
||||||
gint *root_x,
|
gdouble *root_x,
|
||||||
gint *root_y,
|
gdouble *root_y,
|
||||||
gint *win_x,
|
gdouble *win_x,
|
||||||
gint *win_y,
|
gdouble *win_y,
|
||||||
GdkModifierType *mask);
|
GdkModifierType *mask);
|
||||||
static GdkGrabStatus gdk_broadway_device_grab (GdkDevice *device,
|
static GdkGrabStatus gdk_broadway_device_grab (GdkDevice *device,
|
||||||
GdkWindow *window,
|
GdkWindow *window,
|
||||||
@ -59,8 +59,8 @@ static GdkGrabStatus gdk_broadway_device_grab (GdkDevice *device,
|
|||||||
static void gdk_broadway_device_ungrab (GdkDevice *device,
|
static void gdk_broadway_device_ungrab (GdkDevice *device,
|
||||||
guint32 time_);
|
guint32 time_);
|
||||||
static GdkWindow * gdk_broadway_device_window_at_position (GdkDevice *device,
|
static GdkWindow * gdk_broadway_device_window_at_position (GdkDevice *device,
|
||||||
gint *win_x,
|
gdouble *win_x,
|
||||||
gint *win_y,
|
gdouble *win_y,
|
||||||
GdkModifierType *mask,
|
GdkModifierType *mask,
|
||||||
gboolean get_toplevel);
|
gboolean get_toplevel);
|
||||||
static void gdk_broadway_device_select_window_events (GdkDevice *device,
|
static void gdk_broadway_device_select_window_events (GdkDevice *device,
|
||||||
@ -114,14 +114,14 @@ gdk_broadway_device_get_state (GdkDevice *device,
|
|||||||
gdouble *axes,
|
gdouble *axes,
|
||||||
GdkModifierType *mask)
|
GdkModifierType *mask)
|
||||||
{
|
{
|
||||||
gint x_int, y_int;
|
gdouble x, y;
|
||||||
|
|
||||||
gdk_window_get_device_position (window, device, &x_int, &y_int, mask);
|
gdk_window_get_device_position_double (window, device, &x, &y, mask);
|
||||||
|
|
||||||
if (axes)
|
if (axes)
|
||||||
{
|
{
|
||||||
axes[0] = x_int;
|
axes[0] = x;
|
||||||
axes[1] = y_int;
|
axes[1] = y;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -135,8 +135,8 @@ gdk_broadway_device_set_window_cursor (GdkDevice *device,
|
|||||||
static void
|
static void
|
||||||
gdk_broadway_device_warp (GdkDevice *device,
|
gdk_broadway_device_warp (GdkDevice *device,
|
||||||
GdkScreen *screen,
|
GdkScreen *screen,
|
||||||
gint x,
|
gdouble x,
|
||||||
gint y)
|
gdouble y)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,10 +145,10 @@ gdk_broadway_device_query_state (GdkDevice *device,
|
|||||||
GdkWindow *window,
|
GdkWindow *window,
|
||||||
GdkWindow **root_window,
|
GdkWindow **root_window,
|
||||||
GdkWindow **child_window,
|
GdkWindow **child_window,
|
||||||
gint *root_x,
|
gdouble *root_x,
|
||||||
gint *root_y,
|
gdouble *root_y,
|
||||||
gint *win_x,
|
gdouble *win_x,
|
||||||
gint *win_y,
|
gdouble *win_y,
|
||||||
GdkModifierType *mask)
|
GdkModifierType *mask)
|
||||||
{
|
{
|
||||||
GdkWindow *toplevel;
|
GdkWindow *toplevel;
|
||||||
@ -335,8 +335,8 @@ gdk_broadway_device_ungrab (GdkDevice *device,
|
|||||||
|
|
||||||
static GdkWindow *
|
static GdkWindow *
|
||||||
gdk_broadway_device_window_at_position (GdkDevice *device,
|
gdk_broadway_device_window_at_position (GdkDevice *device,
|
||||||
gint *win_x,
|
gdouble *win_x,
|
||||||
gint *win_y,
|
gdouble *win_y,
|
||||||
GdkModifierType *mask,
|
GdkModifierType *mask,
|
||||||
gboolean get_toplevel)
|
gboolean get_toplevel)
|
||||||
{
|
{
|
||||||
|
@ -750,8 +750,8 @@ gdk_broadway_window_get_frame_extents (GdkWindow *window,
|
|||||||
static gboolean
|
static gboolean
|
||||||
gdk_window_broadway_get_device_state (GdkWindow *window,
|
gdk_window_broadway_get_device_state (GdkWindow *window,
|
||||||
GdkDevice *device,
|
GdkDevice *device,
|
||||||
gint *x,
|
gdouble *x,
|
||||||
gint *y,
|
gdouble *y,
|
||||||
GdkModifierType *mask)
|
GdkModifierType *mask)
|
||||||
{
|
{
|
||||||
GdkWindow *child;
|
GdkWindow *child;
|
||||||
|
141
gdk/gdkdevice.c
141
gdk/gdkdevice.c
@ -24,6 +24,9 @@
|
|||||||
#include "gdkinternals.h"
|
#include "gdkinternals.h"
|
||||||
#include "gdkintl.h"
|
#include "gdkintl.h"
|
||||||
|
|
||||||
|
/* for the use of round() */
|
||||||
|
#include "fallback-c89.c"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SECTION:gdkdevice
|
* SECTION:gdkdevice
|
||||||
* @Short_description: Object representing an input device
|
* @Short_description: Object representing an input device
|
||||||
@ -406,28 +409,28 @@ gdk_device_get_state (GdkDevice *device,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gdk_device_get_position:
|
* gdk_device_get_position_double:
|
||||||
* @device: pointer device to query status about.
|
* @device: pointer device to query status about.
|
||||||
* @screen: (out) (transfer none) (allow-none): location to store the #GdkScreen
|
* @screen: (out) (transfer none) (allow-none): location to store the #GdkScreen
|
||||||
* the @device is on, or %NULL.
|
* the @device is on, or %NULL.
|
||||||
* @x: (out) (allow-none): location to store root window X coordinate of @device, 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.
|
* @y: (out) (allow-none): location to store root window Y coordinate of @device, or %NULL.
|
||||||
*
|
*
|
||||||
* Gets the current location of @device. As a slave device
|
* Gets the current location of @device in double precision. As a slave device
|
||||||
* coordinates are those of its master pointer, This function
|
* coordinates are those of its master pointer, This function
|
||||||
* may not be called on devices of type %GDK_DEVICE_TYPE_SLAVE,
|
* may not be called on devices of type %GDK_DEVICE_TYPE_SLAVE,
|
||||||
* unless there is an ongoing grab on them, see gdk_device_grab().
|
* unless there is an ongoing grab on them, see gdk_device_grab().
|
||||||
*
|
*
|
||||||
* Since: 3.0
|
* Since: 3.10
|
||||||
**/
|
**/
|
||||||
void
|
void
|
||||||
gdk_device_get_position (GdkDevice *device,
|
gdk_device_get_position_double (GdkDevice *device,
|
||||||
GdkScreen **screen,
|
GdkScreen **screen,
|
||||||
gint *x,
|
gdouble *x,
|
||||||
gint *y)
|
gdouble *y)
|
||||||
{
|
{
|
||||||
GdkDisplay *display;
|
GdkDisplay *display;
|
||||||
gint tmp_x, tmp_y;
|
gdouble tmp_x, tmp_y;
|
||||||
GdkScreen *default_screen;
|
GdkScreen *default_screen;
|
||||||
GdkWindow *root;
|
GdkWindow *root;
|
||||||
|
|
||||||
@ -455,6 +458,87 @@ gdk_device_get_position (GdkDevice *device,
|
|||||||
*y = tmp_y;
|
*y = tmp_y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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. As a slave device
|
||||||
|
* coordinates are those of its master pointer, This function
|
||||||
|
* may not be called on devices of type %GDK_DEVICE_TYPE_SLAVE,
|
||||||
|
* unless there is an ongoing grab on them, see gdk_device_grab().
|
||||||
|
*
|
||||||
|
* Since: 3.0
|
||||||
|
**/
|
||||||
|
void
|
||||||
|
gdk_device_get_position (GdkDevice *device,
|
||||||
|
GdkScreen **screen,
|
||||||
|
gint *x,
|
||||||
|
gint *y)
|
||||||
|
{
|
||||||
|
gdouble tmp_x, tmp_y;
|
||||||
|
|
||||||
|
gdk_device_get_position_double (device, screen, &tmp_x, &tmp_y);
|
||||||
|
if (x)
|
||||||
|
*x = round (tmp_x);
|
||||||
|
if (y)
|
||||||
|
*y = round (tmp_y);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gdk_device_get_window_at_position_double:
|
||||||
|
* @device: pointer #GdkDevice to query info to.
|
||||||
|
* @win_x: (out) (allow-none): return location for the X coordinate of the device location,
|
||||||
|
* relative to the window origin, or %NULL.
|
||||||
|
* @win_y: (out) (allow-none): return location for the Y coordinate of the device location,
|
||||||
|
* relative to the window origin, or %NULL.
|
||||||
|
*
|
||||||
|
* Obtains the window underneath @device, returning the location of the device in @win_x and @win_y in
|
||||||
|
* double precision. Returns %NULL if the window tree under @device is not known to GDK (for example,
|
||||||
|
* belongs to another application).
|
||||||
|
*
|
||||||
|
* As a slave device coordinates are those of its master pointer, This
|
||||||
|
* function may not be called on devices of type %GDK_DEVICE_TYPE_SLAVE,
|
||||||
|
* unless there is an ongoing grab on them, see gdk_device_grab().
|
||||||
|
*
|
||||||
|
* Returns: (transfer none): the #GdkWindow under the device position, or %NULL.
|
||||||
|
*
|
||||||
|
* Since: 3.0
|
||||||
|
**/
|
||||||
|
GdkWindow *
|
||||||
|
gdk_device_get_window_at_position_double (GdkDevice *device,
|
||||||
|
gdouble *win_x,
|
||||||
|
gdouble *win_y)
|
||||||
|
{
|
||||||
|
gdouble tmp_x, tmp_y;
|
||||||
|
GdkWindow *window;
|
||||||
|
|
||||||
|
g_return_val_if_fail (GDK_IS_DEVICE (device), NULL);
|
||||||
|
g_return_val_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD, NULL);
|
||||||
|
g_return_val_if_fail (gdk_device_get_device_type (device) != GDK_DEVICE_TYPE_SLAVE ||
|
||||||
|
gdk_display_device_is_grabbed (gdk_device_get_display (device), device), NULL);
|
||||||
|
|
||||||
|
window = _gdk_device_window_at_position (device, &tmp_x, &tmp_y, NULL, FALSE);
|
||||||
|
|
||||||
|
/* This might need corrections, as the native window returned
|
||||||
|
may contain client side children */
|
||||||
|
if (window)
|
||||||
|
window = _gdk_window_find_descendant_at (window,
|
||||||
|
tmp_x, tmp_y,
|
||||||
|
&tmp_x, &tmp_y);
|
||||||
|
|
||||||
|
if (win_x)
|
||||||
|
*win_x = tmp_x;
|
||||||
|
if (win_y)
|
||||||
|
*win_y = tmp_y;
|
||||||
|
|
||||||
|
return window;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gdk_device_get_window_at_position:
|
* gdk_device_get_window_at_position:
|
||||||
* @device: pointer #GdkDevice to query info to.
|
* @device: pointer #GdkDevice to query info to.
|
||||||
@ -479,33 +563,16 @@ gdk_device_get_window_at_position (GdkDevice *device,
|
|||||||
gint *win_x,
|
gint *win_x,
|
||||||
gint *win_y)
|
gint *win_y)
|
||||||
{
|
{
|
||||||
gint tmp_x, tmp_y;
|
gdouble tmp_x, tmp_y;
|
||||||
GdkWindow *window;
|
GdkWindow *window;
|
||||||
|
|
||||||
g_return_val_if_fail (GDK_IS_DEVICE (device), NULL);
|
window =
|
||||||
g_return_val_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD, NULL);
|
gdk_device_get_window_at_position_double (device, &tmp_x, &tmp_y);
|
||||||
g_return_val_if_fail (gdk_device_get_device_type (device) != GDK_DEVICE_TYPE_SLAVE ||
|
|
||||||
gdk_display_device_is_grabbed (gdk_device_get_display (device), device), NULL);
|
|
||||||
|
|
||||||
window = _gdk_device_window_at_position (device, &tmp_x, &tmp_y, NULL, FALSE);
|
|
||||||
|
|
||||||
/* This might need corrections, as the native window returned
|
|
||||||
may contain client side children */
|
|
||||||
if (window)
|
|
||||||
{
|
|
||||||
double xx, yy;
|
|
||||||
|
|
||||||
window = _gdk_window_find_descendant_at (window,
|
|
||||||
tmp_x, tmp_y,
|
|
||||||
&xx, &yy);
|
|
||||||
tmp_x = floor (xx + 0.5);
|
|
||||||
tmp_y = floor (yy + 0.5);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (win_x)
|
if (win_x)
|
||||||
*win_x = tmp_x;
|
*win_x = round (tmp_x);
|
||||||
if (win_y)
|
if (win_y)
|
||||||
*win_y = tmp_y;
|
*win_y = round (tmp_y);
|
||||||
|
|
||||||
return window;
|
return window;
|
||||||
}
|
}
|
||||||
@ -1535,8 +1602,8 @@ _gdk_device_translate_window_coord (GdkDevice *device,
|
|||||||
gboolean
|
gboolean
|
||||||
_gdk_device_translate_screen_coord (GdkDevice *device,
|
_gdk_device_translate_screen_coord (GdkDevice *device,
|
||||||
GdkWindow *window,
|
GdkWindow *window,
|
||||||
gint window_root_x,
|
gdouble window_root_x,
|
||||||
gint window_root_y,
|
gdouble window_root_y,
|
||||||
guint index_,
|
guint index_,
|
||||||
gdouble value,
|
gdouble value,
|
||||||
gdouble *axis_value)
|
gdouble *axis_value)
|
||||||
@ -1616,10 +1683,10 @@ _gdk_device_query_state (GdkDevice *device,
|
|||||||
GdkWindow *window,
|
GdkWindow *window,
|
||||||
GdkWindow **root_window,
|
GdkWindow **root_window,
|
||||||
GdkWindow **child_window,
|
GdkWindow **child_window,
|
||||||
gint *root_x,
|
gdouble *root_x,
|
||||||
gint *root_y,
|
gdouble *root_y,
|
||||||
gint *win_x,
|
gdouble *win_x,
|
||||||
gint *win_y,
|
gdouble *win_y,
|
||||||
GdkModifierType *mask)
|
GdkModifierType *mask)
|
||||||
{
|
{
|
||||||
GDK_DEVICE_GET_CLASS (device)->query_state (device,
|
GDK_DEVICE_GET_CLASS (device)->query_state (device,
|
||||||
@ -1635,8 +1702,8 @@ _gdk_device_query_state (GdkDevice *device,
|
|||||||
|
|
||||||
GdkWindow *
|
GdkWindow *
|
||||||
_gdk_device_window_at_position (GdkDevice *device,
|
_gdk_device_window_at_position (GdkDevice *device,
|
||||||
gint *win_x,
|
gdouble *win_x,
|
||||||
gint *win_y,
|
gdouble *win_y,
|
||||||
GdkModifierType *mask,
|
GdkModifierType *mask,
|
||||||
gboolean get_toplevel)
|
gboolean get_toplevel)
|
||||||
{
|
{
|
||||||
|
@ -198,6 +198,17 @@ GdkWindow *
|
|||||||
(GdkDevice *device,
|
(GdkDevice *device,
|
||||||
gint *win_x,
|
gint *win_x,
|
||||||
gint *win_y);
|
gint *win_y);
|
||||||
|
GDK_AVAILABLE_IN_3_10
|
||||||
|
void gdk_device_get_position_double (GdkDevice *device,
|
||||||
|
GdkScreen **screen,
|
||||||
|
gdouble *x,
|
||||||
|
gdouble *y);
|
||||||
|
GDK_AVAILABLE_IN_3_10
|
||||||
|
GdkWindow *
|
||||||
|
gdk_device_get_window_at_position_double
|
||||||
|
(GdkDevice *device,
|
||||||
|
gdouble *win_x,
|
||||||
|
gdouble *win_y);
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
gboolean gdk_device_get_history (GdkDevice *device,
|
gboolean gdk_device_get_history (GdkDevice *device,
|
||||||
GdkWindow *window,
|
GdkWindow *window,
|
||||||
|
@ -80,16 +80,16 @@ struct _GdkDeviceClass
|
|||||||
|
|
||||||
void (* warp) (GdkDevice *device,
|
void (* warp) (GdkDevice *device,
|
||||||
GdkScreen *screen,
|
GdkScreen *screen,
|
||||||
gint x,
|
gdouble x,
|
||||||
gint y);
|
gdouble y);
|
||||||
void (* query_state) (GdkDevice *device,
|
void (* query_state) (GdkDevice *device,
|
||||||
GdkWindow *window,
|
GdkWindow *window,
|
||||||
GdkWindow **root_window,
|
GdkWindow **root_window,
|
||||||
GdkWindow **child_window,
|
GdkWindow **child_window,
|
||||||
gint *root_x,
|
gdouble *root_x,
|
||||||
gint *root_y,
|
gdouble *root_y,
|
||||||
gint *win_x,
|
gdouble *win_x,
|
||||||
gint *win_y,
|
gdouble *win_y,
|
||||||
GdkModifierType *mask);
|
GdkModifierType *mask);
|
||||||
GdkGrabStatus (* grab) (GdkDevice *device,
|
GdkGrabStatus (* grab) (GdkDevice *device,
|
||||||
GdkWindow *window,
|
GdkWindow *window,
|
||||||
@ -102,8 +102,8 @@ struct _GdkDeviceClass
|
|||||||
guint32 time_);
|
guint32 time_);
|
||||||
|
|
||||||
GdkWindow * (* window_at_position) (GdkDevice *device,
|
GdkWindow * (* window_at_position) (GdkDevice *device,
|
||||||
gint *win_x,
|
double *win_x,
|
||||||
gint *win_y,
|
double *win_y,
|
||||||
GdkModifierType *mask,
|
GdkModifierType *mask,
|
||||||
gboolean get_toplevel);
|
gboolean get_toplevel);
|
||||||
void (* select_window_events) (GdkDevice *device,
|
void (* select_window_events) (GdkDevice *device,
|
||||||
@ -140,8 +140,8 @@ gboolean _gdk_device_translate_window_coord (GdkDevice *device,
|
|||||||
|
|
||||||
gboolean _gdk_device_translate_screen_coord (GdkDevice *device,
|
gboolean _gdk_device_translate_screen_coord (GdkDevice *device,
|
||||||
GdkWindow *window,
|
GdkWindow *window,
|
||||||
gint window_root_x,
|
gdouble window_root_x,
|
||||||
gint window_root_y,
|
gdouble window_root_y,
|
||||||
guint index,
|
guint index,
|
||||||
gdouble value,
|
gdouble value,
|
||||||
gdouble *axis_value);
|
gdouble *axis_value);
|
||||||
@ -162,14 +162,14 @@ void _gdk_device_query_state (GdkDevice *device,
|
|||||||
GdkWindow *window,
|
GdkWindow *window,
|
||||||
GdkWindow **root_window,
|
GdkWindow **root_window,
|
||||||
GdkWindow **child_window,
|
GdkWindow **child_window,
|
||||||
gint *root_x,
|
gdouble *root_x,
|
||||||
gint *root_y,
|
gdouble *root_y,
|
||||||
gint *win_x,
|
gdouble *win_x,
|
||||||
gint *win_y,
|
gdouble *win_y,
|
||||||
GdkModifierType *mask);
|
GdkModifierType *mask);
|
||||||
GdkWindow * _gdk_device_window_at_position (GdkDevice *device,
|
GdkWindow * _gdk_device_window_at_position (GdkDevice *device,
|
||||||
gint *win_x,
|
gdouble *win_x,
|
||||||
gint *win_y,
|
gdouble *win_y,
|
||||||
GdkModifierType *mask,
|
GdkModifierType *mask,
|
||||||
gboolean get_toplevel);
|
gboolean get_toplevel);
|
||||||
|
|
||||||
|
@ -32,8 +32,11 @@
|
|||||||
#include "gdkmarshalers.h"
|
#include "gdkmarshalers.h"
|
||||||
#include "gdkscreen.h"
|
#include "gdkscreen.h"
|
||||||
|
|
||||||
|
#include <math.h>
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
|
/* for the use of round() */
|
||||||
|
#include "fallback-c89.c"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SECTION:gdkdisplay
|
* SECTION:gdkdisplay
|
||||||
@ -546,7 +549,7 @@ gdk_display_get_pointer (GdkDisplay *display,
|
|||||||
{
|
{
|
||||||
GdkScreen *default_screen;
|
GdkScreen *default_screen;
|
||||||
GdkWindow *root;
|
GdkWindow *root;
|
||||||
gint tmp_x, tmp_y;
|
gdouble tmp_x, tmp_y;
|
||||||
GdkModifierType tmp_mask;
|
GdkModifierType tmp_mask;
|
||||||
|
|
||||||
g_return_if_fail (GDK_IS_DISPLAY (display));
|
g_return_if_fail (GDK_IS_DISPLAY (display));
|
||||||
@ -569,9 +572,9 @@ gdk_display_get_pointer (GdkDisplay *display,
|
|||||||
if (screen)
|
if (screen)
|
||||||
*screen = gdk_window_get_screen (root);
|
*screen = gdk_window_get_screen (root);
|
||||||
if (x)
|
if (x)
|
||||||
*x = tmp_x;
|
*x = round (tmp_x);
|
||||||
if (y)
|
if (y)
|
||||||
*y = tmp_y;
|
*y = round (tmp_y);
|
||||||
if (mask)
|
if (mask)
|
||||||
*mask = tmp_mask;
|
*mask = tmp_mask;
|
||||||
}
|
}
|
||||||
@ -792,7 +795,7 @@ synthesize_crossing_events (GdkDisplay *display,
|
|||||||
{
|
{
|
||||||
GdkWindow *src_toplevel, *dest_toplevel;
|
GdkWindow *src_toplevel, *dest_toplevel;
|
||||||
GdkModifierType state;
|
GdkModifierType state;
|
||||||
int x, y;
|
double x, y;
|
||||||
|
|
||||||
if (src_window)
|
if (src_window)
|
||||||
src_toplevel = gdk_window_get_toplevel (src_window);
|
src_toplevel = gdk_window_get_toplevel (src_window);
|
||||||
@ -810,7 +813,7 @@ synthesize_crossing_events (GdkDisplay *display,
|
|||||||
src_toplevel == dest_toplevel)
|
src_toplevel == dest_toplevel)
|
||||||
{
|
{
|
||||||
/* Same toplevels */
|
/* Same toplevels */
|
||||||
gdk_window_get_device_position (dest_toplevel,
|
gdk_window_get_device_position_double (dest_toplevel,
|
||||||
device,
|
device,
|
||||||
&x, &y, &state);
|
&x, &y, &state);
|
||||||
_gdk_synthesize_crossing_events (display,
|
_gdk_synthesize_crossing_events (display,
|
||||||
@ -825,7 +828,7 @@ synthesize_crossing_events (GdkDisplay *display,
|
|||||||
}
|
}
|
||||||
else if (dest_toplevel == NULL)
|
else if (dest_toplevel == NULL)
|
||||||
{
|
{
|
||||||
gdk_window_get_device_position (src_toplevel,
|
gdk_window_get_device_position_double (src_toplevel,
|
||||||
device,
|
device,
|
||||||
&x, &y, &state);
|
&x, &y, &state);
|
||||||
_gdk_synthesize_crossing_events (display,
|
_gdk_synthesize_crossing_events (display,
|
||||||
@ -841,7 +844,7 @@ synthesize_crossing_events (GdkDisplay *display,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Different toplevels */
|
/* Different toplevels */
|
||||||
gdk_window_get_device_position (src_toplevel,
|
gdk_window_get_device_position_double (src_toplevel,
|
||||||
device,
|
device,
|
||||||
&x, &y, &state);
|
&x, &y, &state);
|
||||||
_gdk_synthesize_crossing_events (display,
|
_gdk_synthesize_crossing_events (display,
|
||||||
@ -853,7 +856,7 @@ synthesize_crossing_events (GdkDisplay *display,
|
|||||||
time,
|
time,
|
||||||
NULL,
|
NULL,
|
||||||
serial, FALSE);
|
serial, FALSE);
|
||||||
gdk_window_get_device_position (dest_toplevel,
|
gdk_window_get_device_position_double (dest_toplevel,
|
||||||
device,
|
device,
|
||||||
&x, &y, &state);
|
&x, &y, &state);
|
||||||
_gdk_synthesize_crossing_events (display,
|
_gdk_synthesize_crossing_events (display,
|
||||||
@ -876,7 +879,7 @@ get_current_toplevel (GdkDisplay *display,
|
|||||||
GdkModifierType *state_out)
|
GdkModifierType *state_out)
|
||||||
{
|
{
|
||||||
GdkWindow *pointer_window;
|
GdkWindow *pointer_window;
|
||||||
int x, y;
|
gdouble x, y;
|
||||||
GdkModifierType state;
|
GdkModifierType state;
|
||||||
|
|
||||||
pointer_window = _gdk_device_window_at_position (device, &x, &y, &state, TRUE);
|
pointer_window = _gdk_device_window_at_position (device, &x, &y, &state, TRUE);
|
||||||
@ -887,8 +890,8 @@ get_current_toplevel (GdkDisplay *display,
|
|||||||
GDK_WINDOW_TYPE (pointer_window) == GDK_WINDOW_FOREIGN))
|
GDK_WINDOW_TYPE (pointer_window) == GDK_WINDOW_FOREIGN))
|
||||||
pointer_window = NULL;
|
pointer_window = NULL;
|
||||||
|
|
||||||
*x_out = x;
|
*x_out = round (x);
|
||||||
*y_out = y;
|
*y_out = round (y);
|
||||||
*state_out = state;
|
*state_out = state;
|
||||||
|
|
||||||
return pointer_window;
|
return pointer_window;
|
||||||
|
@ -358,7 +358,7 @@ void _gdk_window_invalidate_for_expose (GdkWindow *window,
|
|||||||
cairo_region_t *region);
|
cairo_region_t *region);
|
||||||
|
|
||||||
GdkWindow * _gdk_window_find_child_at (GdkWindow *window,
|
GdkWindow * _gdk_window_find_child_at (GdkWindow *window,
|
||||||
int x, int y);
|
double x, double y);
|
||||||
GdkWindow * _gdk_window_find_descendant_at (GdkWindow *toplevel,
|
GdkWindow * _gdk_window_find_descendant_at (GdkWindow *toplevel,
|
||||||
double x, double y,
|
double x, double y,
|
||||||
double *found_x,
|
double *found_x,
|
||||||
@ -380,8 +380,8 @@ void _gdk_synthesize_crossing_events (GdkDisplay *display,
|
|||||||
GdkDevice *device,
|
GdkDevice *device,
|
||||||
GdkDevice *source_device,
|
GdkDevice *source_device,
|
||||||
GdkCrossingMode mode,
|
GdkCrossingMode mode,
|
||||||
gint toplevel_x,
|
gdouble toplevel_x,
|
||||||
gint toplevel_y,
|
gdouble toplevel_y,
|
||||||
GdkModifierType mask,
|
GdkModifierType mask,
|
||||||
guint32 time_,
|
guint32 time_,
|
||||||
GdkEvent *event_in_queue,
|
GdkEvent *event_in_queue,
|
||||||
|
@ -280,12 +280,12 @@ gdk_offscreen_window_get_root_coords (GdkWindow *window,
|
|||||||
static gboolean
|
static gboolean
|
||||||
gdk_offscreen_window_get_device_state (GdkWindow *window,
|
gdk_offscreen_window_get_device_state (GdkWindow *window,
|
||||||
GdkDevice *device,
|
GdkDevice *device,
|
||||||
gint *x,
|
gdouble *x,
|
||||||
gint *y,
|
gdouble *y,
|
||||||
GdkModifierType *mask)
|
GdkModifierType *mask)
|
||||||
{
|
{
|
||||||
GdkOffscreenWindow *offscreen;
|
GdkOffscreenWindow *offscreen;
|
||||||
int tmpx, tmpy;
|
double tmpx, tmpy;
|
||||||
double dtmpx, dtmpy;
|
double dtmpx, dtmpy;
|
||||||
GdkModifierType tmpmask;
|
GdkModifierType tmpmask;
|
||||||
|
|
||||||
@ -296,18 +296,18 @@ gdk_offscreen_window_get_device_state (GdkWindow *window,
|
|||||||
offscreen = GDK_OFFSCREEN_WINDOW (window->impl);
|
offscreen = GDK_OFFSCREEN_WINDOW (window->impl);
|
||||||
if (offscreen->embedder != NULL)
|
if (offscreen->embedder != NULL)
|
||||||
{
|
{
|
||||||
gdk_window_get_device_position (offscreen->embedder, device, &tmpx, &tmpy, &tmpmask);
|
gdk_window_get_device_position_double (offscreen->embedder, device, &tmpx, &tmpy, &tmpmask);
|
||||||
from_embedder (window,
|
from_embedder (window,
|
||||||
tmpx, tmpy,
|
tmpx, tmpy,
|
||||||
&dtmpx, &dtmpy);
|
&dtmpx, &dtmpy);
|
||||||
tmpx = floor (dtmpx + 0.5);
|
tmpx = dtmpx;
|
||||||
tmpy = floor (dtmpy + 0.5);
|
tmpy = dtmpy;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (x)
|
if (x)
|
||||||
*x = tmpx;
|
*x = round (tmpx);
|
||||||
if (y)
|
if (y)
|
||||||
*y = tmpy;
|
*y = round (tmpy);
|
||||||
if (mask)
|
if (mask)
|
||||||
*mask = tmpmask;
|
*mask = tmpmask;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -4426,30 +4426,30 @@ gdk_window_get_pointer (GdkWindow *window,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gdk_window_get_device_position:
|
* gdk_window_get_device_position_double:
|
||||||
* @window: a #GdkWindow.
|
* @window: a #GdkWindow.
|
||||||
* @device: pointer #GdkDevice to query to.
|
* @device: pointer #GdkDevice to query to.
|
||||||
* @x: (out) (allow-none): return location for the X coordinate of @device, or %NULL.
|
* @x: (out) (allow-none): return location for the X coordinate of @device, or %NULL.
|
||||||
* @y: (out) (allow-none): return location for the Y coordinate of @device, or %NULL.
|
* @y: (out) (allow-none): return location for the Y coordinate of @device, or %NULL.
|
||||||
* @mask: (out) (allow-none): return location for the modifier mask, or %NULL.
|
* @mask: (out) (allow-none): return location for the modifier mask, or %NULL.
|
||||||
*
|
*
|
||||||
* Obtains the current device position and modifier state.
|
* Obtains the current device position in doubles and modifier state.
|
||||||
* The position is given in coordinates relative to the upper left
|
* The position is given in coordinates relative to the upper left
|
||||||
* corner of @window.
|
* corner of @window.
|
||||||
*
|
*
|
||||||
* Return value: (transfer none): The window underneath @device (as with
|
* Return value: (transfer none): The window underneath @device (as with
|
||||||
* gdk_device_get_window_at_position()), or %NULL if the window is not known to GDK.
|
* gdk_device_get_window_at_position()), or %NULL if the window is not known to GDK.
|
||||||
*
|
*
|
||||||
* Since: 3.0
|
* Since: 3.10
|
||||||
**/
|
**/
|
||||||
GdkWindow *
|
GdkWindow *
|
||||||
gdk_window_get_device_position (GdkWindow *window,
|
gdk_window_get_device_position_double (GdkWindow *window,
|
||||||
GdkDevice *device,
|
GdkDevice *device,
|
||||||
gint *x,
|
double *x,
|
||||||
gint *y,
|
double *y,
|
||||||
GdkModifierType *mask)
|
GdkModifierType *mask)
|
||||||
{
|
{
|
||||||
gint tmp_x, tmp_y;
|
gdouble tmp_x, tmp_y;
|
||||||
GdkModifierType tmp_mask;
|
GdkModifierType tmp_mask;
|
||||||
gboolean normal_child;
|
gboolean normal_child;
|
||||||
|
|
||||||
@ -4479,6 +4479,44 @@ gdk_window_get_device_position (GdkWindow *window,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gdk_window_get_device_position:
|
||||||
|
* @window: a #GdkWindow.
|
||||||
|
* @device: pointer #GdkDevice to query to.
|
||||||
|
* @x: (out) (allow-none): return location for the X coordinate of @device, or %NULL.
|
||||||
|
* @y: (out) (allow-none): return location for the Y coordinate of @device, or %NULL.
|
||||||
|
* @mask: (out) (allow-none): return location for the modifier mask, or %NULL.
|
||||||
|
*
|
||||||
|
* Obtains the current device position and modifier state.
|
||||||
|
* The position is given in coordinates relative to the upper left
|
||||||
|
* corner of @window.
|
||||||
|
*
|
||||||
|
* Use gdk_window_get_device_position_double() if you need subpixel precision.
|
||||||
|
*
|
||||||
|
* Return value: (transfer none): The window underneath @device (as with
|
||||||
|
* gdk_device_get_window_at_position()), or %NULL if the window is not known to GDK.
|
||||||
|
*
|
||||||
|
* Since: 3.0
|
||||||
|
**/
|
||||||
|
GdkWindow *
|
||||||
|
gdk_window_get_device_position (GdkWindow *window,
|
||||||
|
GdkDevice *device,
|
||||||
|
gint *x,
|
||||||
|
gint *y,
|
||||||
|
GdkModifierType *mask)
|
||||||
|
{
|
||||||
|
gdouble tmp_x, tmp_y;
|
||||||
|
|
||||||
|
window = gdk_window_get_device_position_double (window, device,
|
||||||
|
&tmp_x, &tmp_y, mask);
|
||||||
|
if (x)
|
||||||
|
*x = round (tmp_x);
|
||||||
|
if (y)
|
||||||
|
*y = round (tmp_y);
|
||||||
|
|
||||||
|
return window;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gdk_get_default_root_window:
|
* gdk_get_default_root_window:
|
||||||
*
|
*
|
||||||
@ -6954,8 +6992,8 @@ pick_embedded_child (GdkWindow *window,
|
|||||||
|
|
||||||
GdkWindow *
|
GdkWindow *
|
||||||
_gdk_window_find_child_at (GdkWindow *window,
|
_gdk_window_find_child_at (GdkWindow *window,
|
||||||
int x,
|
double x,
|
||||||
int y)
|
double y)
|
||||||
{
|
{
|
||||||
GdkWindow *sub;
|
GdkWindow *sub;
|
||||||
double child_x, child_y;
|
double child_x, child_y;
|
||||||
@ -7396,8 +7434,8 @@ send_crossing_event (GdkDisplay *display,
|
|||||||
GdkWindow *subwindow,
|
GdkWindow *subwindow,
|
||||||
GdkDevice *device,
|
GdkDevice *device,
|
||||||
GdkDevice *source_device,
|
GdkDevice *source_device,
|
||||||
gint toplevel_x,
|
gdouble toplevel_x,
|
||||||
gint toplevel_y,
|
gdouble toplevel_y,
|
||||||
GdkModifierType mask,
|
GdkModifierType mask,
|
||||||
guint32 time_,
|
guint32 time_,
|
||||||
GdkEvent *event_in_queue,
|
GdkEvent *event_in_queue,
|
||||||
@ -7512,8 +7550,8 @@ _gdk_synthesize_crossing_events (GdkDisplay *display,
|
|||||||
GdkDevice *device,
|
GdkDevice *device,
|
||||||
GdkDevice *source_device,
|
GdkDevice *source_device,
|
||||||
GdkCrossingMode mode,
|
GdkCrossingMode mode,
|
||||||
gint toplevel_x,
|
double toplevel_x,
|
||||||
gint toplevel_y,
|
double toplevel_y,
|
||||||
GdkModifierType mask,
|
GdkModifierType mask,
|
||||||
guint32 time_,
|
guint32 time_,
|
||||||
GdkEvent *event_in_queue,
|
GdkEvent *event_in_queue,
|
||||||
|
@ -845,6 +845,12 @@ GdkWindow * gdk_window_get_device_position (GdkWindow *window,
|
|||||||
gint *x,
|
gint *x,
|
||||||
gint *y,
|
gint *y,
|
||||||
GdkModifierType *mask);
|
GdkModifierType *mask);
|
||||||
|
GDK_AVAILABLE_IN_3_10
|
||||||
|
GdkWindow * gdk_window_get_device_position_double (GdkWindow *window,
|
||||||
|
GdkDevice *device,
|
||||||
|
gdouble *x,
|
||||||
|
gdouble *y,
|
||||||
|
GdkModifierType *mask);
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
GdkWindow * gdk_window_get_parent (GdkWindow *window);
|
GdkWindow * gdk_window_get_parent (GdkWindow *window);
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
|
@ -98,8 +98,8 @@ struct _GdkWindowImplClass
|
|||||||
gint *root_y);
|
gint *root_y);
|
||||||
gboolean (* get_device_state) (GdkWindow *window,
|
gboolean (* get_device_state) (GdkWindow *window,
|
||||||
GdkDevice *device,
|
GdkDevice *device,
|
||||||
gint *x,
|
gdouble *x,
|
||||||
gint *y,
|
gdouble *y,
|
||||||
GdkModifierType *mask);
|
GdkModifierType *mask);
|
||||||
gboolean (* begin_paint_region) (GdkWindow *window,
|
gboolean (* begin_paint_region) (GdkWindow *window,
|
||||||
const cairo_region_t *region);
|
const cairo_region_t *region);
|
||||||
|
@ -58,10 +58,10 @@ static void gdk_quartz_device_core_query_state (GdkDevice *device,
|
|||||||
GdkWindow *window,
|
GdkWindow *window,
|
||||||
GdkWindow **root_window,
|
GdkWindow **root_window,
|
||||||
GdkWindow **child_window,
|
GdkWindow **child_window,
|
||||||
gint *root_x,
|
gdouble *root_x,
|
||||||
gint *root_y,
|
gdouble *root_y,
|
||||||
gint *win_x,
|
gdouble *win_x,
|
||||||
gint *win_y,
|
gdouble *win_y,
|
||||||
GdkModifierType *mask);
|
GdkModifierType *mask);
|
||||||
static GdkGrabStatus gdk_quartz_device_core_grab (GdkDevice *device,
|
static GdkGrabStatus gdk_quartz_device_core_grab (GdkDevice *device,
|
||||||
GdkWindow *window,
|
GdkWindow *window,
|
||||||
@ -73,8 +73,8 @@ static GdkGrabStatus gdk_quartz_device_core_grab (GdkDevice *device,
|
|||||||
static void gdk_quartz_device_core_ungrab (GdkDevice *device,
|
static void gdk_quartz_device_core_ungrab (GdkDevice *device,
|
||||||
guint32 time_);
|
guint32 time_);
|
||||||
static GdkWindow * gdk_quartz_device_core_window_at_position (GdkDevice *device,
|
static GdkWindow * gdk_quartz_device_core_window_at_position (GdkDevice *device,
|
||||||
gint *win_x,
|
gdouble *win_x,
|
||||||
gint *win_y,
|
gdouble *win_y,
|
||||||
GdkModifierType *mask,
|
GdkModifierType *mask,
|
||||||
gboolean get_toplevel);
|
gboolean get_toplevel);
|
||||||
static void gdk_quartz_device_core_select_window_events (GdkDevice *device,
|
static void gdk_quartz_device_core_select_window_events (GdkDevice *device,
|
||||||
@ -181,8 +181,8 @@ gdk_quartz_device_core_set_window_cursor (GdkDevice *device,
|
|||||||
static void
|
static void
|
||||||
gdk_quartz_device_core_warp (GdkDevice *device,
|
gdk_quartz_device_core_warp (GdkDevice *device,
|
||||||
GdkScreen *screen,
|
GdkScreen *screen,
|
||||||
gint x,
|
gdouble x,
|
||||||
gint y)
|
gdouble y)
|
||||||
{
|
{
|
||||||
CGDisplayMoveCursorToPoint (CGMainDisplayID (), CGPointMake (x, y));
|
CGDisplayMoveCursorToPoint (CGMainDisplayID (), CGPointMake (x, y));
|
||||||
}
|
}
|
||||||
@ -190,8 +190,8 @@ gdk_quartz_device_core_warp (GdkDevice *device,
|
|||||||
static GdkWindow *
|
static GdkWindow *
|
||||||
gdk_quartz_device_core_query_state_helper (GdkWindow *window,
|
gdk_quartz_device_core_query_state_helper (GdkWindow *window,
|
||||||
GdkDevice *device,
|
GdkDevice *device,
|
||||||
gint *x,
|
gdouble *x,
|
||||||
gint *y,
|
gdouble *y,
|
||||||
GdkModifierType *mask)
|
GdkModifierType *mask)
|
||||||
{
|
{
|
||||||
GdkWindow *toplevel;
|
GdkWindow *toplevel;
|
||||||
@ -260,10 +260,10 @@ gdk_quartz_device_core_query_state (GdkDevice *device,
|
|||||||
GdkWindow *window,
|
GdkWindow *window,
|
||||||
GdkWindow **root_window,
|
GdkWindow **root_window,
|
||||||
GdkWindow **child_window,
|
GdkWindow **child_window,
|
||||||
gint *root_x,
|
gdouble *root_x,
|
||||||
gint *root_y,
|
gdouble *root_y,
|
||||||
gint *win_x,
|
gdouble *win_x,
|
||||||
gint *win_y,
|
gdouble *win_y,
|
||||||
GdkModifierType *mask)
|
GdkModifierType *mask)
|
||||||
{
|
{
|
||||||
GdkWindow *found_window;
|
GdkWindow *found_window;
|
||||||
@ -318,8 +318,8 @@ gdk_quartz_device_core_ungrab (GdkDevice *device,
|
|||||||
|
|
||||||
static GdkWindow *
|
static GdkWindow *
|
||||||
gdk_quartz_device_core_window_at_position (GdkDevice *device,
|
gdk_quartz_device_core_window_at_position (GdkDevice *device,
|
||||||
gint *win_x,
|
gdouble *win_x,
|
||||||
gint *win_y,
|
gdouble *win_y,
|
||||||
GdkModifierType *mask,
|
GdkModifierType *mask,
|
||||||
gboolean get_toplevel)
|
gboolean get_toplevel)
|
||||||
{
|
{
|
||||||
|
@ -1818,8 +1818,8 @@ gdk_quartz_window_get_root_origin (GdkWindow *window,
|
|||||||
static GdkWindow *
|
static GdkWindow *
|
||||||
gdk_window_quartz_get_device_state_helper (GdkWindow *window,
|
gdk_window_quartz_get_device_state_helper (GdkWindow *window,
|
||||||
GdkDevice *device,
|
GdkDevice *device,
|
||||||
gint *x,
|
gdouble *x,
|
||||||
gint *y,
|
gdouble *y,
|
||||||
GdkModifierType *mask)
|
GdkModifierType *mask)
|
||||||
{
|
{
|
||||||
NSPoint point;
|
NSPoint point;
|
||||||
@ -1880,8 +1880,8 @@ gdk_window_quartz_get_device_state_helper (GdkWindow *window,
|
|||||||
static gboolean
|
static gboolean
|
||||||
gdk_window_quartz_get_device_state (GdkWindow *window,
|
gdk_window_quartz_get_device_state (GdkWindow *window,
|
||||||
GdkDevice *device,
|
GdkDevice *device,
|
||||||
gint *x,
|
gdouble *x,
|
||||||
gint *y,
|
gdouble *y,
|
||||||
GdkModifierType *mask)
|
GdkModifierType *mask)
|
||||||
{
|
{
|
||||||
return gdk_window_quartz_get_device_state_helper (window,
|
return gdk_window_quartz_get_device_state_helper (window,
|
||||||
|
@ -135,14 +135,14 @@ gdk_wayland_device_get_state (GdkDevice *device,
|
|||||||
gdouble *axes,
|
gdouble *axes,
|
||||||
GdkModifierType *mask)
|
GdkModifierType *mask)
|
||||||
{
|
{
|
||||||
gint x_int, y_int;
|
gdouble x, y;
|
||||||
|
|
||||||
gdk_window_get_device_position (window, device, &x_int, &y_int, mask);
|
gdk_window_get_device_position_double (window, device, &x, &y, mask);
|
||||||
|
|
||||||
if (axes)
|
if (axes)
|
||||||
{
|
{
|
||||||
axes[0] = x_int;
|
axes[0] = x;
|
||||||
axes[1] = y_int;
|
axes[1] = y;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -228,8 +228,8 @@ gdk_wayland_device_set_window_cursor (GdkDevice *device,
|
|||||||
static void
|
static void
|
||||||
gdk_wayland_device_warp (GdkDevice *device,
|
gdk_wayland_device_warp (GdkDevice *device,
|
||||||
GdkScreen *screen,
|
GdkScreen *screen,
|
||||||
gint x,
|
gdouble x,
|
||||||
gint y)
|
gdouble y)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -238,10 +238,10 @@ gdk_wayland_device_query_state (GdkDevice *device,
|
|||||||
GdkWindow *window,
|
GdkWindow *window,
|
||||||
GdkWindow **root_window,
|
GdkWindow **root_window,
|
||||||
GdkWindow **child_window,
|
GdkWindow **child_window,
|
||||||
gint *root_x,
|
gdouble *root_x,
|
||||||
gint *root_y,
|
gdouble *root_y,
|
||||||
gint *win_x,
|
gdouble *win_x,
|
||||||
gint *win_y,
|
gdouble *win_y,
|
||||||
GdkModifierType *mask)
|
GdkModifierType *mask)
|
||||||
{
|
{
|
||||||
GdkWaylandDeviceData *wd;
|
GdkWaylandDeviceData *wd;
|
||||||
@ -345,8 +345,8 @@ gdk_wayland_device_ungrab (GdkDevice *device,
|
|||||||
|
|
||||||
static GdkWindow *
|
static GdkWindow *
|
||||||
gdk_wayland_device_window_at_position (GdkDevice *device,
|
gdk_wayland_device_window_at_position (GdkDevice *device,
|
||||||
gint *win_x,
|
gdouble *win_x,
|
||||||
gint *win_y,
|
gdouble *win_y,
|
||||||
GdkModifierType *mask,
|
GdkModifierType *mask,
|
||||||
gboolean get_toplevel)
|
gboolean get_toplevel)
|
||||||
{
|
{
|
||||||
|
@ -928,7 +928,7 @@ output_handle_done(void *data,
|
|||||||
static void
|
static void
|
||||||
output_handle_scale(void *data,
|
output_handle_scale(void *data,
|
||||||
struct wl_output *wl_output,
|
struct wl_output *wl_output,
|
||||||
uint32_t factor)
|
int32_t factor)
|
||||||
{
|
{
|
||||||
GdkWaylandMonitor *monitor = (GdkWaylandMonitor *)data;
|
GdkWaylandMonitor *monitor = (GdkWaylandMonitor *)data;
|
||||||
|
|
||||||
|
@ -1237,8 +1237,8 @@ gdk_window_wayland_get_root_coords (GdkWindow *window,
|
|||||||
static gboolean
|
static gboolean
|
||||||
gdk_window_wayland_get_device_state (GdkWindow *window,
|
gdk_window_wayland_get_device_state (GdkWindow *window,
|
||||||
GdkDevice *device,
|
GdkDevice *device,
|
||||||
gint *x,
|
gdouble *x,
|
||||||
gint *y,
|
gdouble *y,
|
||||||
GdkModifierType *mask)
|
GdkModifierType *mask)
|
||||||
{
|
{
|
||||||
gboolean return_val;
|
gboolean return_val;
|
||||||
|
@ -47,10 +47,10 @@ static void gdk_device_virtual_query_state (GdkDevice *device,
|
|||||||
GdkWindow *window,
|
GdkWindow *window,
|
||||||
GdkWindow **root_window,
|
GdkWindow **root_window,
|
||||||
GdkWindow **child_window,
|
GdkWindow **child_window,
|
||||||
gint *root_x,
|
gdouble *root_x,
|
||||||
gint *root_y,
|
gdouble *root_y,
|
||||||
gint *win_x,
|
gdouble *win_x,
|
||||||
gint *win_y,
|
gdouble *win_y,
|
||||||
GdkModifierType *mask);
|
GdkModifierType *mask);
|
||||||
static GdkGrabStatus gdk_device_virtual_grab (GdkDevice *device,
|
static GdkGrabStatus gdk_device_virtual_grab (GdkDevice *device,
|
||||||
GdkWindow *window,
|
GdkWindow *window,
|
||||||
@ -62,8 +62,8 @@ static GdkGrabStatus gdk_device_virtual_grab (GdkDevice *device,
|
|||||||
static void gdk_device_virtual_ungrab (GdkDevice *device,
|
static void gdk_device_virtual_ungrab (GdkDevice *device,
|
||||||
guint32 time_);
|
guint32 time_);
|
||||||
static GdkWindow * gdk_device_virtual_window_at_position (GdkDevice *device,
|
static GdkWindow * gdk_device_virtual_window_at_position (GdkDevice *device,
|
||||||
gint *win_x,
|
gdouble *win_x,
|
||||||
gint *win_y,
|
gdouble *win_y,
|
||||||
GdkModifierType *mask,
|
GdkModifierType *mask,
|
||||||
gboolean get_toplevel);
|
gboolean get_toplevel);
|
||||||
static void gdk_device_virtual_select_window_events (GdkDevice *device,
|
static void gdk_device_virtual_select_window_events (GdkDevice *device,
|
||||||
@ -245,10 +245,10 @@ gdk_device_virtual_query_state (GdkDevice *device,
|
|||||||
GdkWindow *window,
|
GdkWindow *window,
|
||||||
GdkWindow **root_window,
|
GdkWindow **root_window,
|
||||||
GdkWindow **child_window,
|
GdkWindow **child_window,
|
||||||
gint *root_x,
|
gdouble *root_x,
|
||||||
gint *root_y,
|
gdouble *root_y,
|
||||||
gint *win_x,
|
gdouble *win_x,
|
||||||
gint *win_y,
|
gdouble *win_y,
|
||||||
GdkModifierType *mask)
|
GdkModifierType *mask)
|
||||||
{
|
{
|
||||||
GdkDeviceVirtual *virtual = GDK_DEVICE_VIRTUAL (device);
|
GdkDeviceVirtual *virtual = GDK_DEVICE_VIRTUAL (device);
|
||||||
@ -342,8 +342,8 @@ screen_to_client (HWND hwnd, POINT screen_pt, POINT *client_pt)
|
|||||||
|
|
||||||
static GdkWindow *
|
static GdkWindow *
|
||||||
gdk_device_virtual_window_at_position (GdkDevice *device,
|
gdk_device_virtual_window_at_position (GdkDevice *device,
|
||||||
gint *win_x,
|
gdouble *win_x,
|
||||||
gint *win_y,
|
gdouble *win_y,
|
||||||
GdkModifierType *mask,
|
GdkModifierType *mask,
|
||||||
gboolean get_toplevel)
|
gboolean get_toplevel)
|
||||||
{
|
{
|
||||||
|
@ -47,10 +47,10 @@ static void gdk_device_win32_query_state (GdkDevice *device,
|
|||||||
GdkWindow *window,
|
GdkWindow *window,
|
||||||
GdkWindow **root_window,
|
GdkWindow **root_window,
|
||||||
GdkWindow **child_window,
|
GdkWindow **child_window,
|
||||||
gint *root_x,
|
gdouble *root_x,
|
||||||
gint *root_y,
|
gdouble *root_y,
|
||||||
gint *win_x,
|
gdouble *win_x,
|
||||||
gint *win_y,
|
gdouble *win_y,
|
||||||
GdkModifierType *mask);
|
GdkModifierType *mask);
|
||||||
static GdkGrabStatus gdk_device_win32_grab (GdkDevice *device,
|
static GdkGrabStatus gdk_device_win32_grab (GdkDevice *device,
|
||||||
GdkWindow *window,
|
GdkWindow *window,
|
||||||
@ -62,8 +62,8 @@ static GdkGrabStatus gdk_device_win32_grab (GdkDevice *device,
|
|||||||
static void gdk_device_win32_ungrab (GdkDevice *device,
|
static void gdk_device_win32_ungrab (GdkDevice *device,
|
||||||
guint32 time_);
|
guint32 time_);
|
||||||
static GdkWindow * gdk_device_win32_window_at_position (GdkDevice *device,
|
static GdkWindow * gdk_device_win32_window_at_position (GdkDevice *device,
|
||||||
gint *win_x,
|
gdouble *win_x,
|
||||||
gint *win_y,
|
gdouble *win_y,
|
||||||
GdkModifierType *mask,
|
GdkModifierType *mask,
|
||||||
gboolean get_toplevel);
|
gboolean get_toplevel);
|
||||||
static void gdk_device_win32_select_window_events (GdkDevice *device,
|
static void gdk_device_win32_select_window_events (GdkDevice *device,
|
||||||
@ -138,8 +138,8 @@ gdk_device_win32_set_window_cursor (GdkDevice *device,
|
|||||||
static void
|
static void
|
||||||
gdk_device_win32_warp (GdkDevice *device,
|
gdk_device_win32_warp (GdkDevice *device,
|
||||||
GdkScreen *screen,
|
GdkScreen *screen,
|
||||||
gint x,
|
gdouble x,
|
||||||
gint y)
|
gdouble y)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -174,10 +174,10 @@ gdk_device_win32_query_state (GdkDevice *device,
|
|||||||
GdkWindow *window,
|
GdkWindow *window,
|
||||||
GdkWindow **root_window,
|
GdkWindow **root_window,
|
||||||
GdkWindow **child_window,
|
GdkWindow **child_window,
|
||||||
gint *root_x,
|
gdouble *root_x,
|
||||||
gint *root_y,
|
gdouble *root_y,
|
||||||
gint *win_x,
|
gdouble *win_x,
|
||||||
gint *win_y,
|
gdouble *win_y,
|
||||||
GdkModifierType *mask)
|
GdkModifierType *mask)
|
||||||
{
|
{
|
||||||
POINT point;
|
POINT point;
|
||||||
@ -259,8 +259,8 @@ screen_to_client (HWND hwnd, POINT screen_pt, POINT *client_pt)
|
|||||||
|
|
||||||
static GdkWindow *
|
static GdkWindow *
|
||||||
gdk_device_win32_window_at_position (GdkDevice *device,
|
gdk_device_win32_window_at_position (GdkDevice *device,
|
||||||
gint *win_x,
|
gdouble *win_x,
|
||||||
gint *win_y,
|
gdouble *win_y,
|
||||||
GdkModifierType *mask,
|
GdkModifierType *mask,
|
||||||
gboolean get_toplevel)
|
gboolean get_toplevel)
|
||||||
{
|
{
|
||||||
|
@ -46,10 +46,10 @@ static void gdk_device_wintab_query_state (GdkDevice *device,
|
|||||||
GdkWindow *window,
|
GdkWindow *window,
|
||||||
GdkWindow **root_window,
|
GdkWindow **root_window,
|
||||||
GdkWindow **child_window,
|
GdkWindow **child_window,
|
||||||
gint *root_x,
|
gdouble *root_x,
|
||||||
gint *root_y,
|
gdouble *root_y,
|
||||||
gint *win_x,
|
gdouble *win_x,
|
||||||
gint *win_y,
|
gdouble *win_y,
|
||||||
GdkModifierType *mask);
|
GdkModifierType *mask);
|
||||||
static GdkGrabStatus gdk_device_wintab_grab (GdkDevice *device,
|
static GdkGrabStatus gdk_device_wintab_grab (GdkDevice *device,
|
||||||
GdkWindow *window,
|
GdkWindow *window,
|
||||||
@ -61,8 +61,8 @@ static GdkGrabStatus gdk_device_wintab_grab (GdkDevice *device,
|
|||||||
static void gdk_device_wintab_ungrab (GdkDevice *device,
|
static void gdk_device_wintab_ungrab (GdkDevice *device,
|
||||||
guint32 time_);
|
guint32 time_);
|
||||||
static GdkWindow * gdk_device_wintab_window_at_position (GdkDevice *device,
|
static GdkWindow * gdk_device_wintab_window_at_position (GdkDevice *device,
|
||||||
gint *win_x,
|
gdouble *win_x,
|
||||||
gint *win_y,
|
gdouble *win_y,
|
||||||
GdkModifierType *mask,
|
GdkModifierType *mask,
|
||||||
gboolean get_toplevel);
|
gboolean get_toplevel);
|
||||||
static void gdk_device_wintab_select_window_events (GdkDevice *device,
|
static void gdk_device_wintab_select_window_events (GdkDevice *device,
|
||||||
@ -180,10 +180,10 @@ gdk_device_wintab_query_state (GdkDevice *device,
|
|||||||
GdkWindow *window,
|
GdkWindow *window,
|
||||||
GdkWindow **root_window,
|
GdkWindow **root_window,
|
||||||
GdkWindow **child_window,
|
GdkWindow **child_window,
|
||||||
gint *root_x,
|
gdouble *root_x,
|
||||||
gint *root_y,
|
gdouble *root_y,
|
||||||
gint *win_x,
|
gdouble *win_x,
|
||||||
gint *win_y,
|
gdouble *win_y,
|
||||||
GdkModifierType *mask)
|
GdkModifierType *mask)
|
||||||
{
|
{
|
||||||
GdkDeviceWintab *device_wintab;
|
GdkDeviceWintab *device_wintab;
|
||||||
@ -268,8 +268,8 @@ gdk_device_wintab_ungrab (GdkDevice *device,
|
|||||||
|
|
||||||
static GdkWindow *
|
static GdkWindow *
|
||||||
gdk_device_wintab_window_at_position (GdkDevice *device,
|
gdk_device_wintab_window_at_position (GdkDevice *device,
|
||||||
gint *win_x,
|
gdouble *win_x,
|
||||||
gint *win_y,
|
gdouble *win_y,
|
||||||
GdkModifierType *mask,
|
GdkModifierType *mask,
|
||||||
gboolean get_toplevel)
|
gboolean get_toplevel)
|
||||||
{
|
{
|
||||||
|
@ -2128,8 +2128,8 @@ gdk_win32_window_get_frame_extents (GdkWindow *window,
|
|||||||
static gboolean
|
static gboolean
|
||||||
gdk_window_win32_get_device_state (GdkWindow *window,
|
gdk_window_win32_get_device_state (GdkWindow *window,
|
||||||
GdkDevice *device,
|
GdkDevice *device,
|
||||||
gint *x,
|
gdouble *x,
|
||||||
gint *y,
|
gdouble *y,
|
||||||
GdkModifierType *mask)
|
GdkModifierType *mask)
|
||||||
{
|
{
|
||||||
GdkWindow *child;
|
GdkWindow *child;
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
|
||||||
#include "gdkx11device-core.h"
|
#include "gdkx11device-core.h"
|
||||||
#include "gdkdeviceprivate.h"
|
#include "gdkdeviceprivate.h"
|
||||||
|
|
||||||
@ -25,6 +26,11 @@
|
|||||||
#include "gdkprivate-x11.h"
|
#include "gdkprivate-x11.h"
|
||||||
#include "gdkasync.h"
|
#include "gdkasync.h"
|
||||||
|
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
/* for the use of round() */
|
||||||
|
#include "fallback-c89.c"
|
||||||
|
|
||||||
struct _GdkX11DeviceCore
|
struct _GdkX11DeviceCore
|
||||||
{
|
{
|
||||||
GdkDevice parent_instance;
|
GdkDevice parent_instance;
|
||||||
@ -50,16 +56,16 @@ static void gdk_x11_device_core_set_window_cursor (GdkDevice *device,
|
|||||||
GdkCursor *cursor);
|
GdkCursor *cursor);
|
||||||
static void gdk_x11_device_core_warp (GdkDevice *device,
|
static void gdk_x11_device_core_warp (GdkDevice *device,
|
||||||
GdkScreen *screen,
|
GdkScreen *screen,
|
||||||
gint x,
|
gdouble x,
|
||||||
gint y);
|
gdouble y);
|
||||||
static void gdk_x11_device_core_query_state (GdkDevice *device,
|
static void gdk_x11_device_core_query_state (GdkDevice *device,
|
||||||
GdkWindow *window,
|
GdkWindow *window,
|
||||||
GdkWindow **root_window,
|
GdkWindow **root_window,
|
||||||
GdkWindow **child_window,
|
GdkWindow **child_window,
|
||||||
gint *root_x,
|
gdouble *root_x,
|
||||||
gint *root_y,
|
gdouble *root_y,
|
||||||
gint *win_x,
|
gdouble *win_x,
|
||||||
gint *win_y,
|
gdouble *win_y,
|
||||||
GdkModifierType *mask);
|
GdkModifierType *mask);
|
||||||
static GdkGrabStatus gdk_x11_device_core_grab (GdkDevice *device,
|
static GdkGrabStatus gdk_x11_device_core_grab (GdkDevice *device,
|
||||||
GdkWindow *window,
|
GdkWindow *window,
|
||||||
@ -71,8 +77,8 @@ static GdkGrabStatus gdk_x11_device_core_grab (GdkDevice *device,
|
|||||||
static void gdk_x11_device_core_ungrab (GdkDevice *device,
|
static void gdk_x11_device_core_ungrab (GdkDevice *device,
|
||||||
guint32 time_);
|
guint32 time_);
|
||||||
static GdkWindow * gdk_x11_device_core_window_at_position (GdkDevice *device,
|
static GdkWindow * gdk_x11_device_core_window_at_position (GdkDevice *device,
|
||||||
gint *win_x,
|
gdouble *win_x,
|
||||||
gint *win_y,
|
gdouble *win_y,
|
||||||
GdkModifierType *mask,
|
GdkModifierType *mask,
|
||||||
gboolean get_toplevel);
|
gboolean get_toplevel);
|
||||||
static void gdk_x11_device_core_select_window_events (GdkDevice *device,
|
static void gdk_x11_device_core_select_window_events (GdkDevice *device,
|
||||||
@ -196,15 +202,14 @@ gdk_x11_device_core_get_state (GdkDevice *device,
|
|||||||
gdouble *axes,
|
gdouble *axes,
|
||||||
GdkModifierType *mask)
|
GdkModifierType *mask)
|
||||||
{
|
{
|
||||||
gint x_int, y_int;
|
gdouble x, y;
|
||||||
|
|
||||||
/* TODO: This rounds the coords, should use double */
|
gdk_window_get_device_position_double (window, device, &x, &y, mask);
|
||||||
gdk_window_get_device_position (window, device, &x_int, &y_int, mask);
|
|
||||||
|
|
||||||
if (axes)
|
if (axes)
|
||||||
{
|
{
|
||||||
axes[0] = x_int;
|
axes[0] = x;
|
||||||
axes[1] = y_int;
|
axes[1] = y;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -228,8 +233,8 @@ gdk_x11_device_core_set_window_cursor (GdkDevice *device,
|
|||||||
static void
|
static void
|
||||||
gdk_x11_device_core_warp (GdkDevice *device,
|
gdk_x11_device_core_warp (GdkDevice *device,
|
||||||
GdkScreen *screen,
|
GdkScreen *screen,
|
||||||
gint x,
|
gdouble x,
|
||||||
gint y)
|
gdouble y)
|
||||||
{
|
{
|
||||||
Display *xdisplay;
|
Display *xdisplay;
|
||||||
Window dest;
|
Window dest;
|
||||||
@ -238,8 +243,8 @@ gdk_x11_device_core_warp (GdkDevice *device,
|
|||||||
dest = GDK_WINDOW_XID (gdk_screen_get_root_window (screen));
|
dest = GDK_WINDOW_XID (gdk_screen_get_root_window (screen));
|
||||||
|
|
||||||
XWarpPointer (xdisplay, None, dest, 0, 0, 0, 0,
|
XWarpPointer (xdisplay, None, dest, 0, 0, 0, 0,
|
||||||
x * GDK_X11_SCREEN (screen)->window_scale,
|
round (x * GDK_X11_SCREEN (screen)->window_scale),
|
||||||
y * GDK_X11_SCREEN (screen)->window_scale);
|
round (y * GDK_X11_SCREEN (screen)->window_scale));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -247,10 +252,10 @@ gdk_x11_device_core_query_state (GdkDevice *device,
|
|||||||
GdkWindow *window,
|
GdkWindow *window,
|
||||||
GdkWindow **root_window,
|
GdkWindow **root_window,
|
||||||
GdkWindow **child_window,
|
GdkWindow **child_window,
|
||||||
gint *root_x,
|
gdouble *root_x,
|
||||||
gint *root_y,
|
gdouble *root_y,
|
||||||
gint *win_x,
|
gdouble *win_x,
|
||||||
gint *win_y,
|
gdouble *win_y,
|
||||||
GdkModifierType *mask)
|
GdkModifierType *mask)
|
||||||
{
|
{
|
||||||
GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (window->impl);
|
GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (window->impl);
|
||||||
@ -299,16 +304,16 @@ gdk_x11_device_core_query_state (GdkDevice *device,
|
|||||||
*child_window = gdk_x11_window_lookup_for_display (display, xchild_window);
|
*child_window = gdk_x11_window_lookup_for_display (display, xchild_window);
|
||||||
|
|
||||||
if (root_x)
|
if (root_x)
|
||||||
*root_x = xroot_x / impl->window_scale;
|
*root_x = (double)xroot_x / impl->window_scale;
|
||||||
|
|
||||||
if (root_y)
|
if (root_y)
|
||||||
*root_y = xroot_y / impl->window_scale;
|
*root_y = (double)xroot_y / impl->window_scale;
|
||||||
|
|
||||||
if (win_x)
|
if (win_x)
|
||||||
*win_x = xwin_x / impl->window_scale;
|
*win_x = (double)xwin_x / impl->window_scale;
|
||||||
|
|
||||||
if (win_y)
|
if (win_y)
|
||||||
*win_y = xwin_y / impl->window_scale;
|
*win_y = (double)xwin_y / impl->window_scale;
|
||||||
|
|
||||||
if (mask)
|
if (mask)
|
||||||
*mask = xmask;
|
*mask = xmask;
|
||||||
@ -416,8 +421,8 @@ gdk_x11_device_core_ungrab (GdkDevice *device,
|
|||||||
|
|
||||||
static GdkWindow *
|
static GdkWindow *
|
||||||
gdk_x11_device_core_window_at_position (GdkDevice *device,
|
gdk_x11_device_core_window_at_position (GdkDevice *device,
|
||||||
gint *win_x,
|
gdouble *win_x,
|
||||||
gint *win_y,
|
gdouble *win_y,
|
||||||
GdkModifierType *mask,
|
GdkModifierType *mask,
|
||||||
gboolean get_toplevel)
|
gboolean get_toplevel)
|
||||||
{
|
{
|
||||||
@ -547,10 +552,10 @@ gdk_x11_device_core_window_at_position (GdkDevice *device,
|
|||||||
impl = GDK_WINDOW_IMPL_X11 (window->impl);
|
impl = GDK_WINDOW_IMPL_X11 (window->impl);
|
||||||
|
|
||||||
if (win_x)
|
if (win_x)
|
||||||
*win_x = (window) ? xwin_x / impl->window_scale : -1;
|
*win_x = (window) ? (double)xwin_x / impl->window_scale : -1;
|
||||||
|
|
||||||
if (win_y)
|
if (win_y)
|
||||||
*win_y = (window) ? xwin_y / impl->window_scale : -1;
|
*win_y = (window) ? (double)xwin_y / impl->window_scale : -1;
|
||||||
|
|
||||||
if (mask)
|
if (mask)
|
||||||
*mask = xmask;
|
*mask = xmask;
|
||||||
|
@ -29,6 +29,10 @@
|
|||||||
#include <X11/Xutil.h>
|
#include <X11/Xutil.h>
|
||||||
#include <X11/extensions/XInput2.h>
|
#include <X11/extensions/XInput2.h>
|
||||||
|
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
/* for the use of round() */
|
||||||
|
#include "fallback-c89.c"
|
||||||
|
|
||||||
typedef struct _ScrollValuator ScrollValuator;
|
typedef struct _ScrollValuator ScrollValuator;
|
||||||
|
|
||||||
@ -76,16 +80,16 @@ static void gdk_x11_device_xi2_set_window_cursor (GdkDevice *device,
|
|||||||
GdkCursor *cursor);
|
GdkCursor *cursor);
|
||||||
static void gdk_x11_device_xi2_warp (GdkDevice *device,
|
static void gdk_x11_device_xi2_warp (GdkDevice *device,
|
||||||
GdkScreen *screen,
|
GdkScreen *screen,
|
||||||
gint x,
|
gdouble x,
|
||||||
gint y);
|
gdouble y);
|
||||||
static void gdk_x11_device_xi2_query_state (GdkDevice *device,
|
static void gdk_x11_device_xi2_query_state (GdkDevice *device,
|
||||||
GdkWindow *window,
|
GdkWindow *window,
|
||||||
GdkWindow **root_window,
|
GdkWindow **root_window,
|
||||||
GdkWindow **child_window,
|
GdkWindow **child_window,
|
||||||
gint *root_x,
|
gdouble *root_x,
|
||||||
gint *root_y,
|
gdouble *root_y,
|
||||||
gint *win_x,
|
gdouble *win_x,
|
||||||
gint *win_y,
|
gdouble *win_y,
|
||||||
GdkModifierType *mask);
|
GdkModifierType *mask);
|
||||||
|
|
||||||
static GdkGrabStatus gdk_x11_device_xi2_grab (GdkDevice *device,
|
static GdkGrabStatus gdk_x11_device_xi2_grab (GdkDevice *device,
|
||||||
@ -99,8 +103,8 @@ static void gdk_x11_device_xi2_ungrab (GdkDevice *device,
|
|||||||
guint32 time_);
|
guint32 time_);
|
||||||
|
|
||||||
static GdkWindow * gdk_x11_device_xi2_window_at_position (GdkDevice *device,
|
static GdkWindow * gdk_x11_device_xi2_window_at_position (GdkDevice *device,
|
||||||
gint *win_x,
|
gdouble *win_x,
|
||||||
gint *win_y,
|
gdouble *win_y,
|
||||||
GdkModifierType *mask,
|
GdkModifierType *mask,
|
||||||
gboolean get_toplevel);
|
gboolean get_toplevel);
|
||||||
static void gdk_x11_device_xi2_select_window_events (GdkDevice *device,
|
static void gdk_x11_device_xi2_select_window_events (GdkDevice *device,
|
||||||
@ -292,8 +296,8 @@ gdk_x11_device_xi2_set_window_cursor (GdkDevice *device,
|
|||||||
static void
|
static void
|
||||||
gdk_x11_device_xi2_warp (GdkDevice *device,
|
gdk_x11_device_xi2_warp (GdkDevice *device,
|
||||||
GdkScreen *screen,
|
GdkScreen *screen,
|
||||||
gint x,
|
gdouble x,
|
||||||
gint y)
|
gdouble y)
|
||||||
{
|
{
|
||||||
GdkX11DeviceXI2 *device_xi2 = GDK_X11_DEVICE_XI2 (device);
|
GdkX11DeviceXI2 *device_xi2 = GDK_X11_DEVICE_XI2 (device);
|
||||||
Window dest;
|
Window dest;
|
||||||
@ -304,8 +308,8 @@ gdk_x11_device_xi2_warp (GdkDevice *device,
|
|||||||
device_xi2->device_id,
|
device_xi2->device_id,
|
||||||
None, dest,
|
None, dest,
|
||||||
0, 0, 0, 0,
|
0, 0, 0, 0,
|
||||||
x * GDK_X11_SCREEN(screen)->window_scale,
|
round (x * GDK_X11_SCREEN(screen)->window_scale),
|
||||||
y * GDK_X11_SCREEN(screen)->window_scale);
|
round (y * GDK_X11_SCREEN(screen)->window_scale));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -313,10 +317,10 @@ gdk_x11_device_xi2_query_state (GdkDevice *device,
|
|||||||
GdkWindow *window,
|
GdkWindow *window,
|
||||||
GdkWindow **root_window,
|
GdkWindow **root_window,
|
||||||
GdkWindow **child_window,
|
GdkWindow **child_window,
|
||||||
gint *root_x,
|
gdouble *root_x,
|
||||||
gint *root_y,
|
gdouble *root_y,
|
||||||
gint *win_x,
|
gdouble *win_x,
|
||||||
gint *win_y,
|
gdouble *win_y,
|
||||||
GdkModifierType *mask)
|
GdkModifierType *mask)
|
||||||
{
|
{
|
||||||
GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (window->impl);
|
GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (window->impl);
|
||||||
@ -384,16 +388,16 @@ gdk_x11_device_xi2_query_state (GdkDevice *device,
|
|||||||
*child_window = gdk_x11_window_lookup_for_display (display, xchild_window);
|
*child_window = gdk_x11_window_lookup_for_display (display, xchild_window);
|
||||||
|
|
||||||
if (root_x)
|
if (root_x)
|
||||||
*root_x = (gint) (xroot_x / impl->window_scale);
|
*root_x = xroot_x / impl->window_scale;
|
||||||
|
|
||||||
if (root_y)
|
if (root_y)
|
||||||
*root_y = (gint) (xroot_y / impl->window_scale);
|
*root_y = xroot_y / impl->window_scale;
|
||||||
|
|
||||||
if (win_x)
|
if (win_x)
|
||||||
*win_x = (gint) (xwin_x / impl->window_scale);
|
*win_x = xwin_x / impl->window_scale;
|
||||||
|
|
||||||
if (win_y)
|
if (win_y)
|
||||||
*win_y = (gint) (xwin_y / impl->window_scale);
|
*win_y = xwin_y / impl->window_scale;
|
||||||
|
|
||||||
if (mask)
|
if (mask)
|
||||||
*mask = _gdk_x11_device_xi2_translate_state (&mod_state, &button_state, &group_state);
|
*mask = _gdk_x11_device_xi2_translate_state (&mod_state, &button_state, &group_state);
|
||||||
@ -477,8 +481,8 @@ gdk_x11_device_xi2_ungrab (GdkDevice *device,
|
|||||||
|
|
||||||
static GdkWindow *
|
static GdkWindow *
|
||||||
gdk_x11_device_xi2_window_at_position (GdkDevice *device,
|
gdk_x11_device_xi2_window_at_position (GdkDevice *device,
|
||||||
gint *win_x,
|
gdouble *win_x,
|
||||||
gint *win_y,
|
gdouble *win_y,
|
||||||
GdkModifierType *mask,
|
GdkModifierType *mask,
|
||||||
gboolean get_toplevel)
|
gboolean get_toplevel)
|
||||||
{
|
{
|
||||||
@ -633,10 +637,10 @@ gdk_x11_device_xi2_window_at_position (GdkDevice *device,
|
|||||||
impl = GDK_WINDOW_IMPL_X11 (window->impl);
|
impl = GDK_WINDOW_IMPL_X11 (window->impl);
|
||||||
|
|
||||||
if (win_x)
|
if (win_x)
|
||||||
*win_x = (window) ? (gint) (xwin_x / impl->window_scale) : -1;
|
*win_x = (window) ? (xwin_x / impl->window_scale) : -1;
|
||||||
|
|
||||||
if (win_y)
|
if (win_y)
|
||||||
*win_y = (window) ? (gint) (xwin_y / impl->window_scale) : -1;
|
*win_y = (window) ? (xwin_y / impl->window_scale) : -1;
|
||||||
|
|
||||||
if (mask)
|
if (mask)
|
||||||
*mask = _gdk_x11_device_xi2_translate_state (&mod_state, &button_state, &group_state);
|
*mask = _gdk_x11_device_xi2_translate_state (&mod_state, &button_state, &group_state);
|
||||||
|
@ -3240,8 +3240,8 @@ gdk_x11_window_get_frame_extents (GdkWindow *window,
|
|||||||
static gboolean
|
static gboolean
|
||||||
gdk_window_x11_get_device_state (GdkWindow *window,
|
gdk_window_x11_get_device_state (GdkWindow *window,
|
||||||
GdkDevice *device,
|
GdkDevice *device,
|
||||||
gint *x,
|
gdouble *x,
|
||||||
gint *y,
|
gdouble *y,
|
||||||
GdkModifierType *mask)
|
GdkModifierType *mask)
|
||||||
{
|
{
|
||||||
GdkWindow *child;
|
GdkWindow *child;
|
||||||
|
Loading…
Reference in New Issue
Block a user