[PATCH xserver 2/5] xwayland: Fix highest raw value on axis scaling

Tiago Vignatti tiago.vignatti at intel.com
Thu Nov 22 14:22:57 PST 2012


Given xf86ScaleAxis(int Cx, int to_max, int to_min, int from_max, int
from_min), if to_max goes from 0 to rows - 1, then from_max has to be entered
accordingly to perform correct scaling. Check xf86ScaleAxis definition for
details.

An easy way to reproduce the bug exposed, is to open an xterm with small
letters and try to select one text character. You can see that the cursor
pointer doesn't match precisely the character selection.

Signed-off-by: Tiago Vignatti <tiago.vignatti at intel.com>
---
 hw/xfree86/xwayland/xwayland-input.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/hw/xfree86/xwayland/xwayland-input.c b/hw/xfree86/xwayland/xwayland-input.c
index 0c0838d..cff6d5e 100644
--- a/hw/xfree86/xwayland/xwayland-input.c
+++ b/hw/xfree86/xwayland/xwayland-input.c
@@ -330,8 +330,10 @@ pointer_handle_motion(void *data, struct wl_pointer *pointer,
     dx = xwl_seat->focus_window->window->drawable.x;
     dy = xwl_seat->focus_window->window->drawable.y;
 
-    lx = xf86ScaleAxis(sx + dx, 0xFFFF, 0, xwl_screen->scrninfo->virtualX, 0);
-    ly = xf86ScaleAxis(sy + dy, 0xFFFF, 0, xwl_screen->scrninfo->virtualY, 0);
+    lx = xf86ScaleAxis(sx + dx, 0xFFFF, 0,
+	               xwl_screen->scrninfo->virtualX - 1, 0);
+    ly = xf86ScaleAxis(sy + dy, 0xFFFF, 0,
+	               xwl_screen->scrninfo->virtualY - 1, 0);
 
     xf86PostMotionEvent(xwl_seat->pointer, TRUE, 0, 2, lx, ly);
 }
-- 
1.7.9.5



More information about the wayland-devel mailing list