refactor menu reloading, added FbTk::AutoReloadHelper
This commit is contained in:
parent
72a45fae3c
commit
93b0c5322a
11 changed files with 263 additions and 188 deletions
|
@ -73,11 +73,11 @@ namespace {
|
||||||
|
|
||||||
void showMenu(const BScreen &screen, FbTk::Menu &menu) {
|
void showMenu(const BScreen &screen, FbTk::Menu &menu) {
|
||||||
|
|
||||||
// special case for root menu
|
// check if menu has changed
|
||||||
if (&menu == &screen.rootMenu()) {
|
if (typeid(menu) == typeid(FbMenu)) {
|
||||||
Fluxbox* fb = Fluxbox::instance();
|
FbMenu *fbmenu = static_cast<FbMenu *>(&menu);
|
||||||
if(fb->menuTimestampsChanged())
|
if (fbmenu->reloadHelper())
|
||||||
fb->rereadMenu();
|
fbmenu->reloadHelper()->checkReload();
|
||||||
}
|
}
|
||||||
|
|
||||||
Window root_ret; // not used
|
Window root_ret; // not used
|
||||||
|
|
|
@ -22,8 +22,11 @@
|
||||||
#ifndef FBMENU_HH
|
#ifndef FBMENU_HH
|
||||||
#define FBMENU_HH
|
#define FBMENU_HH
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include "FbTk/Menu.hh"
|
#include "FbTk/Menu.hh"
|
||||||
#include "FbTk/XLayerItem.hh"
|
#include "FbTk/XLayerItem.hh"
|
||||||
|
#include "FbTk/AutoReloadHelper.hh"
|
||||||
|
|
||||||
class FluxboxWindow;
|
class FluxboxWindow;
|
||||||
|
|
||||||
|
@ -44,11 +47,15 @@ public:
|
||||||
void buttonReleaseEvent(XButtonEvent &be);
|
void buttonReleaseEvent(XButtonEvent &be);
|
||||||
void keyPressEvent(XKeyEvent &ke);
|
void keyPressEvent(XKeyEvent &ke);
|
||||||
|
|
||||||
|
void setReloadHelper(FbTk::AutoReloadHelper *helper) { m_reloader.reset(helper); }
|
||||||
|
FbTk::AutoReloadHelper *reloadHelper() { return m_reloader.get(); }
|
||||||
|
|
||||||
static void setWindow(FluxboxWindow *win) { s_window = win; }
|
static void setWindow(FluxboxWindow *win) { s_window = win; }
|
||||||
static FluxboxWindow *window() { return s_window; }
|
static FluxboxWindow *window() { return s_window; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FbTk::XLayerItem m_layeritem;
|
FbTk::XLayerItem m_layeritem;
|
||||||
|
std::auto_ptr<FbTk::AutoReloadHelper> m_reloader;
|
||||||
static FluxboxWindow *s_window;
|
static FluxboxWindow *s_window;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
66
src/FbTk/AutoReloadHelper.cc
Normal file
66
src/FbTk/AutoReloadHelper.cc
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
// AutoReloadHelper.cc
|
||||||
|
// Copyright (c) 2008 Fluxbox Team (fluxgen at fluxbox dot org)
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
// copy of this software and associated documentation files (the "Software"),
|
||||||
|
// to deal in the Software without restriction, including without limitation
|
||||||
|
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
// and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
// Software is furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
#include "AutoReloadHelper.hh"
|
||||||
|
|
||||||
|
#include "FileUtil.hh"
|
||||||
|
#include "StringUtil.hh"
|
||||||
|
|
||||||
|
namespace FbTk {
|
||||||
|
|
||||||
|
void AutoReloadHelper::checkReload() {
|
||||||
|
if (!m_reload_cmd.get())
|
||||||
|
return;
|
||||||
|
TimestampMap::const_iterator it = m_timestamps.begin();
|
||||||
|
TimestampMap::const_iterator it_end = m_timestamps.end();
|
||||||
|
for (; it != it_end; ++it) {
|
||||||
|
if (FileUtil::getLastStatusChangeTimestamp(it->first.c_str()) !=
|
||||||
|
it->second) {
|
||||||
|
reload();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AutoReloadHelper::setMainFile(std::string file) {
|
||||||
|
file = StringUtil::expandFilename(file);
|
||||||
|
if (file == m_main_file)
|
||||||
|
return;
|
||||||
|
m_main_file = file;
|
||||||
|
reload();
|
||||||
|
}
|
||||||
|
|
||||||
|
void AutoReloadHelper::addFile(std::string file) {
|
||||||
|
if (file.empty())
|
||||||
|
return;
|
||||||
|
file = StringUtil::expandFilename(file);
|
||||||
|
m_timestamps[file] = FileUtil::getLastStatusChangeTimestamp(file.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
void AutoReloadHelper::reload() {
|
||||||
|
if (!m_reload_cmd.get())
|
||||||
|
return;
|
||||||
|
m_timestamps.clear();
|
||||||
|
addFile(m_main_file);
|
||||||
|
m_reload_cmd->execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
} // end namespace FbTk
|
54
src/FbTk/AutoReloadHelper.hh
Normal file
54
src/FbTk/AutoReloadHelper.hh
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
// AutoReloadHelper.hh
|
||||||
|
// Copyright (c) 2008 Fluxbox Team (fluxgen at fluxbox dot org)
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
// copy of this software and associated documentation files (the "Software"),
|
||||||
|
// to deal in the Software without restriction, including without limitation
|
||||||
|
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
// and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
// Software is furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
#ifndef AUTORELOADHELPER_HH
|
||||||
|
#define AUTORELOADHELPER_HH
|
||||||
|
|
||||||
|
#include <map>
|
||||||
|
#include <string>
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#include "Command.hh"
|
||||||
|
#include "RefCount.hh"
|
||||||
|
|
||||||
|
namespace FbTk {
|
||||||
|
|
||||||
|
class AutoReloadHelper {
|
||||||
|
public:
|
||||||
|
|
||||||
|
void setMainFile(std::string filename);
|
||||||
|
void addFile(std::string filename);
|
||||||
|
void setReloadCmd(RefCount<Command<void> > cmd) { m_reload_cmd = cmd; }
|
||||||
|
|
||||||
|
void checkReload();
|
||||||
|
void reload();
|
||||||
|
|
||||||
|
private:
|
||||||
|
RefCount<Command<void> > m_reload_cmd;
|
||||||
|
std::string m_main_file;
|
||||||
|
|
||||||
|
typedef std::map<std::string, time_t> TimestampMap;
|
||||||
|
TimestampMap m_timestamps;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // end namespace FbTk
|
||||||
|
|
||||||
|
#endif // AUTORELOADHELPER_HH
|
|
@ -45,6 +45,7 @@ libFbTk_a_SOURCES = App.hh App.cc Color.cc Color.hh Command.hh \
|
||||||
RegExp.hh RegExp.cc \
|
RegExp.hh RegExp.cc \
|
||||||
FbString.hh FbString.cc \
|
FbString.hh FbString.cc \
|
||||||
Subject.hh Subject.cc Observer.hh Observer.cc SimpleObserver.hh \
|
Subject.hh Subject.cc Observer.hh Observer.cc SimpleObserver.hh \
|
||||||
|
AutoReloadHelper.hh AutoReloadHelper.cc \
|
||||||
Transparent.hh Transparent.cc \
|
Transparent.hh Transparent.cc \
|
||||||
FbPixmap.hh FbPixmap.cc \
|
FbPixmap.hh FbPixmap.cc \
|
||||||
FbDrawable.hh FbDrawable.cc \
|
FbDrawable.hh FbDrawable.cc \
|
||||||
|
|
|
@ -59,6 +59,7 @@ using std::string;
|
||||||
using std::vector;
|
using std::vector;
|
||||||
using std::list;
|
using std::list;
|
||||||
using std::less;
|
using std::less;
|
||||||
|
using FbTk::AutoReloadHelper;
|
||||||
|
|
||||||
list<string> MenuCreator::encoding_stack;
|
list<string> MenuCreator::encoding_stack;
|
||||||
list<size_t> MenuCreator::stacksize_stack;
|
list<size_t> MenuCreator::stacksize_stack;
|
||||||
|
@ -68,13 +69,16 @@ FbTk::StringConvertor MenuCreator::m_stringconvertor(FbTk::StringConvertor::ToFb
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
void createStyleMenu(FbTk::Menu &parent, const string &label,
|
void createStyleMenu(FbTk::Menu &parent, const string &label,
|
||||||
const string &directory) {
|
AutoReloadHelper *reloader, const string &directory) {
|
||||||
// perform shell style ~ home directory expansion
|
// perform shell style ~ home directory expansion
|
||||||
string stylesdir(FbTk::StringUtil::expandFilename(directory));
|
string stylesdir(FbTk::StringUtil::expandFilename(directory));
|
||||||
|
|
||||||
if (!FbTk::FileUtil::isDirectory(stylesdir.c_str()))
|
if (!FbTk::FileUtil::isDirectory(stylesdir.c_str()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (reloader)
|
||||||
|
reloader->addFile(stylesdir);
|
||||||
|
|
||||||
FbTk::Directory dir(stylesdir.c_str());
|
FbTk::Directory dir(stylesdir.c_str());
|
||||||
|
|
||||||
// create a vector of all the filenames in the directory
|
// create a vector of all the filenames in the directory
|
||||||
|
@ -99,18 +103,21 @@ void createStyleMenu(FbTk::Menu &parent, const string &label,
|
||||||
}
|
}
|
||||||
// update menu graphics
|
// update menu graphics
|
||||||
parent.updateMenu();
|
parent.updateMenu();
|
||||||
Fluxbox::instance()->saveMenuFilename(stylesdir.c_str());
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void createRootCmdMenu(FbTk::Menu &parent, const string &label,
|
void createRootCmdMenu(FbTk::Menu &parent, const string &label,
|
||||||
const string &directory, const string &cmd) {
|
const string &directory, AutoReloadHelper *reloader,
|
||||||
|
const string &cmd) {
|
||||||
// perform shell style ~ home directory expansion
|
// perform shell style ~ home directory expansion
|
||||||
string rootcmddir(FbTk::StringUtil::expandFilename(directory));
|
string rootcmddir(FbTk::StringUtil::expandFilename(directory));
|
||||||
|
|
||||||
if (!FbTk::FileUtil::isDirectory(rootcmddir.c_str()))
|
if (!FbTk::FileUtil::isDirectory(rootcmddir.c_str()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (reloader)
|
||||||
|
reloader->addFile(rootcmddir);
|
||||||
|
|
||||||
FbTk::Directory dir(rootcmddir.c_str());
|
FbTk::Directory dir(rootcmddir.c_str());
|
||||||
|
|
||||||
// create a vector of all the filenames in the directory
|
// create a vector of all the filenames in the directory
|
||||||
|
@ -134,7 +141,6 @@ void createRootCmdMenu(FbTk::Menu &parent, const string &label,
|
||||||
}
|
}
|
||||||
// update menu graphics
|
// update menu graphics
|
||||||
parent.updateMenu();
|
parent.updateMenu();
|
||||||
Fluxbox::instance()->saveMenuFilename(rootcmddir.c_str());
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,20 +178,26 @@ public:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void translateMenuItem(FbTk::Parser &parse, ParseItem &item, FbTk::StringConvertor &labelconvertor);
|
void translateMenuItem(FbTk::Parser &parse, ParseItem &item,
|
||||||
|
FbTk::StringConvertor &labelconvertor,
|
||||||
|
AutoReloadHelper *reloader);
|
||||||
|
|
||||||
|
|
||||||
void parseMenu(FbTk::Parser &pars, FbTk::Menu &menu, FbTk::StringConvertor &label_convertor) {
|
void parseMenu(FbTk::Parser &pars, FbTk::Menu &menu,
|
||||||
|
FbTk::StringConvertor &label_convertor,
|
||||||
|
AutoReloadHelper *reloader) {
|
||||||
ParseItem pitem(&menu);
|
ParseItem pitem(&menu);
|
||||||
while (!pars.eof()) {
|
while (!pars.eof()) {
|
||||||
pitem.load(pars, label_convertor);
|
pitem.load(pars, label_convertor);
|
||||||
if (pitem.key() == "end")
|
if (pitem.key() == "end")
|
||||||
return;
|
return;
|
||||||
translateMenuItem(pars, pitem, label_convertor);
|
translateMenuItem(pars, pitem, label_convertor, reloader);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void translateMenuItem(FbTk::Parser &parse, ParseItem &pitem, FbTk::StringConvertor &labelconvertor) {
|
void translateMenuItem(FbTk::Parser &parse, ParseItem &pitem,
|
||||||
|
FbTk::StringConvertor &labelconvertor,
|
||||||
|
AutoReloadHelper *reloader) {
|
||||||
if (pitem.menu() == 0)
|
if (pitem.menu() == 0)
|
||||||
throw string("translateMenuItem: We must have a menu in ParseItem!");
|
throw string("translateMenuItem: We must have a menu in ParseItem!");
|
||||||
|
|
||||||
|
@ -255,13 +267,13 @@ void translateMenuItem(FbTk::Parser &parse, ParseItem &pitem, FbTk::StringConver
|
||||||
if (FbTk::FileUtil::isRegularFile(thisfile.c_str()) &&
|
if (FbTk::FileUtil::isRegularFile(thisfile.c_str()) &&
|
||||||
(filelist[file_index][0] != '.') &&
|
(filelist[file_index][0] != '.') &&
|
||||||
(thisfile[thisfile.length() - 1] != '~')) {
|
(thisfile[thisfile.length() - 1] != '~')) {
|
||||||
MenuCreator::createFromFile(thisfile, menu, false);
|
MenuCreator::createFromFile(thisfile, menu, reloader, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// inject this file into the current menu
|
// inject this file into the current menu
|
||||||
MenuCreator::createFromFile(newfile, menu, false);
|
MenuCreator::createFromFile(newfile, menu, reloader, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
safe_counter--;
|
safe_counter--;
|
||||||
|
@ -278,22 +290,22 @@ void translateMenuItem(FbTk::Parser &parse, ParseItem &pitem, FbTk::StringConver
|
||||||
else
|
else
|
||||||
submenu->setLabel(str_label);
|
submenu->setLabel(str_label);
|
||||||
|
|
||||||
parseMenu(parse, *submenu, labelconvertor);
|
parseMenu(parse, *submenu, labelconvertor, reloader);
|
||||||
submenu->updateMenu();
|
submenu->updateMenu();
|
||||||
menu.insert(str_label, submenu);
|
menu.insert(str_label, submenu);
|
||||||
|
|
||||||
} // end of submenu
|
} // end of submenu
|
||||||
else if (str_key == "stylesdir" || str_key == "stylesmenu") {
|
else if (str_key == "stylesdir" || str_key == "stylesmenu") {
|
||||||
createStyleMenu(menu, str_label,
|
createStyleMenu(menu, str_label, reloader,
|
||||||
str_key == "stylesmenu" ? str_cmd : str_label);
|
str_key == "stylesmenu" ? str_cmd : str_label);
|
||||||
} // end of stylesdir
|
} // end of stylesdir
|
||||||
else if (str_key == "themesdir" || str_key == "themesmenu") {
|
else if (str_key == "themesdir" || str_key == "themesmenu") {
|
||||||
createStyleMenu(menu, str_label,
|
createStyleMenu(menu, str_label, reloader,
|
||||||
str_key == "themesmenu" ? str_cmd : str_label);
|
str_key == "themesmenu" ? str_cmd : str_label);
|
||||||
} // end of themesdir
|
} // end of themesdir
|
||||||
else if (str_key == "wallpapers" || str_key == "wallpapermenu" ||
|
else if (str_key == "wallpapers" || str_key == "wallpapermenu" ||
|
||||||
str_key == "rootcommands") {
|
str_key == "rootcommands") {
|
||||||
createRootCmdMenu(menu, str_label, str_label,
|
createRootCmdMenu(menu, str_label, str_label, reloader,
|
||||||
str_cmd == "" ? realProgramName("fbsetbg") : str_cmd);
|
str_cmd == "" ? realProgramName("fbsetbg") : str_cmd);
|
||||||
} // end of wallpapers
|
} // end of wallpapers
|
||||||
else if (str_key == "workspaces") {
|
else if (str_key == "workspaces") {
|
||||||
|
@ -335,7 +347,9 @@ void translateMenuItem(FbTk::Parser &parse, ParseItem &pitem, FbTk::StringConver
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void parseWindowMenu(FbTk::Parser &parse, FbTk::Menu &menu, FbTk::StringConvertor &labelconvertor) {
|
void parseWindowMenu(FbTk::Parser &parse, FbTk::Menu &menu,
|
||||||
|
FbTk::StringConvertor &labelconvertor,
|
||||||
|
AutoReloadHelper *reloader) {
|
||||||
|
|
||||||
ParseItem pitem(&menu);
|
ParseItem pitem(&menu);
|
||||||
while (!parse.eof()) {
|
while (!parse.eof()) {
|
||||||
|
@ -343,16 +357,16 @@ void parseWindowMenu(FbTk::Parser &parse, FbTk::Menu &menu, FbTk::StringConverto
|
||||||
if (MenuCreator::createWindowMenuItem(pitem.key(), pitem.label(), menu))
|
if (MenuCreator::createWindowMenuItem(pitem.key(), pitem.label(), menu))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (pitem.key() == "end") {
|
if (pitem.key() == "end")
|
||||||
return;
|
return;
|
||||||
} else if (pitem.key() == "submenu") {
|
if (pitem.key() == "submenu") {
|
||||||
FbTk::Menu *submenu = MenuCreator::createMenu(pitem.label(), menu.screenNumber());
|
FbTk::Menu *submenu = MenuCreator::createMenu(pitem.label(), menu.screenNumber());
|
||||||
parseWindowMenu(parse, *submenu, labelconvertor);
|
parseWindowMenu(parse, *submenu, labelconvertor, reloader);
|
||||||
submenu->updateMenu();
|
submenu->updateMenu();
|
||||||
menu.insert(pitem.label(), submenu);
|
menu.insert(pitem.label(), submenu);
|
||||||
|
|
||||||
} else { // try non window menu specific stuff
|
} else { // try non window menu specific stuff
|
||||||
translateMenuItem(parse, pitem, labelconvertor);
|
translateMenuItem(parse, pitem, labelconvertor, reloader);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -376,12 +390,12 @@ bool getStart(FbMenuParser &parser, string &label, FbTk::StringConvertor &labelc
|
||||||
|
|
||||||
}; // end of anonymous namespace
|
}; // end of anonymous namespace
|
||||||
|
|
||||||
FbTk::Menu *MenuCreator::createMenu(const string &label, int screen_number) {
|
FbMenu *MenuCreator::createMenu(const string &label, int screen_number) {
|
||||||
BScreen *screen = Fluxbox::instance()->findScreen(screen_number);
|
BScreen *screen = Fluxbox::instance()->findScreen(screen_number);
|
||||||
if (screen == 0)
|
if (screen == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
FbTk::Menu *menu = new FbMenu(screen->menuTheme(),
|
FbMenu *menu = new FbMenu(screen->menuTheme(),
|
||||||
screen->imageControl(),
|
screen->imageControl(),
|
||||||
*screen->layerManager().getLayer(Layer::MENU));
|
*screen->layerManager().getLayer(Layer::MENU));
|
||||||
if (!label.empty())
|
if (!label.empty())
|
||||||
|
@ -391,7 +405,8 @@ FbTk::Menu *MenuCreator::createMenu(const string &label, int screen_number) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MenuCreator::createFromFile(const string &filename,
|
bool MenuCreator::createFromFile(const string &filename,
|
||||||
FbTk::Menu &inject_into, bool begin) {
|
FbTk::Menu &inject_into,
|
||||||
|
AutoReloadHelper *reloader, bool begin) {
|
||||||
string real_filename = FbTk::StringUtil::expandFilename(filename);
|
string real_filename = FbTk::StringUtil::expandFilename(filename);
|
||||||
|
|
||||||
FbMenuParser parser(real_filename);
|
FbMenuParser parser(real_filename);
|
||||||
|
@ -409,73 +424,49 @@ bool MenuCreator::createFromFile(const string &filename,
|
||||||
}
|
}
|
||||||
|
|
||||||
// save menu filename, so we can check if it changes
|
// save menu filename, so we can check if it changes
|
||||||
Fluxbox::instance()->saveMenuFilename(real_filename.c_str());
|
if (reloader)
|
||||||
|
reloader->addFile(real_filename);
|
||||||
|
|
||||||
parseMenu(parser, inject_into, m_stringconvertor);
|
parseMenu(parser, inject_into, m_stringconvertor, reloader);
|
||||||
endFile();
|
endFile();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool MenuCreator::createWindowMenuFromFile(const string &filename,
|
void MenuCreator::createWindowMenuFromFile(const string &filename,
|
||||||
FbTk::Menu &inject_into) {
|
FbTk::Menu &inject_into,
|
||||||
|
AutoReloadHelper *reloader) {
|
||||||
string real_filename = FbTk::StringUtil::expandFilename(filename);
|
string real_filename = FbTk::StringUtil::expandFilename(filename);
|
||||||
FbMenuParser parser(real_filename);
|
FbMenuParser parser(real_filename);
|
||||||
if (!parser.isLoaded())
|
if (!parser.isLoaded())
|
||||||
return false;
|
return;
|
||||||
|
|
||||||
string label;
|
string label;
|
||||||
|
|
||||||
startFile();
|
startFile();
|
||||||
if (!getStart(parser, label, m_stringconvertor)) {
|
if (!getStart(parser, label, m_stringconvertor)) {
|
||||||
endFile();
|
endFile();
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
parseWindowMenu(parser, inject_into, m_stringconvertor);
|
if (reloader)
|
||||||
endFile();
|
reloader->addFile(real_filename);
|
||||||
|
|
||||||
return true;
|
parseWindowMenu(parser, inject_into, m_stringconvertor, reloader);
|
||||||
|
endFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
FbTk::Menu *MenuCreator::createMenuType(const string &type, int screen_num) {
|
FbMenu *MenuCreator::createMenuType(const string &type, int screen_num) {
|
||||||
BScreen *screen = Fluxbox::instance()->findScreen(screen_num);
|
BScreen *screen = Fluxbox::instance()->findScreen(screen_num);
|
||||||
if (screen == 0)
|
if (screen == 0)
|
||||||
return 0;
|
return 0;
|
||||||
if (type == "iconmenu") {
|
if (type == "iconmenu")
|
||||||
return new ClientMenu(*screen, screen->iconList(),
|
return new ClientMenu(*screen, screen->iconList(),
|
||||||
&screen->iconListSig());
|
&screen->iconListSig());
|
||||||
} else if (type == "workspacemenu") {
|
else if (type == "workspacemenu")
|
||||||
return new WorkspaceMenu(*screen);
|
return new WorkspaceMenu(*screen);
|
||||||
} else if (type == "windowmenu") {
|
|
||||||
FbTk::Menu *menu = createMenu("", screen_num);
|
|
||||||
|
|
||||||
menu->disableTitle(); // not titlebar
|
|
||||||
if (screen->windowMenuFilename().empty() ||
|
|
||||||
! createWindowMenuFromFile(screen->windowMenuFilename(), *menu)) {
|
|
||||||
const char *default_menu[] = {
|
|
||||||
"shade",
|
|
||||||
"stick",
|
|
||||||
"maximize",
|
|
||||||
"iconify",
|
|
||||||
"raise",
|
|
||||||
"lower",
|
|
||||||
"sendto",
|
|
||||||
"layer",
|
|
||||||
"alpha",
|
|
||||||
"extramenus",
|
|
||||||
"separator",
|
|
||||||
"close",
|
|
||||||
0
|
|
||||||
};
|
|
||||||
for (unsigned int i=0; default_menu[i]; ++i)
|
|
||||||
createWindowMenuItem(default_menu[i], "", *menu);
|
|
||||||
}
|
|
||||||
menu->reconfigure(); // update graphics
|
|
||||||
return menu;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,18 +28,24 @@
|
||||||
#include <list>
|
#include <list>
|
||||||
|
|
||||||
namespace FbTk {
|
namespace FbTk {
|
||||||
|
class AutoReloadHelper;
|
||||||
class Menu;
|
class Menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class FbMenu;
|
||||||
class FluxboxWindow;
|
class FluxboxWindow;
|
||||||
|
|
||||||
class MenuCreator {
|
class MenuCreator {
|
||||||
public:
|
public:
|
||||||
static FbTk::Menu *createMenu(const std::string &label, int screen_num);
|
static FbMenu *createMenu(const std::string &label, int screen_num);
|
||||||
static FbTk::Menu *createMenuType(const std::string &label, int screen_num);
|
static FbMenu *createMenuType(const std::string &label, int screen_num);
|
||||||
static bool createFromFile(const std::string &filename,
|
static bool createFromFile(const std::string &filename,
|
||||||
FbTk::Menu &inject_into, bool begin = true);
|
FbTk::Menu &inject_into,
|
||||||
static bool createWindowMenuFromFile(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,
|
static bool createWindowMenuItem(const std::string &type, const std::string &label,
|
||||||
FbTk::Menu &inject_into);
|
FbTk::Menu &inject_into);
|
||||||
|
|
||||||
|
|
|
@ -502,6 +502,15 @@ BScreen::BScreen(FbTk::ResourceManager &rm,
|
||||||
// own resources we must do this.
|
// own resources we must do this.
|
||||||
fluxbox->load_rc(*this);
|
fluxbox->load_rc(*this);
|
||||||
|
|
||||||
|
m_windowmenu.reset(createMenu(""));
|
||||||
|
m_windowmenu->setInternalMenu();
|
||||||
|
m_windowmenu->setReloadHelper(new FbTk::AutoReloadHelper());
|
||||||
|
m_windowmenu->reloadHelper()->setReloadCmd(FbTk::RefCount<FbTk::Command<void> >(new FbTk::SimpleCommand<BScreen>(*this, &BScreen::rereadWindowMenu)));
|
||||||
|
|
||||||
|
m_rootmenu.reset(createMenu(""));
|
||||||
|
m_rootmenu->setReloadHelper(new FbTk::AutoReloadHelper());
|
||||||
|
m_rootmenu->reloadHelper()->setReloadCmd(FbTk::RefCount<FbTk::Command<void> >(new FbTk::SimpleCommand<BScreen>(*this, &BScreen::rereadMenu)));
|
||||||
|
|
||||||
m_configmenu.reset(createMenu(_FB_XTEXT(Menu, Configuration,
|
m_configmenu.reset(createMenu(_FB_XTEXT(Menu, Configuration,
|
||||||
"Configuration", "Title of configuration menu")));
|
"Configuration", "Title of configuration menu")));
|
||||||
setupConfigmenu(*m_configmenu.get());
|
setupConfigmenu(*m_configmenu.get());
|
||||||
|
@ -889,8 +898,8 @@ void BScreen::cycleFocus(int options, const ClientPattern *pat, bool reverse) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FbTk::Menu *BScreen::createMenu(const string &label) {
|
FbMenu *BScreen::createMenu(const string &label) {
|
||||||
FbTk::Menu *menu = new FbMenu(menuTheme(),
|
FbMenu *menu = new FbMenu(menuTheme(),
|
||||||
imageControl(),
|
imageControl(),
|
||||||
*layerManager().getLayer(Layer::MENU));
|
*layerManager().getLayer(Layer::MENU));
|
||||||
if (!label.empty())
|
if (!label.empty())
|
||||||
|
@ -898,8 +907,9 @@ FbTk::Menu *BScreen::createMenu(const string &label) {
|
||||||
|
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
FbTk::Menu *BScreen::createToggleMenu(const string &label) {
|
|
||||||
FbTk::Menu *menu = new ToggleMenu(menuTheme(),
|
FbMenu *BScreen::createToggleMenu(const string &label) {
|
||||||
|
FbMenu *menu = new ToggleMenu(menuTheme(),
|
||||||
imageControl(),
|
imageControl(),
|
||||||
*layerManager().getLayer(Layer::MENU));
|
*layerManager().getLayer(Layer::MENU));
|
||||||
if (!label.empty())
|
if (!label.empty())
|
||||||
|
@ -912,9 +922,7 @@ void BScreen::addExtraWindowMenu(const FbTk::FbString &label, FbTk::Menu *menu)
|
||||||
menu->setInternalMenu();
|
menu->setInternalMenu();
|
||||||
menu->disableTitle();
|
menu->disableTitle();
|
||||||
m_extramenus.push_back(make_pair(label, menu));
|
m_extramenus.push_back(make_pair(label, menu));
|
||||||
// recreate window menu
|
rereadWindowMenu();
|
||||||
m_windowmenu.reset(MenuCreator::createMenuType("windowmenu", screenNumber()));
|
|
||||||
m_windowmenu->setInternalMenu();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BScreen::reconfigure() {
|
void BScreen::reconfigure() {
|
||||||
|
@ -956,10 +964,9 @@ void BScreen::reconfigure() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//reconfigure menus
|
// update menu filenames
|
||||||
// recreate window menu
|
m_rootmenu->reloadHelper()->setMainFile(fluxbox->getMenuFilename());
|
||||||
m_windowmenu.reset(MenuCreator::createMenuType("windowmenu", screenNumber()));
|
m_windowmenu->reloadHelper()->setMainFile(windowMenuFilename());
|
||||||
m_windowmenu->setInternalMenu();
|
|
||||||
|
|
||||||
// reconfigure workspaces
|
// reconfigure workspaces
|
||||||
for_each(m_workspaces_list.begin(),
|
for_each(m_workspaces_list.begin(),
|
||||||
|
@ -992,12 +999,6 @@ void BScreen::reconfigureTabs() {
|
||||||
(*it)->fbwindow()->applyDecorations();
|
(*it)->fbwindow()->applyDecorations();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BScreen::rereadMenu() {
|
|
||||||
initMenu();
|
|
||||||
m_rootmenu->reconfigure();
|
|
||||||
}
|
|
||||||
|
|
||||||
void BScreen::updateWorkspaceName(unsigned int w) {
|
void BScreen::updateWorkspaceName(unsigned int w) {
|
||||||
Workspace *space = getWorkspace(w);
|
Workspace *space = getWorkspace(w);
|
||||||
if (space) {
|
if (space) {
|
||||||
|
@ -1489,23 +1490,20 @@ void BScreen::reassociateWindow(FluxboxWindow *w, unsigned int wkspc_id,
|
||||||
|
|
||||||
void BScreen::initMenus() {
|
void BScreen::initMenus() {
|
||||||
m_workspacemenu.reset(MenuCreator::createMenuType("workspacemenu", screenNumber()));
|
m_workspacemenu.reset(MenuCreator::createMenuType("workspacemenu", screenNumber()));
|
||||||
m_windowmenu.reset(MenuCreator::createMenuType("windowmenu", screenNumber()));
|
m_rootmenu->reloadHelper()->setMainFile(Fluxbox::instance()->getMenuFilename());
|
||||||
m_windowmenu->setInternalMenu();
|
m_windowmenu->reloadHelper()->setMainFile(windowMenuFilename());
|
||||||
initMenu();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BScreen::initMenu() {
|
void BScreen::rereadMenu() {
|
||||||
|
|
||||||
if (m_rootmenu.get()) {
|
m_rootmenu->removeAll();
|
||||||
m_rootmenu->removeAll();
|
m_rootmenu->setLabel("");
|
||||||
m_rootmenu->setLabel("");
|
|
||||||
} else
|
|
||||||
m_rootmenu.reset(createMenu(""));
|
|
||||||
|
|
||||||
Fluxbox * const fb = Fluxbox::instance();
|
Fluxbox * const fb = Fluxbox::instance();
|
||||||
if (!fb->getMenuFilename().empty())
|
if (!fb->getMenuFilename().empty())
|
||||||
MenuCreator::createFromFile(fb->getMenuFilename(), *m_rootmenu);
|
MenuCreator::createFromFile(fb->getMenuFilename(), *m_rootmenu,
|
||||||
|
m_rootmenu->reloadHelper());
|
||||||
|
|
||||||
if (m_rootmenu->numberOfItems() == 0) {
|
if (m_rootmenu->numberOfItems() == 0) {
|
||||||
_FB_USES_NLS;
|
_FB_USES_NLS;
|
||||||
|
@ -1521,14 +1519,39 @@ void BScreen::initMenu() {
|
||||||
restart_fb);
|
restart_fb);
|
||||||
m_rootmenu->insert(_FB_XTEXT(Menu, Exit, "Exit", "Exit command"),
|
m_rootmenu->insert(_FB_XTEXT(Menu, Exit, "Exit", "Exit command"),
|
||||||
exit_fb);
|
exit_fb);
|
||||||
// still save the menu filename, in case it becomes valid later
|
|
||||||
if (!fb->getMenuFilename().empty())
|
|
||||||
fb->saveMenuFilename(fb->getMenuFilename().c_str());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_rootmenu->updateMenu();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BScreen::rereadWindowMenu() {
|
||||||
|
|
||||||
|
m_windowmenu->removeAll();
|
||||||
|
if (!windowMenuFilename().empty())
|
||||||
|
MenuCreator::createWindowMenuFromFile(windowMenuFilename(),
|
||||||
|
*m_windowmenu,
|
||||||
|
m_windowmenu->reloadHelper());
|
||||||
|
|
||||||
|
if (m_windowmenu->numberOfItems() == 0) {
|
||||||
|
const char *defaults[] = {
|
||||||
|
"shade",
|
||||||
|
"stick",
|
||||||
|
"maximize",
|
||||||
|
"iconify",
|
||||||
|
"raise",
|
||||||
|
"lower",
|
||||||
|
"sendto",
|
||||||
|
"layer",
|
||||||
|
"alpha",
|
||||||
|
"extramenus",
|
||||||
|
"separator",
|
||||||
|
"close",
|
||||||
|
0
|
||||||
|
};
|
||||||
|
for (unsigned int i=0; defaults[i]; ++i)
|
||||||
|
MenuCreator::createWindowMenuItem(defaults[i], "", *m_windowmenu);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void BScreen::addConfigMenu(const FbTk::FbString &label, FbTk::Menu &menu) {
|
void BScreen::addConfigMenu(const FbTk::FbString &label, FbTk::Menu &menu) {
|
||||||
m_configmenu_list.push_back(make_pair(label, &menu));
|
m_configmenu_list.push_back(make_pair(label, &menu));
|
||||||
|
|
|
@ -54,6 +54,7 @@
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
class ClientPattern;
|
class ClientPattern;
|
||||||
|
class FbMenu;
|
||||||
class Focusable;
|
class Focusable;
|
||||||
class FluxboxWindow;
|
class FluxboxWindow;
|
||||||
class WinClient;
|
class WinClient;
|
||||||
|
@ -122,12 +123,12 @@ public:
|
||||||
const std::string &windowMenuFilename() const { return *resource.windowmenufile; }
|
const std::string &windowMenuFilename() const { return *resource.windowmenufile; }
|
||||||
FbTk::ImageControl &imageControl() { return *m_image_control.get(); }
|
FbTk::ImageControl &imageControl() { return *m_image_control.get(); }
|
||||||
// menus
|
// menus
|
||||||
const FbTk::Menu &rootMenu() const { return *m_rootmenu.get(); }
|
const FbMenu &rootMenu() const { return *m_rootmenu.get(); }
|
||||||
FbTk::Menu &rootMenu() { return *m_rootmenu.get(); }
|
FbMenu &rootMenu() { return *m_rootmenu.get(); }
|
||||||
const FbTk::Menu &configMenu() const { return *m_configmenu.get(); }
|
const FbMenu &configMenu() const { return *m_configmenu.get(); }
|
||||||
FbTk::Menu &configMenu() { return *m_configmenu.get(); }
|
FbMenu &configMenu() { return *m_configmenu.get(); }
|
||||||
const FbTk::Menu &windowMenu() const { return *m_windowmenu.get(); }
|
const FbMenu &windowMenu() const { return *m_windowmenu.get(); }
|
||||||
FbTk::Menu &windowMenu() { return *m_windowmenu.get(); }
|
FbMenu &windowMenu() { return *m_windowmenu.get(); }
|
||||||
ExtraMenus &extraWindowMenus() { return m_extramenus; }
|
ExtraMenus &extraWindowMenus() { return m_extramenus; }
|
||||||
const ExtraMenus &extraWindowMenus() const { return m_extramenus; }
|
const ExtraMenus &extraWindowMenus() const { return m_extramenus; }
|
||||||
|
|
||||||
|
@ -166,9 +167,9 @@ public:
|
||||||
Workspace *currentWorkspace() { return m_current_workspace; }
|
Workspace *currentWorkspace() { return m_current_workspace; }
|
||||||
const Workspace *currentWorkspace() const { return m_current_workspace; }
|
const Workspace *currentWorkspace() const { return m_current_workspace; }
|
||||||
/// @return the workspace menu
|
/// @return the workspace menu
|
||||||
const FbTk::Menu &workspaceMenu() const { return *m_workspacemenu.get(); }
|
const FbMenu &workspaceMenu() const { return *m_workspacemenu.get(); }
|
||||||
/// @return the workspace menu
|
/// @return the workspace menu
|
||||||
FbTk::Menu &workspaceMenu() { return *m_workspacemenu.get(); }
|
FbMenu &workspaceMenu() { return *m_workspacemenu.get(); }
|
||||||
/// @return focus control handler
|
/// @return focus control handler
|
||||||
const FocusControl &focusControl() const { return *m_focus_control; }
|
const FocusControl &focusControl() const { return *m_focus_control; }
|
||||||
/// @return focus control handler
|
/// @return focus control handler
|
||||||
|
@ -251,15 +252,15 @@ public:
|
||||||
/**
|
/**
|
||||||
* Creates an empty menu with specified label
|
* Creates an empty menu with specified label
|
||||||
* @param label for the menu
|
* @param label for the menu
|
||||||
* @return create menu
|
* @return created menu
|
||||||
*/
|
*/
|
||||||
FbTk::Menu *createMenu(const std::string &label);
|
FbMenu *createMenu(const std::string &label);
|
||||||
/**
|
/**
|
||||||
* Creates an empty toggle menu with a specific label
|
* Creates an empty toggle menu with a specific label
|
||||||
* @param label
|
* @param label
|
||||||
* @return created menu
|
* @return created menu
|
||||||
*/
|
*/
|
||||||
FbTk::Menu *createToggleMenu(const std::string &label);
|
FbMenu *createToggleMenu(const std::string &label);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For extras to add menus.
|
* For extras to add menus.
|
||||||
|
@ -383,6 +384,7 @@ public:
|
||||||
void reconfigure();
|
void reconfigure();
|
||||||
void reconfigureTabs();
|
void reconfigureTabs();
|
||||||
void rereadMenu();
|
void rereadMenu();
|
||||||
|
void rereadWindowMenu();
|
||||||
void shutdown();
|
void shutdown();
|
||||||
/// show position window centered on the screen with "X x Y" text
|
/// show position window centered on the screen with "X x Y" text
|
||||||
void showPosition(int x, int y);
|
void showPosition(int x, int y);
|
||||||
|
@ -489,7 +491,6 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setupConfigmenu(FbTk::Menu &menu);
|
void setupConfigmenu(FbTk::Menu &menu);
|
||||||
void initMenu();
|
|
||||||
void renderGeomWindow();
|
void renderGeomWindow();
|
||||||
void renderPosWindow();
|
void renderPosWindow();
|
||||||
|
|
||||||
|
@ -515,7 +516,7 @@ private:
|
||||||
|
|
||||||
|
|
||||||
std::auto_ptr<FbTk::ImageControl> m_image_control;
|
std::auto_ptr<FbTk::ImageControl> m_image_control;
|
||||||
std::auto_ptr<FbTk::Menu> m_configmenu, m_rootmenu, m_workspacemenu, m_windowmenu;
|
std::auto_ptr<FbMenu> m_configmenu, m_rootmenu, m_workspacemenu, m_windowmenu;
|
||||||
|
|
||||||
ExtraMenus m_extramenus;
|
ExtraMenus m_extramenus;
|
||||||
|
|
||||||
|
|
|
@ -437,8 +437,6 @@ Fluxbox::~Fluxbox() {
|
||||||
delete (*it).first;
|
delete (*it).first;
|
||||||
}
|
}
|
||||||
m_atomhandler.clear();
|
m_atomhandler.clear();
|
||||||
|
|
||||||
clearMenuFilenames();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1469,63 +1467,6 @@ BScreen *Fluxbox::findScreen(int id) {
|
||||||
return *it;
|
return *it;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Fluxbox::menuTimestampsChanged() const {
|
|
||||||
list<MenuTimestamp *>::const_iterator it = m_menu_timestamps.begin();
|
|
||||||
list<MenuTimestamp *>::const_iterator it_end = m_menu_timestamps.end();
|
|
||||||
for (; it != it_end; ++it) {
|
|
||||||
|
|
||||||
time_t timestamp = FbTk::FileUtil::getLastStatusChangeTimestamp((*it)->filename.c_str());
|
|
||||||
|
|
||||||
if (timestamp != (*it)->timestamp)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// no timestamp changed
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Fluxbox::rereadMenu() {
|
|
||||||
clearMenuFilenames();
|
|
||||||
|
|
||||||
for_each(m_screen_list.begin(),
|
|
||||||
m_screen_list.end(),
|
|
||||||
mem_fun(&BScreen::rereadMenu));
|
|
||||||
}
|
|
||||||
|
|
||||||
void Fluxbox::saveMenuFilename(const char *filename) {
|
|
||||||
if (filename == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
bool found = false;
|
|
||||||
|
|
||||||
list<MenuTimestamp *>::iterator it = m_menu_timestamps.begin();
|
|
||||||
list<MenuTimestamp *>::iterator it_end = m_menu_timestamps.end();
|
|
||||||
for (; it != it_end; ++it) {
|
|
||||||
if ((*it)->filename == filename) {
|
|
||||||
found = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! found) {
|
|
||||||
time_t timestamp = FbTk::FileUtil::getLastStatusChangeTimestamp(filename);
|
|
||||||
|
|
||||||
MenuTimestamp *ts = new MenuTimestamp;
|
|
||||||
|
|
||||||
ts->filename = filename;
|
|
||||||
ts->timestamp = timestamp;
|
|
||||||
|
|
||||||
m_menu_timestamps.push_back(ts);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Fluxbox::clearMenuFilenames() {
|
|
||||||
while(!m_menu_timestamps.empty()) {
|
|
||||||
delete m_menu_timestamps.back();
|
|
||||||
m_menu_timestamps.pop_back();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Fluxbox::timed_reconfigure() {
|
void Fluxbox::timed_reconfigure() {
|
||||||
if (m_reconfigure_wait)
|
if (m_reconfigure_wait)
|
||||||
real_reconfigure();
|
real_reconfigure();
|
||||||
|
|
|
@ -136,8 +136,6 @@ public:
|
||||||
void shutdown();
|
void shutdown();
|
||||||
void load_rc(BScreen &scr);
|
void load_rc(BScreen &scr);
|
||||||
void saveStyleFilename(const char *val) { m_rc_stylefile = (val == 0 ? "" : val); }
|
void saveStyleFilename(const char *val) { m_rc_stylefile = (val == 0 ? "" : val); }
|
||||||
void saveMenuFilename(const char *);
|
|
||||||
void clearMenuFilenames();
|
|
||||||
void saveWindowSearch(Window win, WinClient *winclient);
|
void saveWindowSearch(Window win, WinClient *winclient);
|
||||||
// some windows relate to the group, not the client, so we record separately
|
// some windows relate to the group, not the client, so we record separately
|
||||||
// searchWindow on these windows will give the active client in the group
|
// searchWindow on these windows will give the active client in the group
|
||||||
|
@ -149,8 +147,6 @@ public:
|
||||||
void removeGroupSearch(Window win);
|
void removeGroupSearch(Window win);
|
||||||
void restart(const char *command = 0);
|
void restart(const char *command = 0);
|
||||||
void reconfigure();
|
void reconfigure();
|
||||||
void rereadMenu();
|
|
||||||
/// reloads the menus if the timestamps changed
|
|
||||||
|
|
||||||
/// handle any system signal sent to the application
|
/// handle any system signal sent to the application
|
||||||
void handleSignal(int signum);
|
void handleSignal(int signum);
|
||||||
|
@ -176,8 +172,6 @@ public:
|
||||||
typedef std::list<BScreen *> ScreenList;
|
typedef std::list<BScreen *> ScreenList;
|
||||||
const ScreenList screenList() const { return m_screen_list; }
|
const ScreenList screenList() const { return m_screen_list; }
|
||||||
|
|
||||||
/// @return whether the timestamps on the menu changed
|
|
||||||
bool menuTimestampsChanged() const;
|
|
||||||
bool haveShape() const { return m_have_shape; }
|
bool haveShape() const { return m_have_shape; }
|
||||||
int shapeEventbase() const { return m_shape_eventbase; }
|
int shapeEventbase() const { return m_shape_eventbase; }
|
||||||
void getDefaultDataFilename(const char *name, std::string &) const;
|
void getDefaultDataFilename(const char *name, std::string &) const;
|
||||||
|
@ -190,14 +184,6 @@ public:
|
||||||
AttentionNoticeHandler &attentionHandler() { return m_attention_handler; }
|
AttentionNoticeHandler &attentionHandler() { return m_attention_handler; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
typedef struct MenuTimestamp {
|
|
||||||
std::string filename;
|
|
||||||
time_t timestamp;
|
|
||||||
} MenuTimestamp;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
std::string getRcFilename();
|
std::string getRcFilename();
|
||||||
void load_rc();
|
void load_rc();
|
||||||
|
|
||||||
|
@ -241,7 +227,6 @@ private:
|
||||||
// will have it's window being the group index
|
// will have it's window being the group index
|
||||||
std::multimap<Window, WinClient *> m_group_search;
|
std::multimap<Window, WinClient *> m_group_search;
|
||||||
|
|
||||||
std::list<MenuTimestamp *> m_menu_timestamps;
|
|
||||||
ScreenList m_screen_list;
|
ScreenList m_screen_list;
|
||||||
|
|
||||||
FluxboxWindow *m_masked_window;
|
FluxboxWindow *m_masked_window;
|
||||||
|
|
Loading…
Reference in a new issue