]>
Dogcows Code - chaz/openbox/blob - tests/fullscreen.c
1 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
3 fullscreen.c for the Openbox window manager
4 Copyright (c) 2003-2007 Dana Jansens
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 See the COPYING file for a copy of the GNU General Public License.
27 Atom _net_fs
, _net_state
;
29 int x
=10,y
=10,h
=100,w
=400;
31 display
= XOpenDisplay(NULL
);
33 if (display
== NULL
) {
34 fprintf(stderr
, "couldn't connect to X server :0\n");
38 _net_state
= XInternAtom(display
, "_NET_WM_STATE", False
);
39 _net_fs
= XInternAtom(display
, "_NET_WM_STATE_FULLSCREEN", False
);
41 win
= XCreateWindow(display
, RootWindow(display
, 0),
42 x
, y
, w
, h
, 10, CopyFromParent
, CopyFromParent
,
43 CopyFromParent
, 0, NULL
);
45 XSetWindowBackground(display
,win
,WhitePixel(display
,0));
47 XMapWindow(display
, win
);
51 printf("fullscreen\n");
52 msg
.xclient
.type
= ClientMessage
;
53 msg
.xclient
.message_type
= _net_state
;
54 msg
.xclient
.display
= display
;
55 msg
.xclient
.window
= win
;
56 msg
.xclient
.format
= 32;
57 msg
.xclient
.data
.l
[0] = 2; // toggle
58 msg
.xclient
.data
.l
[1] = _net_fs
;
59 msg
.xclient
.data
.l
[2] = 0l;
60 msg
.xclient
.data
.l
[3] = 0l;
61 msg
.xclient
.data
.l
[4] = 0l;
62 XSendEvent(display
, RootWindow(display
, 0), False
,
63 SubstructureNotifyMask
| SubstructureRedirectMask
, &msg
);
68 msg
.xclient
.type
= ClientMessage
;
69 msg
.xclient
.message_type
= _net_state
;
70 msg
.xclient
.display
= display
;
71 msg
.xclient
.window
= win
;
72 msg
.xclient
.format
= 32;
73 msg
.xclient
.data
.l
[0] = 2; // toggle
74 msg
.xclient
.data
.l
[1] = _net_fs
;
75 msg
.xclient
.data
.l
[2] = 0l;
76 msg
.xclient
.data
.l
[3] = 0l;
77 msg
.xclient
.data
.l
[4] = 0l;
78 XSendEvent(display
, RootWindow(display
, 0), False
,
79 SubstructureNotifyMask
| SubstructureRedirectMask
, &msg
);
81 XSelectInput(display
, win
, ExposureMask
| StructureNotifyMask
);
84 XNextEvent(display
, &report
);
86 switch (report
.type
) {
91 x
= report
.xconfigure
.x
;
92 y
= report
.xconfigure
.y
;
93 w
= report
.xconfigure
.width
;
94 h
= report
.xconfigure
.height
;
95 printf("confignotify %i,%i-%ix%i\n",x
,y
,w
,h
);
This page took 0.035009 seconds and 4 git commands to generate.