mouse: Correctly round floating points

Fix #835
This commit is contained in:
Emmanuel Lepage Vallee 2016-04-18 23:26:39 -04:00
parent 8387d8fecc
commit 5ebe073cdc
1 changed files with 3 additions and 2 deletions

View File

@ -30,6 +30,7 @@
*/ */
#include "mouse.h" #include "mouse.h"
#include "math.h"
#include "common/util.h" #include "common/util.h"
#include "common/xutil.h" #include "common/xutil.h"
#include "globalconf.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)) if(!mouse_query_pointer_root(&mouse_x, &mouse_y, NULL, &mask))
return 0; return 0;
x = luaA_getopt_integer_range(L, 1, "x", mouse_x, MIN_X11_COORDINATE, MAX_X11_COORDINATE); x = round(luaA_getopt_number_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); y = round(luaA_getopt_number_range(L, 1, "y", mouse_y, MIN_X11_COORDINATE, MAX_X11_COORDINATE));
if(ignore_enter_notify) if(ignore_enter_notify)
client_ignore_enterleave_events(); client_ignore_enterleave_events();