From d59d72fe491b51fdf397c367f15049ce4e43a4ab Mon Sep 17 00:00:00 2001 From: Themaister Date: Fri, 29 Mar 2013 19:30:09 +0100 Subject: [PATCH] Don't warp pointer unless needed. --- input/x11_input.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/input/x11_input.c b/input/x11_input.c index aa0318e660..f44d5047fd 100644 --- a/input/x11_input.c +++ b/input/x11_input.c @@ -237,11 +237,15 @@ static void x_input_poll_mouse(x11_input_t *x11) { struct rarch_viewport vp = {0}; video_viewport_info_func(&vp); - unsigned mid_w = vp.full_width >> 1; - unsigned mid_h = vp.full_height >> 1; - XWarpPointer(x11->display, None, - x11->win, 0, 0, 0, 0, - mid_w, mid_h); + int mid_w = vp.full_width >> 1; + int mid_h = vp.full_height >> 1; + + if (x11->mouse_x != mid_w || x11->mouse_y != mid_h) + { + XWarpPointer(x11->display, None, + x11->win, 0, 0, 0, 0, + mid_w, mid_h); + } x11->mouse_last_x = mid_w; x11->mouse_last_y = mid_h; }