11 int x=10,y=10,h=400,w=400;
14 display = XOpenDisplay(NULL);
16 if (display == NULL) {
17 fprintf(stderr, "couldn't connect to X server :0\n");
21 state = XInternAtom(display, "_NET_WM_STATE", True);
22 modal = XInternAtom(display, "_NET_WM_STATE_MODAL", True);
24 parent = XCreateWindow(display, RootWindow(display, 0),
25 x, y, w, h, 10, CopyFromParent, CopyFromParent,
26 CopyFromParent, 0, 0);
27 child = XCreateWindow(display, RootWindow(display, 0),
28 x, y, w/2, h/2, 10, CopyFromParent, CopyFromParent,
29 CopyFromParent, 0, 0);
31 XSetWindowBackground(display,parent,WhitePixel(display,0));
32 XSetWindowBackground(display,child,BlackPixel(display,0));
34 XSetTransientForHint(display, child, parent);
36 XMapWindow(display, parent);
37 XMapWindow(display, child);
40 ce.xclient.type = ClientMessage;
41 ce.xclient.message_type = state;
42 ce.xclient.display = display;
43 ce.xclient.window = child;
44 ce.xclient.format = 32;
45 ce.xclient.data.l[0] = 1;
46 ce.xclient.data.l[1] = modal;
47 ce.xclient.data.l[2] = 0;
48 XSendEvent(display, RootWindow(display, DefaultScreen(display)),
49 False, SubstructureNotifyMask | SubstructureRedirectMask, &ce);
52 XNextEvent(display, &report);