Xinerama-Setup and Extended Input devices (Screen Mode)

When I use Screen Mode with my Wacom Tablet, Inkscape and GIMP (both
using the gtk xinput) show the following behavior: since I limit the
Tablet to only one screen (1680x1050), but my entire desktop spans over
three screens (1680+1680+1920x1080), if I draw a circle, on the canvas
of Gimp I see an ellipse which is approximately three times as wide as
it is high.

this means, that in screen mode the coordinates are the data from the
tablet (in the 16000x12000 range) converted to the entire screen
(5280x1080) instead of that of the current screen.

I therefore made the following change, which takes into account the
current screen's size, and at least for me now everything works as it
should: a circle on the tablet becomes a circle on the canvas.

Mind you, this happens only in screen mode (but that's apart from Window
mode the only mode where pressure sensitivity works).

diff --git a/gdk/x11/gdkinput-x11.c b/gdk/x11/gdkinput-x11.c
index a793a42..355963e 100644
--- a/gdk/x11/gdkinput-x11.c
+++ b/gdk/x11/gdkinput-x11.c
@@ -454,8 +454,15 @@ gdk_input_translate_coordinates (GdkDevicePrivate *gdkdev,
   if (gdkdev->info.mode == GDK_MODE_SCREEN)
-      x_scale = gdk_screen_get_width (gdk_drawable_get_screen (window)) / device_width;
-      y_scale = gdk_screen_get_height (gdk_drawable_get_screen (window)) / device_height;
+      int core_pointer_x, core_pointer_y, cur_monitor;
+      GdkRectangle mon_geometry;
+      GdkScreen *cur_screen;
+      gdk_display_get_pointer(gdk_drawable_get_display(window),&cur_screen,&core_pointer_x,&core_pointer_y,0);
+      cur_monitor = gdk_screen_get_monitor_at_point(cur_screen, core_pointer_x, core_pointer_y);
+      gdk_screen_get_monitor_geometry(cur_screen,cur_monitor,&mon_geometry);
+      x_scale = mon_geometry.width / device_width;
+      y_scale = mon_geometry.height / device_height;
       x_offset = - impl_window->input_window->root_x - priv->abs_x;
       y_offset = - impl_window->input_window->root_y - priv->abs_y;

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]