diff options
author | fluxgen <fluxgen> | 2002-02-20 23:49:06 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2002-02-20 23:49:06 (GMT) |
commit | f1a96599e83fad6af8e727137ecb01d3ad7c9c91 (patch) | |
tree | ffe5c325c58eb638a6efbe30d9fed81da5880078 | |
parent | 16be0991aead5754e148fc93b97499164a2d47d7 (diff) | |
download | fluxbox-f1a96599e83fad6af8e727137ecb01d3ad7c9c91.zip fluxbox-f1a96599e83fad6af8e727137ecb01d3ad7c9c91.tar.bz2 |
indentation
-rw-r--r-- | src/Windowmenu.cc | 311 |
1 files changed, 155 insertions, 156 deletions
diff --git a/src/Windowmenu.cc b/src/Windowmenu.cc index dcf6bd6..8840217 100644 --- a/src/Windowmenu.cc +++ b/src/Windowmenu.cc | |||
@@ -13,20 +13,19 @@ | |||
13 | // | 13 | // |
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 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, | 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | 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 | 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 | 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 | 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
20 | // DEALINGS IN THE SOFTWARE. | 20 | // DEALINGS IN THE SOFTWARE. |
21 | 21 | ||
22 | // stupid macros needed to access some functions in version 2 of the GNU C | 22 | //use GNU extensions |
23 | // library | 23 | #ifndef _GNU_SOURCE |
24 | #ifndef _GNU_SOURCE | 24 | #define _GNU_SOURCE |
25 | #define _GNU_SOURCE | ||
26 | #endif // _GNU_SOURCE | 25 | #endif // _GNU_SOURCE |
27 | 26 | ||
28 | #ifdef HAVE_CONFIG_H | 27 | #ifdef HAVE_CONFIG_H |
29 | # include "../config.h" | 28 | # include "../config.h" |
30 | #endif // HAVE_CONFIG_H | 29 | #endif // HAVE_CONFIG_H |
31 | 30 | ||
32 | #include "i18n.hh" | 31 | #include "i18n.hh" |
@@ -36,262 +35,262 @@ | |||
36 | #include "Windowmenu.hh" | 35 | #include "Windowmenu.hh" |
37 | #include "Workspace.hh" | 36 | #include "Workspace.hh" |
38 | 37 | ||
39 | #ifdef STDC_HEADERS | 38 | #ifdef STDC_HEADERS |
40 | # include <string.h> | 39 | # include <string.h> |
41 | #endif // STDC_HEADERS | 40 | #endif // STDC_HEADERS |
42 | 41 | ||
43 | 42 | ||
44 | Windowmenu::Windowmenu(FluxboxWindow *win) : Basemenu(win->getScreen()) { | 43 | Windowmenu::Windowmenu(FluxboxWindow *win) : Basemenu(win->getScreen()), |
45 | window = win; | 44 | window(win), |
46 | screen = window->getScreen(); | 45 | screen(window->getScreen()){ |
47 | 46 | ||
48 | setTitleVisibility(False); | 47 | setTitleVisibility(False); |
49 | setMovable(False); | 48 | setMovable(False); |
50 | setInternalMenu(); | 49 | setInternalMenu(); |
51 | 50 | ||
52 | I18n *i18n = I18n::instance(); | 51 | I18n *i18n = I18n::instance(); |
53 | 52 | ||
54 | sendToMenu = new SendtoWorkspacemenu(this); | 53 | sendToMenu = new SendtoWorkspacemenu(this); |
55 | sendGroupToMenu = new SendGroupToWorkspacemenu(this); | 54 | sendGroupToMenu = new SendGroupToWorkspacemenu(this); |
56 | 55 | ||
57 | insert(i18n->getMessage( | 56 | insert(i18n->getMessage( |
58 | #ifdef NLS | 57 | #ifdef NLS |
59 | WindowmenuSet, WindowmenuSendTo, | 58 | WindowmenuSet, WindowmenuSendTo, |
60 | #else // !NLS | 59 | #else // !NLS |
61 | 0, 0, | 60 | 0, 0, |
62 | #endif // NLS | 61 | #endif // NLS |
63 | "Send To ..."), | 62 | "Send To ..."), |
64 | sendToMenu); | 63 | sendToMenu); |
65 | 64 | ||
66 | insert(i18n->getMessage( | 65 | insert(i18n->getMessage( |
67 | #ifdef NLS | 66 | #ifdef NLS |
68 | WindowmenuSet, WindowmenuSendGroupTo, | 67 | WindowmenuSet, WindowmenuSendGroupTo, |
69 | #else // !NLS | 68 | #else // !NLS |
70 | 0, 0, | 69 | 0, 0, |
71 | #endif // NLS | 70 | #endif // NLS |
72 | "Send Group To ..."), | 71 | "Send Group To ..."), |
73 | sendGroupToMenu); | 72 | sendGroupToMenu); |
74 | 73 | ||
75 | insert(i18n->getMessage( | 74 | insert(i18n->getMessage( |
76 | #ifdef NLS | 75 | #ifdef NLS |
77 | WindowmenuSet, WindowmenuShade, | 76 | WindowmenuSet, WindowmenuShade, |
78 | #else // !NLS | 77 | #else // !NLS |
79 | 0, 0, | 78 | 0, 0, |
80 | #endif // NLS | 79 | #endif // NLS |
81 | "Shade"), | 80 | "Shade"), |
82 | BScreen::WINDOWSHADE); | 81 | BScreen::WINDOWSHADE); |
83 | insert(i18n->getMessage( | 82 | insert(i18n->getMessage( |
84 | #ifdef NLS | 83 | #ifdef NLS |
85 | WindowmenuSet, WindowmenuIconify, | 84 | WindowmenuSet, WindowmenuIconify, |
86 | #else // !NLS | 85 | #else // !NLS |
87 | 0, 0, | 86 | 0, 0, |
88 | #endif // NLS | 87 | #endif // NLS |
89 | "Iconify"), | 88 | "Iconify"), |
90 | BScreen::WINDOWICONIFY); | 89 | BScreen::WINDOWICONIFY); |
91 | insert(i18n->getMessage( | 90 | insert(i18n->getMessage( |
92 | #ifdef NLS | 91 | #ifdef NLS |
93 | WindowmenuSet, WindowmenuMaximize, | 92 | WindowmenuSet, WindowmenuMaximize, |
94 | #else // !NLS | 93 | #else // !NLS |
95 | 0, 0, | 94 | 0, 0, |
96 | #endif // NLS | 95 | #endif // NLS |
97 | "Maximize"), | 96 | "Maximize"), |
98 | BScreen::WINDOWMAXIMIZE); | 97 | BScreen::WINDOWMAXIMIZE); |
99 | insert(i18n->getMessage( | 98 | insert(i18n->getMessage( |
100 | #ifdef NLS | 99 | #ifdef NLS |
101 | WindowmenuSet, WindowmenuRaise, | 100 | WindowmenuSet, WindowmenuRaise, |
102 | #else // !NLS | 101 | #else // !NLS |
103 | 0, 0, | 102 | 0, 0, |
104 | #endif // NLS | 103 | #endif // NLS |
105 | "Raise"), | 104 | "Raise"), |
106 | BScreen::WINDOWRAISE); | 105 | BScreen::WINDOWRAISE); |
107 | insert(i18n->getMessage( | 106 | insert(i18n->getMessage( |
108 | #ifdef NLS | 107 | #ifdef NLS |
109 | WindowmenuSet, WindowmenuLower, | 108 | WindowmenuSet, WindowmenuLower, |
110 | #else // !NLS | 109 | #else // !NLS |
111 | 0, 0, | 110 | 0, 0, |
112 | #endif // NLS | 111 | #endif // NLS |
113 | "Lower"), | 112 | "Lower"), |
114 | BScreen::WINDOWLOWER); | 113 | BScreen::WINDOWLOWER); |
115 | insert(i18n->getMessage( | 114 | insert(i18n->getMessage( |
116 | #ifdef NLS | 115 | #ifdef NLS |
117 | WindowmenuSet, WindowmenuStick, | 116 | WindowmenuSet, WindowmenuStick, |
118 | #else // !NLS | 117 | #else // !NLS |
119 | 0, 0, | 118 | 0, 0, |
120 | #endif // NLS | 119 | #endif // NLS |
121 | "Stick"), | 120 | "Stick"), |
122 | BScreen::WINDOWSTICK); | 121 | BScreen::WINDOWSTICK); |
123 | insert(i18n->getMessage( | 122 | insert(i18n->getMessage( |
124 | #ifdef NLS | 123 | #ifdef NLS |
125 | WindowmenuSet, WindowmenuKillClient, | 124 | WindowmenuSet, WindowmenuKillClient, |
126 | #else // !NLS | 125 | #else // !NLS |
127 | 0, 0, | 126 | 0, 0, |
128 | #endif // NLS | 127 | #endif // NLS |
129 | "Kill Client"), | 128 | "Kill Client"), |
130 | BScreen::WINDOWKILL); | 129 | BScreen::WINDOWKILL); |
131 | insert(i18n->getMessage( | 130 | insert(i18n->getMessage( |
132 | #ifdef NLS | 131 | #ifdef NLS |
133 | WindowmenuSet, WindowmenuClose, | 132 | WindowmenuSet, WindowmenuClose, |
134 | #else // !NLS | 133 | #else // !NLS |
135 | 0, 0, | 134 | 0, 0, |
136 | #endif // NLS | 135 | #endif // NLS |
137 | "Close"), | 136 | "Close"), |
138 | BScreen::WINDOWCLOSE); | 137 | BScreen::WINDOWCLOSE); |
139 | insert(i18n->getMessage( | 138 | insert(i18n->getMessage( |
140 | #ifdef NLS | 139 | #ifdef NLS |
141 | WindowmenuSet, WindowmenuTab, | 140 | WindowmenuSet, WindowmenuTab, |
142 | #else // !NLS | 141 | #else // !NLS |
143 | 0, 0, | 142 | 0, 0, |
144 | #endif // NLS | 143 | #endif // NLS |
145 | "Tab"), | 144 | "Tab"), |
146 | BScreen::WINDOWTAB); | 145 | BScreen::WINDOWTAB); |
147 | 146 | ||
148 | update(); | 147 | update(); |
149 | 148 | ||
150 | setItemEnabled(2, window->hasTitlebar()); | 149 | setItemEnabled(2, window->hasTitlebar()); |
151 | setItemEnabled(3, window->isIconifiable()); | 150 | setItemEnabled(3, window->isIconifiable()); |
152 | setItemEnabled(4, window->isMaximizable()); | 151 | setItemEnabled(4, window->isMaximizable()); |
153 | setItemEnabled(9, window->isClosable()); | 152 | setItemEnabled(9, window->isClosable()); |
154 | setItemEnabled(10, window->hasTab()); | 153 | setItemEnabled(10, window->hasTab()); |
155 | 154 | ||
156 | } | 155 | } |
157 | 156 | ||
158 | 157 | ||
159 | Windowmenu::~Windowmenu(void) { | 158 | Windowmenu::~Windowmenu(void) { |
160 | delete sendToMenu; | 159 | delete sendToMenu; |
161 | delete sendGroupToMenu; | 160 | delete sendGroupToMenu; |
162 | } | 161 | } |
163 | 162 | ||
164 | 163 | ||
165 | void Windowmenu::show(void) { | 164 | void Windowmenu::show(void) { |
166 | if (isItemEnabled(2)) setItemSelected(2, window->isShaded()); | 165 | if (isItemEnabled(2)) setItemSelected(2, window->isShaded()); |
167 | if (isItemEnabled(4)) setItemSelected(4, window->isMaximized()); | 166 | if (isItemEnabled(4)) setItemSelected(4, window->isMaximized()); |
168 | if (isItemEnabled(7)) setItemSelected(7, window->isStuck()); | 167 | if (isItemEnabled(7)) setItemSelected(7, window->isStuck()); |
169 | 168 | ||
170 | Basemenu::show(); | 169 | Basemenu::show(); |
171 | } | 170 | } |
172 | 171 | ||
173 | 172 | ||
174 | void Windowmenu::itemSelected(int button, int index) { | 173 | void Windowmenu::itemSelected(int button, int index) { |
175 | BasemenuItem *item = find(index); | 174 | BasemenuItem *item = find(index); |
176 | 175 | ||
177 | switch (item->function()) { | 176 | switch (item->function()) { |
178 | case BScreen::WINDOWSHADE: | 177 | case BScreen::WINDOWSHADE: |
179 | hide(); | 178 | hide(); |
180 | 179 | ||
181 | window->shade(); | 180 | window->shade(); |
182 | if (window->hasTab()) | 181 | if (window->hasTab()) |
183 | window->getTab()->shade(); | 182 | window->getTab()->shade(); |
184 | break; | 183 | break; |
185 | 184 | ||
186 | case BScreen::WINDOWICONIFY: | 185 | case BScreen::WINDOWICONIFY: |
187 | hide(); | 186 | hide(); |
188 | window->iconify(); | 187 | window->iconify(); |
189 | break; | 188 | break; |
190 | 189 | ||
191 | case BScreen::WINDOWMAXIMIZE: | 190 | case BScreen::WINDOWMAXIMIZE: |
192 | hide(); | 191 | hide(); |
193 | window->maximize((unsigned int) button); | 192 | window->maximize((unsigned int) button); |
194 | break; | 193 | break; |
195 | 194 | ||
196 | case BScreen::WINDOWCLOSE: | 195 | case BScreen::WINDOWCLOSE: |
197 | hide(); | 196 | hide(); |
198 | window->close(); | 197 | window->close(); |
199 | break; | 198 | break; |
200 | 199 | ||
201 | case BScreen::WINDOWRAISE: | 200 | case BScreen::WINDOWRAISE: |
202 | hide(); | 201 | hide(); |
203 | if (window->hasTab()) | 202 | if (window->hasTab()) |
204 | window->getTab()->raise(); //raise tabs | 203 | window->getTab()->raise(); //raise tabs |
205 | screen->getWorkspace(window->getWorkspaceNumber())->raiseWindow(window); | 204 | screen->getWorkspace(window->getWorkspaceNumber())->raiseWindow(window); |
206 | break; | 205 | break; |
207 | 206 | ||
208 | case BScreen::WINDOWLOWER: | 207 | case BScreen::WINDOWLOWER: |
209 | hide(); | 208 | hide(); |
210 | screen->getWorkspace(window->getWorkspaceNumber())->lowerWindow(window); | 209 | screen->getWorkspace(window->getWorkspaceNumber())->lowerWindow(window); |
211 | if (window->hasTab()) | 210 | if (window->hasTab()) |
212 | window->getTab()->lower(); //lower tabs AND all it's windows | 211 | window->getTab()->lower(); //lower tabs AND all it's windows |
213 | break; | 212 | break; |
214 | 213 | ||
215 | case BScreen::WINDOWSTICK: | 214 | case BScreen::WINDOWSTICK: |
216 | hide(); | 215 | hide(); |
217 | window->stick(); | 216 | window->stick(); |
218 | break; | 217 | break; |
219 | 218 | ||
220 | case BScreen::WINDOWKILL: | 219 | case BScreen::WINDOWKILL: |
221 | hide(); | 220 | hide(); |
222 | XKillClient(screen->getBaseDisplay()->getXDisplay(), | 221 | XKillClient(screen->getBaseDisplay()->getXDisplay(), |
223 | window->getClientWindow()); | 222 | window->getClientWindow()); |
224 | break; | 223 | break; |
225 | case BScreen::WINDOWTAB: | 224 | case BScreen::WINDOWTAB: |
226 | hide(); | 225 | hide(); |
227 | window->setTab(!window->hasTab()); | 226 | window->setTab(!window->hasTab()); |
228 | break; | 227 | break; |
229 | } | 228 | } |
230 | } | 229 | } |
231 | 230 | ||
232 | 231 | ||
233 | void Windowmenu::reconfigure(void) { | 232 | void Windowmenu::reconfigure(void) { |
234 | setItemEnabled(1, window->hasTitlebar()); | 233 | setItemEnabled(1, window->hasTitlebar()); |
235 | setItemEnabled(2, window->isIconifiable()); | 234 | setItemEnabled(2, window->isIconifiable()); |
236 | setItemEnabled(3, window->isMaximizable()); | 235 | setItemEnabled(3, window->isMaximizable()); |
237 | setItemEnabled(8, window->isClosable()); | 236 | setItemEnabled(8, window->isClosable()); |
238 | 237 | ||
239 | sendToMenu->reconfigure(); | 238 | sendToMenu->reconfigure(); |
240 | sendGroupToMenu->reconfigure(); | 239 | sendGroupToMenu->reconfigure(); |
241 | 240 | ||
242 | Basemenu::reconfigure(); | 241 | Basemenu::reconfigure(); |
243 | } | 242 | } |
244 | 243 | ||
245 | 244 | ||
246 | Windowmenu::SendtoWorkspacemenu::SendtoWorkspacemenu(Windowmenu *w) | 245 | Windowmenu::SendtoWorkspacemenu::SendtoWorkspacemenu(Windowmenu *w) |
247 | : Basemenu(w->screen) | 246 | : Basemenu(w->screen) |
248 | { | 247 | { |
249 | windowmenu = w; | 248 | windowmenu = w; |
250 | 249 | ||
251 | setTitleVisibility(False); | 250 | setTitleVisibility(False); |
252 | setMovable(False); | 251 | setMovable(False); |
253 | setInternalMenu(); | 252 | setInternalMenu(); |
254 | update(); | 253 | update(); |
255 | } | 254 | } |
256 | 255 | ||
257 | 256 | ||
258 | void Windowmenu::SendtoWorkspacemenu::itemSelected(int button, int index) { | 257 | void Windowmenu::SendtoWorkspacemenu::itemSelected(int button, int index) { |
259 | if (button > 2) return; | 258 | if (button > 2) return; |
260 | 259 | ||
261 | if (index <= windowmenu->screen->getCount()) { | 260 | if (index <= windowmenu->screen->getCount()) { |
262 | if (index == windowmenu->screen->getCurrentWorkspaceID()) return; | 261 | if (index == windowmenu->screen->getCurrentWorkspaceID()) return; |
263 | if (windowmenu->window->isStuck()) windowmenu->window->stick(); | 262 | if (windowmenu->window->isStuck()) windowmenu->window->stick(); |
264 | 263 | ||
265 | if (button == 1) windowmenu->window->withdraw(); | 264 | if (button == 1) windowmenu->window->withdraw(); |
266 | windowmenu->screen->reassociateWindow(windowmenu->window, index, True); | 265 | windowmenu->screen->reassociateWindow(windowmenu->window, index, True); |
267 | if (windowmenu->window->getTab()) { | 266 | if (windowmenu->window->getTab()) { |
268 | windowmenu->window->getTab()->disconnect(); | 267 | windowmenu->window->getTab()->disconnect(); |
269 | windowmenu->window->getTab()->setPosition(); | 268 | windowmenu->window->getTab()->setPosition(); |
270 | } | 269 | } |
271 | if (button == 2) windowmenu->screen->changeWorkspaceID(index); | 270 | if (button == 2) windowmenu->screen->changeWorkspaceID(index); |
272 | } | 271 | } |
273 | hide(); | 272 | hide(); |
274 | } | 273 | } |
275 | 274 | ||
276 | 275 | ||
277 | void Windowmenu::SendtoWorkspacemenu::update(void) { | 276 | void Windowmenu::SendtoWorkspacemenu::update(void) { |
278 | int i, r = getCount(); | 277 | int i, r = getCount(); |
279 | 278 | ||
280 | if (getCount() != 0) | 279 | if (getCount() != 0) { |
281 | for (i = 0; i < r; ++i) | 280 | for (i = 0; i < r; ++i) |
282 | remove(0); | 281 | remove(0); |
283 | 282 | } | |
284 | for (i = 0; i < windowmenu->screen->getCount(); ++i) | 283 | for (i = 0; i < windowmenu->screen->getCount(); ++i) |
285 | insert(windowmenu->screen->getWorkspace(i)->getName()); | 284 | insert(windowmenu->screen->getWorkspace(i)->getName()); |
286 | 285 | ||
287 | Basemenu::update(); | 286 | Basemenu::update(); |
288 | } | 287 | } |
289 | 288 | ||
290 | 289 | ||
291 | void Windowmenu::SendtoWorkspacemenu::show(void) { | 290 | void Windowmenu::SendtoWorkspacemenu::show(void) { |
292 | update(); | 291 | update(); |
293 | 292 | ||
294 | Basemenu::show(); | 293 | Basemenu::show(); |
295 | } | 294 | } |
296 | 295 | ||
297 | void Windowmenu::SendGroupToWorkspacemenu::itemSelected(int button, int index) { | 296 | void Windowmenu::SendGroupToWorkspacemenu::itemSelected(int button, int index) { |
@@ -307,13 +306,13 @@ void Windowmenu::SendGroupToWorkspacemenu::itemSelected(int button, int index) { | |||
307 | if (button == 1) { | 306 | if (button == 1) { |
308 | if (getWindowMenu()->window->hasTab()) { | 307 | if (getWindowMenu()->window->hasTab()) { |
309 | for (Tab *first = Tab::getFirst(getWindowMenu()->window->getTab()); | 308 | for (Tab *first = Tab::getFirst(getWindowMenu()->window->getTab()); |
310 | first!=0; first=first->next()) { | 309 | first!=0; first=first->next()) { |
311 | first->withdraw(); | 310 | first->withdraw(); |
312 | first->getWindow()->withdraw(); | 311 | first->getWindow()->withdraw(); |
313 | getWindowMenu()->screen->reassociateWindow(first->getWindow(), index, True); | 312 | getWindowMenu()->screen->reassociateWindow(first->getWindow(), index, True); |
314 | 313 | ||
315 | } | 314 | } |
316 | } else { | 315 | } else { |
317 | getWindowMenu()->window->withdraw(); | 316 | getWindowMenu()->window->withdraw(); |
318 | getWindowMenu()->screen->reassociateWindow(getWindowMenu()->window, index, True); | 317 | getWindowMenu()->screen->reassociateWindow(getWindowMenu()->window, index, True); |
319 | } | 318 | } |