aboutsummaryrefslogtreecommitdiff
path: root/src/Screen.cc
diff options
context:
space:
mode:
authorrathnor <rathnor>2003-02-18 15:11:12 (GMT)
committerrathnor <rathnor>2003-02-18 15:11:12 (GMT)
commitb4ffe4fe21699c7123728aeeb99576a540b3694e (patch)
treef8a133be750f844f3c48f5a631fb8bf088544549 /src/Screen.cc
parentaa602770fbbd4e84154028d3181d275b81ea914d (diff)
downloadfluxbox-b4ffe4fe21699c7123728aeeb99576a540b3694e.zip
fluxbox-b4ffe4fe21699c7123728aeeb99576a540b3694e.tar.bz2
Added layer menus for windows, toolbar, and slit, plus associated
resources. Cleaned up some cruft from the previous layering setup.
Diffstat (limited to 'src/Screen.cc')
-rw-r--r--src/Screen.cc96
1 files changed, 13 insertions, 83 deletions
diff --git a/src/Screen.cc b/src/Screen.cc
index 178b2a4..9f0bfe7 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.110 2003/02/17 12:35:59 fluxgen Exp $ 25// $Id: Screen.cc,v 1.111 2003/02/18 15:11:07 rathnor Exp $
26 26
27 27
28#include "Screen.hh" 28#include "Screen.hh"
@@ -45,7 +45,8 @@
45#include "MacroCommand.hh" 45#include "MacroCommand.hh"
46#include "XLayerItem.hh" 46#include "XLayerItem.hh"
47#include "MultLayers.hh" 47#include "MultLayers.hh"
48#include "LayeredMenu.hh" 48#include "FbMenu.hh"
49#include "LayerMenu.hh"
49 50
50//use GNU extensions 51//use GNU extensions
51#ifndef _GNU_SOURCE 52#ifndef _GNU_SOURCE
@@ -131,13 +132,14 @@ int anotherWMRunning(Display *display, XErrorEvent *) {
131} 132}
132 133
133FbTk::Menu *createMenuFromScreen(BScreen &screen) { 134FbTk::Menu *createMenuFromScreen(BScreen &screen) {
134 FbTk::Menu *menu = new LayeredMenu(*screen.menuTheme(), 135 FbTk::Menu *menu = new FbMenu(*screen.menuTheme(),
135 screen.getScreenNumber(), 136 screen.getScreenNumber(),
136 *screen.getImageControl(), 137 *screen.getImageControl(),
137 *screen.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())); 138 *screen.layerManager().getLayer(Fluxbox::instance()->getMenuLayer()));
138 return menu; 139 return menu;
139} 140}
140 141
142/*
141class WindowLayerMenuItem : public FbTk::MenuItem { 143class WindowLayerMenuItem : public FbTk::MenuItem {
142public: 144public:
143 WindowLayerMenuItem(const char *label, FluxboxWindow &win, int layernum): 145 WindowLayerMenuItem(const char *label, FluxboxWindow &win, int layernum):
@@ -152,6 +154,8 @@ private:
152 FluxboxWindow &m_window; 154 FluxboxWindow &m_window;
153 int m_layernum; 155 int m_layernum;
154}; 156};
157*/
158
155 159
156}; // End anonymous namespace 160}; // End anonymous namespace
157 161
@@ -345,7 +349,6 @@ void FbTk::ThemeItem<std::string>::setFromString(const char *str) {
345BScreen::ScreenResource::ScreenResource(ResourceManager &rm, 349BScreen::ScreenResource::ScreenResource(ResourceManager &rm,
346 const std::string &scrname, 350 const std::string &scrname,
347 const std::string &altscrname): 351 const std::string &altscrname):
348 toolbar_on_top(rm, false, scrname+".toolbar.onTop", altscrname+".Toolbar.OnTop"),
349 toolbar_auto_hide(rm, false, scrname+".toolbar.autoHide", altscrname+".Toolbar.AutoHide"), 352 toolbar_auto_hide(rm, false, scrname+".toolbar.autoHide", altscrname+".Toolbar.AutoHide"),
350 image_dither(rm, false, scrname+".imageDither", altscrname+".ImageDither"), 353 image_dither(rm, false, scrname+".imageDither", altscrname+".ImageDither"),
351 opaque_move(rm, false, "session.opaqueMove", "Session.OpaqueMove"), 354 opaque_move(rm, false, "session.opaqueMove", "Session.OpaqueMove"),
@@ -365,6 +368,8 @@ BScreen::ScreenResource::ScreenResource(ResourceManager &rm,
365 edge_snap_threshold(rm, 0, scrname+".edgeSnapThreshold", altscrname+".EdgeSnapThreshold"), 368 edge_snap_threshold(rm, 0, scrname+".edgeSnapThreshold", altscrname+".EdgeSnapThreshold"),
366 tab_width(rm, 64, scrname+".tab.width", altscrname+".Tab.Width"), 369 tab_width(rm, 64, scrname+".tab.width", altscrname+".Tab.Width"),
367 tab_height(rm, 16, scrname+".tab.height", altscrname+".Tab.Height"), 370 tab_height(rm, 16, scrname+".tab.height", altscrname+".Tab.Height"),
371 slit_layernum(rm, Fluxbox::instance()->getDockLayer(), scrname+".slit.layer", altscrname+".Slit.Layer"),
372 toolbar_layernum(rm, Fluxbox::instance()->getDesktopLayer(), scrname+".toolbar.layer", altscrname+".Toolbar.Layer"),
368 tab_placement(rm, Tab::PTOP, scrname+".tab.placement", altscrname+".Tab.Placement"), 373 tab_placement(rm, Tab::PTOP, scrname+".tab.placement", altscrname+".Tab.Placement"),
369 tab_alignment(rm, Tab::ALEFT, scrname+".tab.alignment", altscrname+".Tab.Alignment"), 374 tab_alignment(rm, Tab::ALEFT, scrname+".tab.alignment", altscrname+".Tab.Alignment"),
370 toolbar_on_head(rm, 0, scrname+".toolbar.onhead", altscrname+".Toolbar.onHead") 375 toolbar_on_head(rm, 0, scrname+".toolbar.onhead", altscrname+".Toolbar.onHead")
@@ -515,10 +520,10 @@ BScreen::BScreen(ResourceManager &rm,
515 current_workspace = workspacesList.front(); 520 current_workspace = workspacesList.front();
516 521
517#ifdef SLIT 522#ifdef SLIT
518 m_slit.reset(new Slit(*this)); 523 m_slit.reset(new Slit(*this, *layerManager().getLayer(getSlitLayerNum())));
519#endif // SLIT 524#endif // SLIT
520 525
521 m_toolbar.reset(new Toolbar(*this)); 526 m_toolbar.reset(new Toolbar(*this, *layerManager().getLayer(getToolbarLayerNum())));
522 // setup toolbar width menu item 527 // setup toolbar width menu item
523 FbTk::MenuItem *toolbar_menuitem = new IntResMenuItem("Toolbar width percent", 528 FbTk::MenuItem *toolbar_menuitem = new IntResMenuItem("Toolbar width percent",
524 resource.toolbar_width_percent, 529 resource.toolbar_width_percent,
@@ -536,6 +541,7 @@ BScreen::BScreen(ResourceManager &rm,
536 FbTk::RefCount<FbTk::Command> reconfig_toolbar_and_save_resource(toolbar_menuitem_macro); 541 FbTk::RefCount<FbTk::Command> reconfig_toolbar_and_save_resource(toolbar_menuitem_macro);
537 542
538 toolbar_menuitem->setCommand(reconfig_toolbar_and_save_resource); 543 toolbar_menuitem->setCommand(reconfig_toolbar_and_save_resource);
544
539 m_toolbar->menu().insert(toolbar_menuitem); 545 m_toolbar->menu().insert(toolbar_menuitem);
540 546
541 setupWorkspacemenu(*this, *workspacemenu); 547 setupWorkspacemenu(*this, *workspacemenu);
@@ -549,8 +555,6 @@ BScreen::BScreen(ResourceManager &rm,
549 555
550 initMenu(); // create and initiate rootmenu 556 initMenu(); // create and initiate rootmenu
551 557
552 raiseWindows(Workspace::Stack());
553
554 //update menus 558 //update menus
555 m_rootmenu->update(); 559 m_rootmenu->update();
556 m_configmenu->update(); 560 m_configmenu->update();
@@ -749,7 +753,6 @@ void BScreen::reconfigure() {
749 m_configmenu->reconfigure(); 753 m_configmenu->reconfigure();
750 754
751 initMenu(); 755 initMenu();
752 raiseWindows(Workspace::Stack());
753 m_rootmenu->reconfigure(); 756 m_rootmenu->reconfigure();
754 757
755 758
@@ -784,7 +787,6 @@ void BScreen::reconfigure() {
784 787
785void BScreen::rereadMenu() { 788void BScreen::rereadMenu() {
786 initMenu(); 789 initMenu();
787 raiseWindows(Workspace::Stack());
788 790
789 m_rootmenu->reconfigure(); 791 m_rootmenu->reconfigure();
790} 792}
@@ -1253,35 +1255,6 @@ void BScreen::setupWindowActions(FluxboxWindow &win) {
1253 menu.removeAll(); // clear old items 1255 menu.removeAll(); // clear old items
1254 menu.disableTitle(); // not titlebar 1256 menu.disableTitle(); // not titlebar
1255 1257
1256 // check and setup layer menu as a submenu windowmenu
1257 FbTk::Menu &layer_menu = win.getLayermenu();
1258 layer_menu.disableTitle(); // no titlebar
1259 // if it hasn't already been setup (no need to reset it)
1260 if (layer_menu.numberOfItems() == 0) {
1261 Fluxbox *fluxbox = Fluxbox::instance();
1262 struct {
1263 int set;
1264 int base;
1265 const char *default_str;
1266 int layernum;
1267 } layer_menuitems[] = {
1268 //TODO: nls
1269 {0, 0, "Above Slit", fluxbox->getAboveSlitLayer()},
1270 {0, 0, "Slit", fluxbox->getSlitLayer()},
1271 {0, 0, "Top", fluxbox->getTopLayer()},
1272 {0, 0, "Normal", fluxbox->getNormalLayer()},
1273 {0, 0, "Bottom", fluxbox->getBottomLayer()},
1274 {0, 0, "Desktop", fluxbox->getDesktopLayer()},
1275 };
1276
1277 for (size_t i=0; i < 6; ++i) {
1278 // TODO: fetch nls string
1279 layer_menu.insert(new WindowLayerMenuItem(layer_menuitems[i].default_str,
1280 win, layer_menuitems[i].layernum));
1281 };
1282 layer_menu.update();
1283 }
1284
1285 // set new menu items 1258 // set new menu items
1286 menu.insert("Shade", shade_cmd); 1259 menu.insert("Shade", shade_cmd);
1287 menu.insert("Stick", stick_cmd); 1260 menu.insert("Stick", stick_cmd);
@@ -1291,57 +1264,14 @@ void BScreen::setupWindowActions(FluxboxWindow &win) {
1291 menu.insert("Iconify", iconify_cmd); 1264 menu.insert("Iconify", iconify_cmd);
1292 menu.insert("Raise", raise_cmd); 1265 menu.insert("Raise", raise_cmd);
1293 menu.insert("Lower", lower_cmd); 1266 menu.insert("Lower", lower_cmd);
1294 menu.insert("Layer...", &layer_menu); 1267 menu.insert("Layer...", win.getLayermenu());
1295 menu.insert("ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ"); 1268 menu.insert("ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ");
1296 menu.insert("Close", close_cmd); 1269 menu.insert("Close", close_cmd);
1297 1270
1298 menu.reconfigure(); // update graphics 1271 menu.reconfigure(); // update graphics
1299 1272
1300} 1273}
1301void BScreen::raiseWindows(const Workspace::Stack &workspace_stack) {
1302
1303 // TODO: I don't think we need this...
1304#ifdef DEBUG
1305 cerr<<"BScreen::raiseWindows() called"<<endl;
1306#endif //DEBUG
1307
1308 /*
1309
1310 Window session_stack[(workspace_stack.size() + workspacesList.size() + rootmenuList.size() + 30)];
1311 int i = 0;
1312
1313 Workspaces::iterator wit = workspacesList.begin();
1314 Workspaces::iterator wit_end = workspacesList.end();
1315 for (; wit != wit_end; ++wit) {
1316 session_stack[i++] = (*wit)->menu().windowID();
1317 }
1318
1319 session_stack[i++] = workspacemenu->windowID();
1320
1321 Rootmenus::iterator rit = rootmenuList.begin();
1322 Rootmenus::iterator rit_end = rootmenuList.end();
1323 for (; rit != rit_end; ++rit) {
1324 session_stack[i++] = (*rit)->windowID();
1325 }
1326 session_stack[i++] = m_rootmenu->windowID();
1327 1274
1328 if (m_toolbar->isOnTop())
1329 session_stack[i++] = m_toolbar->getWindowID();
1330
1331#ifdef SLIT
1332 if (m_slit->isOnTop())
1333 session_stack[i++] = m_slit->getWindowID();
1334#endif // SLIT
1335 if (!workspace_stack.empty()) {
1336 Workspace::Stack::const_reverse_iterator it = workspace_stack.rbegin();
1337 Workspace::Stack::const_reverse_iterator it_end = workspace_stack.rend();
1338 for (; it != it_end; ++it)
1339 session_stack[i++] = (*it);
1340 }
1341
1342 XRestackWindows(getBaseDisplay()->getXDisplay(), session_stack, i);
1343 */
1344}
1345 1275
1346void BScreen::saveStrftimeFormat(const char *format) { 1276void BScreen::saveStrftimeFormat(const char *format) {
1347 //make sure std::string don't get 0 string 1277 //make sure std::string don't get 0 string