From aeeabc3b2f72e8cd4dac9ffc74b75a1c8e508c00 Mon Sep 17 00:00:00 2001 From: markt Date: Wed, 21 Mar 2007 22:49:37 +0000 Subject: hidemenus should hide custommenus, and fixed custommenu memleak --- ChangeLog | 3 +++ src/FbCommands.cc | 7 +++++-- src/FbCommands.hh | 5 ++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 22e74d5..7c4354e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,9 @@ (Format: Year/Month/Day) Changes for 1.0rc3: *07/03/21: + * HideMenus didn't work on CustomMenus, and also fixed a memleak with + CustomMenu (Mark + thanks Julien Trolet) + FbCommands.cc/hh * Added new command TypeAheadFocus (Mark) - syntax is the same as for NextWindow; when you run the command, you can start typing the title of the window, and it will gain focus; pressing diff --git a/src/FbCommands.cc b/src/FbCommands.cc index d53afd2..20d45e0 100644 --- a/src/FbCommands.cc +++ b/src/FbCommands.cc @@ -269,6 +269,8 @@ void HideMenuCmd::execute() { 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() { diff --git a/src/FbCommands.hh b/src/FbCommands.hh index 3bc5074..314d339 100644 --- a/src/FbCommands.hh +++ b/src/FbCommands.hh @@ -28,6 +28,9 @@ #include "Command.hh" +#include "FbTk/RefCount.hh" +#include "FbTk/Menu.hh" + #include namespace FbCommands { @@ -124,7 +127,7 @@ public: void execute(); private: std::string custom_menu_file; - + FbTk::RefCount m_menu; }; class ShowRootMenuCmd: public FbTk::Command { -- cgit v0.11.2