diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Windowmenu.cc | 72 | ||||
-rw-r--r-- | src/Windowmenu.hh | 13 |
2 files changed, 39 insertions, 46 deletions
diff --git a/src/Windowmenu.cc b/src/Windowmenu.cc index b798e67..cbcc4ce 100644 --- a/src/Windowmenu.cc +++ b/src/Windowmenu.cc | |||
@@ -21,7 +21,7 @@ | |||
21 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 21 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
22 | // DEALINGS IN THE SOFTWARE. | 22 | // DEALINGS IN THE SOFTWARE. |
23 | 23 | ||
24 | // $Id: Windowmenu.cc,v 1.20 2002/10/19 17:12:44 fluxgen Exp $ | 24 | // $Id: Windowmenu.cc,v 1.21 2002/10/23 22:02:13 fluxgen Exp $ |
25 | 25 | ||
26 | //use GNU extensions | 26 | //use GNU extensions |
27 | #ifndef _GNU_SOURCE | 27 | #ifndef _GNU_SOURCE |
@@ -39,16 +39,13 @@ | |||
39 | #include "Windowmenu.hh" | 39 | #include "Windowmenu.hh" |
40 | #include "Workspace.hh" | 40 | #include "Workspace.hh" |
41 | 41 | ||
42 | #ifdef STDC_HEADERS | 42 | #include <cstring> |
43 | #include <string.h> | ||
44 | #endif // STDC_HEADERS | ||
45 | |||
46 | 43 | ||
47 | Windowmenu::Windowmenu(FluxboxWindow &win) : Basemenu(win.getScreen()), | 44 | Windowmenu::Windowmenu(FluxboxWindow &win) : Basemenu(win.getScreen()), |
48 | window(win), | 45 | window(win), |
49 | screen(win.getScreen()), | 46 | screen(win.getScreen()), |
50 | sendToMenu(this), | 47 | sendToMenu(win), |
51 | sendGroupToMenu(this) { | 48 | sendGroupToMenu(win) { |
52 | 49 | ||
53 | setTitleVisibility(False); | 50 | setTitleVisibility(False); |
54 | setMovable(False); | 51 | setMovable(False); |
@@ -110,7 +107,7 @@ sendGroupToMenu(this) { | |||
110 | setItemEnabled(3, window.isIconifiable()); | 107 | setItemEnabled(3, window.isIconifiable()); |
111 | setItemEnabled(4, window.isMaximizable()); | 108 | setItemEnabled(4, window.isMaximizable()); |
112 | setItemEnabled(9, window.isClosable()); | 109 | setItemEnabled(9, window.isClosable()); |
113 | setItemEnabled(10, window.isResizable()); // tab option | 110 | setItemEnabled(10, window.isGroupable()); // tab option |
114 | 111 | ||
115 | } | 112 | } |
116 | 113 | ||
@@ -208,13 +205,11 @@ void Windowmenu::reconfigure() { | |||
208 | } | 205 | } |
209 | 206 | ||
210 | 207 | ||
211 | Windowmenu::SendtoWorkspacemenu::SendtoWorkspacemenu(Windowmenu *w) | 208 | Windowmenu::SendtoWorkspacemenu::SendtoWorkspacemenu(FluxboxWindow &win): Basemenu(win.getScreen()), |
212 | : Basemenu(w->screen) | 209 | m_fbwindow(win) |
213 | { | 210 | { |
214 | windowmenu = w; | 211 | setTitleVisibility(false); |
215 | 212 | setMovable(false); | |
216 | setTitleVisibility(False); | ||
217 | setMovable(False); | ||
218 | setInternalMenu(); | 213 | setInternalMenu(); |
219 | update(); | 214 | update(); |
220 | } | 215 | } |
@@ -224,18 +219,16 @@ void Windowmenu::SendtoWorkspacemenu::itemSelected(int button, unsigned int inde | |||
224 | if (button > 2) | 219 | if (button > 2) |
225 | return; | 220 | return; |
226 | 221 | ||
227 | if (index <= windowmenu->screen->getCount()) { | 222 | if (index <= screen()->getCount()) { |
228 | 223 | ||
229 | // no need to send it to a workspace it already exist on | 224 | // no need to send it to a workspace it already exist on |
230 | if (index == windowmenu->screen->getCurrentWorkspaceID()) | 225 | if (index == screen()->getCurrentWorkspaceID()) |
231 | return; | 226 | return; |
232 | 227 | ||
233 | if (button == 1) { // send to workspace without changing workspace | 228 | if (button == 1) { // send to workspace without changing workspace |
234 | windowmenu->screen->sendToWorkspace(index, | 229 | screen()->sendToWorkspace(index, &m_fbwindow, false); |
235 | &windowmenu->window, false); | ||
236 | } else if (button == 2) { // send to workspace and change workspace | 230 | } else if (button == 2) { // send to workspace and change workspace |
237 | windowmenu->screen->sendToWorkspace(index, | 231 | screen()->sendToWorkspace(index, &m_fbwindow, true); |
238 | &windowmenu->window, true); | ||
239 | } | 232 | } |
240 | } | 233 | } |
241 | 234 | ||
@@ -250,8 +243,8 @@ void Windowmenu::SendtoWorkspacemenu::update() { | |||
250 | for (i = 0; i < r; ++i) | 243 | for (i = 0; i < r; ++i) |
251 | remove(0); | 244 | remove(0); |
252 | } | 245 | } |
253 | for (i = 0; i < windowmenu->screen->getCount(); ++i) | 246 | for (i = 0; i < screen()->getCount(); ++i) |
254 | insert(windowmenu->screen->getWorkspace(i)->name().c_str()); | 247 | insert(screen()->getWorkspace(i)->name().c_str()); |
255 | 248 | ||
256 | Basemenu::update(); | 249 | Basemenu::update(); |
257 | } | 250 | } |
@@ -263,47 +256,48 @@ void Windowmenu::SendtoWorkspacemenu::show() { | |||
263 | Basemenu::show(); | 256 | Basemenu::show(); |
264 | } | 257 | } |
265 | 258 | ||
259 | Windowmenu::SendGroupToWorkspacemenu:: | ||
260 | SendGroupToWorkspacemenu(FluxboxWindow &win):SendtoWorkspacemenu(win) | ||
261 | { | ||
262 | |||
263 | } | ||
264 | |||
266 | void Windowmenu::SendGroupToWorkspacemenu::itemSelected(int button, unsigned int index) { | 265 | void Windowmenu::SendGroupToWorkspacemenu::itemSelected(int button, unsigned int index) { |
267 | if (button > 2) | 266 | if (button > 2) |
268 | return; | 267 | return; |
269 | 268 | ||
270 | if (index <= getWindowMenu()->screen->getCount()) { | 269 | if (index <= screen()->getCount()) { |
271 | if (index == getWindowMenu()->screen->getCurrentWorkspaceID()) | 270 | if (index == screen()->getCurrentWorkspaceID()) |
272 | return; | 271 | return; |
273 | if (getWindowMenu()->window.isStuck()) | 272 | if (fbwin().isStuck()) |
274 | getWindowMenu()->window.stick(); | 273 | fbwin().stick(); |
275 | 274 | ||
276 | // if the window is iconic, deiconify it | 275 | // if the window is iconic, deiconify it |
277 | if (getWindowMenu()->window.isIconic()) | 276 | if (fbwin().isIconic()) |
278 | getWindowMenu()->window.deiconify(); | 277 | fbwin().deiconify(); |
279 | 278 | ||
280 | if (button == 1) { | 279 | if (button == 1) { |
281 | // TODO: use reassociateGroup from BScreen instead | 280 | // TODO: use reassociateGroup from BScreen instead |
282 | if (getWindowMenu()->window.hasTab()) { | 281 | if (fbwin().hasTab()) { |
283 | for (Tab *first = Tab::getFirst(getWindowMenu()->window.getTab()); | 282 | for (Tab *first = Tab::getFirst(fbwin().getTab()); |
284 | first!=0; first=first->next()) { | 283 | first!=0; first=first->next()) { |
285 | first->withdraw(); | 284 | first->withdraw(); |
286 | first->getWindow()->withdraw(); | 285 | first->getWindow()->withdraw(); |
287 | getWindowMenu()->screen->reassociateWindow(first->getWindow(), index, True); | 286 | screen()->reassociateWindow(first->getWindow(), index, true); |
288 | 287 | ||
289 | } | 288 | } |
290 | } else { | 289 | } else { |
291 | getWindowMenu()->window.withdraw(); | 290 | fbwin().withdraw(); |
292 | getWindowMenu()->screen->reassociateWindow(&getWindowMenu()->window, index, True); | 291 | screen()->reassociateWindow(&fbwin(), index, true); |
293 | } | 292 | } |
294 | 293 | ||
295 | } | 294 | } |
296 | 295 | ||
297 | if (button == 2) | 296 | if (button == 2) |
298 | getWindowMenu()->screen->changeWorkspaceID(index); | 297 | screen()->changeWorkspaceID(index); |
299 | } | 298 | } |
300 | hide(); | 299 | hide(); |
301 | } | 300 | } |
302 | 301 | ||
303 | Windowmenu::SendGroupToWorkspacemenu:: | ||
304 | SendGroupToWorkspacemenu(Windowmenu *w):SendtoWorkspacemenu(w) | ||
305 | { | ||
306 | |||
307 | } | ||
308 | 302 | ||
309 | 303 | ||
diff --git a/src/Windowmenu.hh b/src/Windowmenu.hh index 55dd90b..8d5f1ef 100644 --- a/src/Windowmenu.hh +++ b/src/Windowmenu.hh | |||
@@ -52,25 +52,24 @@ private: | |||
52 | 52 | ||
53 | class SendtoWorkspacemenu : public Basemenu { | 53 | class SendtoWorkspacemenu : public Basemenu { |
54 | public: | 54 | public: |
55 | SendtoWorkspacemenu(Windowmenu *); | 55 | SendtoWorkspacemenu(FluxboxWindow &win); |
56 | inline Windowmenu *getWindowMenu() const { return windowmenu; } | ||
57 | void update(); | 56 | void update(); |
58 | 57 | ||
59 | virtual void show(); | 58 | virtual void show(); |
59 | FluxboxWindow &fbwin() { return m_fbwindow; } | ||
60 | protected: | 60 | protected: |
61 | virtual void itemSelected(int button, unsigned int index); | 61 | virtual void itemSelected(int button, unsigned int index); |
62 | |||
63 | private: | 62 | private: |
64 | Windowmenu *windowmenu; | 63 | FluxboxWindow &m_fbwindow; |
65 | |||
66 | }; | 64 | }; |
67 | 65 | ||
68 | class SendGroupToWorkspacemenu : public SendtoWorkspacemenu { | 66 | class SendGroupToWorkspacemenu : public SendtoWorkspacemenu { |
69 | public: | 67 | public: |
70 | SendGroupToWorkspacemenu(Windowmenu *winmenu); | 68 | SendGroupToWorkspacemenu(FluxboxWindow &win); |
71 | 69 | ||
72 | protected: | 70 | protected: |
73 | virtual void itemSelected(int button, unsigned int index); | 71 | virtual void itemSelected(int button, unsigned int index); |
72 | |||
74 | }; | 73 | }; |
75 | 74 | ||
76 | SendtoWorkspacemenu sendToMenu; | 75 | SendtoWorkspacemenu sendToMenu; |