diff options
author | fluxgen <fluxgen> | 2003-02-15 02:03:09 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2003-02-15 02:03:09 (GMT) |
commit | 6d159ae8c7761869f6a38d2c61ab6173640fcd0f (patch) | |
tree | ff5ca25790f0e0a1f0bab77424bb981c4043617d | |
parent | 0a01f73b51766fc5619c5e38424e4aa344b47583 (diff) | |
download | fluxbox-6d159ae8c7761869f6a38d2c61ab6173640fcd0f.zip fluxbox-6d159ae8c7761869f6a38d2c61ab6173640fcd0f.tar.bz2 |
fixed style menu and some minor indentation
-rw-r--r-- | src/Screen.cc | 217 |
1 files changed, 104 insertions, 113 deletions
diff --git a/src/Screen.cc b/src/Screen.cc index 33fca08..14b344f 100644 --- a/src/Screen.cc +++ b/src/Screen.cc | |||
@@ -22,7 +22,7 @@ | |||
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
23 | // DEALINGS IN THE SOFTWARE. | 23 | // DEALINGS IN THE SOFTWARE. |
24 | 24 | ||
25 | // $Id: Screen.cc,v 1.103 2003/02/09 14:11:12 rathnor Exp $ | 25 | // $Id: Screen.cc,v 1.104 2003/02/15 02:03:09 fluxgen Exp $ |
26 | 26 | ||
27 | 27 | ||
28 | #include "Screen.hh" | 28 | #include "Screen.hh" |
@@ -130,10 +130,6 @@ int anotherWMRunning(Display *display, XErrorEvent *) { | |||
130 | return(-1); | 130 | return(-1); |
131 | } | 131 | } |
132 | 132 | ||
133 | int dcmp(const void *one, const void *two) { | ||
134 | return (strcmp((*(char **) one), (*(char **) two))); | ||
135 | } | ||
136 | |||
137 | FbTk::Menu *createMenuFromScreen(BScreen &screen) { | 133 | FbTk::Menu *createMenuFromScreen(BScreen &screen) { |
138 | FbTk::Menu *menu = new LayeredMenu(*screen.menuTheme(), | 134 | FbTk::Menu *menu = new LayeredMenu(*screen.menuTheme(), |
139 | screen.getScreenNumber(), | 135 | screen.getScreenNumber(), |
@@ -306,13 +302,18 @@ template <> | |||
306 | void FbTk::ThemeItem<std::string>::load() { } | 302 | void FbTk::ThemeItem<std::string>::load() { } |
307 | 303 | ||
308 | template <> | 304 | template <> |
309 | void FbTk::ThemeItem<std::string>::setDefaultValue() { *(*this) = ""; } | 305 | void FbTk::ThemeItem<std::string>::setDefaultValue() { |
306 | *(*this) = ""; | ||
307 | } | ||
310 | 308 | ||
311 | template <> | 309 | template <> |
312 | void FbTk::ThemeItem<std::string>::setFromString(const char *str) { *(*this) = (str ? str : ""); } | 310 | void FbTk::ThemeItem<std::string>::setFromString(const char *str) { |
311 | *(*this) = (str ? str : ""); | ||
312 | } | ||
313 | 313 | ||
314 | BScreen::ScreenResource::ScreenResource(ResourceManager &rm, | 314 | BScreen::ScreenResource::ScreenResource(ResourceManager &rm, |
315 | const std::string &scrname, const std::string &altscrname): | 315 | const std::string &scrname, |
316 | const std::string &altscrname): | ||
316 | toolbar_on_top(rm, false, scrname+".toolbar.onTop", altscrname+".Toolbar.OnTop"), | 317 | toolbar_on_top(rm, false, scrname+".toolbar.onTop", altscrname+".Toolbar.OnTop"), |
317 | toolbar_auto_hide(rm, false, scrname+".toolbar.autoHide", altscrname+".Toolbar.AutoHide"), | 318 | toolbar_auto_hide(rm, false, scrname+".toolbar.autoHide", altscrname+".Toolbar.AutoHide"), |
318 | image_dither(rm, false, scrname+".imageDither", altscrname+".ImageDither"), | 319 | image_dither(rm, false, scrname+".imageDither", altscrname+".ImageDither"), |
@@ -394,7 +395,7 @@ BScreen::BScreen(ResourceManager &rm, | |||
394 | 395 | ||
395 | image_control = | 396 | image_control = |
396 | new FbTk::ImageControl(scrn, true, fluxbox->colorsPerChannel(), | 397 | new FbTk::ImageControl(scrn, true, fluxbox->colorsPerChannel(), |
397 | fluxbox->getCacheLife(), fluxbox->getCacheMax()); | 398 | fluxbox->getCacheLife(), fluxbox->getCacheMax()); |
398 | image_control->installRootColormap(); | 399 | image_control->installRootColormap(); |
399 | root_colormap_installed = true; | 400 | root_colormap_installed = true; |
400 | 401 | ||
@@ -416,9 +417,9 @@ BScreen::BScreen(ResourceManager &rm, | |||
416 | theme->getWindowStyle().tab.font.rotate(0); | 417 | theme->getWindowStyle().tab.font.rotate(0); |
417 | } | 418 | } |
418 | 419 | ||
419 | const char *s = i18n->getMessage( | 420 | const char *s = i18n->getMessage( |
420 | FBNLS::ScreenSet, FBNLS::ScreenPositionLength, | 421 | FBNLS::ScreenSet, FBNLS::ScreenPositionLength, |
421 | "W: 0000 x H: 0000"); // W is wide! | 422 | "W: 0000 x H: 0000"); |
422 | 423 | ||
423 | int l = strlen(s); | 424 | int l = strlen(s); |
424 | 425 | ||
@@ -503,6 +504,7 @@ BScreen::BScreen(ResourceManager &rm, | |||
503 | //update menus | 504 | //update menus |
504 | m_rootmenu->update(); | 505 | m_rootmenu->update(); |
505 | m_configmenu->update(); | 506 | m_configmenu->update(); |
507 | |||
506 | #ifdef SLIT | 508 | #ifdef SLIT |
507 | if (m_slit.get()) | 509 | if (m_slit.get()) |
508 | m_slit->reconfigure(); | 510 | m_slit->reconfigure(); |
@@ -692,7 +694,8 @@ void BScreen::reconfigure() { | |||
692 | geom_window, geom_pixmap); | 694 | geom_window, geom_pixmap); |
693 | } | 695 | } |
694 | } | 696 | } |
695 | if (tmp) image_control->removeImage(tmp); | 697 | if (tmp) |
698 | image_control->removeImage(tmp); | ||
696 | 699 | ||
697 | XSetWindowBorderWidth(getBaseDisplay()->getXDisplay(), geom_window, | 700 | XSetWindowBorderWidth(getBaseDisplay()->getXDisplay(), geom_window, |
698 | theme->getBorderWidth()); | 701 | theme->getBorderWidth()); |
@@ -704,11 +707,11 @@ void BScreen::reconfigure() { | |||
704 | m_configmenu->reconfigure(); | 707 | m_configmenu->reconfigure(); |
705 | 708 | ||
706 | { | 709 | { |
707 | int remember_sub = m_rootmenu->currentSubmenu(); | 710 | //int remember_sub = m_rootmenu->currentSubmenu(); |
708 | initMenu(); | 711 | initMenu(); |
709 | raiseWindows(Workspace::Stack()); | 712 | raiseWindows(Workspace::Stack()); |
710 | m_rootmenu->reconfigure(); | 713 | m_rootmenu->reconfigure(); |
711 | m_rootmenu->drawSubmenu(remember_sub); | 714 | //m_rootmenu->drawSubmenu(remember_sub); |
712 | } | 715 | } |
713 | 716 | ||
714 | // m_toolbar->setPlacement(*resource.toolbar_placement); | 717 | // m_toolbar->setPlacement(*resource.toolbar_placement); |
@@ -1132,7 +1135,8 @@ void BScreen::setupWindowActions(FluxboxWindow &win) { | |||
1132 | 1135 | ||
1133 | //create new buttons | 1136 | //create new buttons |
1134 | if (win.isIconifiable()) { | 1137 | if (win.isIconifiable()) { |
1135 | FbTk::Button *iconifybtn = new WinButton(WinButton::MINIMIZE, frame.titlebar(), 0, 0, 10, 10); | 1138 | FbTk::Button *iconifybtn = new WinButton(WinButton::MINIMIZE, frame.titlebar(), |
1139 | 0, 0, 10, 10); | ||
1136 | iconifybtn->setOnClick(iconify_cmd); | 1140 | iconifybtn->setOnClick(iconify_cmd); |
1137 | iconifybtn->show(); | 1141 | iconifybtn->show(); |
1138 | frame.addRightButton(iconifybtn); | 1142 | frame.addRightButton(iconifybtn); |
@@ -1142,7 +1146,8 @@ void BScreen::setupWindowActions(FluxboxWindow &win) { | |||
1142 | } | 1146 | } |
1143 | 1147 | ||
1144 | if (win.isMaximizable()) { | 1148 | if (win.isMaximizable()) { |
1145 | FbTk::Button *maximizebtn = new WinButton(WinButton::MAXIMIZE, frame.titlebar(), 0, 0, 10, 10); | 1149 | FbTk::Button *maximizebtn = new WinButton(WinButton::MAXIMIZE, frame.titlebar(), |
1150 | 0, 0, 10, 10); | ||
1146 | 1151 | ||
1147 | maximizebtn->setOnClick(maximize_cmd, 1); | 1152 | maximizebtn->setOnClick(maximize_cmd, 1); |
1148 | maximizebtn->setOnClick(maximize_horiz_cmd, 3); | 1153 | maximizebtn->setOnClick(maximize_horiz_cmd, 3); |
@@ -1173,7 +1178,7 @@ void BScreen::setupWindowActions(FluxboxWindow &win) { | |||
1173 | // setup menu | 1178 | // setup menu |
1174 | FbTk::Menu &menu = win.getWindowmenu(); | 1179 | FbTk::Menu &menu = win.getWindowmenu(); |
1175 | menu.removeAll(); // clear old items | 1180 | menu.removeAll(); // clear old items |
1176 | menu.disableTitle(); | 1181 | menu.disableTitle(); // not titlebar |
1177 | 1182 | ||
1178 | // set new menu items | 1183 | // set new menu items |
1179 | menu.insert("Shade", shade_cmd); | 1184 | menu.insert("Shade", shade_cmd); |
@@ -1252,7 +1257,6 @@ string BScreen::getNameOfWorkspace(unsigned int workspace) const { | |||
1252 | } else { | 1257 | } else { |
1253 | return ""; | 1258 | return ""; |
1254 | } | 1259 | } |
1255 | |||
1256 | } | 1260 | } |
1257 | 1261 | ||
1258 | void BScreen::reassociateGroup(FluxboxWindow *w, unsigned int wkspc_id, bool ignore_sticky) { | 1262 | void BScreen::reassociateGroup(FluxboxWindow *w, unsigned int wkspc_id, bool ignore_sticky) { |
@@ -1374,9 +1378,7 @@ void BScreen::prevFocus(int opts) { | |||
1374 | } | 1378 | } |
1375 | } | 1379 | } |
1376 | 1380 | ||
1377 | //--------- raiseFocus ----------- | 1381 | |
1378 | // Raise the current focused window | ||
1379 | //-------------------------------- | ||
1380 | void BScreen::raiseFocus() { | 1382 | void BScreen::raiseFocus() { |
1381 | bool have_focused = false; | 1383 | bool have_focused = false; |
1382 | int focused_window_number = -1; | 1384 | int focused_window_number = -1; |
@@ -1466,7 +1468,7 @@ void BScreen::initMenu() { | |||
1466 | fb->saveMenuFilename(fb->getMenuFilename()); | 1468 | fb->saveMenuFilename(fb->getMenuFilename()); |
1467 | } | 1469 | } |
1468 | 1470 | ||
1469 | // looks through a menufile and adds correct items to the root-menu. | 1471 | /// looks through a menufile and adds correct items to the root-menu. |
1470 | bool BScreen::parseMenuFile(ifstream &file, FbTk::Menu &menu, int &row) { | 1472 | bool BScreen::parseMenuFile(ifstream &file, FbTk::Menu &menu, int &row) { |
1471 | 1473 | ||
1472 | string line; | 1474 | string line; |
@@ -1524,26 +1526,26 @@ bool BScreen::parseMenuFile(ifstream &file, FbTk::Menu &menu, int &row) { | |||
1524 | FbTk::RefCount<FbTk::Command> exit_fb_cmd(new FbCommands::ExitFluxboxCmd()); | 1526 | FbTk::RefCount<FbTk::Command> exit_fb_cmd(new FbCommands::ExitFluxboxCmd()); |
1525 | menu.insert(str_label.c_str(), exit_fb_cmd); | 1527 | menu.insert(str_label.c_str(), exit_fb_cmd); |
1526 | } | 1528 | } |
1527 | } // end of exit | 1529 | } else if (str_key == "style") { // style |
1528 | /*else if (str_key == "style") { // style | 1530 | if (!( str_label.size() && str_cmd.size())) { |
1529 | if (!( str_label.size() && str_cmd.size())) { | 1531 | fprintf(stderr, |
1530 | fprintf(stderr, | 1532 | i18n-> |
1531 | i18n-> | 1533 | getMessage( |
1532 | getMessage( | 1534 | FBNLS::ScreenSet, FBNLS::ScreenSTYLEError, |
1533 | FBNLS::ScreenSet, FBNLS::ScreenSTYLEError, | 1535 | "BScreen::parseMenuFile: [style] error, " |
1534 | "BScreen::parseMenuFile: [style] error, " | 1536 | "no menu label and/or filename defined\n")); |
1535 | "no menu label and/or filename defined\n")); | 1537 | cerr<<"Row: "<<row<<endl; |
1536 | cerr<<"Row: "<<row<<endl; | 1538 | } else { |
1537 | } else { | 1539 | // perform shell style ~ home directory expansion |
1538 | // perform shell style ~ home directory expansion | 1540 | // and insert style |
1539 | // and insert style | 1541 | FbTk::RefCount<FbTk::Command> |
1540 | menu->insert(str_label.c_str(), BScreen::SETSTYLE, | 1542 | setstyle_cmd(new FbCommands:: |
1541 | StringUtil::expandFilename(str_cmd).c_str()); | 1543 | SetStyleCmd(StringUtil:: |
1544 | expandFilename(str_cmd))); | ||
1545 | menu.insert(str_label.c_str(), setstyle_cmd); | ||
1542 | 1546 | ||
1543 | } | 1547 | } |
1544 | } // end of style | 1548 | } else if (str_key == "config") { |
1545 | */ | ||
1546 | else if (str_key == "config") { | ||
1547 | if (! str_label.size()) { | 1549 | if (! str_label.size()) { |
1548 | fprintf(stderr, | 1550 | fprintf(stderr, |
1549 | i18n-> | 1551 | i18n-> |
@@ -1580,9 +1582,12 @@ bool BScreen::parseMenuFile(ifstream &file, FbTk::Menu &menu, int &row) { | |||
1580 | fprintf(stderr, | 1582 | fprintf(stderr, |
1581 | i18n-> | 1583 | i18n-> |
1582 | getMessage( | 1584 | getMessage( |
1583 | FBNLS::ScreenSet, FBNLS::ScreenINCLUDEErrorReg, | 1585 | FBNLS::ScreenSet, |
1586 | FBNLS::ScreenINCLUDEErrorReg, | ||
1584 | "BScreen::parseMenuFile: [include] error: " | 1587 | "BScreen::parseMenuFile: [include] error: " |
1585 | "'%s' is not a regular file\n"), newfile.c_str()); | 1588 | "'%s' is not a regular file\n"), |
1589 | newfile.c_str()); | ||
1590 | |||
1586 | cerr<<"Row: "<<row<<endl; | 1591 | cerr<<"Row: "<<row<<endl; |
1587 | } | 1592 | } |
1588 | 1593 | ||
@@ -1619,7 +1624,7 @@ bool BScreen::parseMenuFile(ifstream &file, FbTk::Menu &menu, int &row) { | |||
1619 | menu.insert(str_label.c_str(), submenu); | 1624 | menu.insert(str_label.c_str(), submenu); |
1620 | // save to list so we can delete it later | 1625 | // save to list so we can delete it later |
1621 | rootmenuList.push_back(submenu); | 1626 | rootmenuList.push_back(submenu); |
1622 | 1627 | ||
1623 | } | 1628 | } |
1624 | } // end of sub | 1629 | } // end of sub |
1625 | else if (str_key == "restart") { | 1630 | else if (str_key == "restart") { |
@@ -1653,22 +1658,23 @@ bool BScreen::parseMenuFile(ifstream &file, FbTk::Menu &menu, int &row) { | |||
1653 | FbTk::RefCount<FbTk::Command> reconfig_fb_cmd(new FbCommands::ReconfigureFluxboxCmd()); | 1658 | FbTk::RefCount<FbTk::Command> reconfig_fb_cmd(new FbCommands::ReconfigureFluxboxCmd()); |
1654 | menu.insert(str_label.c_str(), reconfig_fb_cmd); | 1659 | menu.insert(str_label.c_str(), reconfig_fb_cmd); |
1655 | } | 1660 | } |
1656 | } // end of reconf | 1661 | } else if (str_key == "stylesdir" || str_key == "stylesmenu") { |
1657 | /* else if (str_key == "stylesdir" || str_key == "stylesmenu") { | 1662 | |
1658 | bool newmenu = (str_key == "stylesmenu"); | 1663 | bool newmenu = (str_key == "stylesmenu"); |
1659 | if (!( str_label.size() && str_cmd.size()) && newmenu) { | 1664 | |
1660 | fprintf(stderr, | 1665 | if (!( str_label.size() && str_cmd.size()) && newmenu) { |
1661 | i18n-> | 1666 | fprintf(stderr, |
1662 | getMessage( | 1667 | i18n-> |
1663 | FBNLS::ScreenSet, FBNLS::ScreenSTYLESDIRError, | 1668 | getMessage( |
1664 | "BScreen::parseMenuFile: [stylesdir/stylesmenu]" | 1669 | FBNLS::ScreenSet, FBNLS::ScreenSTYLESDIRError, |
1665 | " error, no directory defined\n")); | 1670 | "BScreen::parseMenuFile: [stylesdir/stylesmenu]" |
1666 | cerr<<"Row: "<<row<<endl; | 1671 | " error, no directory defined\n")); |
1667 | } else { // else 'y' | 1672 | cerr<<"Row: "<<row<<endl; |
1668 | createStyleMenu(menu, newmenu, str_label.c_str(), | 1673 | } else { |
1669 | (newmenu) ? str_cmd.c_str() : str_label.c_str()); | 1674 | createStyleMenu(menu, newmenu, str_label.c_str(), |
1670 | } // end of else 'y' | 1675 | (newmenu) ? str_cmd.c_str() : str_label.c_str()); |
1671 | } */// end of stylesdir | 1676 | } |
1677 | } // end of stylesdir | ||
1672 | else if (str_key == "workspaces") { | 1678 | else if (str_key == "workspaces") { |
1673 | if (!str_label.size()) { | 1679 | if (!str_label.size()) { |
1674 | fprintf(stderr, | 1680 | fprintf(stderr, |
@@ -1692,15 +1698,18 @@ void BScreen::setupConfigmenu(FbTk::Menu &menu) { | |||
1692 | using namespace FBNLS; | 1698 | using namespace FBNLS; |
1693 | 1699 | ||
1694 | FbTk::MacroCommand *s_a_reconf_macro = new FbTk::MacroCommand(); | 1700 | FbTk::MacroCommand *s_a_reconf_macro = new FbTk::MacroCommand(); |
1695 | FbTk::RefCount<FbTk::Command> saverc_cmd(new FbTk::SimpleCommand<Fluxbox>(*Fluxbox::instance(), &Fluxbox::save_rc)); | 1701 | FbTk::RefCount<FbTk::Command> saverc_cmd(new FbTk::SimpleCommand<Fluxbox>(*Fluxbox::instance(), |
1702 | &Fluxbox::save_rc)); | ||
1696 | FbTk::RefCount<FbTk::Command> reconf_cmd(new FbCommands::ReconfigureFluxboxCmd()); | 1703 | FbTk::RefCount<FbTk::Command> reconf_cmd(new FbCommands::ReconfigureFluxboxCmd()); |
1697 | s_a_reconf_macro->add(saverc_cmd); | 1704 | s_a_reconf_macro->add(saverc_cmd); |
1698 | s_a_reconf_macro->add(reconf_cmd); | 1705 | s_a_reconf_macro->add(reconf_cmd); |
1699 | FbTk::RefCount<FbTk::Command> save_and_reconfigure(s_a_reconf_macro); | 1706 | FbTk::RefCount<FbTk::Command> save_and_reconfigure(s_a_reconf_macro); |
1707 | |||
1700 | #ifdef SLIT | 1708 | #ifdef SLIT |
1701 | if (getSlit() != 0) | 1709 | if (getSlit() != 0) |
1702 | menu.insert("Slit", &getSlit()->menu()); | 1710 | menu.insert("Slit", &getSlit()->menu()); |
1703 | #endif // SLIT | 1711 | #endif // SLIT |
1712 | |||
1704 | menu.insert(i18n->getMessage( | 1713 | menu.insert(i18n->getMessage( |
1705 | ToolbarSet, ToolbarToolbarTitle, | 1714 | ToolbarSet, ToolbarToolbarTitle, |
1706 | "Toolbar"), &m_toolbar->menu()); | 1715 | "Toolbar"), &m_toolbar->menu()); |
@@ -1751,59 +1760,41 @@ void BScreen::setupConfigmenu(FbTk::Menu &menu) { | |||
1751 | menu.update(); | 1760 | menu.update(); |
1752 | } | 1761 | } |
1753 | 1762 | ||
1754 | void BScreen::createStyleMenu(FbTk::Menu &menu, bool newmenu, const char *label, const char *directory) { | 1763 | void BScreen::createStyleMenu(FbTk::Menu &menu, bool newmenu, |
1755 | /* | 1764 | const char *label, const char *directory) { |
1765 | |||
1756 | // perform shell style ~ home directory expansion | 1766 | // perform shell style ~ home directory expansion |
1757 | string stylesdir(StringUtil::expandFilename(directory ? directory : "")); | 1767 | string stylesdir(StringUtil::expandFilename(directory ? directory : "")); |
1758 | 1768 | ||
1759 | I18n *i18n = I18n::instance(); | 1769 | I18n *i18n = I18n::instance(); |
1760 | struct stat statbuf; | 1770 | struct stat statbuf; |
1761 | 1771 | ||
1762 | if (! stat(stylesdir.c_str(), &statbuf)) { // stat | 1772 | if (! stat(stylesdir.c_str(), &statbuf)) { |
1763 | if (S_ISDIR(statbuf.st_mode)) { // dir | 1773 | if (S_ISDIR(statbuf.st_mode)) { // is a directory? |
1764 | Rootmenu *stylesmenu; | ||
1765 | if (newmenu) | ||
1766 | stylesmenu = new Rootmenu(this); | ||
1767 | else | ||
1768 | stylesmenu = menu; | ||
1769 | 1774 | ||
1770 | DirHelper d(stylesdir.c_str()); | 1775 | DirHelper d(stylesdir.c_str()); |
1771 | int entries = 0; | 1776 | std::vector<std::string> filelist(d.entries()); |
1772 | struct dirent *p; | 1777 | for (size_t file_index = 0; file_index < d.entries(); ++file_index) |
1773 | 1778 | filelist[file_index] = d.readFilename(); | |
1774 | // get the total number of directory entries | ||
1775 | while ((p = d.read())) entries++; | ||
1776 | |||
1777 | d.rewind(); | ||
1778 | 1779 | ||
1779 | char **ls = new char* [entries]; | 1780 | std::sort(filelist.begin(), filelist.end(), greater<string>()); |
1780 | int index = 0; | ||
1781 | while ((p = d.read())) | ||
1782 | ls[index++] = StringUtil::strdup(p->d_name); | ||
1783 | 1781 | ||
1784 | qsort(ls, entries, sizeof(char *), dcmp); | 1782 | int slen = stylesdir.size(); |
1785 | 1783 | for (size_t file_index = 0; file_index < d.entries(); file_index++) { | |
1786 | int n, slen = strlen(stylesdir.c_str()); | 1784 | int nlen = filelist[file_index].size(); |
1787 | for (n = 0; n < entries; n++) { // for | ||
1788 | int nlen = strlen(ls[n]); | ||
1789 | char style[MAXPATHLEN + 1]; | 1785 | char style[MAXPATHLEN + 1]; |
1790 | strncpy(style, stylesdir.c_str(), slen); | 1786 | strncpy(style, stylesdir.c_str(), slen); |
1791 | *(style + slen) = '/'; | 1787 | *(style + slen) = '/'; |
1792 | strncpy(style + slen + 1, ls[n], nlen + 1); | 1788 | strncpy(style + slen + 1, filelist[file_index].c_str(), nlen + 1); |
1793 | if ((! stat(style, &statbuf)) && S_ISREG(statbuf.st_mode)) | 1789 | if ( !stat(style, &statbuf) && S_ISREG(statbuf.st_mode)) { |
1794 | stylesmenu->insert(ls[n], BScreen::SETSTYLE, style); | 1790 | FbTk::RefCount<FbTk::Command> setstyle_cmd(new FbCommands:: |
1795 | delete [] ls[n]; | 1791 | SetStyleCmd(style)); |
1792 | menu.insert(filelist[file_index].c_str(), setstyle_cmd); | ||
1793 | } | ||
1796 | } | 1794 | } |
1797 | 1795 | ||
1798 | delete [] ls; | 1796 | menu.update(); |
1799 | 1797 | // ?? | |
1800 | stylesmenu->update(); | ||
1801 | if (newmenu) { | ||
1802 | stylesmenu->setLabel(label); | ||
1803 | menu->insert(label, stylesmenu); | ||
1804 | // rootmenuList.push_back(stylesmenu); | ||
1805 | } | ||
1806 | |||
1807 | Fluxbox::instance()->saveMenuFilename(stylesdir.c_str()); | 1798 | Fluxbox::instance()->saveMenuFilename(stylesdir.c_str()); |
1808 | } else { // dir | 1799 | } else { // dir |
1809 | fprintf(stderr, | 1800 | fprintf(stderr, |
@@ -1821,29 +1812,29 @@ void BScreen::createStyleMenu(FbTk::Menu &menu, bool newmenu, const char *label, | |||
1821 | FBNLS::ScreenSet, FBNLS::ScreenSTYLESDIRErrorNoExist, | 1812 | FBNLS::ScreenSet, FBNLS::ScreenSTYLESDIRErrorNoExist, |
1822 | "BScreen::parseMenuFile: [stylesdir/stylesmenu]" | 1813 | "BScreen::parseMenuFile: [stylesdir/stylesmenu]" |
1823 | " error, %s does not exist\n"), stylesdir.c_str()); | 1814 | " error, %s does not exist\n"), stylesdir.c_str()); |
1824 | } // end of 'stat' | 1815 | } // end of stat |
1825 | */ | 1816 | |
1826 | } | 1817 | } |
1827 | 1818 | ||
1828 | void BScreen::shutdown() { | 1819 | void BScreen::shutdown() { |
1829 | XSelectInput(getBaseDisplay()->getXDisplay(), getRootWindow(), NoEventMask); | 1820 | XSelectInput(getBaseDisplay()->getXDisplay(), getRootWindow(), NoEventMask); |
1830 | XSync(getBaseDisplay()->getXDisplay(), False); | 1821 | XSync(getBaseDisplay()->getXDisplay(), False); |
1831 | 1822 | ||
1832 | { | 1823 | |
1833 | Workspaces::iterator it = workspacesList.begin(); | 1824 | Workspaces::iterator it = workspacesList.begin(); |
1834 | Workspaces::iterator it_end = workspacesList.end(); | 1825 | Workspaces::iterator it_end = workspacesList.end(); |
1835 | for (; it != it_end; ++it) { | 1826 | for (; it != it_end; ++it) { |
1836 | (*it)->shutdown(); | 1827 | (*it)->shutdown(); |
1837 | } | ||
1838 | } | 1828 | } |
1839 | 1829 | ||
1840 | { | 1830 | |
1841 | while (!iconList.empty()) { | 1831 | |
1842 | iconList.back()->restore(true); // restore with remap | 1832 | while (!iconList.empty()) { |
1843 | delete iconList.back(); // the window removes it self from iconlist | 1833 | iconList.back()->restore(true); // restore with remap |
1844 | } | 1834 | delete iconList.back(); // the window removes it self from iconlist |
1845 | } | 1835 | } |
1846 | 1836 | ||
1837 | |||
1847 | #ifdef SLIT | 1838 | #ifdef SLIT |
1848 | if (m_slit.get()) | 1839 | if (m_slit.get()) |
1849 | m_slit->shutdown(); | 1840 | m_slit->shutdown(); |