hidemenus hide custommenus and fix custommenu memleak
markt markt
3 files changed,
13 insertions(+),
3 deletions(-)
M
src/FbCommands.cc
→
src/FbCommands.cc
@@ -269,6 +269,8 @@ if (screen->rootMenu().isVisible())
screen->rootMenu().hide(); if (screen->workspaceMenu().isVisible()) screen->workspaceMenu().hide(); + if (FbTk::Menu::shownMenu()) + FbTk::Menu::shownMenu()->hide(); } ShowCustomMenuCmd::ShowCustomMenuCmd(const string &arguments) : custom_menu_file(arguments) {}@@ -277,8 +279,9 @@ void ShowCustomMenuCmd::execute() {
BScreen *screen = Fluxbox::instance()->mouseScreen(); if (screen == 0) return; - ::showMenu(*screen, *MenuCreator::createFromFile(custom_menu_file, - screen->screenNumber(), true)); + m_menu = MenuCreator::createFromFile(custom_menu_file, + screen->screenNumber(), true); + ::showMenu(*screen, **m_menu); } void ShowRootMenuCmd::execute() {
M
src/FbCommands.hh
→
src/FbCommands.hh
@@ -28,6 +28,9 @@ #define FBCOMMANDS_HH
#include "Command.hh" +#include "FbTk/RefCount.hh" +#include "FbTk/Menu.hh" + #include <string> namespace FbCommands {@@ -124,7 +127,7 @@ explicit ShowCustomMenuCmd(const std::string &arguments);
void execute(); private: std::string custom_menu_file; - + FbTk::RefCount<FbTk::Menu> m_menu; }; class ShowRootMenuCmd: public FbTk::Command {