aboutsummaryrefslogtreecommitdiff
path: root/src/FbCommands.cc
diff options
context:
space:
mode:
authorMark Tiefenbruck <mark@fluxbox.org>2008-05-11 17:17:21 (GMT)
committerMark Tiefenbruck <mark@fluxbox.org>2008-05-11 17:17:21 (GMT)
commit72a45fae3c39323206e7d19913bb3ab17a691691 (patch)
treef920a884d39c8d5d161e0fa7a3c8a6296f7a3d71 /src/FbCommands.cc
parent85d8ac754974aae0a513b585e4f1810007cb157c (diff)
downloadfluxbox_pavel-72a45fae3c39323206e7d19913bb3ab17a691691.zip
fluxbox_pavel-72a45fae3c39323206e7d19913bb3ab17a691691.tar.bz2
reuse some menu pointers instead of using delete/new
Diffstat (limited to 'src/FbCommands.cc')
-rw-r--r--src/FbCommands.cc25
1 files changed, 12 insertions, 13 deletions
diff --git a/src/FbCommands.cc b/src/FbCommands.cc
index 91490d3..4eabae2 100644
--- a/src/FbCommands.cc
+++ b/src/FbCommands.cc
@@ -76,13 +76,8 @@ void showMenu(const BScreen &screen, FbTk::Menu &menu) {
76 // special case for root menu 76 // special case for root menu
77 if (&menu == &screen.rootMenu()) { 77 if (&menu == &screen.rootMenu()) {
78 Fluxbox* fb = Fluxbox::instance(); 78 Fluxbox* fb = Fluxbox::instance();
79 if(fb->menuTimestampsChanged()) { 79 if(fb->menuTimestampsChanged())
80 // we dont show the menu here because fluxbox
81 // will bring up the rootmenu after the timed
82 // reread of the menu
83 fb->rereadMenu(); 80 fb->rereadMenu();
84 return;
85 }
86 } 81 }
87 82
88 Window root_ret; // not used 83 Window root_ret; // not used
@@ -335,8 +330,8 @@ void ShowClientMenuCmd::execute() {
335 m_list.push_back(static_cast<FluxboxWindow *>(*it)); 330 m_list.push_back(static_cast<FluxboxWindow *>(*it));
336 } 331 }
337 332
338 m_menu = new ClientMenu(*screen, m_list, 0); 333 m_menu.reset(new ClientMenu(*screen, m_list, 0));
339 ::showMenu(*screen, **m_menu); 334 ::showMenu(*screen, *m_menu.get());
340} 335}
341 336
342REGISTER_COMMAND_WITH_ARGS(custommenu, FbCommands::ShowCustomMenuCmd, void); 337REGISTER_COMMAND_WITH_ARGS(custommenu, FbCommands::ShowCustomMenuCmd, void);
@@ -347,11 +342,15 @@ void ShowCustomMenuCmd::execute() {
347 BScreen *screen = Fluxbox::instance()->mouseScreen(); 342 BScreen *screen = Fluxbox::instance()->mouseScreen();
348 if (screen == 0) 343 if (screen == 0)
349 return; 344 return;
350 m_menu = MenuCreator::createFromFile(custom_menu_file, 345
351 screen->screenNumber()); 346 if (m_menu.get()) {
352 if (!m_menu.get()) 347 m_menu->removeAll();
353 return; 348 m_menu->setLabel("");
354 ::showMenu(*screen, **m_menu); 349 } else
350 m_menu.reset(screen->createMenu(""));
351
352 MenuCreator::createFromFile(custom_menu_file, *m_menu.get());
353 ::showMenu(*screen, *m_menu.get());
355} 354}
356 355
357REGISTER_COMMAND(rootmenu, FbCommands::ShowRootMenuCmd, void); 356REGISTER_COMMAND(rootmenu, FbCommands::ShowRootMenuCmd, void);