all repos — fluxbox @ 28837ee6e1e3226bec37a7854bd36c45406058f6

custom fork of the fluxbox windowmanager

introduced session.styleOverlay (~/.fluxbox/overlay), all style settings
made in that file will override/overlay the ones made in the used
style. TODO: write more specific docu about it
mathias mathias
commit

28837ee6e1e3226bec37a7854bd36c45406058f6

parent

6403deb65e7ce00c94d22c4b6893437a6cafe481

M ChangeLogChangeLog

@@ -1,5 +1,11 @@

(Format: Year/Month/Day) Changes for 0.9.15: +*05/11/16: + * Added overlayStyle resource to init-file (Mathias) + session.overlayStyle : ~/.fluxbox/overlay + Style settings in this file override any settings from a + regular style + fluxbox.hh/cc Screen.cc FbCommands.cc FbTk/Theme.hh/cc *05/11/13: * Fixed #1307877 fbsetbg did not create ~/.fluxbox/lastwallpaper (Henrik)
M src/FbCommands.ccsrc/FbCommands.cc

@@ -213,7 +213,8 @@

void SetStyleCmd::execute() { Fluxbox::instance()->saveStyleFilename(m_filename.c_str()); Fluxbox::instance()->save_rc(); - FbTk::ThemeManager::instance().load(m_filename); + FbTk::ThemeManager::instance().load(m_filename, + Fluxbox::instance()->getStyleOverlayFilename()); } void ShowRootMenuCmd::execute() {
M src/FbTk/Theme.ccsrc/FbTk/Theme.cc

@@ -83,7 +83,8 @@ m_themelist.remove(&tm);

return true; } -bool ThemeManager::load(const std::string &filename, int screen_num) { +bool ThemeManager::load(const std::string &filename, + const std::string &overlay_filename, int screen_num) { std::string location = FbTk::StringUtil::expandFilename(filename); std::string prefix = "";

@@ -107,6 +108,20 @@

if (!m_database.load(location.c_str())) return false; + + if (!overlay_filename.empty()) { + std::string overlay_location = FbTk::StringUtil::expandFilename(overlay_filename); + if (FileUtil::isRegularFile(overlay_location.c_str())) { + XrmDatabaseHelper overlay_db; + if (overlay_db.load(overlay_location.c_str())) { + // after a merge the src_db is destroyed + // so, make sure XrmDatabaseHelper::m_database == 0 + XrmMergeDatabases(*overlay_db, &(*m_database)); + *overlay_db = 0; + } + } + } + // relies on the fact that load_rc clears search paths each time if (m_themelocation != "") { Image::removeSearchPath(m_themelocation);

@@ -129,8 +144,8 @@ if (screen_num < 0)

loadTheme(**theme_it); else if (screen_num == (*theme_it)->screenNum()) // specified screen loadTheme(**theme_it); - } + // notify all themes that we reconfigured theme_it = m_themelist.begin(); for (; theme_it != theme_it_end; ++theme_it) {
M src/FbTk/Theme.hhsrc/FbTk/Theme.hh

@@ -127,7 +127,7 @@ class ThemeManager {

public: static ThemeManager &instance(); /// load style file "filename" to screen - bool load(const std::string &filename, int screen_num = -1); + bool load(const std::string &filename, const std::string &overlay_filename, int screen_num = -1); std::string resourceValue(const std::string &name, const std::string &altname); void loadTheme(Theme &tm); bool loadItem(ThemeItem_base &resource);
M src/Screen.ccsrc/Screen.cc

@@ -358,6 +358,7 @@ // So we lock root theme temporary so it doesn't uses RootTheme::reconfigTheme

// This must be fixed in the future. m_root_theme->lock(true); FbTk::ThemeManager::instance().load(fluxbox->getStyleFilename(), + fluxbox->getStyleOverlayFilename(), m_root_theme->screenNum()); m_root_theme->lock(false); m_root_theme->setLineAttributes(*resource.gc_line_width,

@@ -789,6 +790,7 @@ m_reconfigure_sig.notify();

// Reload style FbTk::ThemeManager::instance().load(fluxbox->getStyleFilename(), + fluxbox->getStyleOverlayFilename(), m_root_theme->screenNum()); }
M src/fluxbox.ccsrc/fluxbox.cc

@@ -205,6 +205,7 @@ "session.colorsPerChannel", "Session.ColorsPerChannel"),

m_rc_numlayers(m_resourcemanager, 13, "session.numLayers", "Session.NumLayers"), m_rc_double_click_interval(m_resourcemanager, 250, "session.doubleClickInterval", "Session.DoubleClickInterval"), m_rc_stylefile(m_resourcemanager, DEFAULTSTYLE, "session.styleFile", "Session.StyleFile"), + m_rc_styleoverlayfile(m_resourcemanager, "~/.fluxbox/ovrd_style", "session.styleOverlay", "Session.StyleOverlay"), m_rc_menufile(m_resourcemanager, DEFAULTMENU, "session.menuFile", "Session.MenuFile"), m_rc_keyfile(m_resourcemanager, DEFAULTKEYSFILE, "session.keyFile", "Session.KeyFile"), m_rc_slitlistfile(m_resourcemanager, "~/.fluxbox/slitlist", "session.slitlistFile", "Session.SlitlistFile"),

@@ -299,7 +300,7 @@ #endif // HAVE_RANDR

load_rc(); // setup theme manager to have our style file ready to be scanned - FbTk::ThemeManager::instance().load(getStyleFilename()); + FbTk::ThemeManager::instance().load(getStyleFilename(), getStyleOverlayFilename()); // setup atom handlers before we create any windows #ifdef REMEMBER

@@ -377,9 +378,9 @@ "Error message when no unmanaged screens found - usually means another window manager is running"));

} m_keyscreen = m_mousescreen = m_screen_list.front(); - + // setup theme manager to have our style file ready to be scanned - FbTk::ThemeManager::instance().load(FbTk::StringUtil::expandFilename(getStyleFilename())); + FbTk::ThemeManager::instance().load(getStyleFilename(), getStyleOverlayFilename()); //XSynchronize(disp, False); sync(false);

@@ -1587,7 +1588,7 @@ for(it = names.begin(); it != names.end(); it++) {

if (!(*it).empty() && (*it) != "") screen.addWorkspaceName((*it).c_str()); } - + } FbTk::Image::removeAllSearchPaths();
M src/fluxbox.hhsrc/fluxbox.hh

@@ -80,54 +80,56 @@ class Fluxbox : public FbTk::App,

public FbTk::SignalEventHandler, public FbTk::Observer { public: - Fluxbox(int argc, char **argv, const char * dpy_name= 0, + Fluxbox(int argc, char **argv, const char * dpy_name= 0, const char *rcfilename = 0); virtual ~Fluxbox(); static Fluxbox *instance() { return s_singleton; } + /// main event loop void eventLoop(); bool validateWindow(Window win) const; void grab(); void ungrab(); Keys *keys() { return m_key.get(); } - inline Atom getFluxboxPidAtom() const { return m_fluxbox_pid; } + Atom getFluxboxPidAtom() const { return m_fluxbox_pid; } // Not currently implemented until we decide how it'll be used //WinClient *searchGroup(Window); WinClient *searchWindow(Window); - inline WinClient *getFocusedWindow() { return m_focused_window; } + WinClient *getFocusedWindow() { return m_focused_window; } int initScreen(int screen_nr); BScreen *searchScreen(Window w); - inline unsigned int getDoubleClickInterval() const { return *m_rc_double_click_interval; } - inline Time getLastTime() const { return m_last_time; } + unsigned int getDoubleClickInterval() const { return *m_rc_double_click_interval; } + Time getLastTime() const { return m_last_time; } AtomHandler *getAtomHandler(const std::string &name); void addAtomHandler(AtomHandler *atomh, const std::string &name); void removeAtomHandler(AtomHandler *atomh); /// obsolete - enum Titlebar{SHADE=0, MINIMIZE, MAXIMIZE, CLOSE, STICK, MENUICON, EMPTY}; + enum Titlebar{SHADE=0, MINIMIZE, MAXIMIZE, CLOSE, STICK, MENUICON, EMPTY}; enum TabsAttachArea{ATTACH_AREA_WINDOW= 0, ATTACH_AREA_TITLEBAR}; - inline bool getIgnoreBorder() const { return *m_rc_ignoreborder; } - inline bool &getPseudoTrans() { return *m_rc_pseudotrans; } + bool getIgnoreBorder() const { return *m_rc_ignoreborder; } + bool &getPseudoTrans() { return *m_rc_pseudotrans; } - inline const std::vector<Fluxbox::Titlebar>& getTitlebarRight() const { return *m_rc_titlebar_right; } - inline const std::vector<Fluxbox::Titlebar>& getTitlebarLeft() const { return *m_rc_titlebar_left; } - inline Fluxbox::TabsAttachArea getTabsAttachArea() const { return *m_rc_tabs_attach_area; } - inline const std::string &getStyleFilename() const { return *m_rc_stylefile; } + const std::vector<Fluxbox::Titlebar>& getTitlebarRight() const { return *m_rc_titlebar_right; } + const std::vector<Fluxbox::Titlebar>& getTitlebarLeft() const { return *m_rc_titlebar_left; } + Fluxbox::TabsAttachArea getTabsAttachArea() const { return *m_rc_tabs_attach_area; } + const std::string &getStyleFilename() const { return *m_rc_stylefile; } + const std::string &getStyleOverlayFilename() const { return *m_rc_styleoverlayfile; } - inline const std::string &getMenuFilename() const { return *m_rc_menufile; } - inline const std::string &getSlitlistFilename() const { return *m_rc_slitlistfile; } - inline const std::string &getAppsFilename() const { return *m_rc_appsfile; } - inline int colorsPerChannel() const { return *m_rc_colors_per_channel; } - inline int getNumberOfLayers() const { return *m_rc_numlayers; } - inline int getTabsPadding() const { return *m_rc_tabs_padding; } - inline int getFocusedTabMinWidth() const { return *m_rc_focused_tab_min_width; } + const std::string &getMenuFilename() const { return *m_rc_menufile; } + const std::string &getSlitlistFilename() const { return *m_rc_slitlistfile; } + const std::string &getAppsFilename() const { return *m_rc_appsfile; } + int colorsPerChannel() const { return *m_rc_colors_per_channel; } + int getNumberOfLayers() const { return *m_rc_numlayers; } + int getTabsPadding() const { return *m_rc_tabs_padding; } + int getFocusedTabMinWidth() const { return *m_rc_focused_tab_min_width; } // class to store layer numbers (special Resource type) // we have a special resource type because we need to be able to name certain layers

@@ -135,7 +137,7 @@ // a Resource<int> wouldn't allow this

class Layer { public: explicit Layer(int i) : m_num(i) {}; - inline int getNum() const { return m_num; } + int getNum() const { return m_num; } Layer &operator=(int num) { m_num = num; return *this; }

@@ -144,22 +146,22 @@ int m_num;

}; // TODO these probably should be configurable - inline int getMenuLayer() const { return 0; } - inline int getAboveDockLayer() const { return 2; } - inline int getDockLayer() const { return 4; } - inline int getTopLayer() const { return 6; } - inline int getNormalLayer() const { return 8; } - inline int getBottomLayer() const { return 10; } - inline int getDesktopLayer() const { return 12; } + int getMenuLayer() const { return 0; } + int getAboveDockLayer() const { return 2; } + int getDockLayer() const { return 4; } + int getTopLayer() const { return 6; } + int getNormalLayer() const { return 8; } + int getBottomLayer() const { return 10; } + int getDesktopLayer() const { return 12; } - inline time_t getAutoRaiseDelay() const { return *m_rc_auto_raise_delay; } + time_t getAutoRaiseDelay() const { return *m_rc_auto_raise_delay; } - inline unsigned int getCacheLife() const { return *m_rc_cache_life * 60000; } - inline unsigned int getCacheMax() const { return *m_rc_cache_max; } - inline bool useMod1() const { return *m_rc_use_mod1; } + unsigned int getCacheLife() const { return *m_rc_cache_life * 60000; } + unsigned int getCacheMax() const { return *m_rc_cache_max; } + bool useMod1() const { return *m_rc_use_mod1; } - inline void maskWindowEvents(Window w, FluxboxWindow *bw) + void maskWindowEvents(Window w, FluxboxWindow *bw) { m_masked = w; m_masked_window = bw; } void watchKeyRelease(BScreen &screen, unsigned int mods);

@@ -173,6 +175,7 @@ void load_rc(BScreen &scr);

void loadRootCommand(BScreen &scr); void loadTitlebar(); void saveStyleFilename(const char *val) { m_rc_stylefile = (val == 0 ? "" : val); } + void saveStyleOverlayFilename(const char *val) { m_rc_styleoverlayfile = (val == 0 ? "" : val); } void saveMenuFilename(const char *); void clearMenuFilenames(); void saveTitlebarFilename(const char *);

@@ -247,7 +250,7 @@ void setupConfigFiles();

void handleButtonEvent(XButtonEvent &be); void handleUnmapNotify(XUnmapEvent &ue); void handleClientMessage(XClientMessageEvent &ce); - void handleKeyEvent(XKeyEvent &ke); + void handleKeyEvent(XKeyEvent &ke); void setTitlebar(std::vector<Fluxbox::Titlebar>& dir, const char *arg); std::auto_ptr<FbAtoms> m_fbatoms;

@@ -263,6 +266,7 @@ m_rc_double_click_interval,

m_rc_tabs_padding, m_rc_focused_tab_min_width; FbTk::Resource<std::string> m_rc_stylefile, + m_rc_styleoverlayfile, m_rc_menufile, m_rc_keyfile, m_rc_slitlistfile, m_rc_groupfile, m_rc_appsfile;

@@ -280,7 +284,7 @@ WindowMap m_window_search_group;

// A window is the group leader, which can map to several // WinClients in the group, it is *not* fluxbox's concept of groups // See ICCCM section 4.1.11 - // The group leader (which may not be mapped, so may not have a WinClient) + // The group leader (which may not be mapped, so may not have a WinClient) // will have it's window being the group index std::multimap<Window, WinClient *> m_group_search;