all repos — fluxbox @ ac9c672a1e9f2b1665a2046d87500c1e096fb5d7

custom fork of the fluxbox windowmanager

allow window menu items in ordinary menus
Mark Tiefenbruck mark@fluxbox.org
commit

ac9c672a1e9f2b1665a2046d87500c1e096fb5d7

parent

11a066ec1374e198fbae361aea6d8e967eefbc53

5 files changed, 10 insertions(+), 60 deletions(-)

jump to
M ChangeLogChangeLog

@@ -1,5 +1,8 @@

(Format: Year/Month/Day) Changes for 1.1 +*08/06/06: + * Allow window menu items in ordinary menus (Mark) + MenuCreator.cc/hh *08/06/04: * Leave titlebar and handle borders alone with borderless windows (Mark) FbWinFrame.cc/hh
M src/FbCommands.ccsrc/FbCommands.cc

@@ -80,6 +80,8 @@ if (fbmenu->reloadHelper())

fbmenu->reloadHelper()->checkReload(); } + FbMenu::setWindow(FocusControl::focusedFbWindow()); + Window root_ret; // not used Window window_ret; // not used
M src/MenuCreator.ccsrc/MenuCreator.cc

@@ -321,9 +321,9 @@ } else if (str_key == "encoding") {

MenuCreator::startEncoding(str_cmd); } else if (str_key == "endencoding") { MenuCreator::endEncoding(); - } - else { // ok, if we didn't find any special menu item we try with command parser - // we need to attach command with arguments so command parser can parse it + } else if (!MenuCreator::createWindowMenuItem(str_key, str_label, menu)) { + // if we didn't find any special menu item we try with command parser + // we need to attach command to arguments so command parser can parse it string line = str_key + " " + str_cmd; FbTk::RefCount<FbTk::Command<void> > command(FbTk::CommandParser<void>::instance().parse(line)); if (*command != 0) {

@@ -347,32 +347,6 @@ item->setIcon(pitem.icon(), menu.screenNumber());

} } - -void parseWindowMenu(FbTk::Parser &parse, FbTk::Menu &menu, - FbTk::StringConvertor &labelconvertor, - AutoReloadHelper *reloader) { - - ParseItem pitem(&menu); - while (!parse.eof()) { - pitem.load(parse, labelconvertor); - if (MenuCreator::createWindowMenuItem(pitem.key(), pitem.label(), menu)) - continue; - - if (pitem.key() == "end") - return; - if (pitem.key() == "submenu") { - FbTk::Menu *submenu = MenuCreator::createMenu(pitem.label(), menu.screenNumber()); - parseWindowMenu(parse, *submenu, labelconvertor, reloader); - submenu->updateMenu(); - menu.insert(pitem.label(), submenu); - - } else { // try non window menu specific stuff - translateMenuItem(parse, pitem, labelconvertor, reloader); - } - } -} - - bool getStart(FbMenuParser &parser, string &label, FbTk::StringConvertor &labelconvertor) { ParseItem pitem(0); while (!parser.eof()) {

@@ -433,31 +407,6 @@ endFile();

return true; } - - -void MenuCreator::createWindowMenuFromFile(const string &filename, - FbTk::Menu &inject_into, - AutoReloadHelper *reloader) { - string real_filename = FbTk::StringUtil::expandFilename(filename); - FbMenuParser parser(real_filename); - if (!parser.isLoaded()) - return; - - string label; - - startFile(); - if (!getStart(parser, label, m_stringconvertor)) { - endFile(); - return; - } - - if (reloader) - reloader->addFile(real_filename); - - parseWindowMenu(parser, inject_into, m_stringconvertor, reloader); - endFile(); -} - FbMenu *MenuCreator::createMenuType(const string &type, int screen_num) { BScreen *screen = Fluxbox::instance()->findScreen(screen_num);
M src/MenuCreator.hhsrc/MenuCreator.hh

@@ -43,9 +43,6 @@ static bool createFromFile(const std::string &filename,

FbTk::Menu &inject_into, FbTk::AutoReloadHelper *reloader = NULL, bool begin = true); - static void createWindowMenuFromFile(const std::string &filename, - FbTk::Menu &inject_into, - FbTk::AutoReloadHelper *reloader); static bool createWindowMenuItem(const std::string &type, const std::string &label, FbTk::Menu &inject_into);
M src/Screen.ccsrc/Screen.cc

@@ -1527,9 +1527,8 @@ void BScreen::rereadWindowMenu() {

m_windowmenu->removeAll(); if (!windowMenuFilename().empty()) - MenuCreator::createWindowMenuFromFile(windowMenuFilename(), - *m_windowmenu, - m_windowmenu->reloadHelper()); + MenuCreator::createFromFile(windowMenuFilename(), *m_windowmenu, + m_windowmenu->reloadHelper()); if (m_windowmenu->numberOfItems() == 0) { const char *defaults[] = {