diff options
author | Mathias Gumz <akira at fluxbox dot org> | 2011-10-17 15:07:00 (GMT) |
---|---|---|
committer | Mathias Gumz <akira at fluxbox dot org> | 2011-10-17 15:07:00 (GMT) |
commit | a2558a2b14054058342d9946deefd7c72dc2d887 (patch) | |
tree | b2ef11d800f0a350c8c5b25209713eb7e3dba81b | |
parent | dc6c9c4e9b4d2976563634d84fa0ea0aa8a01f6d (diff) | |
download | fluxbox-a2558a2b14054058342d9946deefd7c72dc2d887.zip fluxbox-a2558a2b14054058342d9946deefd7c72dc2d887.tar.bz2 |
removed obsolete handler for the gnome-window manager hints
nowadays every app should use the extended window manager hints exclusively.
-rw-r--r-- | configure.in | 19 | ||||
-rw-r--r-- | src/Gnome.cc | 466 | ||||
-rw-r--r-- | src/Gnome.hh | 104 | ||||
-rw-r--r-- | src/Makefile.am | 5 | ||||
-rw-r--r-- | src/fluxbox.cc | 6 | ||||
-rw-r--r-- | src/main.cc | 5 |
6 files changed, 1 insertions, 604 deletions
diff --git a/configure.in b/configure.in index 1d69f34..e75e51f 100644 --- a/configure.in +++ b/configure.in | |||
@@ -359,25 +359,6 @@ AC_ARG_ENABLE( | |||
359 | AC_DEFINE(TIMEDCACHE, 1, "timed cache") | 359 | AC_DEFINE(TIMEDCACHE, 1, "timed cache") |
360 | ) | 360 | ) |
361 | 361 | ||
362 | dnl Check GNOME | ||
363 | |||
364 | AC_MSG_CHECKING([whether to have GNOME support]) | ||
365 | AC_ARG_ENABLE( | ||
366 | gnome, | ||
367 | [ --enable-gnome GNOME support ([default=yes])], | ||
368 | if test x$enableval = "xyes"; then | ||
369 | AC_MSG_RESULT([yes]) | ||
370 | AC_DEFINE(USE_GNOME, 1, "Gnome 1 support") | ||
371 | GNOME=true | ||
372 | else | ||
373 | AC_MSG_RESULT([no]) | ||
374 | GNOME=false | ||
375 | fi, | ||
376 | AC_MSG_RESULT([yes]) | ||
377 | AC_DEFINE(USE_GNOME, 1, "Gnome 1 support") | ||
378 | GNOME=true | ||
379 | ) | ||
380 | AM_CONDITIONAL(GNOME, test x$GNOME = xtrue) | ||
381 | 362 | ||
382 | AC_MSG_CHECKING([whether to have Xft support]) | 363 | AC_MSG_CHECKING([whether to have Xft support]) |
383 | AM_PATH_XFT(yes, | 364 | AM_PATH_XFT(yes, |
diff --git a/src/Gnome.cc b/src/Gnome.cc deleted file mode 100644 index 0c3b6f1..0000000 --- a/src/Gnome.cc +++ /dev/null | |||
@@ -1,466 +0,0 @@ | |||
1 | // Gnome.cc for fluxbox | ||
2 | // Copyright (c) 2002 - 2006 Henrik Kinnunen (fluxgen at fluxbox dot org) | ||
3 | // | ||
4 | // Permission is hereby granted, free of charge, to any person obtaining a | ||
5 | // copy of this software and associated documentation files (the "Software"), | ||
6 | // to deal in the Software without restriction, including without limitation | ||
7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
8 | // and/or sell copies of the Software, and to permit persons to whom the | ||
9 | // Software is furnished to do so, subject to the following conditions: | ||
10 | // | ||
11 | // The above copyright notice and this permission notice shall be included in | ||
12 | // all copies or substantial portions of the Software. | ||
13 | // | ||
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
20 | // DEALINGS IN THE SOFTWARE. | ||
21 | |||
22 | #include "Gnome.hh" | ||
23 | |||
24 | #include "FbTk/App.hh" | ||
25 | #include "FbTk/I18n.hh" | ||
26 | #include "Window.hh" | ||
27 | #include "Screen.hh" | ||
28 | #include "WinClient.hh" | ||
29 | #include "Workspace.hh" | ||
30 | #include "Layer.hh" | ||
31 | #include "Debug.hh" | ||
32 | |||
33 | #include <iostream> | ||
34 | #ifdef HAVE_CSTRING | ||
35 | #include <cstring> | ||
36 | #else | ||
37 | #include <string.h> | ||
38 | #endif | ||
39 | |||
40 | using std::cerr; | ||
41 | using std::endl; | ||
42 | using std::list; | ||
43 | using std::hex; | ||
44 | using std::dec; | ||
45 | |||
46 | Gnome::Gnome() { | ||
47 | setName("gnome"); | ||
48 | createAtoms(); | ||
49 | enableUpdate(); | ||
50 | } | ||
51 | |||
52 | Gnome::~Gnome() { | ||
53 | // destroy gnome windows | ||
54 | while (!m_gnomewindows.empty()) { | ||
55 | XDestroyWindow(FbTk::App::instance()->display(), m_gnomewindows.back()); | ||
56 | m_gnomewindows.pop_back(); | ||
57 | } | ||
58 | } | ||
59 | |||
60 | |||
61 | void Gnome::initForScreen(BScreen &screen) { | ||
62 | Display *disp = FbTk::App::instance()->display(); | ||
63 | // create the GNOME window | ||
64 | Window gnome_win = XCreateSimpleWindow(disp, | ||
65 | screen.rootWindow().window(), 0, 0, 5, 5, 0, 0, 0); | ||
66 | // supported WM check | ||
67 | screen.rootWindow().changeProperty(m_gnome_wm_supporting_wm_check, | ||
68 | XA_WINDOW, 32, | ||
69 | PropModeReplace, (unsigned char *) &gnome_win, 1); | ||
70 | |||
71 | XChangeProperty(disp, gnome_win, | ||
72 | m_gnome_wm_supporting_wm_check, | ||
73 | XA_WINDOW, 32, PropModeReplace, (unsigned char *) &gnome_win, 1); | ||
74 | |||
75 | // supported gnome atoms | ||
76 | Atom gnomeatomlist[] = { | ||
77 | m_gnome_wm_supporting_wm_check, | ||
78 | m_gnome_wm_win_workspace_names, | ||
79 | m_gnome_wm_win_client_list, | ||
80 | m_gnome_wm_win_state, | ||
81 | m_gnome_wm_win_hints, | ||
82 | m_gnome_wm_win_layer | ||
83 | }; | ||
84 | //list atoms that we support | ||
85 | screen.rootWindow().changeProperty(m_gnome_wm_prot, | ||
86 | XA_ATOM, 32, PropModeReplace, | ||
87 | (unsigned char *)gnomeatomlist, | ||
88 | (sizeof gnomeatomlist)/sizeof gnomeatomlist[0]); | ||
89 | |||
90 | m_gnomewindows.push_back(gnome_win); | ||
91 | |||
92 | updateClientList(screen); | ||
93 | updateWorkspaceNames(screen); | ||
94 | updateWorkspaceCount(screen); | ||
95 | updateCurrentWorkspace(screen); | ||
96 | |||
97 | } | ||
98 | |||
99 | void Gnome::setupFrame(FluxboxWindow &win) { | ||
100 | // load gnome state (take queues from the main window of the frame) | ||
101 | long flags; | ||
102 | bool exists; | ||
103 | flags=win.winClient().cardinalProperty(m_gnome_wm_win_state,&exists); | ||
104 | if (exists) { | ||
105 | setState(&win, flags); | ||
106 | } else { | ||
107 | updateState(win); | ||
108 | } | ||
109 | |||
110 | // load gnome layer atom | ||
111 | flags=win.winClient().cardinalProperty(m_gnome_wm_win_layer,&exists); | ||
112 | if (exists) { | ||
113 | setLayer(&win, flags); | ||
114 | } else { | ||
115 | updateLayer(win); | ||
116 | } | ||
117 | |||
118 | // load gnome workspace atom | ||
119 | flags=win.winClient().cardinalProperty(m_gnome_wm_win_workspace,&exists); | ||
120 | if (exists) | ||
121 | { | ||
122 | unsigned int workspace_num = flags; | ||
123 | if (win.workspaceNumber() != workspace_num) | ||
124 | win.setWorkspace(workspace_num); | ||
125 | } else { | ||
126 | updateWorkspace(win); | ||
127 | } | ||
128 | |||
129 | } | ||
130 | |||
131 | |||
132 | bool Gnome::propertyNotify(WinClient &winclient, Atom the_property) { | ||
133 | if (the_property == m_gnome_wm_win_state) { | ||
134 | fbdbg<<"("<<__FUNCTION__<<"): _WIN_STATE"<<endl; | ||
135 | return true; | ||
136 | } else if (the_property == m_gnome_wm_win_layer) { | ||
137 | fbdbg<<"("<<__FUNCTION__<<"): _WIN_LAYER"<<endl; | ||
138 | return true; | ||
139 | } | ||
140 | return false; | ||
141 | } | ||
142 | |||
143 | |||
144 | void Gnome::updateClientList(BScreen &screen) { | ||
145 | size_t num=0; | ||
146 | |||
147 | // count window clients in each workspace | ||
148 | BScreen::Workspaces::const_iterator workspace_it = | ||
149 | screen.getWorkspacesList().begin(); | ||
150 | BScreen::Workspaces::const_iterator workspace_it_end = | ||
151 | screen.getWorkspacesList().end(); | ||
152 | for (; workspace_it != workspace_it_end; ++workspace_it) { | ||
153 | Workspace::Windows::iterator win_it = | ||
154 | (*workspace_it)->windowList().begin(); | ||
155 | Workspace::Windows::iterator win_it_end = | ||
156 | (*workspace_it)->windowList().end(); | ||
157 | for (; win_it != win_it_end; ++win_it) | ||
158 | num += (*win_it)->numClients(); | ||
159 | } | ||
160 | |||
161 | Window *wl = new Window[num]; | ||
162 | if (wl == 0) { | ||
163 | _FB_USES_NLS; | ||
164 | cerr<<_FB_CONSOLETEXT(Gnome, OutOfMemoryClientList, "Fatal: Out of memory, can't allocate for GNOME client list", "")<<endl; | ||
165 | return; | ||
166 | } | ||
167 | |||
168 | //add client windows to buffer | ||
169 | workspace_it = screen.getWorkspacesList().begin(); | ||
170 | int win=0; | ||
171 | for (; workspace_it != workspace_it_end; ++workspace_it) { | ||
172 | |||
173 | // Fill in array of window ID's | ||
174 | Workspace::Windows::const_iterator it = | ||
175 | (*workspace_it)->windowList().begin(); | ||
176 | Workspace::Windows::const_iterator it_end = | ||
177 | (*workspace_it)->windowList().end(); | ||
178 | for (; it != it_end; ++it) { | ||
179 | // TODO! | ||
180 | //check if the window don't want to be visible in the list | ||
181 | //if (! ( (*it)->getGnomeHints() & WIN_STATE_HIDDEN) ) { | ||
182 | list<WinClient *>::iterator client_it = | ||
183 | (*it)->clientList().begin(); | ||
184 | list<WinClient *>::iterator client_it_end = | ||
185 | (*it)->clientList().end(); | ||
186 | for (; client_it != client_it_end; ++client_it) | ||
187 | wl[win++] = (*client_it)->window(); | ||
188 | |||
189 | } | ||
190 | } | ||
191 | //number of windows to show in client list | ||
192 | num = win; | ||
193 | screen.rootWindow().changeProperty(m_gnome_wm_win_client_list, | ||
194 | XA_WINDOW, 32, | ||
195 | PropModeReplace, (unsigned char *)wl, num); | ||
196 | |||
197 | delete[] wl; | ||
198 | } | ||
199 | |||
200 | void Gnome::updateClientClose(WinClient &client) { | ||
201 | if (!client.screen().isShuttingdown()) { | ||
202 | XDeleteProperty(FbTk::App::instance()->display(), client.window(), | ||
203 | m_gnome_wm_win_workspace); | ||
204 | XDeleteProperty(FbTk::App::instance()->display(), client.window(), | ||
205 | m_gnome_wm_win_layer); | ||
206 | XDeleteProperty(FbTk::App::instance()->display(), client.window(), | ||
207 | m_gnome_wm_win_state); | ||
208 | } | ||
209 | } | ||
210 | |||
211 | void Gnome::updateWorkspaceNames(BScreen &screen) { | ||
212 | |||
213 | size_t number_of_desks = screen.getWorkspaceNames().size(); | ||
214 | const BScreen::WorkspaceNames &workspace_names = screen.getWorkspaceNames(); | ||
215 | // convert our desktop names to a char * so we can send it | ||
216 | char** names = new char*[number_of_desks]; | ||
217 | |||
218 | for (size_t i = 0; i < number_of_desks; i++) { | ||
219 | names[i] = new char[workspace_names[i].size() + 1]; | ||
220 | strcpy(names[i], workspace_names[i].c_str()); | ||
221 | } | ||
222 | |||
223 | XTextProperty text; | ||
224 | if (XStringListToTextProperty(names, number_of_desks, &text)) { | ||
225 | XSetTextProperty(FbTk::App::instance()->display(), screen.rootWindow().window(), | ||
226 | &text, m_gnome_wm_win_workspace_names); | ||
227 | XFree(text.value); | ||
228 | } | ||
229 | |||
230 | // destroy name buffers | ||
231 | for (size_t i = 0; i < number_of_desks; i++) | ||
232 | delete[] names[i]; | ||
233 | |||
234 | delete[] names; | ||
235 | } | ||
236 | |||
237 | void Gnome::updateCurrentWorkspace(BScreen &screen) { | ||
238 | long workspace = screen.currentWorkspaceID(); | ||
239 | screen.rootWindow().changeProperty(m_gnome_wm_win_workspace, XA_CARDINAL, 32, PropModeReplace, | ||
240 | (unsigned char *)&workspace, 1); | ||
241 | |||
242 | updateClientList(screen); // make sure the client list is updated too | ||
243 | } | ||
244 | |||
245 | void Gnome::updateWorkspaceCount(BScreen &screen) { | ||
246 | long numworkspaces = screen.numberOfWorkspaces(); | ||
247 | screen.rootWindow().changeProperty(m_gnome_wm_win_workspace_count, XA_CARDINAL, 32, PropModeReplace, | ||
248 | (unsigned char *)&numworkspaces, 1); | ||
249 | } | ||
250 | |||
251 | void Gnome::updateWorkspace(FluxboxWindow &win) { | ||
252 | long val = win.workspaceNumber(); | ||
253 | if (win.isStuck()) { | ||
254 | val = -1; | ||
255 | } | ||
256 | |||
257 | fbdbg<<"setting workspace("<<val<<") for window("<<&win<<")"<<endl; | ||
258 | |||
259 | FluxboxWindow::ClientList::iterator client_it = win.clientList().begin(); | ||
260 | FluxboxWindow::ClientList::iterator client_it_end = win.clientList().end(); | ||
261 | for (; client_it != client_it_end; ++client_it) | ||
262 | (*client_it)->changeProperty(m_gnome_wm_win_workspace, | ||
263 | XA_CARDINAL, 32, PropModeReplace, | ||
264 | (unsigned char *)&val, 1); | ||
265 | } | ||
266 | |||
267 | void Gnome::updateState(FluxboxWindow &win) { | ||
268 | //translate to gnome win state | ||
269 | long state=0; | ||
270 | if (win.isStuck()) | ||
271 | state |= WIN_STATE_STICKY; | ||
272 | if (win.isIconic()) | ||
273 | state |= WIN_STATE_MINIMIZED; | ||
274 | if (win.isShaded()) | ||
275 | state |= WIN_STATE_SHADED; |