summaryrefslogtreecommitdiff
path: root/src/Screen.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/Screen.cc')
-rw-r--r--src/Screen.cc48
1 files changed, 46 insertions, 2 deletions
diff --git a/src/Screen.cc b/src/Screen.cc
index 5b903b1..926193d 100644
--- a/src/Screen.cc
+++ b/src/Screen.cc
@@ -367,7 +367,7 @@ BScreen::BScreen(FbTk::ResourceManager &rm,
367#endif // SLIT 367#endif // SLIT
368 368
369 rm.unlock(); 369 rm.unlock();
370 370
371 XFlush(disp); 371 XFlush(disp);
372} 372}
373 373
@@ -384,6 +384,7 @@ void destroyAndClearList(A &a) {
384 384
385BScreen::~BScreen() { 385BScreen::~BScreen() {
386 386
387
387 if (! managed) 388 if (! managed)
388 return; 389 return;
389 390
@@ -394,6 +395,24 @@ BScreen::~BScreen() {
394 // we need to destroy it before we destroy workspaces 395 // we need to destroy it before we destroy workspaces
395 m_workspacemenu.reset(0); 396 m_workspacemenu.reset(0);
396 397
398 ExtraMenus::iterator mit = m_extramenus.begin();
399 ExtraMenus::iterator mit_end = m_extramenus.end();
400 for (; mit != mit_end; ++mit) {
401 // we set them to NOT internal so that they will be deleted when the
402 // menu is cleaned up. We can't delete them here because they are
403 // still in the menu
404 // (They need to be internal for most of the time so that if we
405 // rebuild the menu, then they won't be removed.
406 if (mit->second->parent() == 0) {
407 // not attached to our windowmenu
408 // so we clean it up
409 delete mit->second;
410 } else {
411 // let the parent clean it up
412 mit->second->setInternalMenu(false);
413 }
414 }
415
397 if (geom_pixmap != None) 416 if (geom_pixmap != None)
398 imageControl().removeImage(geom_pixmap); 417 imageControl().removeImage(geom_pixmap);
399 418
@@ -601,6 +620,25 @@ FbTk::Menu *BScreen::createMenu(const std::string &label) {
601 return menu; 620 return menu;
602} 621}
603 622
623void BScreen::addExtraWindowMenu(const char *label, FbTk::Menu *menu) {
624 menu->setInternalMenu();
625 menu->disableTitle();
626 m_extramenus.push_back(std::make_pair(label, menu));
627 // recreate window menu
628 m_windowmenu.reset(MenuCreator::createMenuType("windowmenu", screenNumber()));
629}
630
631void BScreen::removeExtraWindowMenu(FbTk::Menu *menu) {
632 ExtraMenus::iterator it = find_if(m_extramenus.begin(),
633 m_extramenus.end(),
634 FbTk::Compose(bind2nd(equal_to<FbTk::Menu *>(), menu),
635 FbTk::Select2nd<ExtraMenus::value_type>()));
636 if (it != m_extramenus.end())
637 m_extramenus.erase(it);
638 // recreate window menu
639 m_windowmenu.reset(MenuCreator::createMenuType("windowmenu", screenNumber()));
640}
641
604void BScreen::hideMenus() { 642void BScreen::hideMenus() {
605 // hide extra menus 643 // hide extra menus
606 Fluxbox::instance()->hideExtraMenus(*this); 644 Fluxbox::instance()->hideExtraMenus(*this);
@@ -684,6 +722,8 @@ void BScreen::reconfigure() {
684 //reconfigure menus 722 //reconfigure menus
685 m_workspacemenu->reconfigure(); 723 m_workspacemenu->reconfigure();
686 m_configmenu->reconfigure(); 724 m_configmenu->reconfigure();
725 // recreate window menu
726 m_windowmenu.reset(MenuCreator::createMenuType("windowmenu", screenNumber()));
687 727
688 // We need to check to see if the timestamps 728 // We need to check to see if the timestamps
689 // changed before we actually can restore the menus 729 // changed before we actually can restore the menus
@@ -963,9 +1003,11 @@ void BScreen::sendToWorkspace(unsigned int id, FluxboxWindow *win, bool changeWS
963 win->deiconify(); 1003 win->deiconify();
964 1004
965 // if the window isn't on current workspace, hide it 1005 // if the window isn't on current workspace, hide it
966 if (id != currentWorkspace()->workspaceID()) 1006 if (id != currentWorkspace()->workspaceID())
967 win->withdraw(true); 1007 win->withdraw(true);
968 1008
1009 windowMenu().hide();
1010
969 reassociateWindow(win, id, true); 1011 reassociateWindow(win, id, true);
970 1012
971 // if the window is on current workspace, show it. 1013 // if the window is on current workspace, show it.
@@ -1649,9 +1691,11 @@ void BScreen::dirFocus(FluxboxWindow &win, const FocusDir dir) {
1649} 1691}
1650void BScreen::initMenus() { 1692void BScreen::initMenus() {
1651 m_workspacemenu.reset(MenuCreator::createMenuType("workspacemenu", screenNumber())); 1693 m_workspacemenu.reset(MenuCreator::createMenuType("workspacemenu", screenNumber()));
1694 m_windowmenu.reset(MenuCreator::createMenuType("windowmenu", screenNumber()));
1652 initMenu(); 1695 initMenu();
1653} 1696}
1654 1697
1698
1655void BScreen::initMenu() { 1699void BScreen::initMenu() {
1656 1700
1657 if (m_rootmenu.get()) { 1701 if (m_rootmenu.get()) {