-
Notifications
You must be signed in to change notification settings - Fork 33
/
ignw.c
55 lines (41 loc) · 904 Bytes
/
ignw.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
/* See LICENSE file for copyright and license details. */
#include <stdio.h>
#include <stdlib.h>
#include <err.h>
#include <xcb/xcb.h>
#include <xcb/xcb_aux.h>
#include "arg.h"
#include "util.h"
static xcb_connection_t *conn;
static void usage(char *);
static void set_override(xcb_window_t, int);
static void
usage(char *name)
{
fprintf(stderr, "usage: %s [-sr] <wid> [wid..]\n", name);
exit(1);
}
static void
set_override(xcb_window_t w, int or)
{
uint32_t mask = XCB_CW_OVERRIDE_REDIRECT;
uint32_t val[] = { or };
xcb_change_window_attributes(conn, w, mask, val);
}
int
main(int argc, char **argv)
{
int setflag = 0;
char *argv0;
ARGBEGIN {
case 's': setflag = 1; break;
case 'r': setflag = 0; break;
default: usage(argv0);
} ARGEND;
init_xcb(&conn);
while (*argv)
set_override(strtoul(*argv++, NULL, 16), setflag);
xcb_aux_sync(conn);
kill_xcb(&conn);
return 0;
}