wmutils

X windows manipulation utilities
git clone git://z3bra.org/wmutils
Log | Files | Refs | LICENSE

commit c4588e45882b4b5249fd4a7f4f3eb26631f7a8f0
parent 85eb6467a53fff9a6d5b7fb6b9b9c55ddc28de88
Author: z3bra <willy@mailoo.org>
Date:   Thu Dec 18 13:56:32 2014

do not move the cursor when setting input focus

Diffstat:
 wtf.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/wtf.c b/wtf.c @@ -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) @@ -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); @@ -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); } @@ -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);