]> Dogcows Code - chaz/openbox/blob - tests/modal.c
dont need libtool doing dlopen capable libs
[chaz/openbox] / tests / modal.c
1 #include <stdio.h>
2 #include <X11/Xlib.h>
3 #include <X11/Xutil.h>
4 #include <X11/Xatom.h>
5
6 int main () {
7 Display *display;
8 Window parent, child;
9 XEvent report;
10 Atom state, modal;
11 int x=10,y=10,h=400,w=400;
12
13 display = XOpenDisplay(NULL);
14
15 if (display == NULL) {
16 fprintf(stderr, "couldn't connect to X server :0\n");
17 return 0;
18 }
19
20 state = XInternAtom(display, "_NET_WM_STATE", True);
21 modal = XInternAtom(display, "_NET_WM_STATE_MODAL", True);
22
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);
29
30 XSetWindowBackground(display,parent,WhitePixel(display,0));
31 XSetWindowBackground(display,child,BlackPixel(display,0));
32
33 XSetTransientForHint(display, child, parent);
34 XChangeProperty(display, child, state, XA_ATOM, 32,
35 PropModeReplace, (unsigned char*)&modal, 1);
36
37 XMapWindow(display, parent);
38 XMapWindow(display, child);
39 XFlush(display);
40
41 while (1) {
42 XNextEvent(display, &report);
43 }
44
45 return 1;
46 }
This page took 0.03905 seconds and 4 git commands to generate.