diff options
Diffstat (limited to 'src/Clientmenu.cc')
-rw-r--r-- | src/Clientmenu.cc | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/src/Clientmenu.cc b/src/Clientmenu.cc new file mode 100644 index 0000000..e873124 --- /dev/null +++ b/src/Clientmenu.cc | |||
@@ -0,0 +1,63 @@ | |||
1 | // Clientmenu.cc for Blackbox - an X11 Window manager | ||
2 | // Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net) | ||
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 | // stupid macros needed to access some functions in version 2 of the GNU C | ||
23 | // library | ||
24 | #ifndef _GNU_SOURCE | ||
25 | #define _GNU_SOURCE | ||
26 | #endif // _GNU_SOURCE | ||
27 | |||
28 | #ifdef HAVE_CONFIG_H | ||
29 | # include "../config.h" | ||
30 | #endif // HAVE_CONFIG_H | ||
31 | |||
32 | #include "fluxbox.hh" | ||
33 | #include "Clientmenu.hh" | ||
34 | #include "Screen.hh" | ||
35 | #include "Window.hh" | ||
36 | #include "Workspace.hh" | ||
37 | #include "Workspacemenu.hh" | ||
38 | |||
39 | |||
40 | Clientmenu::Clientmenu(Workspace *ws) : Basemenu(ws->getScreen()) { | ||
41 | wkspc = ws; | ||
42 | screen = wkspc->getScreen(); | ||
43 | |||
44 | setInternalMenu(); | ||
45 | } | ||
46 | |||
47 | |||
48 | void Clientmenu::itemSelected(int button, int index) { | ||
49 | if (button > 2) return; | ||
50 | |||
51 | FluxboxWindow *win = wkspc->getWindow(index); | ||
52 | if (win) { | ||
53 | if (button == 1) { | ||
54 | if (! wkspc->isCurrent()) wkspc->setCurrent(); | ||
55 | } else if (button == 2) { | ||
56 | if (! wkspc->isCurrent()) win->deiconify(True, False); | ||
57 | } | ||
58 | wkspc->raiseWindow(win); | ||
59 | win->setInputFocus(); | ||
60 | } | ||
61 | |||
62 | if (! (screen->getWorkspacemenu()->isTorn() || isTorn())) hide(); | ||
63 | } | ||