]> Dogcows Code - chaz/openbox/blob - tests/override.c
5f803da36b1f3b0545e18536a0aec7b319942131
[chaz/openbox] / tests / override.c
1 #include <stdio.h>
2 #include <X11/Xlib.h>
3
4 int main () {
5 XSetWindowAttributes xswa;
6 unsigned long xswamask;
7 Display *display;
8 Window win;
9 XEvent report;
10 int x=10,y=10,h=100,w=400;
11
12 display = XOpenDisplay(NULL);
13
14 if (display == NULL) {
15 fprintf(stderr, "couldn't connect to X server :0\n");
16 return 0;
17 }
18
19 xswa.override_redirect = True;
20 xswamask = CWOverrideRedirect;
21
22 win = XCreateWindow(display, RootWindow(display, 0),
23 x, y, w, h, 10, CopyFromParent, CopyFromParent,
24 CopyFromParent, xswamask, &xswa);
25
26 XSetWindowBackground(display,win,WhitePixel(display,0));
27
28 XMapWindow(display, win);
29 XFlush(display);
30 sleep(1);
31 XUnmapWindow(display, win);
32 XFlush(display);
33 sleep(1);
34 XMapWindow(display, win);
35 XFlush(display);
36
37 XSelectInput(display, win, ExposureMask | StructureNotifyMask);
38
39 while (1) {
40 XNextEvent(display, &report);
41
42 switch (report.type) {
43 case Expose:
44 printf("exposed\n");
45 break;
46 case ConfigureNotify:
47 x = report.xconfigure.x;
48 y = report.xconfigure.y;
49 w = report.xconfigure.width;
50 h = report.xconfigure.height;
51 printf("confignotify %i,%i-%ix%i\n",x,y,w,h);
52 break;
53 }
54
55 }
56
57 return 1;
58 }
This page took 0.033835 seconds and 3 git commands to generate.