-
Notifications
You must be signed in to change notification settings - Fork 33
/
chwso.c
67 lines (53 loc) · 1.03 KB
/
chwso.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/* See LICENSE file for copyright and license details. */
#include <xcb/xcb.h>
#include <xcb/xcb_aux.h>
#include <stdlib.h>
#include <stdio.h>
#include <err.h>
#include "arg.h"
#include "util.h"
static xcb_connection_t *conn;
static void usage(char *);
static void stack(xcb_window_t, uint32_t[1]);
static void
usage(char *name)
{
fprintf(stderr, "usage: %s -rli <wid>\n", name);
exit(1);
}
static void
stack(xcb_window_t win, uint32_t values[1])
{
xcb_configure_window(conn, win, XCB_CONFIG_WINDOW_STACK_MODE, values);
}
int
main(int argc, char **argv)
{
xcb_window_t win;
uint32_t values[1];
char *argv0 = NULL;
if (argc != 3)
usage(argv[0]);
init_xcb(&conn);
win = strtoul(argv[2], NULL, 16);
if (!win)
return 1;
ARGBEGIN {
case 'r':
values[0] = XCB_STACK_MODE_ABOVE;
break;
case 'l':
values[0] = XCB_STACK_MODE_BELOW;
break;
case 'i':
values[0] = XCB_STACK_MODE_OPPOSITE;
break;
default:
usage(argv0);
break;
} ARGEND
stack(win, values);
xcb_aux_sync(conn);
kill_xcb(&conn);
return 0;
}