tignw.c - wmutils - X windows manipulation utilities
(HTM) git clone git://z3bra.org/wmutils
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
tignw.c (904B)
---
1 /* See LICENSE file for copyright and license details. */
2
3 #include <stdio.h>
4 #include <stdlib.h>
5 #include <err.h>
6 #include <xcb/xcb.h>
7 #include <xcb/xcb_aux.h>
8
9 #include "arg.h"
10 #include "util.h"
11
12 static xcb_connection_t *conn;
13
14 static void usage(char *);
15 static void set_override(xcb_window_t, int);
16
17 static void
18 usage(char *name)
19 {
20 fprintf(stderr, "usage: %s [-sr] <wid> [wid..]\n", name);
21 exit(1);
22 }
23
24 static void
25 set_override(xcb_window_t w, int or)
26 {
27 uint32_t mask = XCB_CW_OVERRIDE_REDIRECT;
28 uint32_t val[] = { or };
29
30 xcb_change_window_attributes(conn, w, mask, val);
31 }
32
33 int
34 main(int argc, char **argv)
35 {
36 int setflag = 0;
37 char *argv0;
38
39 ARGBEGIN {
40 case 's': setflag = 1; break;
41 case 'r': setflag = 0; break;
42 default: usage(argv0);
43 } ARGEND;
44
45 init_xcb(&conn);
46
47 while (*argv)
48 set_override(strtoul(*argv++, NULL, 16), setflag);
49
50 xcb_aux_sync(conn);
51
52 kill_xcb(&conn);
53
54 return 0;
55 }