all repos — fluxbox @ ef9565efd8431eed3f561154c58765d5a77be90a

custom fork of the fluxbox windowmanager

fix crash bug when windowmenu doesn't include extramenus
improve checking of existence/success of loading windowmenu file
rathnor rathnor
commit

ef9565efd8431eed3f561154c58765d5a77be90a

parent

92dc8d745214ac4f8c81bbad6d529a19fb4fe46c

5 files changed, 34 insertions(+), 17 deletions(-)

jump to
M ChangeLogChangeLog

@@ -1,6 +1,12 @@

(Format: Year/Month/Day) Changes for 0.9.10: *04/08/29: + * Fix crash when extramenus not attached to windowmenu (Simon) + - and add checking that windowmenu file exists and sorta parses + Window.cc FbTk/Menu.hh MenuCreator.hh/cc + * Tweak toolbar size/position (esp when 100% width) (Simon) + - and fix menu size bug when initialising with no style + Toolbar.cc FbTk/MenuTheme.cc * Add back Workspace<n> actions with deprecated message (Simon) - need transition time, remove when 1.0 has been widely used for a while FbCommandFactory.cc
M src/FbTk/Menu.hhsrc/FbTk/Menu.hh

@@ -22,7 +22,7 @@ // 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. -// $Id: Menu.hh,v 1.38 2004/08/03 21:25:51 fluxgen Exp $ +// $Id: Menu.hh,v 1.39 2004/08/29 12:35:29 rathnor Exp $ #ifndef FBTK_MENU_HH #define FBTK_MENU_HH

@@ -162,6 +162,9 @@ //@}

/// @return true if index is valid inline bool validIndex(int index) const { return (index < static_cast<int>(numberOfItems()) && index >= 0); } + inline Menu *parent() { return m_parent; } + inline const Menu *parent() const { return m_parent; } + protected: inline void setTitleVisibility(bool b) {

@@ -179,8 +182,6 @@ int x= -1, int y= -1,

unsigned int width= 0, unsigned int height= 0); virtual void redrawTitle(); virtual void internal_hide(); - inline Menu *parent() { return m_parent; } - inline const Menu *parent() const { return m_parent; } void update(FbTk::Subject *); void renderTransp(int x, int y,
M src/MenuCreator.ccsrc/MenuCreator.cc

@@ -20,7 +20,7 @@ // 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. -// $Id: MenuCreator.cc,v 1.11 2004/08/26 18:26:39 akir Exp $ +// $Id: MenuCreator.cc,v 1.12 2004/08/29 12:35:29 rathnor Exp $ #include "MenuCreator.hh"

@@ -322,36 +322,38 @@ return menu;

} -void MenuCreator::createFromFile(const std::string &filename, +bool MenuCreator::createFromFile(const std::string &filename, FbTk::Menu &inject_into) { std::string real_filename = FbTk::StringUtil::expandFilename(filename); FbMenuParser parser(real_filename); if (!parser.isLoaded()) - return; + return false; std::string label; if (!getStart(parser, label)) - return; + return false; parseMenu(parser, inject_into); + return true; } -void MenuCreator::createFromFile(const std::string &filename, +bool MenuCreator::createFromFile(const std::string &filename, FbTk::Menu &inject_into, FluxboxWindow &win) { std::string real_filename = FbTk::StringUtil::expandFilename(filename); FbMenuParser parser(real_filename); if (!parser.isLoaded()) - return; + return false; std::string label; if (!getStart(parser, label)) - return; + return false; parseWindowMenu(parser, inject_into, win); + return true; }
M src/MenuCreator.hhsrc/MenuCreator.hh

@@ -36,8 +36,8 @@ public:

static FbTk::Menu *createMenu(const std::string &label, int screen_num); static FbTk::Menu *createFromFile(const std::string &filename, int screen_num); static FbTk::Menu *createMenuType(const std::string &label, int screen_num); - static void createFromFile(const std::string &filename, FbTk::Menu &inject_into); - static void createFromFile(const std::string &filename, FbTk::Menu &inject_into, + static bool createFromFile(const std::string &filename, FbTk::Menu &inject_into); + static bool createFromFile(const std::string &filename, FbTk::Menu &inject_into, FluxboxWindow &win); static bool createWindowMenuItem(const std::string &type, const std::string &label, FbTk::Menu &inject_into, FluxboxWindow &win);
M src/Window.ccsrc/Window.cc

@@ -22,7 +22,7 @@ // 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. -// $Id: Window.cc,v 1.296 2004/08/13 12:39:02 fluxgen Exp $ +// $Id: Window.cc,v 1.297 2004/08/29 12:35:29 rathnor Exp $ #include "Window.hh"

@@ -350,7 +350,14 @@ // menu is cleaned up. We can't delete them here because they are

// still in the menu // (They need to be internal for most of the time so that if we // rebuild the menu, then they won't be removed. - mit->second->setInternalMenu(false); + if (mit->second->parent() == 0) { + // not attached to our windowmenu + // so we clean it up + delete mit->second; + } else { + // let the parent clean it up + mit->second->setInternalMenu(false); + } } #ifdef DEBUG

@@ -3562,9 +3569,10 @@

menu().removeAll(); // clear old items menu().disableTitle(); // not titlebar - if (!screen().windowMenuFilename().empty()) { - MenuCreator::createFromFile(screen().windowMenuFilename(), menu(), *this); - } else { + if (screen().windowMenuFilename().empty() || + ! MenuCreator::createFromFile(screen().windowMenuFilename(), menu(), *this)) + + { MenuCreator::createWindowMenuItem("shade", "", menu(), *this); MenuCreator::createWindowMenuItem("stick", "", menu(), *this); MenuCreator::createWindowMenuItem("maximize", "", menu(), *this);