From 5ebe073cdc377fb4f04d8f9f2613447d482e4a3d Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage Vallee Date: Mon, 18 Apr 2016 23:26:39 -0400 Subject: [PATCH] mouse: Correctly round floating points Fix #835 --- mouse.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mouse.c b/mouse.c index 78557dfd..5c80b17b 100644 --- a/mouse.c +++ b/mouse.c @@ -30,6 +30,7 @@ */ #include "mouse.h" +#include "math.h" #include "common/util.h" #include "common/xutil.h" #include "globalconf.h" @@ -224,8 +225,8 @@ luaA_mouse_coords(lua_State *L) if(!mouse_query_pointer_root(&mouse_x, &mouse_y, NULL, &mask)) return 0; - x = luaA_getopt_integer_range(L, 1, "x", mouse_x, MIN_X11_COORDINATE, MAX_X11_COORDINATE); - y = luaA_getopt_integer_range(L, 1, "y", mouse_y, MIN_X11_COORDINATE, MAX_X11_COORDINATE); + x = round(luaA_getopt_number_range(L, 1, "x", mouse_x, MIN_X11_COORDINATE, MAX_X11_COORDINATE)); + y = round(luaA_getopt_number_range(L, 1, "y", mouse_y, MIN_X11_COORDINATE, MAX_X11_COORDINATE)); if(ignore_enter_notify) client_ignore_enterleave_events();