[gtk+/xi2: 84/84] GdkDevice: take into account axis_width=0 for screen coords.



commit 3e1c886145793b955810df3d6dfc1fdbffc0cba5
Author: Carlos Garnacho <carlos lanedo com>
Date:   Mon Nov 2 11:05:08 2009 +0100

    GdkDevice: take into account axis_width=0 for screen coords.
    
    This was already handled in the master branch, it went missing when merging
    relative axes translation into the xi2 branch.

 gdk/gdkdevice.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/gdk/gdkdevice.c b/gdk/gdkdevice.c
index 6955c32..f2a9642 100644
--- a/gdk/gdkdevice.c
+++ b/gdk/gdkdevice.c
@@ -1018,12 +1018,20 @@ _gdk_device_translate_screen_coord (GdkDevice *device,
 
   if (axis_info.use == GDK_AXIS_X)
     {
-      scale = gdk_screen_get_width (gdk_drawable_get_screen (window)) / axis_width;
+      if (axis_width > 0)
+        scale = gdk_screen_get_width (gdk_drawable_get_screen (window)) / axis_width;
+      else
+        scale = 1;
+
       offset = - window_root_x - window_private->abs_x;
     }
   else
     {
-      scale = gdk_screen_get_height (gdk_drawable_get_screen (window)) / axis_width;
+      if (axis_width > 0)
+        scale = gdk_screen_get_height (gdk_drawable_get_screen (window)) / axis_width;
+      else
+        scale = 1;
+
       offset = - window_root_y - window_private->abs_y;
     }
 



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