]> Dogcows Code - chaz/openbox/blob - tests/urgent.c
use .los not .os
[chaz/openbox] / tests / urgent.c
1 #include <stdio.h>
2 #include <unistd.h>
3 #include <X11/Xlib.h>
4 #include <X11/Xutil.h>
5
6 int main () {
7 Display *display;
8 Window win;
9 XEvent report;
10 Atom _net_fs, _net_state;
11 XEvent msg;
12 int x=50,y=50,h=100,w=400;
13 XWMHints hint;
14
15 display = XOpenDisplay(NULL);
16
17 if (display == NULL) {
18 fprintf(stderr, "couldn't connect to X server :0\n");
19 return 0;
20 }
21
22 _net_state = XInternAtom(display, "_NET_WM_STATE", False);
23 _net_fs = XInternAtom(display, "_NET_WM_STATE_FULLSCREEN", False);
24
25 win = XCreateWindow(display, RootWindow(display, 0),
26 x, y, w, h, 10, CopyFromParent, CopyFromParent,
27 CopyFromParent, 0, NULL);
28
29 XSetWindowBackground(display,win,WhitePixel(display,0));
30
31 XMapWindow(display, win);
32 XFlush(display);
33 sleep(2);
34
35 hint.flags = XUrgencyHint;
36 XSetWMHints(display, win, &hint);
37 XFlush(display);
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.040552 seconds and 4 git commands to generate.