adds rule for floating webcam window
[dwm.git] / transient.c
1 /* cc transient.c -o transient -lX11 */
2
3 #include <stdlib.h>
4 #include <unistd.h>
5 #include <X11/Xlib.h>
6 #include <X11/Xutil.h>
7
8 int main(void) {
9 Display *d;
10 Window r, f, t = None;
11 XSizeHints h;
12 XEvent e;
13
14 d = XOpenDisplay(NULL);
15 if (!d)
16 exit(1);
17 r = DefaultRootWindow(d);
18
19 f = XCreateSimpleWindow(d, r, 100, 100, 400, 400, 0, 0, 0);
20 h.min_width = h.max_width = h.min_height = h.max_height = 400;
21 h.flags = PMinSize | PMaxSize;
22 XSetWMNormalHints(d, f, &h);
23 XStoreName(d, f, "floating");
24 XMapWindow(d, f);
25
26 XSelectInput(d, f, ExposureMask);
27 while (1) {
28 XNextEvent(d, &e);
29
30 if (t == None) {
31 sleep(5);
32 t = XCreateSimpleWindow(d, r, 50, 50, 100, 100, 0, 0, 0);
33 XSetTransientForHint(d, t, f);
34 XStoreName(d, t, "transient");
35 XMapWindow(d, t);
36 XSelectInput(d, t, ExposureMask);
37 }
38 }
39
40 XCloseDisplay(d);
41 exit(0);
42 }