9 Atom _net_fs, _net_state;
11 int x=10,y=10,h=100,w=400;
13 display = XOpenDisplay(NULL);
15 if (display == NULL) {
16 fprintf(stderr, "couldn't connect to X server :0\n");
20 _net_state = XInternAtom(display, "_NET_WM_STATE", False);
21 _net_fs = XInternAtom(display, "_NET_WM_STATE_FULLSCREEN", False);
23 win = XCreateWindow(display, RootWindow(display, 0),
24 x, y, w, h, 10, CopyFromParent, CopyFromParent,
25 CopyFromParent, 0, NULL);
27 XSetWindowBackground(display,win,WhitePixel(display,0));
29 XMapWindow(display, win);
33 printf("fullscreen\n");
34 msg.xclient.type = ClientMessage;
35 msg.xclient.message_type = _net_state;
36 msg.xclient.display = display;
37 msg.xclient.window = win;
38 msg.xclient.format = 32;
39 msg.xclient.data.l[0] = 2; // toggle
40 msg.xclient.data.l[1] = _net_fs;
41 msg.xclient.data.l[2] = 0l;
42 msg.xclient.data.l[3] = 0l;
43 msg.xclient.data.l[4] = 0l;
44 XSendEvent(display, RootWindow(display, 0), False,
45 SubstructureNotifyMask | SubstructureRedirectMask, &msg);
50 msg.xclient.type = ClientMessage;
51 msg.xclient.message_type = _net_state;
52 msg.xclient.display = display;
53 msg.xclient.window = win;
54 msg.xclient.format = 32;
55 msg.xclient.data.l[0] = 2; // toggle
56 msg.xclient.data.l[1] = _net_fs;
57 msg.xclient.data.l[2] = 0l;
58 msg.xclient.data.l[3] = 0l;
59 msg.xclient.data.l[4] = 0l;
60 XSendEvent(display, RootWindow(display, 0), False,
61 SubstructureNotifyMask | SubstructureRedirectMask, &msg);
63 XSelectInput(display, win, ExposureMask | StructureNotifyMask);
66 XNextEvent(display, &report);
68 switch (report.type) {
73 x = report.xconfigure.x;
74 y = report.xconfigure.y;
75 w = report.xconfigure.width;
76 h = report.xconfigure.height;
77 printf("confignotify %i,%i-%ix%i\n",x,y,w,h);