twtf.c - wmutils - X windows manipulation utilities
 (HTM) git clone git://z3bra.org/wmutils
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
       twtf.c (686B)
       ---
            1 /* See LICENSE file for copyright and license details. */
            2 
            3 #include <xcb/xcb.h>
            4 #include <xcb/xcb_aux.h>
            5 #include <stdlib.h>
            6 #include <stdio.h>
            7 #include <string.h>
            8 #include <err.h>
            9 
           10 #include "util.h"
           11 
           12 static xcb_connection_t *conn;
           13 
           14 static void usage (char *);
           15 
           16 static void
           17 usage(char *name)
           18 {
           19         fprintf(stderr, "usage: %s <wid>\n", name);
           20         exit(1);
           21 }
           22 
           23 int
           24 main(int argc, char **argv)
           25 {
           26         xcb_window_t win;
           27 
           28         if (argc != 2 || strncmp(argv[0], "-h", 2) == 0)
           29                 usage(argv[0]);
           30 
           31         init_xcb(&conn);
           32 
           33         win = strtoul(argv[1], NULL, 16);
           34 
           35         if (win) {
           36                 xcb_set_input_focus(conn, XCB_INPUT_FOCUS_POINTER_ROOT, win,
           37                                 XCB_CURRENT_TIME);
           38 
           39                 xcb_aux_sync(conn);
           40         }
           41 
           42         kill_xcb(&conn);
           43         return 0;
           44 }