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 msg
.xclient
.type
= ClientMessage
;
34 msg
.xclient
.message_type
= _net_state
;
35 msg
.xclient
.display
= display
;
36 msg
.xclient
.window
= win
;
37 msg
.xclient
.format
= 32;
38 msg
.xclient
.data
.l
[0] = 2; // toggle
39 msg
.xclient
.data
.l
[1] = _net_fs
;
40 msg
.xclient
.data
.l
[2] = 0l;
41 msg
.xclient
.data
.l
[3] = 0l;
42 msg
.xclient
.data
.l
[4] = 0l;
43 XSendEvent(display
, RootWindow(display
, 0), False
,
44 StructureNotifyMask
| SubstructureNotifyMask
, &msg
);
48 msg
.xclient
.type
= ClientMessage
;
49 msg
.xclient
.message_type
= _net_state
;
50 msg
.xclient
.display
= display
;
51 msg
.xclient
.window
= win
;
52 msg
.xclient
.format
= 32;
53 msg
.xclient
.data
.l
[0] = 2; // toggle
54 msg
.xclient
.data
.l
[1] = _net_fs
;
55 msg
.xclient
.data
.l
[2] = 0l;
56 msg
.xclient
.data
.l
[3] = 0l;
57 msg
.xclient
.data
.l
[4] = 0l;
58 XSendEvent(display
, RootWindow(display
, 0), False
,
59 StructureNotifyMask
| SubstructureNotifyMask
, &msg
);
61 XSelectInput(display
, win
, ExposureMask
| StructureNotifyMask
);
64 XNextEvent(display
, &report
);
66 switch (report
.type
) {
71 x
= report
.xconfigure
.x
;
72 y
= report
.xconfigure
.y
;
73 w
= report
.xconfigure
.width
;
74 h
= report
.xconfigure
.height
;
75 printf("confignotify %i,%i-%ix%i\n",x
,y
,w
,h
);