sync latest drw.{c,h} changes from dmenu
[dwm.git] / transient.c
blob040adb5b3c94d5838689d28f7714ec23297fb30a
1 /* cc transient.c -o transient -lX11 */
3 #include <stdlib.h>
4 #include <unistd.h>
5 #include <X11/Xlib.h>
6 #include <X11/Xutil.h>
8 int main(void) {
9 Display *d;
10 Window r, f, t = None;
11 XSizeHints h;
12 XEvent e;
14 d = XOpenDisplay(NULL);
15 if (!d)
16 exit(1);
17 r = DefaultRootWindow(d);
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);
26 XSelectInput(d, f, ExposureMask);
27 while (1) {
28 XNextEvent(d, &e);
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);
40 XCloseDisplay(d);
41 exit(0);