aboutsummaryrefslogtreecommitdiff
path: root/src/Screen.cc
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2003-05-13 00:23:05 (GMT)
committerfluxgen <fluxgen>2003-05-13 00:23:05 (GMT)
commitdec9d5b7f55cd7ec80dcc15850a32f9022e9dde9 (patch)
treed1ace76fcf04bafc590af4d5bc956826be473c87 /src/Screen.cc
parent2014d60ef394006ea916907226643200bbc86dc6 (diff)
downloadfluxbox-dec9d5b7f55cd7ec80dcc15850a32f9022e9dde9.zip
fluxbox-dec9d5b7f55cd7ec80dcc15850a32f9022e9dde9.tar.bz2
fixed restoring of submenus after a reconfigure, and changed some configure menu items to just saverc instead of doing that and reconfigure
Diffstat (limited to 'src/Screen.cc')
-rw-r--r--src/Screen.cc60
1 files changed, 50 insertions, 10 deletions
diff --git a/src/Screen.cc b/src/Screen.cc
index 349ca85..e579136 100644
--- a/src/Screen.cc
+++ b/src/Screen.cc
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: Screen.cc,v 1.159 2003/05/12 04:47:34 fluxgen Exp $ 25// $Id: Screen.cc,v 1.160 2003/05/13 00:23:05 fluxgen Exp $
26 26
27 27
28#include "Screen.hh" 28#include "Screen.hh"
@@ -884,10 +884,50 @@ void BScreen::reconfigure() {
884 //reconfigure menus 884 //reconfigure menus
885 workspacemenu->reconfigure(); 885 workspacemenu->reconfigure();
886 m_configmenu->reconfigure(); 886 m_configmenu->reconfigure();
887 887
888 // We need to check to see if the timestamps
889 // changed before we actually can restore the menus
890 // in the same way, since we can't really say if
891 // any submenu is in the same place as before if the
892 // menu changed.
893
894 // if timestamp changed then no restoring
895 bool restore_menus = ! Fluxbox::instance()->menuTimestampsChanged();
896
897 // destroy old timestamps
898 Fluxbox::instance()->clearMenuFilenames();
899
900 // save submenu index so we can restore them afterwards
901 vector<int> remember_sub;
902 if (restore_menus) {
903 FbTk::Menu *menu = m_rootmenu.get();
904 while (menu) {
905 int r = menu->currentSubmenu();
906 if (r < 0) break;
907 remember_sub.push_back(r);
908 menu = menu->find(r)->submenu();
909 }
910 }
911
888 initMenu(); 912 initMenu();
889 m_rootmenu->reconfigure(); 913 m_rootmenu->reconfigure();
890 914
915 if (restore_menus) {
916 // restore submenus, no timestamp changed
917 FbTk::Menu *menu = m_rootmenu.get();
918 for (int i = 0; i < (int)remember_sub.size(); i++ ) {
919 int sub = remember_sub[i];
920 if (!menu || sub < 0)
921 break;
922 FbTk::MenuItem *item = menu->find(sub);
923 if (item != 0) {
924 menu->drawSubmenu(sub);
925 menu = item->submenu();
926 } else
927 menu = 0;
928
929 }
930 }
891 931
892 if (getToolbar()) { 932 if (getToolbar()) {
893 getToolbar()->setPlacement(*resource.toolbar_placement); 933 getToolbar()->setPlacement(*resource.toolbar_placement);
@@ -2165,41 +2205,41 @@ void BScreen::setupConfigmenu(FbTk::Menu &menu) {
2165 i18n->getMessage( 2205 i18n->getMessage(
2166 ConfigmenuSet, ConfigmenuOpaqueMove, 2206 ConfigmenuSet, ConfigmenuOpaqueMove,
2167 "Opaque Window Moving"), 2207 "Opaque Window Moving"),
2168 *resource.opaque_move, save_and_reconfigure)); 2208 *resource.opaque_move, saverc_cmd));
2169 menu.insert(new 2209 menu.insert(new
2170 BoolMenuItem(i18n->getMessage( 2210 BoolMenuItem(i18n->getMessage(
2171 ConfigmenuSet, ConfigmenuFullMax, 2211 ConfigmenuSet, ConfigmenuFullMax,
2172 "Full Maximization"), 2212 "Full Maximization"),
2173 *resource.full_max, save_and_reconfigure)); 2213 *resource.full_max, saverc_cmd));
2174 menu.insert(new 2214 menu.insert(new
2175 BoolMenuItem(i18n->getMessage( 2215 BoolMenuItem(i18n->getMessage(
2176 ConfigmenuSet, ConfigmenuFocusNew, 2216 ConfigmenuSet, ConfigmenuFocusNew,
2177 "Focus New Windows"), 2217 "Focus New Windows"),
2178 *resource.focus_new, save_and_reconfigure)); 2218 *resource.focus_new, saverc_cmd));
2179 menu.insert(new 2219 menu.insert(new
2180 BoolMenuItem(i18n->getMessage( 2220 BoolMenuItem(i18n->getMessage(
2181 ConfigmenuSet, ConfigmenuFocusLast, 2221 ConfigmenuSet, ConfigmenuFocusLast,
2182 "Focus Last Window on Workspace"), 2222 "Focus Last Window on Workspace"),
2183 *resource.focus_last, save_and_reconfigure)); 2223 *resource.focus_last, saverc_cmd));
2184 menu.insert(new 2224 menu.insert(new
2185 BoolMenuItem(i18n->getMessage( 2225 BoolMenuItem(i18n->getMessage(
2186 ConfigmenuSet, ConfigmenuMaxOverSlit, 2226 ConfigmenuSet, ConfigmenuMaxOverSlit,
2187 "Maximize Over Slit"), 2227 "Maximize Over Slit"),
2188 *resource.max_over_slit, save_and_reconfigure)); 2228 *resource.max_over_slit, saverc_cmd));
2189 menu.insert(new 2229 menu.insert(new
2190 BoolMenuItem(i18n->getMessage( 2230 BoolMenuItem(i18n->getMessage(
2191 ConfigmenuSet, ConfigmenuWorkspaceWarping, 2231 ConfigmenuSet, ConfigmenuWorkspaceWarping,
2192 "Workspace Warping"), 2232 "Workspace Warping"),
2193 *resource.workspace_warping, save_and_reconfigure)); 2233 *resource.workspace_warping, saverc_cmd));
2194 menu.insert(new 2234 menu.insert(new
2195 BoolMenuItem(i18n->getMessage( 2235 BoolMenuItem(i18n->getMessage(
2196 ConfigmenuSet, ConfigmenuDesktopWheeling, 2236 ConfigmenuSet, ConfigmenuDesktopWheeling,
2197 "Desktop MouseWheel Switching"), 2237 "Desktop MouseWheel Switching"),
2198 *resource.desktop_wheeling, save_and_reconfigure)); 2238 *resource.desktop_wheeling, saverc_cmd));
2199 2239
2200 menu.insert(new BoolMenuItem("Click Raises", 2240 menu.insert(new BoolMenuItem("Click Raises",
2201 *resource.click_raises, 2241 *resource.click_raises,
2202 save_and_reconfigure)); 2242 saverc_cmd));
2203 // setup antialias cmd to reload style and save resource on toggle 2243 // setup antialias cmd to reload style and save resource on toggle
2204 menu.insert(new BoolMenuItem("antialias", *resource.antialias, 2244 menu.insert(new BoolMenuItem("antialias", *resource.antialias,
2205 save_and_reconfigure)); 2245 save_and_reconfigure));