moved class Layer from class Fluxbox and thus reduces some dependecies
jump to
@@ -27,8 +27,8 @@ #include "Screen.hh"
#include "Window.hh" #include "WinClient.hh" #include "Workspace.hh" -#include "fluxbox.hh" - +#include "Layer.hh" +#include "FbTk/App.hh" #include "FbTk/FbWindow.hh" #include "FbTk/I18n.hh"@@ -194,7 +194,7 @@ &ret_type, &fmt, &nitems, &bytes_after,
&data); if (data) { Atom *atoms = (unsigned long *)data; - for (unsigned long l=0; l<nitems; ++l) { + for (unsigned long l = 0; l < nitems; ++l) { /* From Extended Window Manager Hints, draft 1.3: * * _NET_WM_WINDOW_TYPE_DOCK indicates a dock or panel feature.@@ -217,7 +217,7 @@ */
win.setFocusHidden(true); win.setIconHidden(true); - win.moveToLayer(Fluxbox::instance()->getDesktopLayer()); + win.moveToLayer(Layer::DESKTOP); win.setDecorationMask(0); win.setTabable(false); win.setMovable(false);@@ -534,9 +534,9 @@ if (win.isStuck())
state.push_back(m_net_wm_state_sticky); if (win.isShaded()) state.push_back(m_net_wm_state_shaded); - if (win.layerNum() == Fluxbox::instance()->getBottomLayer()) + if (win.layerNum() == Layer::BOTTOM) state.push_back(m_net_wm_state_below); - if (win.layerNum() == Fluxbox::instance()->getAboveDockLayer()) + if (win.layerNum() == Layer::ABOVE_DOCK) state.push_back(m_net_wm_state_above); if (win.isIconic()) state.push_back(m_net_wm_state_hidden);@@ -889,15 +889,15 @@ } else if (state == m_net_wm_state_skip_taskbar) {
win.setIconHidden(value); } else if (state == m_net_wm_state_below) { // bottom layer if (value) - win.moveToLayer(Fluxbox::instance()->getBottomLayer()); + win.moveToLayer(Layer::BOTTOM); else - win.moveToLayer(Fluxbox::instance()->getNormalLayer()); + win.moveToLayer(Layer::NORMAL); } else if (state == m_net_wm_state_above) { // above layer if (value) - win.moveToLayer(Fluxbox::instance()->getAboveDockLayer()); + win.moveToLayer(Layer::ABOVE_DOCK); else - win.moveToLayer(Fluxbox::instance()->getNormalLayer()); + win.moveToLayer(Layer::NORMAL); } }@@ -916,16 +916,16 @@ setFullscreen(win, getState(win) == 0); // toggle current state
} else if (state == m_net_wm_state_skip_taskbar) { win.setIconHidden(!win.isIconHidden()); } else if (state == m_net_wm_state_below) { // bottom layer - if (win.layerNum() == Fluxbox::instance()->getBottomLayer()) - win.moveToLayer(Fluxbox::instance()->getNormalLayer()); + if (win.layerNum() == Layer::BOTTOM) + win.moveToLayer(Layer::NORMAL); else - win.moveToLayer(Fluxbox::instance()->getBottomLayer()); + win.moveToLayer(Layer::BOTTOM); } else if (state == m_net_wm_state_above) { // top layer - if (win.layerNum() == Fluxbox::instance()->getAboveDockLayer()) - win.moveToLayer(Fluxbox::instance()->getNormalLayer()); + if (win.layerNum() == Layer::ABOVE_DOCK) + win.moveToLayer(Layer::NORMAL); else - win.moveToLayer(Fluxbox::instance()->getAboveDockLayer()); + win.moveToLayer(Layer::ABOVE_DOCK); } }
@@ -23,12 +23,14 @@ // $Id$
#include "Gnome.hh" -#include "fluxbox.hh" +#include "App.hh" #include "Window.hh" #include "Screen.hh" #include "WinClient.hh" #include "Workspace.hh" +#include "Layer.hh" #include "FbTk/I18n.hh" + #include <iostream> #include <new>@@ -279,7 +281,7 @@
void Gnome::updateLayer(FluxboxWindow &win) { //TODO - map from flux layers to gnome ones // our layers are in the opposite direction to GNOME - long layernum = Fluxbox::instance()->getDesktopLayer() - win.layerNum(); + long layernum = Layer::DESKTOP - win.layerNum(); FluxboxWindow::ClientList::iterator client_it = win.clientList().begin(); FluxboxWindow::ClientList::iterator client_it_end = win.clientList().end();@@ -418,47 +420,47 @@ case WIN_LAYER_DESKTOP:
#ifdef DEBUG cerr<<"Gnome::setLayer("<<win->title()<<", WIN_LAYER_DESKTOP)"<<endl; #endif // DEBUG - layer = Fluxbox::instance()->getDesktopLayer(); + layer = Layer::DESKTOP; break; case WIN_LAYER_BELOW: #ifdef DEBUG cerr<<"Gnome::setLayer("<<win->title()<<", WIN_LAYER_BELOW)"<<endl; #endif // DEBUG - layer = Fluxbox::instance()->getBottomLayer(); + layer = Layer::BOTTOM; break; case WIN_LAYER_NORMAL: #ifdef DEBUG cerr<<"Gnome::setLayer("<<win->title()<<", WIN_LAYER_NORMAL)"<<endl; #endif // DEBUG - layer = Fluxbox::instance()->getNormalLayer(); + layer = Layer::NORMAL; break; case WIN_LAYER_ONTOP: #ifdef DEBUG cerr<<"Gnome::setLayer("<<win->title()<<", WIN_LAYER_ONTOP)"<<endl; #endif // DEBUG - layer = Fluxbox::instance()->getTopLayer(); + layer = Layer::TOP; break; case WIN_LAYER_DOCK: #ifdef DEBUG cerr<<"Gnome::setLayer("<<win->title()<<", WIN_LAYER_DOCK)"<<endl; #endif // DEBUG - layer = Fluxbox::instance()->getDockLayer(); + layer = Layer::DOCK; break; case WIN_LAYER_ABOVE_DOCK: #ifdef DEBUG cerr<<"Gnome::setLayer("<<win->title()<<", WIN_LAYER_ABOVE_DOCK)"<<endl; #endif // DEBUG - layer = Fluxbox::instance()->getAboveDockLayer(); + layer = Layer::ABOVE_DOCK; break; case WIN_LAYER_MENU: #ifdef DEBUG cerr<<"Gnome::setLayer("<<win->title()<<", WIN_LAYER_MENU)"<<endl; #endif // DEBUG - layer = Fluxbox::instance()->getMenuLayer(); + layer = Layer::MENU; break; default: // our windows are in the opposite direction to gnome - layer = Fluxbox::instance()->getDesktopLayer() - layer; + layer = Layer::DESKTOP - layer; #ifdef DEBUG cerr<<"Gnome::setLayer("<<win->title()<<", "<<layer<<")"<<endl; #endif // DEBUG
@@ -25,7 +25,7 @@ #include "IconMenu.hh"
#include "Screen.hh" #include "IconMenuItem.hh" -#include "fluxbox.hh" +#include "Layer.hh" #include "FbTk/I18n.hh" #include <typeinfo>@@ -47,7 +47,7 @@ IconMenu::IconMenu(BScreen &screen):
FbMenu(screen.menuTheme(), screen.imageControl(), *screen.layerManager(). - getLayer(Fluxbox::instance()->getMenuLayer())) { + getLayer(Layer::MENU)) { _FB_USES_NLS; setLabel(_FBTEXT(Menu, Icons, "Icons", "Iconic windows menu title"));
@@ -29,12 +29,13 @@ #include "IconbarTheme.hh"
#include "Window.hh" #include "IconButton.hh" #include "Workspace.hh" -#include "fluxbox.hh" #include "FbMenu.hh" #include "BoolMenuItem.hh" #include "CommandParser.hh" #include "WinClient.hh" #include "FocusControl.hh" +#include "FbCommands.hh" +#include "Layer.hh" #include "FbTk/I18n.hh" #include "FbTk/Menu.hh"@@ -236,9 +237,7 @@ _FB_USES_NLS;
menu.setLabel(_FBTEXT(Toolbar, IconbarMode, "Iconbar Mode", "Menu title - chooses which set of icons are shown in the iconbar")); - RefCount<Command> saverc_cmd(new SimpleCommand<Fluxbox>( - *Fluxbox::instance(), - &Fluxbox::save_rc)); + RefCount<Command> saverc_cmd(new FbCommands::SaveResources()); menu.insert(new ToolbarModeMenuItem(_FBTEXT(Toolbar, IconbarModeNone,@@ -382,7 +381,7 @@ screen.name() + ".iconbar.iconTextPadding", screen.altName() + ".Iconbar.IconTextPadding"),
m_rc_use_pixmap(screen.resourceManager(), true, screen.name() + ".iconbar.usePixmap", screen.altName() + ".Iconbar.UsePixmap"), m_menu(screen.menuTheme(), screen.imageControl(), - *screen.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())) { + *screen.layerManager().getLayer(Layer::MENU)) { // setup mode menu setupModeMenu(m_menu, *this);
@@ -0,0 +1,52 @@
+// Layer.hh for Fluxbox Window Manager +// Copyright (c) 2006 Fluxbox Team (fluxgen at fluxbox dot org) +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the "Software"), +// to deal in the Software without restriction, including without limitation +// the rights to use, copy, modify, merge, publish, distribute, sublicense, +// and/or sell copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. + +#ifndef LAYER_HH +#define LAYER_HH + +/** + * (This is not the layer->raise/lower handling stuff, @see FbTk::Layer) + * Class to store layer numbers (special Resource type) + * we have a special resource type because we need to be able to name certain layers + * a Resource<int> wouldn't allow this + */ +class Layer { +public: + enum { + MENU = 0, + ABOVE_DOCK = 2, + DOCK = 4, + TOP = 6, + NORMAL = 8, + BOTTOM = 10, + DESKTOP = 12 + }; + + explicit Layer(int i) : m_num(i) {}; + int getNum() const { return m_num; } + + Layer &operator=(int num) { m_num = num; return *this; } + +private: + int m_num; +}; + +#endif // LAYER_HH
@@ -1,6 +1,7 @@
#include "LayerMenu.hh" -#include "fluxbox.hh" +#include "FbCommands.hh" +#include "Layer.hh" #include "FbTk/RefCount.hh" #include "FbTk/SimpleCommand.hh"@@ -11,7 +12,6 @@ FbTk::XLayer &layer, LayerObject *object, bool save_rc):
ToggleMenu(tm, imgctrl, layer) { _FB_USES_NLS; - Fluxbox *fluxbox = Fluxbox::instance(); struct { int set;@@ -20,17 +20,15 @@ const char *default_str;
int layernum; } layer_menuitems[] = { //TODO: nls - {0, 0, _FBTEXT(Layer, AboveDock, "Above Dock", "Layer above dock"), fluxbox->getAboveDockLayer()}, - {0, 0, _FBTEXT(Layer, Dock, "Dock", "Layer dock"), fluxbox->getDockLayer()}, - {0, 0, _FBTEXT(Layer, Top, "Top", "Layer top"), fluxbox->getTopLayer()}, - {0, 0, _FBTEXT(Layer, Normal, "Normal", "Layer normal"), fluxbox->getNormalLayer()}, - {0, 0, _FBTEXT(Layer, Bottom, "Bottom", "Layer bottom"), fluxbox->getBottomLayer()}, - {0, 0, _FBTEXT(Layer, Desktop, "Desktop", "Layer desktop"), fluxbox->getDesktopLayer()}, + {0, 0, _FBTEXT(Layer, AboveDock, "Above Dock", "Layer above dock"), Layer::ABOVE_DOCK}, + {0, 0, _FBTEXT(Layer, Dock, "Dock", "Layer dock"), Layer::DOCK}, + {0, 0, _FBTEXT(Layer, Top, "Top", "Layer top"), Layer::TOP}, + {0, 0, _FBTEXT(Layer, Normal, "Normal", "Layer normal"), Layer::NORMAL}, + {0, 0, _FBTEXT(Layer, Bottom, "Bottom", "Layer bottom"), Layer::BOTTOM}, + {0, 0, _FBTEXT(Layer, Desktop, "Desktop", "Layer desktop"), Layer::DESKTOP}, }; - FbTk::RefCount<FbTk::Command> saverc_cmd(new FbTk::SimpleCommand<Fluxbox>( - *Fluxbox::instance(), - &Fluxbox::save_rc)); + FbTk::RefCount<FbTk::Command> saverc_cmd(new FbCommands::SaveResources()); for (size_t i=0; i < 6; ++i) { // TODO: fetch nls string
@@ -36,6 +36,7 @@ #include "IconMenu.hh"
#include "WorkspaceMenu.hh" #include "LayerMenu.hh" #include "SendToMenu.hh" +#include "Layer.hh" #include "FbMenuParser.hh" #include "StyleMenuItem.hh"@@ -364,8 +365,7 @@ return 0;
FbTk::Menu *menu = new FbMenu(screen->menuTheme(), screen->imageControl(), - *screen->layerManager(). - getLayer(Fluxbox::instance()->getMenuLayer())); + *screen->layerManager().getLayer(Layer::MENU)); if (!label.empty()) menu->setLabel(label.c_str());@@ -511,24 +511,41 @@ maximize_item->setCommand(3, maximize_horiz_cmd);
menu.insert(maximize_item); } else if (type == "iconify") { RefCmd iconify_cmd(new WindowCmd<void>(&FluxboxWindow::iconify)); - menu.insert(label.empty()?_FBTEXT(Windowmenu, Iconify, "Iconify", "Iconify the window"):label.c_str(), iconify_cmd); + menu.insert(label.empty() ? + _FBTEXT(Windowmenu, Iconify, + "Iconify", "Iconify the window") : + label.c_str(), iconify_cmd); } else if (type == "close") { RefCmd close_cmd(new WindowCmd<void>(&FluxboxWindow::close)); - menu.insert(label.empty()?_FBTEXT(Windowmenu, Close, "Close", "Close the window"):label.c_str(), close_cmd); + menu.insert(label.empty() ? + _FBTEXT(Windowmenu, Close, + "Close", "Close the window") : + label.c_str(), close_cmd); } else if (type == "kill" || type == "killwindow") { RefCmd kill_cmd(new WindowCmd<void>(&FluxboxWindow::kill)); - menu.insert(label.empty()?_FBTEXT(Windowmenu, Kill, "Kill", "Kill the window"):label.c_str(), kill_cmd); + menu.insert(label.empty() ? + _FBTEXT(Windowmenu, Kill, + "Kill", "Kill the window"): + label.c_str(), kill_cmd); } else if (type == "lower") { RefCmd lower_cmd(new WindowCmd<void>(&FluxboxWindow::lower)); - menu.insert(label.empty()?_FBTEXT(Windowmenu, Lower, "Lower", "Lower the window"):label.c_str(), lower_cmd); + menu.insert( label.empty() ? + _FBTEXT(Windowmenu, Lower, + "Lower", "Lower the window"): + label.c_str(), lower_cmd); } else if (type == "raise") { RefCmd raise_cmd(new WindowCmd<void>(&FluxboxWindow::raise)); - menu.insert(label.empty()?_FBTEXT(Windowmenu, Raise, "Raise", "Raise the window"):label.c_str(), raise_cmd); + menu.insert(label.empty() ? + _FBTEXT(Windowmenu, Raise, + "Raise", "Raise the window"): + label.c_str(), raise_cmd); } else if (type == "stick") { RefCmd stick_cmd(new WindowCmd<void>(&FluxboxWindow::stick)); - menu.insert(label.empty()?_FBTEXT(Windowmenu, Stick, "Stick", "Stick the window"):label.c_str(), stick_cmd); - } - else if (type == "extramenus") { + menu.insert(label.empty() ? + _FBTEXT(Windowmenu, Stick, + "Stick", "Stick the window"): + label.c_str(), stick_cmd); + } else if (type == "extramenus") { BScreen *screen = Fluxbox::instance()->findScreen(menu.screenNumber()); BScreen::ExtraMenus::iterator it = screen->extraWindowMenus().begin(); BScreen::ExtraMenus::iterator it_end = screen->extraWindowMenus().end();@@ -540,7 +557,7 @@
} else if (type == "sendto") { menu.insert(label.empty() ? _FBTEXT(Windowmenu, SendTo, "Send To...", "Send to menu item name"): label.c_str(), new SendToMenu(*Fluxbox::instance()->findScreen(menu.screenNumber()))); - }else if (type == "layer") { + } else if (type == "layer") { BScreen *screen = Fluxbox::instance()->findScreen(menu.screenNumber()); if (screen == 0) return false;@@ -549,8 +566,7 @@ static MenuContext context;
FbTk::Menu *submenu = new LayerMenu(screen->menuTheme(), screen->imageControl(), - *screen->layerManager(). - getLayer(Fluxbox::instance()->getMenuLayer()), + *screen->layerManager().getLayer(Layer::MENU), &context, false); submenu->disableTitle();
@@ -32,6 +32,7 @@ #include "FbMenu.hh"
#include "FbCommands.hh" #include "fluxbox.hh" #include "WindowCmd.hh" +#include "Layer.hh" #include "FbTk/I18n.hh" #include "FbTk/StringUtil.hh"@@ -345,19 +346,19 @@ app.rememberHead(h);
} else if (str_key == "Layer") { unsigned int l; if (str_label == "DESKTOP") { - l = Fluxbox::instance()->getDesktopLayer(); + l = Layer::DESKTOP; } else if (str_label == "BOTTOM") { - l = Fluxbox::instance()->getBottomLayer(); + l = Layer::BOTTOM; } else if (str_label == "NORMAL") { - l = Fluxbox::instance()->getNormalLayer(); + l = Layer::NORMAL; } else if (str_label == "TOP") { - l = Fluxbox::instance()->getTopLayer(); + l = Layer::TOP; } else if (str_label == "DOCK") { - l = Fluxbox::instance()->getDockLayer(); + l = Layer::DOCK; } else if (str_label == "ABOVEDOCK") { - l = Fluxbox::instance()->getAboveDockLayer(); + l = Layer::ABOVE_DOCK; } else if (str_label == "MENU") { - l = Fluxbox::instance()->getMenuLayer(); + l = Layer::MENU; } else { FbTk_istringstream iss(str_label.c_str()); iss >> l;
@@ -24,8 +24,11 @@
// holds main resource functions +#include "FbTk/StringUtil.hh" +#include "FbTk/Resource.hh" #include "fluxbox.hh" -#include "FbTk/StringUtil.hh" + +#include "Layer.hh" #include <stdio.h> #include <string>@@ -188,54 +191,55 @@ return string(tmpstr);
} template<> -void FbTk::Resource<Fluxbox::Layer>:: +void FbTk::Resource<Layer>:: setFromString(const char *strval) { int tempnum = 0; if (sscanf(strval, "%d", &tempnum) == 1) m_value = tempnum; else if (strcasecmp(strval, "Menu") == 0) - m_value = Fluxbox::instance()->getMenuLayer(); + m_value = ::Layer::MENU; else if (strcasecmp(strval, "AboveDock") == 0) - m_value = Fluxbox::instance()->getAboveDockLayer(); + m_value = ::Layer::ABOVE_DOCK; else if (strcasecmp(strval, "Dock") == 0) - m_value = Fluxbox::instance()->getDockLayer(); + m_value = ::Layer::DOCK; else if (strcasecmp(strval, "Top") == 0) - m_value = Fluxbox::instance()->getTopLayer(); + m_value = ::Layer::TOP; else if (strcasecmp(strval, "Normal") == 0) - m_value = Fluxbox::instance()->getNormalLayer(); + m_value = ::Layer::NORMAL; else if (strcasecmp(strval, "Bottom") == 0) - m_value = Fluxbox::instance()->getBottomLayer(); + m_value = ::Layer::BOTTOM; else if (strcasecmp(strval, "Desktop") == 0) - m_value = Fluxbox::instance()->getDesktopLayer(); + m_value = ::Layer::DESKTOP; else setDefaultValue(); } template<> -string FbTk::Resource<Fluxbox::Layer>:: +std::string FbTk::Resource<Layer>:: getString() const { - - if (m_value.getNum() == Fluxbox::instance()->getMenuLayer()) - return string("Menu"); - else if (m_value.getNum() == Fluxbox::instance()->getAboveDockLayer()) - return string("AboveDock"); - else if (m_value.getNum() == Fluxbox::instance()->getDockLayer()) - return string("Dock"); - else if (m_value.getNum() == Fluxbox::instance()->getTopLayer()) - return string("Top"); - else if (m_value.getNum() == Fluxbox::instance()->getNormalLayer()) - return string("Normal"); - else if (m_value.getNum() == Fluxbox::instance()->getBottomLayer()) - return string("Bottom"); - else if (m_value.getNum() == Fluxbox::instance()->getDesktopLayer()) - return string("Desktop"); - else { + switch (m_value.getNum()) { + case Layer::MENU: + return std::string("Menu"); + case Layer::ABOVE_DOCK: + return std::string("AboveDock"); + case Layer::DOCK: + return std::string("Dock"); + case Layer::TOP: + return std::string("Top"); + case Layer::NORMAL: + return std::string("Normal"); + case Layer::BOTTOM: + return std::string("Bottom"); + case Layer::DESKTOP: + return std::string("Desktop"); + default: char tmpstr[128]; sprintf(tmpstr, "%d", m_value.getNum()); - return string(tmpstr); + return std::string(tmpstr); } } + template<> void FbTk::Resource<long>:: setFromString(const char *strval) {
@@ -362,7 +362,7 @@ *resource.gc_cap_style,
*resource.gc_join_style); #ifdef SLIT - m_slit.reset(new Slit(*this, *layerManager().getLayer(fluxbox->getDesktopLayer()), + m_slit.reset(new Slit(*this, *layerManager().getLayer(Layer::DESKTOP), fluxbox->getSlitlistFilename().c_str())); #endif // SLIT@@ -458,8 +458,6 @@ Window r, p, *children;
Display *disp = FbTk::App::instance()->display(); XQueryTree(disp, rootWindow().window(), &r, &p, &children, &nchild); - Fluxbox *fluxbox = Fluxbox::instance(); - // preen the window list of all icon windows... for better dockapp support for (unsigned int i = 0; i < nchild; i++) {@@ -485,6 +483,8 @@ XFree(wmhints);
} } + + Fluxbox *fluxbox = Fluxbox::instance(); // manage shown windows // complexity: O(n^2) if we have lots of transients to transient_for@@ -617,7 +617,7 @@
FbTk::Menu *BScreen::createMenu(const std::string &label) { FbTk::Menu *menu = new FbMenu(menuTheme(), imageControl(), - *layerManager().getLayer(Fluxbox::instance()->getMenuLayer())); + *layerManager().getLayer(Layer::MENU)); if (!label.empty()) menu->setLabel(label.c_str());@@ -1235,7 +1235,7 @@ win = winclient->fbwindow();
else { win = new FluxboxWindow(*winclient, winFrameTheme(), - *layerManager().getLayer(Fluxbox::instance()->getNormalLayer())); + *layerManager().getLayer(Layer::NORMAL)); if (!win->isManaged()) { delete win;@@ -1274,7 +1274,7 @@ }
FluxboxWindow *win = new FluxboxWindow(client, winFrameTheme(), - *layerManager().getLayer(Fluxbox::instance()->getNormalLayer())); + *layerManager().getLayer(Layer::NORMAL)); #ifdef SLIT if (win->initialState() == WithdrawnState && slit() != 0) {
@@ -26,9 +26,10 @@ #include "SendToMenu.hh"
#include "Window.hh" #include "Screen.hh" -#include "fluxbox.hh" #include "Workspace.hh" #include "WindowCmd.hh" +#include "fluxbox.hh" +#include "Layer.hh" #include "FbTk/MultiButtonMenuItem.hh" #include "FbTk/Command.hh"@@ -50,7 +51,7 @@
SendToMenu::SendToMenu(BScreen &screen): FbMenu(screen.menuTheme(), screen.imageControl(), - *screen.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())) { + *screen.layerManager().getLayer(Layer::MENU)) { // listen to: // workspace count signal // workspace names signal
@@ -44,7 +44,6 @@ #include "SimpleCommand.hh"
#include "MacroCommand.hh" #include "FbCommands.hh" #include "LayerMenu.hh" -#include "fluxbox.hh" #include "XLayer.hh" #include "RootTheme.hh" #include "FbTk/Theme.hh"@@ -252,13 +251,13 @@ : m_hidden(false),
m_screen(scr), m_slitmenu(scr.menuTheme(), scr.imageControl(), - *scr.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())), + *scr.layerManager().getLayer(Layer::MENU)), m_placement_menu(scr.menuTheme(), scr.imageControl(), - *scr.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())), + *scr.layerManager().getLayer(Layer::MENU)), m_clientlist_menu(scr.menuTheme(), scr.imageControl(), - *scr.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())), + *scr.layerManager().getLayer(Layer::MENU)), frame(scr.rootWindow()), //For KDE dock applets m_kwm1_dockwindow(XInternAtom(FbTk::App::instance()->display(),@@ -284,7 +283,7 @@ m_rc_alpha(scr.resourceManager(), 255,
scr.name() + ".slit.alpha", scr.altName() + ".Slit.Alpha"), m_rc_on_head(scr.resourceManager(), 0, scr.name() + ".slit.onhead", scr.altName() + ".Slit.onHead"), - m_rc_layernum(scr.resourceManager(), Fluxbox::Layer(Fluxbox::instance()->getDockLayer()), + m_rc_layernum(scr.resourceManager(), Layer(Layer::DOCK), scr.name() + ".slit.layer", scr.altName() + ".Slit.Layer") { _FB_USES_NLS;@@ -317,7 +316,7 @@
m_layermenu.reset(new LayerMenu(scr.menuTheme(), scr.imageControl(), *scr.layerManager(). - getLayer(Fluxbox::instance()->getMenuLayer()), + getLayer(Layer::MENU), this, true)); m_layermenu->setLabel(_FBTEXT(Slit, Layer, "Slit Layer", "Title of Slit Layer Menu"));@@ -1240,7 +1239,7 @@ new XineramaHeadMenu<Slit>(
screen().menuTheme(), screen(), screen().imageControl(), - *screen().layerManager().getLayer(Fluxbox::instance()->getMenuLayer()), + *screen().layerManager().getLayer(Layer::MENU), *this, _FBTEXT(Slit, OnHead, "Slit on Head", "Title of Slits On Head menu") ));
@@ -29,7 +29,7 @@ #define SLIT_HH
#include "LayerMenu.hh" -#include "fluxbox.hh" +#include "Layer.hh" #include "FbTk/Menu.hh" #include "FbTk/FbWindow.hh"@@ -49,6 +49,7 @@ class SlitClient;
class BScreen; class FbMenu; class Strut; +class Layer; /// Handles dock apps class Slit: public FbTk::EventHandler, public FbTk::Observer, public LayerObject {@@ -176,7 +177,7 @@ FbTk::Resource<bool> m_rc_auto_hide, m_rc_maximize_over;
FbTk::Resource<Slit::Placement> m_rc_placement; FbTk::Resource<Slit::Direction> m_rc_direction; FbTk::Resource<int> m_rc_alpha, m_rc_on_head; - FbTk::Resource<Fluxbox::Layer> m_rc_layernum; + FbTk::Resource<Layer> m_rc_layernum; };
@@ -33,13 +33,13 @@ // themes
#include "ToolbarTheme.hh" #include "FbTk/I18n.hh" -#include "fluxbox.hh" #include "Screen.hh" #include "IntResMenuItem.hh" #include "BoolMenuItem.hh" #include "Xinerama.hh" #include "Strut.hh" #include "CommandParser.hh" +#include "Layer.hh" #include "FbTk/ImageControl.hh" #include "FbTk/MacroCommand.hh"@@ -198,15 +198,15 @@ m_screen(scrn),
m_layeritem(frame.window, layer), m_layermenu(scrn.menuTheme(), scrn.imageControl(), - *scrn.layerManager().getLayer(Fluxbox::instance()->getMenuLayer()), + *scrn.layerManager().getLayer(Layer::MENU), this, true), m_placementmenu(scrn.menuTheme(), scrn.imageControl(), - *scrn.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())), + *scrn.layerManager().getLayer(Layer::MENU)), m_toolbarmenu(scrn.menuTheme(), scrn.imageControl(), - *scrn.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())), + *scrn.layerManager().getLayer(Layer::MENU)), m_theme(scrn.screenNumber()), m_tool_factory(scrn), m_strut(0),@@ -220,7 +220,7 @@ m_rc_width_percent(scrn.resourceManager(), 65,
scrn.name() + ".toolbar.widthPercent", scrn.altName() + ".Toolbar.WidthPercent"), m_rc_alpha(scrn.resourceManager(), 255, scrn.name() + ".toolbar.alpha", scrn.altName() + ".Toolbar.Alpha"), - m_rc_layernum(scrn.resourceManager(), Fluxbox::Layer(Fluxbox::instance()->getDesktopLayer()), + m_rc_layernum(scrn.resourceManager(), Layer(Layer::DESKTOP), scrn.name() + ".toolbar.layer", scrn.altName() + ".Toolbar.Layer"), m_rc_on_head(scrn.resourceManager(), 0, scrn.name() + ".toolbar.onhead", scrn.altName() + ".Toolbar.onHead"),@@ -799,7 +799,8 @@ visible_macro->add(toggle_visible);
visible_macro->add(reconfig_toolbar); visible_macro->add(save_resources); RefCommand toggle_visible_cmd(visible_macro); - menu().insert(new BoolMenuItem(_FBTEXT(Common, Visible, "Visible", "Whether this item is visible"), + menu().insert(new BoolMenuItem(_FBTEXT(Common, Visible, + "Visible", "Whether this item is visible"), *m_rc_visible, toggle_visible_cmd)); menu().insert(new BoolMenuItem(_FBTEXT(Common, AutoHide,@@ -807,27 +808,33 @@ "Auto hide", "Toggle auto hide of toolbar"),
*m_rc_auto_hide, reconfig_toolbar_and_save_resource)); - MenuItem *toolbar_menuitem = new IntResMenuItem(_FBTEXT(Toolbar, WidthPercent, "Toolbar width percent", "Percentage of screen width taken by toolbar"), - m_rc_width_percent, - 0, 100, menu()); // min/max value + MenuItem *toolbar_menuitem = + new IntResMenuItem(_FBTEXT(Toolbar, WidthPercent, + "Toolbar width percent", + "Percentage of screen width taken by toolbar"), + m_rc_width_percent, + 0, 100, menu()); // min/max value toolbar_menuitem->setCommand(reconfig_toolbar_and_save_resource); menu().insert(toolbar_menuitem); - menu().insert(new BoolMenuItem(_FBTEXT(Common, MaximizeOver,"Maximize Over", "Maximize over this thing when maximizing"), + menu().insert(new BoolMenuItem(_FBTEXT(Common, MaximizeOver, + "Maximize Over", + "Maximize over this thing when maximizing"), *m_rc_maximize_over, reconfig_toolbar_and_save_resource)); menu().insert(_FBTEXT(Menu, Layer, "Layer...", "Title of Layer menu"), &layerMenu()); if (screen().hasXinerama()) { menu().insert(_FBTEXT(Menu, OnHead, "On Head...", "Title of On Head menu"), - new XineramaHeadMenu<Toolbar>(screen().menuTheme(), - screen(), - screen().imageControl(), - *screen().layerManager().getLayer(Fluxbox::instance()->getMenuLayer()), - *this, - _FBTEXT(Toolbar, OnHead, "Toolbar on Head", "Title of toolbar on head menu"))); + new XineramaHeadMenu<Toolbar>(screen().menuTheme(), + screen(), + screen().imageControl(), + *screen().layerManager().getLayer(::Layer::MENU), + *this, + _FBTEXT(Toolbar, OnHead, "Toolbar on Head", + "Title of toolbar on head menu"))); } typedef pair<const char*, Toolbar::Placement> PlacementP;
@@ -31,7 +31,7 @@ #include "ToolbarTheme.hh"
#include "LayerMenu.hh" #include "ToolFactory.hh" #include "ToolTheme.hh" -#include "fluxbox.hh" +#include "Layer.hh" #include "FbTk/Timer.hh" #include "FbTk/Resource.hh"@@ -183,7 +183,7 @@ // resources
FbTk::Resource<bool> m_rc_auto_hide, m_rc_maximize_over, m_rc_visible; FbTk::Resource<int> m_rc_width_percent; FbTk::Resource<int> m_rc_alpha; - FbTk::Resource<Fluxbox::Layer> m_rc_layernum; + FbTk::Resource<Layer> m_rc_layernum; FbTk::Resource<int> m_rc_on_head; FbTk::Resource<Placement> m_rc_placement; FbTk::Resource<int> m_rc_height;
@@ -41,6 +41,7 @@ #include "Remember.hh"
#include "MenuCreator.hh" #include "StringUtil.hh" #include "FocusControl.hh" +#include "Layer.hh" #include "FbTk/TextButton.hh" #include "FbTk/Compose.hh"@@ -1595,7 +1596,7 @@
// be xinerama aware moveResize(screen().getHeadX(head), screen().getHeadY(head), screen().getHeadWidth(head), screen().getHeadHeight(head)); - moveToLayer(Fluxbox::instance()->getAboveDockLayer()); + moveToLayer(::Layer::ABOVE_DOCK); fullscreen = true;@@ -1612,7 +1613,7 @@ moveResize(m_old_pos_x, m_old_pos_y, m_old_width, m_old_height);
moveToLayer(m_old_layernum); m_old_decoration_mask = 0; - m_old_layernum = Fluxbox::instance()->getNormalLayer(); + m_old_layernum = ::Layer::NORMAL; stateSig().notify(); }@@ -1886,7 +1887,7 @@
void FluxboxWindow::raiseLayer() { // don't let it up to menu layer - if (layerNum() == (Fluxbox::instance()->getMenuLayer()+1)) + if (layerNum() == ::Layer::MENU + 1) return; if (!isInitialized()) {@@ -1968,11 +1969,9 @@ #ifdef DEBUG
cerr<<"FluxboxWindow("<<title()<<")::moveToLayer("<<layernum<<")"<<endl; #endif // DEBUG - Fluxbox * fluxbox = Fluxbox::instance(); - // don't let it set its layer into menu area - if (layernum <= fluxbox->getMenuLayer()) { - layernum = fluxbox->getMenuLayer() + 1; + if (layernum <= ::Layer::MENU) { + layernum = ::Layer::MENU + 1; } if (!isInitialized()) {
@@ -26,7 +26,6 @@ // $Id$
#include "Workspace.hh" -#include "fluxbox.hh" #include "Screen.hh" #include "Window.hh" #include "WinClient.hh"@@ -34,6 +33,7 @@ #include "FbWinFrame.hh"
#include "WindowCmd.hh" #include "FocusControl.hh" #include "PlacementStrategy.hh" +#include "Layer.hh" #include "FbTk/I18n.hh" #include "FbTk/MenuItem.hh"@@ -136,7 +136,7 @@ const std::string &name, unsigned int id):
m_screen(scrn), m_lastfocus(0), m_clientmenu(scrn.menuTheme(), scrn.imageControl(), - *scrn.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())), + *scrn.layerManager().getLayer(Layer::MENU)), m_layermanager(layermanager), m_name(name), m_id(id) {
@@ -24,12 +24,12 @@
#include "WorkspaceMenu.hh" #include "Screen.hh" -#include "fluxbox.hh" #include "Workspace.hh" #include "WorkspaceCmd.hh" #include "MenuCreator.hh" #include "CommandParser.hh" #include "FbCommands.hh" +#include "Layer.hh" #include "FbTk/I18n.hh" #include "FbTk/SimpleCommand.hh"@@ -57,8 +57,7 @@
WorkspaceMenu::WorkspaceMenu(BScreen &screen): FbMenu(screen.menuTheme(), screen.imageControl(), - *screen.layerManager(). - getLayer(Fluxbox::instance()->getMenuLayer())) { + *screen.layerManager().getLayer(Layer::MENU)) { init(screen);
@@ -35,6 +35,7 @@ #include "WinClient.hh"
#include "Keys.hh" #include "FbAtoms.hh" #include "FocusControl.hh" +#include "Layer.hh" #include "defaults.hh"@@ -491,7 +492,7 @@
#ifdef USE_TOOLBAR m_toolbars.push_back(new Toolbar(*screen, *screen->layerManager(). - getLayer(Fluxbox::instance()->getNormalLayer()))); + getLayer(::Layer::NORMAL))); #endif // USE_TOOLBAR // must do this after toolbar is created
@@ -136,26 +136,6 @@ // class to store layer numbers (special Resource type)
// we have a special resource type because we need to be able to name certain layers // a Resource<int> wouldn't allow this - class Layer { - public: - explicit Layer(int i) : m_num(i) {}; - int getNum() const { return m_num; } - - Layer &operator=(int num) { m_num = num; return *this; } - - private: - int m_num; - }; - - // TODO these probably should be configurable - int getMenuLayer() const { return 0; } - int getAboveDockLayer() const { return 2; } - int getDockLayer() const { return 4; } - int getTopLayer() const { return 6; } - int getNormalLayer() const { return 8; } - int getBottomLayer() const { return 10; } - int getDesktopLayer() const { return 12; } - time_t getAutoRaiseDelay() const { return *m_rc_auto_raise_delay; }