1/* cc transient.c -o transient -lX11 */23#include <stdlib.h>4#include <unistd.h>5#include <X11/Xlib.h>6#include <X11/Xutil.h>78int main(void) {9 Display *d;10 Window r, f, t = None;11 XSizeHints h;12 XEvent e;1314 d = XOpenDisplay(NULL);15 if (!d)16 exit(1);17 r = DefaultRootWindow(d);1819 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);2526 XSelectInput(d, f, ExposureMask);27 while (1) {28 XNextEvent(d, &e);2930 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 }3940 XCloseDisplay(d);41 exit(0);42}