new config + uselessgap
[azarus-dwm.git] / transient.c
blob41f2d3f18b152b81a18b917e2b3f657391caa515
1 /* cc transient.c -o transient -lX11 */
3 #include <X11/Xlib.h>
4 #include <X11/Xutil.h>
5 #include <stdlib.h>
6 #include <unistd.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);
18 r = DefaultRootWindow(d);
20 f = XCreateSimpleWindow(d, r, 100, 100, 400, 400, 0, 0, 0);
21 h.min_width = h.max_width = h.min_height = h.max_height = 400;
22 h.flags = PMinSize | PMaxSize;
23 XSetWMNormalHints(d, f, &h);
24 XStoreName(d, f, "floating");
25 XMapWindow(d, f);
27 XSelectInput(d, f, ExposureMask);
28 while (1) {
29 XNextEvent(d, &e);
31 if (t == None) {
32 sleep(5);
33 t = XCreateSimpleWindow(d, r, 50, 50, 100, 100, 0, 0, 0);
34 XSetTransientForHint(d, t, f);
35 XStoreName(d, t, "transient");
36 XMapWindow(d, t);
37 XSelectInput(d, t, ExposureMask);
41 XCloseDisplay(d);
42 exit(0);