11 int x=10,y=10,h=400,w=400;
13 display = XOpenDisplay(NULL);
15 if (display == NULL) {
16 fprintf(stderr, "couldn't connect to X server :0\n");
20 state = XInternAtom(display, "_NET_WM_STATE", True);
21 modal = XInternAtom(display, "_NET_WM_STATE_MODAL", True);
23 parent = XCreateWindow(display, RootWindow(display, 0),
24 x, y, w, h, 10, CopyFromParent, CopyFromParent,
25 CopyFromParent, 0, 0);
26 child = XCreateWindow(display, RootWindow(display, 0),
27 x, y, w/2, h/2, 10, CopyFromParent, CopyFromParent,
28 CopyFromParent, 0, 0);
30 XSetWindowBackground(display,parent,WhitePixel(display,0));
31 XSetWindowBackground(display,child,BlackPixel(display,0));
33 XSetTransientForHint(display, child, parent);
34 XChangeProperty(display, child, state, XA_ATOM, 32,
35 PropModeReplace, (unsigned char*)&modal, 1);
37 XMapWindow(display, parent);
38 XMapWindow(display, child);
42 XNextEvent(display, &report);