tdo not move the cursor when setting input focus - wmutils - X windows manipulation utilities
 (HTM) git clone git://z3bra.org/wmutils
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit c4588e45882b4b5249fd4a7f4f3eb26631f7a8f0
 (DIR) parent 85eb6467a53fff9a6d5b7fb6b9b9c55ddc28de88
 (HTM) Author: z3bra <willy@mailoo.org>
       Date:   Thu, 18 Dec 2014 13:56:32 +0100
       
       do not move the cursor when setting input focus
       
       Diffstat:
         M wtf.c                               |      14 +++++---------
       
       1 file changed, 5 insertions(+), 9 deletions(-)
       ---
 (DIR) diff --git a/wtf.c b/wtf.c
       t@@ -21,10 +21,10 @@
        
        #include "util.h"
        
       -static xcb_connection_t   *conn;
       +static xcb_connection_t *conn;
        
       -static void usage          (char *name);
       -static void center_pointer (xcb_window_t);
       +static void usage (char *name);
       +static void set_focus (xcb_window_t);
        
        static void
        usage (char *name)
       t@@ -34,7 +34,7 @@ usage (char *name)
        }
        
        static void
       -center_pointer (xcb_window_t win)
       +set_focus (xcb_window_t win)
        {
                xcb_get_geometry_reply_t *geom;
                geom = xcb_get_geometry_reply(conn, xcb_get_geometry(conn, win), NULL);
       t@@ -42,10 +42,6 @@ center_pointer (xcb_window_t win)
                if (!geom)
                        errx(1, "center_pointer: missing geometry!");
        
       -        xcb_warp_pointer(conn, XCB_NONE, win, 0, 0, 0, 0,
       -                        (geom->width  + (geom->border_width * 2)) / 2,
       -                        (geom->height + (geom->border_width * 2)) / 2);
       -
                xcb_set_input_focus(conn, XCB_INPUT_FOCUS_POINTER_ROOT, win,
                                XCB_CURRENT_TIME);
        }
       t@@ -65,7 +61,7 @@ main (int argc, char **argv)
                if (!win)
                        errx(1, "could not get focused window");
        
       -        center_pointer(win);
       +        set_focus(win);
                xcb_flush(conn);
        
                kill_xcb(&conn);