diff options
author | fluxgen <fluxgen> | 2003-01-09 17:29:14 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2003-01-09 17:29:14 (GMT) |
commit | 51c33a318d66cb6c5f54b7ee9ebea06c7898fbcf (patch) | |
tree | d1d0b0a6838f8e5eef5e6ec03a73ae1f0c82e094 | |
parent | ccd693067e85b6049a9d61dc33338ecd6e8c22ee (diff) | |
download | fluxbox-51c33a318d66cb6c5f54b7ee9ebea06c7898fbcf.zip fluxbox-51c33a318d66cb6c5f54b7ee9ebea06c7898fbcf.tar.bz2 |
removed
-rw-r--r-- | src/Rootmenu.cc | 158 | ||||
-rw-r--r-- | src/Rootmenu.hh | 47 |
2 files changed, 0 insertions, 205 deletions
diff --git a/src/Rootmenu.cc b/src/Rootmenu.cc deleted file mode 100644 index bb290cd..0000000 --- a/src/Rootmenu.cc +++ /dev/null | |||
@@ -1,158 +0,0 @@ | |||
1 | // Rootmenu.cc for fluxbox | ||
2 | // Copyright (c) 2002 Henrik Kinnunen (fluxgen at linuxmail.org) | ||
3 | // Rootmenu.cc for Blackbox - an X11 Window manager | ||
4 | // Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net) | ||
5 | // | ||
6 | // Permission is hereby granted, free of charge, to any person obtaining a | ||
7 | // copy of this software and associated documentation files (the "Software"), | ||
8 | // to deal in the Software without restriction, including without limitation | ||
9 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
10 | // and/or sell copies of the Software, and to permit persons to whom the | ||
11 | // Software is furnished to do so, subject to the following conditions: | ||
12 | // | ||
13 | // The above copyright notice and this permission notice shall be included in | ||
14 | // all copies or substantial portions of the Software. | ||
15 | // | ||
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
19 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
21 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
22 | // DEALINGS IN THE SOFTWARE. | ||
23 | |||
24 | //Use GNU extensions | ||
25 | #ifndef _GNU_SOURCE | ||
26 | #define _GNU_SOURCE | ||
27 | #endif // _GNU_SOURCE | ||
28 | |||
29 | #ifdef HAVE_CONFIG_H | ||
30 | # include "../config.h" | ||
31 | #endif // HAVE_CONFIG_H | ||
32 | |||
33 | #include "fluxbox.hh" | ||
34 | #include "Rootmenu.hh" | ||
35 | #include "Screen.hh" | ||
36 | |||
37 | #ifdef HAVE_STDIO_H | ||
38 | # include <stdio.h> | ||
39 | #endif // HAVE_STDIO_H | ||
40 | |||
41 | #ifdef STDC_HEADERS | ||
42 | # include <stdlib.h> | ||
43 | # include <string.h> | ||
44 | #endif // STDC_HEADERS | ||
45 | |||
46 | #ifdef HAVE_SYS_PARAM_H | ||
47 | # include <sys/param.h> | ||
48 | #endif // HAVE_SYS_PARAM_H | ||
49 | |||
50 | #ifndef MAXPATHLEN | ||
51 | #define MAXPATHLEN 255 | ||
52 | #endif // MAXPATHLEN | ||
53 | |||
54 | |||
55 | Rootmenu::Rootmenu(BScreen *scrn) | ||
56 | : Basemenu(scrn), | ||
57 | auto_group_window(0) | ||
58 | { | ||
59 | |||
60 | } | ||
61 | |||
62 | |||
63 | void Rootmenu::itemSelected(int button, unsigned int index) { | ||
64 | |||
65 | Fluxbox *fluxbox = Fluxbox::instance(); | ||
66 | |||
67 | if (button == 1) { | ||
68 | BasemenuItem *item = find(index); | ||
69 | |||
70 | if (item->function()) { | ||
71 | switch (item->function()) { | ||
72 | case BScreen::EXECUTE: | ||
73 | if (item->exec().size()) { | ||
74 | #ifndef __EMX__ | ||
75 | char displaystring[MAXPATHLEN]; | ||
76 | sprintf(displaystring, "DISPLAY=%s", | ||
77 | DisplayString(screen()->getBaseDisplay()->getXDisplay())); | ||
78 | sprintf(displaystring + strlen(displaystring) - 1, "%d", | ||
79 | screen()->getScreenNumber()); | ||
80 | |||
81 | screen()->setAutoGroupWindow(useAutoGroupWindow()); | ||
82 | |||
83 | bexec(item->exec().c_str(), displaystring); | ||
84 | #else // __EMX__ | ||
85 | spawnlp(P_NOWAIT, "cmd.exe", "cmd.exe", "/c", item->exec().c_str(), NULL); | ||
86 | #endif // !__EMX__ | ||
87 | } | ||
88 | break; | ||
89 | |||
90 | case BScreen::RESTART: | ||
91 | fluxbox->restart(); | ||
92 | break; | ||
93 | |||
94 | case BScreen::RESTARTOTHER: | ||
95 | if (item->exec().size()) | ||
96 | fluxbox->restart(item->exec().c_str()); | ||
97 | break; | ||
98 | |||
99 | case BScreen::EXIT: | ||
100 | fluxbox->shutdown(); | ||
101 | break; | ||
102 | |||
103 | case BScreen::SETSTYLE: | ||
104 | if (item->exec().size()) { | ||
105 | fluxbox->saveStyleFilename(item->exec().c_str()); | ||
106 | fluxbox->reconfigureTabs(); | ||
107 | } | ||
108 | fluxbox->reconfigure(); | ||
109 | fluxbox->save_rc(); | ||
110 | break; | ||
111 | case BScreen::RECONFIGURE: | ||
112 | fluxbox->reconfigure(); | ||
113 | return; | ||
114 | } | ||
115 | if (! (screen()->getRootmenu()->isTorn() || isTorn()) && | ||
116 | item->function() != BScreen::RECONFIGURE && | ||
117 | item->function() != BScreen::SETSTYLE) | ||
118 | hide(); | ||
119 | } | ||
120 | } | ||
121 | } | ||
122 | |||
123 | void Rootmenu::setAutoGroupWindow(Window window) { | ||
124 | auto_group_window = window; | ||
125 | } | ||
126 | |||
127 | void Rootmenu::show() { | ||
128 | Basemenu::show(); | ||
129 | // make sure it's full visible | ||
130 | |||
131 | int newx = x(), newy = y(); | ||
132 | if (x() < 0) | ||
133 | newx = 0; | ||
134 | else if (x() + width() > screen()->getWidth()) | ||
135 | newx = screen()->getWidth() - width(); | ||
136 | if (y() < 0) | ||
137 | newy = 0; | ||
138 | else if (y() + height() > screen()->getHeight()) | ||
139 | newy = screen()->getHeight() - height(); | ||
140 | |||
141 | move(newx, newy); | ||
142 | } | ||
143 | |||
144 | Window Rootmenu::useAutoGroupWindow() { | ||
145 | // Return and clear the auto-grouping state. | ||
146 | Window w = auto_group_window; | ||
147 | if (w) | ||
148 | auto_group_window = 0; // clear it immediately | ||
149 | // If not set check the parent and the parent's parent, ... | ||
150 | else if (parent()) { | ||
151 | // TODO: dynamic_cast throws std::bad_cast! | ||
152 | Rootmenu *p = dynamic_cast<Rootmenu*>(parent()); | ||
153 | w = p->useAutoGroupWindow(); | ||
154 | } | ||
155 | return w; | ||
156 | } | ||
157 | |||
158 | |||
diff --git a/src/Rootmenu.hh b/src/Rootmenu.hh deleted file mode 100644 index 75df30d..0000000 --- a/src/Rootmenu.hh +++ /dev/null | |||
@@ -1,47 +0,0 @@ | |||
1 | // Rootmenu.hh for fluxbox | ||
2 | // Copyright (c) 2002 Henrik Kinnunen (fluxgen at linuxmail.org) | ||
3 | // | ||
4 | // Rootmenu.hh for Blackbox - an X11 Window manager | ||
5 | // Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net) | ||
6 | // | ||
7 | // Permission is hereby granted, free of charge, to any person obtaining a | ||
8 | // copy of this software and associated documentation files (the "Software"), | ||
9 | // to deal in the Software without restriction, including without limitation | ||
10 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
11 | // and/or sell copies of the Software, and to permit persons to whom the | ||
12 | // Software is furnished to do so, subject to the following conditions: | ||
13 | // | ||
14 | // The above copyright notice and this permission notice shall be included in | ||
15 | // all copies or substantial portions of the Software. | ||
16 | // | ||
17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
20 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
23 | // DEALINGS IN THE SOFTWARE. | ||
24 | |||
25 | #ifndef ROOTMENU_HH | ||
26 | #define ROOTMENU_HH | ||
27 | |||
28 | #include "Basemenu.hh" | ||
29 | |||
30 | class Rootmenu: public Basemenu { | ||
31 | public: | ||
32 | explicit Rootmenu(BScreen *scr); | ||
33 | void setAutoGroupWindow(Window window); | ||
34 | void show(); | ||
35 | |||
36 | protected: | ||
37 | virtual void itemSelected(int button, unsigned int index); | ||
38 | |||
39 | private: | ||
40 | Window useAutoGroupWindow(); | ||
41 | Window auto_group_window; | ||
42 | |||
43 | }; | ||
44 | |||
45 | |||
46 | #endif // ROOTMENU_HH | ||
47 | |||