Commit 525e5cff authored by Alexander Larsson's avatar Alexander Larsson

x11: Initial cut at supporting window scaling for X11

If you set GDK_SCALE=2 in the environment then all windows will be
scaled by 2. Its not an ideal solution as it doesn't handle
multi-monitors at different scales, and only affects gtk apps.
But it is a good starting points and will help a lot on HiDPI
laptops.
parent ed4fcee4
...@@ -135,10 +135,12 @@ gdk_x11_device_core_get_history (GdkDevice *device, ...@@ -135,10 +135,12 @@ gdk_x11_device_core_get_history (GdkDevice *device,
XTimeCoord *xcoords; XTimeCoord *xcoords;
GdkTimeCoord **coords; GdkTimeCoord **coords;
GdkWindow *impl_window; GdkWindow *impl_window;
GdkWindowImplX11 *impl;
int tmp_n_events; int tmp_n_events;
int i, j; int i, j;
impl_window = _gdk_window_get_impl_window (window); impl_window = _gdk_window_get_impl_window (window);
impl = GDK_WINDOW_IMPL_X11 (impl_window->impl);
xcoords = XGetMotionEvents (GDK_WINDOW_XDISPLAY (window), xcoords = XGetMotionEvents (GDK_WINDOW_XDISPLAY (window),
GDK_WINDOW_XID (impl_window), GDK_WINDOW_XID (impl_window),
start, stop, &tmp_n_events); start, stop, &tmp_n_events);
...@@ -149,11 +151,13 @@ gdk_x11_device_core_get_history (GdkDevice *device, ...@@ -149,11 +151,13 @@ gdk_x11_device_core_get_history (GdkDevice *device,
for (i = 0, j = 0; i < tmp_n_events; i++) for (i = 0, j = 0; i < tmp_n_events; i++)
{ {
if (impl_coord_in_window (window, xcoords[i].x, xcoords[i].y)) if (impl_coord_in_window (window,
xcoords[i].x / impl->window_scale,
xcoords[i].y / impl->window_scale))
{ {
coords[j]->time = xcoords[i].time; coords[j]->time = xcoords[i].time;
coords[j]->axes[0] = xcoords[i].x - window->abs_x; coords[j]->axes[0] = (double)xcoords[i].x / impl->window_scale - window->abs_x;
coords[j]->axes[1] = xcoords[i].y - window->abs_y; coords[j]->axes[1] = (double)xcoords[i].y / impl->window_scale - window->abs_y;
j++; j++;
} }
} }
...@@ -194,6 +198,7 @@ gdk_x11_device_core_get_state (GdkDevice *device, ...@@ -194,6 +198,7 @@ gdk_x11_device_core_get_state (GdkDevice *device,
{ {
gint x_int, y_int; gint x_int, y_int;
/* TODO: This rounds the coords, should use double */
gdk_window_get_device_position (window, device, &x_int, &y_int, mask); gdk_window_get_device_position (window, device, &x_int, &y_int, mask);
if (axes) if (axes)
...@@ -232,7 +237,9 @@ gdk_x11_device_core_warp (GdkDevice *device, ...@@ -232,7 +237,9 @@ gdk_x11_device_core_warp (GdkDevice *device,
xdisplay = GDK_DISPLAY_XDISPLAY (gdk_device_get_display (device)); xdisplay = GDK_DISPLAY_XDISPLAY (gdk_device_get_display (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, x, y); XWarpPointer (xdisplay, None, dest, 0, 0, 0, 0,
x * GDK_X11_SCREEN (screen)->window_scale,
y * GDK_X11_SCREEN (screen)->window_scale);
} }
static void static void
...@@ -246,6 +253,7 @@ gdk_x11_device_core_query_state (GdkDevice *device, ...@@ -246,6 +253,7 @@ gdk_x11_device_core_query_state (GdkDevice *device,
gint *win_y, gint *win_y,
GdkModifierType *mask) GdkModifierType *mask)
{ {
GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (window->impl);
GdkDisplay *display; GdkDisplay *display;
GdkScreen *default_screen; GdkScreen *default_screen;
Window xroot_window, xchild_window; Window xroot_window, xchild_window;
...@@ -291,16 +299,16 @@ gdk_x11_device_core_query_state (GdkDevice *device, ...@@ -291,16 +299,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; *root_x = xroot_x / impl->window_scale;
if (root_y) if (root_y)
*root_y = xroot_y; *root_y = xroot_y / impl->window_scale;
if (win_x) if (win_x)
*win_x = xwin_x; *win_x = xwin_x / impl->window_scale;
if (win_y) if (win_y)
*win_y = xwin_y; *win_y = xwin_y / impl->window_scale;
if (mask) if (mask)
*mask = xmask; *mask = xmask;
...@@ -413,6 +421,7 @@ gdk_x11_device_core_window_at_position (GdkDevice *device, ...@@ -413,6 +421,7 @@ gdk_x11_device_core_window_at_position (GdkDevice *device,
GdkModifierType *mask, GdkModifierType *mask,
gboolean get_toplevel) gboolean get_toplevel)
{ {
GdkWindowImplX11 *impl;
GdkDisplay *display; GdkDisplay *display;
GdkScreen *screen; GdkScreen *screen;
Display *xdisplay; Display *xdisplay;
...@@ -464,6 +473,7 @@ gdk_x11_device_core_window_at_position (GdkDevice *device, ...@@ -464,6 +473,7 @@ gdk_x11_device_core_window_at_position (GdkDevice *device,
for (list = toplevels; list != NULL; list = g_list_next (list)) for (list = toplevels; list != NULL; list = g_list_next (list))
{ {
window = GDK_WINDOW (list->data); window = GDK_WINDOW (list->data);
impl = GDK_WINDOW_IMPL_X11 (window->impl);
xwindow = GDK_WINDOW_XID (window); xwindow = GDK_WINDOW_XID (window);
gdk_x11_display_error_trap_push (display); gdk_x11_display_error_trap_push (display);
XQueryPointer (xdisplay, xwindow, XQueryPointer (xdisplay, xwindow,
...@@ -479,7 +489,7 @@ gdk_x11_device_core_window_at_position (GdkDevice *device, ...@@ -479,7 +489,7 @@ gdk_x11_device_core_window_at_position (GdkDevice *device,
break; break;
} }
gdk_window_get_geometry (window, NULL, NULL, &width, &height); gdk_window_get_geometry (window, NULL, NULL, &width, &height);
if (winx >= 0 && winy >= 0 && winx < width && winy < height) if (winx >= 0 && winy >= 0 && winx < width * impl->window_scale && winy < height * impl->window_scale)
{ {
/* A childless toplevel, or below another window? */ /* A childless toplevel, or below another window? */
XSetWindowAttributes attributes; XSetWindowAttributes attributes;
...@@ -532,12 +542,15 @@ gdk_x11_device_core_window_at_position (GdkDevice *device, ...@@ -532,12 +542,15 @@ gdk_x11_device_core_window_at_position (GdkDevice *device,
gdk_x11_display_ungrab (display); gdk_x11_display_ungrab (display);
window = gdk_x11_window_lookup_for_display (display, last); window = gdk_x11_window_lookup_for_display (display, last);
impl = NULL;
if (window)
impl = GDK_WINDOW_IMPL_X11 (window->impl);
if (win_x) if (win_x)
*win_x = (window) ? xwin_x : -1; *win_x = (window) ? xwin_x / impl->window_scale : -1;
if (win_y) if (win_y)
*win_y = (window) ? xwin_y : -1; *win_y = (window) ? xwin_y / impl->window_scale : -1;
if (mask) if (mask)
*mask = xmask; *mask = xmask;
......
...@@ -303,7 +303,9 @@ gdk_x11_device_xi2_warp (GdkDevice *device, ...@@ -303,7 +303,9 @@ gdk_x11_device_xi2_warp (GdkDevice *device,
XIWarpPointer (GDK_SCREEN_XDISPLAY (screen), XIWarpPointer (GDK_SCREEN_XDISPLAY (screen),
device_xi2->device_id, device_xi2->device_id,
None, dest, None, dest,
0, 0, 0, 0, x, y); 0, 0, 0, 0,
x * GDK_X11_SCREEN(screen)->window_scale,
y * GDK_X11_SCREEN(screen)->window_scale);
} }
static void static void
...@@ -317,6 +319,7 @@ gdk_x11_device_xi2_query_state (GdkDevice *device, ...@@ -317,6 +319,7 @@ gdk_x11_device_xi2_query_state (GdkDevice *device,
gint *win_y, gint *win_y,
GdkModifierType *mask) GdkModifierType *mask)
{ {
GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (window->impl);
GdkX11DeviceXI2 *device_xi2 = GDK_X11_DEVICE_XI2 (device); GdkX11DeviceXI2 *device_xi2 = GDK_X11_DEVICE_XI2 (device);
GdkDisplay *display; GdkDisplay *display;
GdkScreen *default_screen; GdkScreen *default_screen;
...@@ -381,16 +384,16 @@ gdk_x11_device_xi2_query_state (GdkDevice *device, ...@@ -381,16 +384,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; *root_x = (gint) (xroot_x / impl->window_scale);
if (root_y) if (root_y)
*root_y = (gint) xroot_y; *root_y = (gint) (xroot_y / impl->window_scale);
if (win_x) if (win_x)
*win_x = (gint) xwin_x; *win_x = (gint) (xwin_x / impl->window_scale);
if (win_y) if (win_y)
*win_y = (gint) xwin_y; *win_y = (gint) (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);
...@@ -479,6 +482,7 @@ gdk_x11_device_xi2_window_at_position (GdkDevice *device, ...@@ -479,6 +482,7 @@ gdk_x11_device_xi2_window_at_position (GdkDevice *device,
GdkModifierType *mask, GdkModifierType *mask,
gboolean get_toplevel) gboolean get_toplevel)
{ {
GdkWindowImplX11 *impl;
GdkX11DeviceXI2 *device_xi2 = GDK_X11_DEVICE_XI2 (device); GdkX11DeviceXI2 *device_xi2 = GDK_X11_DEVICE_XI2 (device);
GdkDisplay *display; GdkDisplay *display;
GdkScreen *screen; GdkScreen *screen;
...@@ -624,12 +628,15 @@ gdk_x11_device_xi2_window_at_position (GdkDevice *device, ...@@ -624,12 +628,15 @@ gdk_x11_device_xi2_window_at_position (GdkDevice *device,
gdk_x11_display_ungrab (display); gdk_x11_display_ungrab (display);
window = gdk_x11_window_lookup_for_display (display, last); window = gdk_x11_window_lookup_for_display (display, last);
impl = NULL;
if (window)
impl = GDK_WINDOW_IMPL_X11 (window->impl);
if (win_x) if (win_x)
*win_x = (window) ? (gint) xwin_x : -1; *win_x = (window) ? (gint) (xwin_x / impl->window_scale) : -1;
if (win_y) if (win_y)
*win_y = (window) ? (gint) xwin_y : -1; *win_y = (window) ? (gint) (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);
......
...@@ -332,9 +332,11 @@ gdk_x11_device_manager_core_translate_event (GdkEventTranslator *translator, ...@@ -332,9 +332,11 @@ gdk_x11_device_manager_core_translate_event (GdkEventTranslator *translator,
GdkEvent *event, GdkEvent *event,
XEvent *xevent) XEvent *xevent)
{ {
GdkWindowImplX11 *impl;
GdkX11DeviceManagerCore *device_manager; GdkX11DeviceManagerCore *device_manager;
GdkWindow *window; GdkWindow *window;
gboolean return_val; gboolean return_val;
int scale;
GdkX11Display *display_x11 = GDK_X11_DISPLAY (display); GdkX11Display *display_x11 = GDK_X11_DISPLAY (display);
device_manager = GDK_X11_DEVICE_MANAGER_CORE (translator); device_manager = GDK_X11_DEVICE_MANAGER_CORE (translator);
...@@ -342,14 +344,18 @@ gdk_x11_device_manager_core_translate_event (GdkEventTranslator *translator, ...@@ -342,14 +344,18 @@ gdk_x11_device_manager_core_translate_event (GdkEventTranslator *translator,
window = get_event_window (translator, xevent); window = get_event_window (translator, xevent);
scale = 1;
if (window) if (window)
{ {
if (GDK_WINDOW_DESTROYED (window) || !GDK_IS_WINDOW (window)) if (GDK_WINDOW_DESTROYED (window) || !GDK_IS_WINDOW (window))
return FALSE; return FALSE;
g_object_ref (window); g_object_ref (window);
impl = GDK_WINDOW_IMPL_X11 (window->impl);
scale = impl->window_scale;
} }
event->any.window = window; event->any.window = window;
event->any.send_event = xevent->xany.send_event ? TRUE : FALSE; event->any.send_event = xevent->xany.send_event ? TRUE : FALSE;
...@@ -458,10 +464,10 @@ gdk_x11_device_manager_core_translate_event (GdkEventTranslator *translator, ...@@ -458,10 +464,10 @@ gdk_x11_device_manager_core_translate_event (GdkEventTranslator *translator,
event->scroll.window = window; event->scroll.window = window;
event->scroll.time = xevent->xbutton.time; event->scroll.time = xevent->xbutton.time;
event->scroll.x = (gdouble) xevent->xbutton.x; event->scroll.x = (gdouble) xevent->xbutton.x / scale;
event->scroll.y = (gdouble) xevent->xbutton.y; event->scroll.y = (gdouble) xevent->xbutton.y / scale;
event->scroll.x_root = (gdouble) xevent->xbutton.x_root; event->scroll.x_root = (gdouble) xevent->xbutton.x_root / scale;
event->scroll.y_root = (gdouble) xevent->xbutton.y_root; event->scroll.y_root = (gdouble) xevent->xbutton.y_root / scale;
event->scroll.state = (GdkModifierType) xevent->xbutton.state; event->scroll.state = (GdkModifierType) xevent->xbutton.state;
event->scroll.device = device_manager->core_pointer; event->scroll.device = device_manager->core_pointer;
...@@ -480,10 +486,10 @@ gdk_x11_device_manager_core_translate_event (GdkEventTranslator *translator, ...@@ -480,10 +486,10 @@ gdk_x11_device_manager_core_translate_event (GdkEventTranslator *translator,
event->button.type = GDK_BUTTON_PRESS; event->button.type = GDK_BUTTON_PRESS;
event->button.window = window; event->button.window = window;
event->button.time = xevent->xbutton.time; event->button.time = xevent->xbutton.time;
event->button.x = (gdouble) xevent->xbutton.x; event->button.x = (gdouble) xevent->xbutton.x / scale;
event->button.y = (gdouble) xevent->xbutton.y; event->button.y = (gdouble) xevent->xbutton.y / scale;
event->button.x_root = (gdouble) xevent->xbutton.x_root; event->button.x_root = (gdouble) xevent->xbutton.x_root / scale;
event->button.y_root = (gdouble) xevent->xbutton.y_root; event->button.y_root = (gdouble) xevent->xbutton.y_root / scale;
event->button.axes = NULL; event->button.axes = NULL;
event->button.state = (GdkModifierType) xevent->xbutton.state; event->button.state = (GdkModifierType) xevent->xbutton.state;
event->button.button = xevent->xbutton.button; event->button.button = xevent->xbutton.button;
...@@ -523,10 +529,10 @@ gdk_x11_device_manager_core_translate_event (GdkEventTranslator *translator, ...@@ -523,10 +529,10 @@ gdk_x11_device_manager_core_translate_event (GdkEventTranslator *translator,
event->button.type = GDK_BUTTON_RELEASE; event->button.type = GDK_BUTTON_RELEASE;
event->button.window = window; event->button.window = window;
event->button.time = xevent->xbutton.time; event->button.time = xevent->xbutton.time;
event->button.x = (gdouble) xevent->xbutton.x; event->button.x = (gdouble) xevent->xbutton.x / scale;
event->button.y = (gdouble) xevent->xbutton.y; event->button.y = (gdouble) xevent->xbutton.y / scale;
event->button.x_root = (gdouble) xevent->xbutton.x_root; event->button.x_root = (gdouble) xevent->xbutton.x_root / scale;
event->button.y_root = (gdouble) xevent->xbutton.y_root; event->button.y_root = (gdouble) xevent->xbutton.y_root / scale;
event->button.axes = NULL; event->button.axes = NULL;
event->button.state = (GdkModifierType) xevent->xbutton.state; event->button.state = (GdkModifierType) xevent->xbutton.state;
event->button.button = xevent->xbutton.button; event->button.button = xevent->xbutton.button;
...@@ -553,10 +559,10 @@ gdk_x11_device_manager_core_translate_event (GdkEventTranslator *translator, ...@@ -553,10 +559,10 @@ gdk_x11_device_manager_core_translate_event (GdkEventTranslator *translator,
event->motion.type = GDK_MOTION_NOTIFY; event->motion.type = GDK_MOTION_NOTIFY;
event->motion.window = window; event->motion.window = window;
event->motion.time = xevent->xmotion.time; event->motion.time = xevent->xmotion.time;
event->motion.x = (gdouble) xevent->xmotion.x; event->motion.x = (gdouble) xevent->xmotion.x / scale;
event->motion.y = (gdouble) xevent->xmotion.y; event->motion.y = (gdouble) xevent->xmotion.y / scale;
event->motion.x_root = (gdouble) xevent->xmotion.x_root; event->motion.x_root = (gdouble) xevent->xmotion.x_root / scale;
event->motion.y_root = (gdouble) xevent->xmotion.y_root; event->motion.y_root = (gdouble) xevent->xmotion.y_root / scale;
event->motion.axes = NULL; event->motion.axes = NULL;
event->motion.state = (GdkModifierType) xevent->xmotion.state; event->motion.state = (GdkModifierType) xevent->xmotion.state;
event->motion.is_hint = xevent->xmotion.is_hint; event->motion.is_hint = xevent->xmotion.is_hint;
...@@ -602,10 +608,10 @@ gdk_x11_device_manager_core_translate_event (GdkEventTranslator *translator, ...@@ -602,10 +608,10 @@ gdk_x11_device_manager_core_translate_event (GdkEventTranslator *translator,
event->crossing.subwindow = NULL; event->crossing.subwindow = NULL;
event->crossing.time = xevent->xcrossing.time; event->crossing.time = xevent->xcrossing.time;
event->crossing.x = (gdouble) xevent->xcrossing.x; event->crossing.x = (gdouble) xevent->xcrossing.x / scale;
event->crossing.y = (gdouble) xevent->xcrossing.y; event->crossing.y = (gdouble) xevent->xcrossing.y / scale;
event->crossing.x_root = (gdouble) xevent->xcrossing.x_root; event->crossing.x_root = (gdouble) xevent->xcrossing.x_root / scale;
event->crossing.y_root = (gdouble) xevent->xcrossing.y_root; event->crossing.y_root = (gdouble) xevent->xcrossing.y_root / scale;
event->crossing.mode = translate_crossing_mode (xevent->xcrossing.mode); event->crossing.mode = translate_crossing_mode (xevent->xcrossing.mode);
event->crossing.detail = translate_notify_type (xevent->xcrossing.detail); event->crossing.detail = translate_notify_type (xevent->xcrossing.detail);
...@@ -646,10 +652,10 @@ gdk_x11_device_manager_core_translate_event (GdkEventTranslator *translator, ...@@ -646,10 +652,10 @@ gdk_x11_device_manager_core_translate_event (GdkEventTranslator *translator,
event->crossing.subwindow = NULL; event->crossing.subwindow = NULL;
event->crossing.time = xevent->xcrossing.time; event->crossing.time = xevent->xcrossing.time;
event->crossing.x = (gdouble) xevent->xcrossing.x; event->crossing.x = (gdouble) xevent->xcrossing.x / scale;
event->crossing.y = (gdouble) xevent->xcrossing.y; event->crossing.y = (gdouble) xevent->xcrossing.y / scale;
event->crossing.x_root = (gdouble) xevent->xcrossing.x_root; event->crossing.x_root = (gdouble) xevent->xcrossing.x_root / scale;
event->crossing.y_root = (gdouble) xevent->xcrossing.y_root; event->crossing.y_root = (gdouble) xevent->xcrossing.y_root / scale;
event->crossing.mode = translate_crossing_mode (xevent->xcrossing.mode); event->crossing.mode = translate_crossing_mode (xevent->xcrossing.mode);
event->crossing.detail = translate_notify_type (xevent->xcrossing.detail); event->crossing.detail = translate_notify_type (xevent->xcrossing.detail);
......
...@@ -1115,6 +1115,8 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator, ...@@ -1115,6 +1115,8 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
XGenericEventCookie *cookie; XGenericEventCookie *cookie;
gboolean return_val = TRUE; gboolean return_val = TRUE;
GdkWindow *window; GdkWindow *window;
GdkWindowImplX11 *impl;
int scale;
XIEvent *ev; XIEvent *ev;
device_manager = (GdkX11DeviceManagerXI2 *) translator; device_manager = (GdkX11DeviceManagerXI2 *) translator;
...@@ -1136,6 +1138,13 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator, ...@@ -1136,6 +1138,13 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
if (window && GDK_WINDOW_DESTROYED (window)) if (window && GDK_WINDOW_DESTROYED (window))
return FALSE; return FALSE;
scale = 1;
if (window)
{
impl = GDK_WINDOW_IMPL_X11 (window->impl);
scale = impl->window_scale;
}
if (ev->evtype == XI_Motion || if (ev->evtype == XI_Motion ||
ev->evtype == XI_ButtonRelease) ev->evtype == XI_ButtonRelease)
{ {
...@@ -1232,10 +1241,10 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator, ...@@ -1232,10 +1241,10 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
event->scroll.window = window; event->scroll.window = window;
event->scroll.time = xev->time; event->scroll.time = xev->time;
event->scroll.x = (gdouble) xev->event_x; event->scroll.x = (gdouble) xev->event_x / scale;
event->scroll.y = (gdouble) xev->event_y; event->scroll.y = (gdouble) xev->event_y / scale;
event->scroll.x_root = (gdouble) xev->root_x; event->scroll.x_root = (gdouble) xev->root_x / scale;
event->scroll.y_root = (gdouble) xev->root_y; event->scroll.y_root = (gdouble) xev->root_y / scale;
event->scroll.delta_x = 0; event->scroll.delta_x = 0;
event->scroll.delta_y = 0; event->scroll.delta_y = 0;
...@@ -1259,10 +1268,10 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator, ...@@ -1259,10 +1268,10 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
event->button.window = window; event->button.window = window;
event->button.time = xev->time; event->button.time = xev->time;
event->button.x = (gdouble) xev->event_x; event->button.x = (gdouble) xev->event_x / scale;
event->button.y = (gdouble) xev->event_y; event->button.y = (gdouble) xev->event_y / scale;
event->button.x_root = (gdouble) xev->root_x; event->button.x_root = (gdouble) xev->root_x / scale;
event->button.y_root = (gdouble) xev->root_y; event->button.y_root = (gdouble) xev->root_y / scale;
event->button.device = g_hash_table_lookup (device_manager->id_table, event->button.device = g_hash_table_lookup (device_manager->id_table,
GUINT_TO_POINTER (xev->deviceid)); GUINT_TO_POINTER (xev->deviceid));
...@@ -1350,10 +1359,10 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator, ...@@ -1350,10 +1359,10 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
event->scroll.window = window; event->scroll.window = window;
event->scroll.time = xev->time; event->scroll.time = xev->time;
event->scroll.x = (gdouble) xev->event_x; event->scroll.x = (gdouble) xev->event_x / scale;
event->scroll.y = (gdouble) xev->event_y; event->scroll.y = (gdouble) xev->event_y / scale;
event->scroll.x_root = (gdouble) xev->root_x; event->scroll.x_root = (gdouble) xev->root_x / scale;
event->scroll.y_root = (gdouble) xev->root_y; event->scroll.y_root = (gdouble) xev->root_y / scale;
event->scroll.delta_x = delta_x; event->scroll.delta_x = delta_x;
event->scroll.delta_y = delta_y; event->scroll.delta_y = delta_y;
...@@ -1367,10 +1376,10 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator, ...@@ -1367,10 +1376,10 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
event->motion.type = GDK_MOTION_NOTIFY; event->motion.type = GDK_MOTION_NOTIFY;
event->motion.window = window; event->motion.window = window;
event->motion.time = xev->time; event->motion.time = xev->time;
event->motion.x = (gdouble) xev->event_x; event->motion.x = (gdouble) xev->event_x / scale;
event->motion.y = (gdouble) xev->event_y; event->motion.y = (gdouble) xev->event_y / scale;
event->motion.x_root = (gdouble) xev->root_x; event->motion.x_root = (gdouble) xev->root_x / scale;
event->motion.y_root = (gdouble) xev->root_y; event->motion.y_root = (gdouble) xev->root_y / scale;
event->motion.device = device; event->motion.device = device;
gdk_event_set_source_device (event, source_device); gdk_event_set_source_device (event, source_device);
...@@ -1423,10 +1432,10 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator, ...@@ -1423,10 +1432,10 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
event->touch.window = window; event->touch.window = window;
event->touch.time = xev->time; event->touch.time = xev->time;
event->touch.x = (gdouble) xev->event_x; event->touch.x = (gdouble) xev->event_x / scale;
event->touch.y = (gdouble) xev->event_y; event->touch.y = (gdouble) xev->event_y / scale;
event->touch.x_root = (gdouble) xev->root_x; event->touch.x_root = (gdouble) xev->root_x / scale;
event->touch.y_root = (gdouble) xev->root_y; event->touch.y_root = (gdouble) xev->root_y / scale;
event->touch.device = g_hash_table_lookup (device_manager->id_table, event->touch.device = g_hash_table_lookup (device_manager->id_table,
GUINT_TO_POINTER (xev->deviceid)); GUINT_TO_POINTER (xev->deviceid));
...@@ -1492,10 +1501,10 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator, ...@@ -1492,10 +1501,10 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
event->touch.sequence = GUINT_TO_POINTER (xev->detail); event->touch.sequence = GUINT_TO_POINTER (xev->detail);
event->touch.type = GDK_TOUCH_UPDATE; event->touch.type = GDK_TOUCH_UPDATE;
event->touch.time = xev->time; event->touch.time = xev->time;
event->touch.x = (gdouble) xev->event_x; event->touch.x = (gdouble) xev->event_x / scale;
event->touch.y = (gdouble) xev->event_y; event->touch.y = (gdouble) xev->event_y / scale;
event->touch.x_root = (gdouble) xev->root_x; event->touch.x_root = (gdouble) xev->root_x / scale;
event->touch.y_root = (gdouble) xev->root_y; event->touch.y_root = (gdouble) xev->root_y / scale;
event->touch.device = g_hash_table_lookup (device_manager->id_table, event->touch.device = g_hash_table_lookup (device_manager->id_table,
GINT_TO_POINTER (xev->deviceid)); GINT_TO_POINTER (xev->deviceid));
...@@ -1540,10 +1549,10 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator, ...@@ -1540,10 +1549,10 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,