summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2002-08-14 22:21:06 (GMT)
committerfluxgen <fluxgen>2002-08-14 22:21:06 (GMT)
commit0b25dc379cdcea545c93fcc6108c500f805c1f10 (patch)
treedb2e60eb15f5c4032ecfcc81b70080e159990558 /src
parentab4fef4450d40364cd97f7ad2af227cb957014c3 (diff)
downloadfluxbox_lack-0b25dc379cdcea545c93fcc6108c500f805c1f10.zip
fluxbox_lack-0b25dc379cdcea545c93fcc6108c500f805c1f10.tar.bz2
updated fbatoms stuff and changed some strings to std string
Diffstat (limited to 'src')
-rw-r--r--src/Screen.cc78
1 files changed, 37 insertions, 41 deletions
diff --git a/src/Screen.cc b/src/Screen.cc
index 9ff9c8a..f968ac7 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.61 2002/08/11 22:28:18 fluxgen Exp $ 25// $Id: Screen.cc,v 1.62 2002/08/14 22:21:06 fluxgen Exp $
26 26
27//use GNU extensions 27//use GNU extensions
28#ifndef _GNU_SOURCE 28#ifndef _GNU_SOURCE
@@ -682,7 +682,7 @@ void BScreen::updateWorkspaceNamesAtom() {
682 682
683 if (XStringListToTextProperty(names, number_of_desks, &text)) { 683 if (XStringListToTextProperty(names, number_of_desks, &text)) {
684 XSetTextProperty(getBaseDisplay()->getXDisplay(), getRootWindow(), 684 XSetTextProperty(getBaseDisplay()->getXDisplay(), getRootWindow(),
685 &text, getBaseDisplay()->getGnomeWorkspaceNamesAtom()); 685 &text, FbAtoms::instance()->getGnomeWorkspaceNamesAtom());
686 XFree(text.value); 686 XFree(text.value);
687 } 687 }
688 688
@@ -900,7 +900,7 @@ void BScreen::updateNetizenCurrentWorkspace() {
900 //update _WIN_WORKSPACE 900 //update _WIN_WORKSPACE
901 int gnome_workspace = getCurrentWorkspaceID(); 901 int gnome_workspace = getCurrentWorkspaceID();
902 XChangeProperty(getBaseDisplay()->getXDisplay(), getRootWindow(), 902 XChangeProperty(getBaseDisplay()->getXDisplay(), getRootWindow(),
903 getBaseDisplay()->getGnomeWorkspaceAtom(), XA_CARDINAL, 32, PropModeReplace, 903 FbAtoms::instance()->getGnomeWorkspaceAtom(), XA_CARDINAL, 32, PropModeReplace,
904 (unsigned char *)&gnome_workspace, 1); 904 (unsigned char *)&gnome_workspace, 1);
905 updateGnomeClientList(); 905 updateGnomeClientList();
906 #endif 906 #endif
@@ -933,7 +933,7 @@ void BScreen::updateNetizenWorkspaceCount() {
933 { 933 {
934 int numworkspaces = getCount(); 934 int numworkspaces = getCount();
935 XChangeProperty(getBaseDisplay()->getXDisplay(), getRootWindow(), 935 XChangeProperty(getBaseDisplay()->getXDisplay(), getRootWindow(),
936 getBaseDisplay()->getGnomeWorkspaceCountAtom(), XA_CARDINAL, 32, PropModeReplace, 936 FbAtoms::instance()->getGnomeWorkspaceCountAtom(), XA_CARDINAL, 32, PropModeReplace,
937 (unsigned char *)&numworkspaces, 1); 937 (unsigned char *)&numworkspaces, 1);
938 } 938 }
939 #endif 939 #endif
@@ -1348,12 +1348,11 @@ bool BScreen::parseMenuFile(ifstream &file, Rootmenu *menu, int &row) {
1348 "no menu label and/or filename defined\n")); 1348 "no menu label and/or filename defined\n"));
1349 cerr<<"Row: "<<row<<endl; 1349 cerr<<"Row: "<<row<<endl;
1350 } else { 1350 } else {
1351 char *style;
1352
1353 // perform shell style ~ home directory expansion 1351 // perform shell style ~ home directory expansion
1354 style = StringUtil::expandFilename(str_cmd.c_str()); 1352 // and insert style
1355 menu->insert(str_label.c_str(), BScreen::SETSTYLE, style); 1353 menu->insert(str_label.c_str(), BScreen::SETSTYLE,
1356 delete style; 1354 StringUtil::expandFilename(str_cmd).c_str());
1355
1357 } 1356 }
1358 } // end of style 1357 } // end of style
1359 1358
@@ -1379,13 +1378,11 @@ bool BScreen::parseMenuFile(ifstream &file, Rootmenu *menu, int &row) {
1379 "no filename defined\n")); 1378 "no filename defined\n"));
1380 cerr<<"Row: "<<row<<endl; 1379 cerr<<"Row: "<<row<<endl;
1381 } else { // start of else 'x' 1380 } else { // start of else 'x'
1382 char *newfile;
1383
1384 // perform shell style ~ home directory expansion 1381 // perform shell style ~ home directory expansion
1385 newfile = StringUtil::expandFilename(str_label.c_str()); 1382 string newfile(StringUtil::expandFilename(str_label));
1386 1383
1387 if (newfile) { 1384 if (newfile.size() != 0) {
1388 FILE *submenufile = fopen(newfile, "r"); 1385 FILE *submenufile = fopen(newfile.c_str(), "r");
1389 1386
1390 if (submenufile) { 1387 if (submenufile) {
1391 struct stat buf; 1388 struct stat buf;
@@ -1396,19 +1393,18 @@ bool BScreen::parseMenuFile(ifstream &file, Rootmenu *menu, int &row) {
1396 getMessage( 1393 getMessage(
1397 FBNLS::ScreenSet, FBNLS::ScreenINCLUDEErrorReg, 1394 FBNLS::ScreenSet, FBNLS::ScreenINCLUDEErrorReg,
1398 "BScreen::parseMenuFile: [include] error: " 1395 "BScreen::parseMenuFile: [include] error: "
1399 "'%s' is not a regular file\n"), newfile); 1396 "'%s' is not a regular file\n"), newfile.c_str());
1400 cerr<<"Row: "<<row<<endl; 1397 cerr<<"Row: "<<row<<endl;
1401 } 1398 }
1402 1399
1403 if (! feof(submenufile)) { 1400 if (! feof(submenufile)) {
1404 fclose(submenufile); 1401 fclose(submenufile);
1405 ifstream subfile(newfile); 1402 ifstream subfile(newfile.c_str());
1406 if (! parseMenuFile(subfile, menu, row)) 1403 if (! parseMenuFile(subfile, menu, row))
1407 fluxbox->saveMenuFilename(newfile); 1404 fluxbox->saveMenuFilename(newfile.c_str());
1408 } 1405 }
1409 } else 1406 } else
1410 perror(newfile); 1407 perror(newfile.c_str());
1411 delete newfile;
1412 } 1408 }
1413 } // end of else 'x' 1409 } // end of else 'x'
1414 } // end of include 1410 } // end of include
@@ -1497,14 +1493,14 @@ bool BScreen::parseMenuFile(ifstream &file, Rootmenu *menu, int &row) {
1497} 1493}
1498 1494
1499void BScreen::createStyleMenu(Rootmenu *menu, bool newmenu, const char *label, const char *directory) { 1495void BScreen::createStyleMenu(Rootmenu *menu, bool newmenu, const char *label, const char *directory) {
1500 I18n *i18n = I18n::instance(); 1496
1501
1502 // perform shell style ~ home directory expansion 1497 // perform shell style ~ home directory expansion
1503 auto_ptr<char> stylesdir(StringUtil::expandFilename(directory)); 1498 string stylesdir(StringUtil::expandFilename(directory ? directory : ""));
1504 1499
1500 I18n *i18n = I18n::instance();
1505 struct stat statbuf; 1501 struct stat statbuf;
1506 1502
1507 if (! stat(stylesdir.get(), &statbuf)) { // stat 1503 if (! stat(stylesdir.c_str(), &statbuf)) { // stat
1508 if (S_ISDIR(statbuf.st_mode)) { // dir 1504 if (S_ISDIR(statbuf.st_mode)) { // dir
1509 Rootmenu *stylesmenu; 1505 Rootmenu *stylesmenu;
1510 if (newmenu) 1506 if (newmenu)
@@ -1512,7 +1508,7 @@ void BScreen::createStyleMenu(Rootmenu *menu, bool newmenu, const char *label, c
1512 else 1508 else
1513 stylesmenu = menu; 1509 stylesmenu = menu;
1514 1510
1515 DIR *d = opendir(stylesdir.get()); 1511 DIR *d = opendir(stylesdir.c_str());
1516 int entries = 0; 1512 int entries = 0;
1517 struct dirent *p; 1513 struct dirent *p;
1518 1514
@@ -1528,11 +1524,11 @@ void BScreen::createStyleMenu(Rootmenu *menu, bool newmenu, const char *label, c
1528 1524
1529 qsort(ls, entries, sizeof(char *), dcmp); 1525 qsort(ls, entries, sizeof(char *), dcmp);
1530 1526
1531 int n, slen = strlen(stylesdir.get()); 1527 int n, slen = strlen(stylesdir.c_str());
1532 for (n = 0; n < entries; n++) { // for 1528 for (n = 0; n < entries; n++) { // for
1533 int nlen = strlen(ls[n]); 1529 int nlen = strlen(ls[n]);
1534 char style[MAXPATHLEN + 1]; 1530 char style[MAXPATHLEN + 1];
1535 strncpy(style, stylesdir.get(), slen); 1531 strncpy(style, stylesdir.c_str(), slen);
1536 *(style + slen) = '/'; 1532 *(style + slen) = '/';
1537 strncpy(style + slen + 1, ls[n], nlen + 1); 1533 strncpy(style + slen + 1, ls[n], nlen + 1);
1538 if ((! stat(style, &statbuf)) && S_ISREG(statbuf.st_mode)) 1534 if ((! stat(style, &statbuf)) && S_ISREG(statbuf.st_mode))
@@ -1549,7 +1545,7 @@ void BScreen::createStyleMenu(Rootmenu *menu, bool newmenu, const char *label, c
1549 rootmenuList.push_back(stylesmenu); 1545 rootmenuList.push_back(stylesmenu);
1550 } 1546 }
1551 1547
1552 fluxbox->saveMenuFilename(stylesdir.get()); 1548 fluxbox->saveMenuFilename(stylesdir.c_str());
1553 } else { // dir 1549 } else { // dir
1554 fprintf(stderr, 1550 fprintf(stderr,
1555 i18n-> 1551 i18n->
@@ -1557,7 +1553,7 @@ void BScreen::createStyleMenu(Rootmenu *menu, bool newmenu, const char *label, c
1557 FBNLS::ScreenSet, FBNLS::ScreenSTYLESDIRErrorNotDir, 1553 FBNLS::ScreenSet, FBNLS::ScreenSTYLESDIRErrorNotDir,
1558 "BScreen::parseMenuFile:" 1554 "BScreen::parseMenuFile:"
1559 " [stylesdir/stylesmenu] error, %s is not a" 1555 " [stylesdir/stylesmenu] error, %s is not a"
1560 " directory\n"), stylesdir.get()); 1556 " directory\n"), stylesdir.c_str());
1561 } // end of 'dir' 1557 } // end of 'dir'
1562 } else { // stat 1558 } else { // stat
1563 fprintf(stderr, 1559 fprintf(stderr,
@@ -1565,7 +1561,7 @@ void BScreen::createStyleMenu(Rootmenu *menu, bool newmenu, const char *label, c
1565 getMessage( 1561 getMessage(
1566 FBNLS::ScreenSet, FBNLS::ScreenSTYLESDIRErrorNoExist, 1562 FBNLS::ScreenSet, FBNLS::ScreenSTYLESDIRErrorNoExist,
1567 "BScreen::parseMenuFile: [stylesdir/stylesmenu]" 1563 "BScreen::parseMenuFile: [stylesdir/stylesmenu]"
1568 " error, %s does not exist\n"), stylesdir.get()); 1564 " error, %s does not exist\n"), stylesdir.c_str());
1569 } // end of 'stat' 1565 } // end of 'stat'
1570 1566
1571} 1567}
@@ -1749,29 +1745,29 @@ void BScreen::initGnomeAtoms() {
1749 /* create the GNOME window */ 1745 /* create the GNOME window */
1750 gnome_win = XCreateSimpleWindow(getBaseDisplay()->getXDisplay(), 1746 gnome_win = XCreateSimpleWindow(getBaseDisplay()->getXDisplay(),
1751 getRootWindow(), 0, 0, 5, 5, 0, 0, 0); 1747 getRootWindow(), 0, 0, 5, 5, 0, 0, 0);
1752 1748 FbAtoms *fba = FbAtoms::instance();
1753 /* supported WM check */ 1749 /* supported WM check */
1754 XChangeProperty(getBaseDisplay()->getXDisplay(), 1750 XChangeProperty(getBaseDisplay()->getXDisplay(),
1755 getRootWindow(), getBaseDisplay()->getGnomeSupportingWMCheckAtom(), 1751 getRootWindow(), fba->getGnomeSupportingWMCheckAtom(),
1756 XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &gnome_win, 1); 1752 XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &gnome_win, 1);
1757 1753
1758 XChangeProperty(getBaseDisplay()->getXDisplay(), gnome_win, 1754 XChangeProperty(getBaseDisplay()->getXDisplay(), gnome_win,
1759 getBaseDisplay()->getGnomeSupportingWMCheckAtom(), 1755 fba->getGnomeSupportingWMCheckAtom(),
1760 XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &gnome_win, 1); 1756 XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &gnome_win, 1);
1761 1757
1762 Atom gnomeatomlist[] = { 1758 Atom gnomeatomlist[] = {
1763 getBaseDisplay()->getGnomeWorkspaceAtom(), 1759 fba->getGnomeWorkspaceAtom(),
1764 getBaseDisplay()->getGnomeWorkspaceCountAtom(), 1760 fba->getGnomeWorkspaceCountAtom(),
1765 getBaseDisplay()->getGnomeStateAtom(), 1761 fba->getGnomeStateAtom(),
1766 getBaseDisplay()->getGnomeWorkspaceNamesAtom(), 1762 fba->getGnomeWorkspaceNamesAtom(),
1767 getBaseDisplay()->getGnomeHintsAtom(), 1763 fba->getGnomeHintsAtom(),
1768 getBaseDisplay()->getGnomeClientListAtom(), 1764 fba->getGnomeClientListAtom(),
1769// getBaseDisplay()->getGnomeLayerAtom(), // not supported yet 1765// getBaseDisplay()->getGnomeLayerAtom(), // not supported yet
1770 }; 1766 };
1771 1767
1772 //list atoms that we support 1768 //list atoms that we support
1773 XChangeProperty(getBaseDisplay()->getXDisplay(), getRootWindow(), 1769 XChangeProperty(getBaseDisplay()->getXDisplay(), getRootWindow(),
1774 getBaseDisplay()->getGnomeProtAtom(), XA_ATOM, 32, PropModeReplace, 1770 fba->getGnomeProtAtom(), XA_ATOM, 32, PropModeReplace,
1775 (unsigned char *)gnomeatomlist, (sizeof gnomeatomlist)/sizeof gnomeatomlist[0]); 1771 (unsigned char *)gnomeatomlist, (sizeof gnomeatomlist)/sizeof gnomeatomlist[0]);
1776 1772
1777} 1773}
@@ -1804,7 +1800,7 @@ void BScreen::updateGnomeClientList() {
1804 //number of windows to show in client list 1800 //number of windows to show in client list
1805 num = win; 1801 num = win;
1806 XChangeProperty(getBaseDisplay()->getXDisplay(), 1802 XChangeProperty(getBaseDisplay()->getXDisplay(),
1807 getRootWindow(), getBaseDisplay()->getGnomeClientListAtom(), XA_CARDINAL, 32, 1803 getRootWindow(), FbAtoms::instance()->getGnomeClientListAtom(), XA_CARDINAL, 32,
1808 PropModeReplace, (unsigned char *)wl, num); 1804 PropModeReplace, (unsigned char *)wl, num);
1809 1805
1810 if (wl) 1806 if (wl)