mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-25 13:11:13 +00:00
gdk: Require passing screen size to translate_screen_coord()
This commit is contained in:
parent
4445807421
commit
2033b06cb6
@ -1784,6 +1784,8 @@ _gdk_device_translate_screen_coord (GdkDevice *device,
|
||||
GdkWindow *window,
|
||||
gdouble window_root_x,
|
||||
gdouble window_root_y,
|
||||
gdouble screen_width,
|
||||
gdouble screen_height,
|
||||
guint index_,
|
||||
gdouble value,
|
||||
gdouble *axis_value)
|
||||
@ -1808,7 +1810,7 @@ _gdk_device_translate_screen_coord (GdkDevice *device,
|
||||
if (axis_info.use == GDK_AXIS_X)
|
||||
{
|
||||
if (axis_width > 0)
|
||||
scale = gdk_screen_get_width (gdk_window_get_screen (window)) / axis_width;
|
||||
scale = screen_width / axis_width;
|
||||
else
|
||||
scale = 1;
|
||||
|
||||
@ -1817,7 +1819,7 @@ _gdk_device_translate_screen_coord (GdkDevice *device,
|
||||
else
|
||||
{
|
||||
if (axis_width > 0)
|
||||
scale = gdk_screen_get_height (gdk_window_get_screen (window)) / axis_width;
|
||||
scale = screen_height / axis_width;
|
||||
else
|
||||
scale = 1;
|
||||
|
||||
|
@ -152,6 +152,8 @@ gboolean _gdk_device_translate_screen_coord (GdkDevice *device,
|
||||
GdkWindow *window,
|
||||
gdouble window_root_x,
|
||||
gdouble window_root_y,
|
||||
gdouble screen_width,
|
||||
gdouble screen_height,
|
||||
guint index,
|
||||
gdouble value,
|
||||
gdouble *axis_value);
|
||||
|
@ -219,12 +219,13 @@ _gdk_device_wintab_translate_axes (GdkDeviceWintab *device_wintab,
|
||||
gdouble *y)
|
||||
{
|
||||
GdkDevice *device;
|
||||
GdkWindow *impl_window;
|
||||
GdkWindow *impl_window, *root_window;
|
||||
gint root_x, root_y;
|
||||
gdouble temp_x, temp_y;
|
||||
gint i;
|
||||
|
||||
device = GDK_DEVICE (device_wintab);
|
||||
root_window = gdk_screen_get_root_window (gdk_window_get_screen (window));
|
||||
impl_window = _gdk_window_get_impl_window (window);
|
||||
temp_x = temp_y = 0;
|
||||
|
||||
@ -246,7 +247,10 @@ _gdk_device_wintab_translate_axes (GdkDeviceWintab *device_wintab,
|
||||
&axes[i]);
|
||||
else
|
||||
_gdk_device_translate_screen_coord (device, window,
|
||||
root_x, root_y, i,
|
||||
root_x, root_y,
|
||||
gdk_window_get_width (root_window),
|
||||
gdk_window_get_height (root_window),
|
||||
i,
|
||||
device_wintab->last_axis_data[i],
|
||||
&axes[i]);
|
||||
if (use == GDK_AXIS_X)
|
||||
|
@ -243,12 +243,16 @@ gdk_x11_device_xi2_get_state (GdkDevice *device,
|
||||
_gdk_device_translate_window_coord (device, window, j, value, &axes[j]);
|
||||
else
|
||||
{
|
||||
GdkWindow *root_window;
|
||||
gint root_x, root_y;
|
||||
|
||||
root_window = gdk_screen_get_root_window (gdk_window_get_screen (window));
|
||||
/* FIXME: Maybe root coords chaching should happen here */
|
||||
gdk_window_get_origin (window, &root_x, &root_y);
|
||||
_gdk_device_translate_screen_coord (device, window,
|
||||
root_x, root_y,
|
||||
gdk_window_get_width (root_window),
|
||||
gdk_window_get_height (root_window),
|
||||
j, value,
|
||||
&axes[j]);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user