tchwso.c - wmutils - X windows manipulation utilities
(HTM) git clone git://z3bra.org/wmutils
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
tchwso.c (1057B)
---
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 <err.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 stack(xcb_window_t, uint32_t[1]);
16
17 static void
18 usage(char *name)
19 {
20 fprintf(stderr, "usage: %s -rli <wid>\n", name);
21 exit(1);
22 }
23
24 static void
25 stack(xcb_window_t win, uint32_t values[1])
26 {
27 xcb_configure_window(conn, win, XCB_CONFIG_WINDOW_STACK_MODE, values);
28 }
29
30 int
31 main(int argc, char **argv)
32 {
33 xcb_window_t win;
34 uint32_t values[1];
35 char *argv0 = NULL;
36
37 if (argc != 3)
38 usage(argv[0]);
39
40 init_xcb(&conn);
41
42 win = strtoul(argv[2], NULL, 16);
43 if (!win)
44 return 1;
45
46 ARGBEGIN {
47 case 'r':
48 values[0] = XCB_STACK_MODE_ABOVE;
49 break;
50 case 'l':
51 values[0] = XCB_STACK_MODE_BELOW;
52 break;
53 case 'i':
54 values[0] = XCB_STACK_MODE_OPPOSITE;
55 break;
56 default:
57 usage(argv0);
58 break;
59 } ARGEND
60
61 stack(win, values);
62 xcb_aux_sync(conn);
63
64 kill_xcb(&conn);
65
66 return 0;
67 }