moved class Layer from class Fluxbox and thus reduces some dependecies

This commit is contained in:
fluxgen 2006-02-20 21:04:35 +00:00
parent 2566d84561
commit 369b4e1b92
20 changed files with 218 additions and 159 deletions

View file

@ -27,8 +27,8 @@
#include "Window.hh" #include "Window.hh"
#include "WinClient.hh" #include "WinClient.hh"
#include "Workspace.hh" #include "Workspace.hh"
#include "fluxbox.hh" #include "Layer.hh"
#include "FbTk/App.hh"
#include "FbTk/FbWindow.hh" #include "FbTk/FbWindow.hh"
#include "FbTk/I18n.hh" #include "FbTk/I18n.hh"
@ -194,7 +194,7 @@ void Ewmh::setupFrame(FluxboxWindow &win) {
&data); &data);
if (data) { if (data) {
Atom *atoms = (unsigned long *)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: /* From Extended Window Manager Hints, draft 1.3:
* *
* _NET_WM_WINDOW_TYPE_DOCK indicates a dock or panel feature. * _NET_WM_WINDOW_TYPE_DOCK indicates a dock or panel feature.
@ -217,7 +217,7 @@ void Ewmh::setupFrame(FluxboxWindow &win) {
win.setFocusHidden(true); win.setFocusHidden(true);
win.setIconHidden(true); win.setIconHidden(true);
win.moveToLayer(Fluxbox::instance()->getDesktopLayer()); win.moveToLayer(Layer::DESKTOP);
win.setDecorationMask(0); win.setDecorationMask(0);
win.setTabable(false); win.setTabable(false);
win.setMovable(false); win.setMovable(false);
@ -534,9 +534,9 @@ void Ewmh::updateState(FluxboxWindow &win) {
state.push_back(m_net_wm_state_sticky); state.push_back(m_net_wm_state_sticky);
if (win.isShaded()) if (win.isShaded())
state.push_back(m_net_wm_state_shaded); 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); 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); state.push_back(m_net_wm_state_above);
if (win.isIconic()) if (win.isIconic())
state.push_back(m_net_wm_state_hidden); state.push_back(m_net_wm_state_hidden);
@ -889,15 +889,15 @@ void Ewmh::setState(FluxboxWindow &win, Atom state, bool value) {
win.setIconHidden(value); win.setIconHidden(value);
} else if (state == m_net_wm_state_below) { // bottom layer } else if (state == m_net_wm_state_below) { // bottom layer
if (value) if (value)
win.moveToLayer(Fluxbox::instance()->getBottomLayer()); win.moveToLayer(Layer::BOTTOM);
else else
win.moveToLayer(Fluxbox::instance()->getNormalLayer()); win.moveToLayer(Layer::NORMAL);
} else if (state == m_net_wm_state_above) { // above layer } else if (state == m_net_wm_state_above) { // above layer
if (value) if (value)
win.moveToLayer(Fluxbox::instance()->getAboveDockLayer()); win.moveToLayer(Layer::ABOVE_DOCK);
else else
win.moveToLayer(Fluxbox::instance()->getNormalLayer()); win.moveToLayer(Layer::NORMAL);
} }
} }
@ -916,16 +916,16 @@ void Ewmh::toggleState(FluxboxWindow &win, Atom state) {
} else if (state == m_net_wm_state_skip_taskbar) { } else if (state == m_net_wm_state_skip_taskbar) {
win.setIconHidden(!win.isIconHidden()); win.setIconHidden(!win.isIconHidden());
} else if (state == m_net_wm_state_below) { // bottom layer } else if (state == m_net_wm_state_below) { // bottom layer
if (win.layerNum() == Fluxbox::instance()->getBottomLayer()) if (win.layerNum() == Layer::BOTTOM)
win.moveToLayer(Fluxbox::instance()->getNormalLayer()); win.moveToLayer(Layer::NORMAL);
else else
win.moveToLayer(Fluxbox::instance()->getBottomLayer()); win.moveToLayer(Layer::BOTTOM);
} else if (state == m_net_wm_state_above) { // top layer } else if (state == m_net_wm_state_above) { // top layer
if (win.layerNum() == Fluxbox::instance()->getAboveDockLayer()) if (win.layerNum() == Layer::ABOVE_DOCK)
win.moveToLayer(Fluxbox::instance()->getNormalLayer()); win.moveToLayer(Layer::NORMAL);
else else
win.moveToLayer(Fluxbox::instance()->getAboveDockLayer()); win.moveToLayer(Layer::ABOVE_DOCK);
} }
} }

View file

@ -23,13 +23,15 @@
#include "Gnome.hh" #include "Gnome.hh"
#include "fluxbox.hh" #include "App.hh"
#include "Window.hh" #include "Window.hh"
#include "Screen.hh" #include "Screen.hh"
#include "WinClient.hh" #include "WinClient.hh"
#include "Workspace.hh" #include "Workspace.hh"
#include "Layer.hh"
#include "FbTk/I18n.hh" #include "FbTk/I18n.hh"
#include <iostream> #include <iostream>
#include <new> #include <new>
using namespace std; using namespace std;
@ -279,7 +281,7 @@ void Gnome::updateState(FluxboxWindow &win) {
void Gnome::updateLayer(FluxboxWindow &win) { void Gnome::updateLayer(FluxboxWindow &win) {
//TODO - map from flux layers to gnome ones //TODO - map from flux layers to gnome ones
// our layers are in the opposite direction to GNOME // 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 = win.clientList().begin();
FluxboxWindow::ClientList::iterator client_it_end = win.clientList().end(); FluxboxWindow::ClientList::iterator client_it_end = win.clientList().end();
@ -418,47 +420,47 @@ void Gnome::setLayer(FluxboxWindow *win, int layer) {
#ifdef DEBUG #ifdef DEBUG
cerr<<"Gnome::setLayer("<<win->title()<<", WIN_LAYER_DESKTOP)"<<endl; cerr<<"Gnome::setLayer("<<win->title()<<", WIN_LAYER_DESKTOP)"<<endl;
#endif // DEBUG #endif // DEBUG
layer = Fluxbox::instance()->getDesktopLayer(); layer = Layer::DESKTOP;
break; break;
case WIN_LAYER_BELOW: case WIN_LAYER_BELOW:
#ifdef DEBUG #ifdef DEBUG
cerr<<"Gnome::setLayer("<<win->title()<<", WIN_LAYER_BELOW)"<<endl; cerr<<"Gnome::setLayer("<<win->title()<<", WIN_LAYER_BELOW)"<<endl;
#endif // DEBUG #endif // DEBUG
layer = Fluxbox::instance()->getBottomLayer(); layer = Layer::BOTTOM;
break; break;
case WIN_LAYER_NORMAL: case WIN_LAYER_NORMAL:
#ifdef DEBUG #ifdef DEBUG
cerr<<"Gnome::setLayer("<<win->title()<<", WIN_LAYER_NORMAL)"<<endl; cerr<<"Gnome::setLayer("<<win->title()<<", WIN_LAYER_NORMAL)"<<endl;
#endif // DEBUG #endif // DEBUG
layer = Fluxbox::instance()->getNormalLayer(); layer = Layer::NORMAL;
break; break;
case WIN_LAYER_ONTOP: case WIN_LAYER_ONTOP:
#ifdef DEBUG #ifdef DEBUG
cerr<<"Gnome::setLayer("<<win->title()<<", WIN_LAYER_ONTOP)"<<endl; cerr<<"Gnome::setLayer("<<win->title()<<", WIN_LAYER_ONTOP)"<<endl;
#endif // DEBUG #endif // DEBUG
layer = Fluxbox::instance()->getTopLayer(); layer = Layer::TOP;
break; break;
case WIN_LAYER_DOCK: case WIN_LAYER_DOCK:
#ifdef DEBUG #ifdef DEBUG
cerr<<"Gnome::setLayer("<<win->title()<<", WIN_LAYER_DOCK)"<<endl; cerr<<"Gnome::setLayer("<<win->title()<<", WIN_LAYER_DOCK)"<<endl;
#endif // DEBUG #endif // DEBUG
layer = Fluxbox::instance()->getDockLayer(); layer = Layer::DOCK;
break; break;
case WIN_LAYER_ABOVE_DOCK: case WIN_LAYER_ABOVE_DOCK:
#ifdef DEBUG #ifdef DEBUG
cerr<<"Gnome::setLayer("<<win->title()<<", WIN_LAYER_ABOVE_DOCK)"<<endl; cerr<<"Gnome::setLayer("<<win->title()<<", WIN_LAYER_ABOVE_DOCK)"<<endl;
#endif // DEBUG #endif // DEBUG
layer = Fluxbox::instance()->getAboveDockLayer(); layer = Layer::ABOVE_DOCK;
break; break;
case WIN_LAYER_MENU: case WIN_LAYER_MENU:
#ifdef DEBUG #ifdef DEBUG
cerr<<"Gnome::setLayer("<<win->title()<<", WIN_LAYER_MENU)"<<endl; cerr<<"Gnome::setLayer("<<win->title()<<", WIN_LAYER_MENU)"<<endl;
#endif // DEBUG #endif // DEBUG
layer = Fluxbox::instance()->getMenuLayer(); layer = Layer::MENU;
break; break;
default: default:
// our windows are in the opposite direction to gnome // our windows are in the opposite direction to gnome
layer = Fluxbox::instance()->getDesktopLayer() - layer; layer = Layer::DESKTOP - layer;
#ifdef DEBUG #ifdef DEBUG
cerr<<"Gnome::setLayer("<<win->title()<<", "<<layer<<")"<<endl; cerr<<"Gnome::setLayer("<<win->title()<<", "<<layer<<")"<<endl;
#endif // DEBUG #endif // DEBUG

View file

@ -25,7 +25,7 @@
#include "Screen.hh" #include "Screen.hh"
#include "IconMenuItem.hh" #include "IconMenuItem.hh"
#include "fluxbox.hh" #include "Layer.hh"
#include "FbTk/I18n.hh" #include "FbTk/I18n.hh"
#include <typeinfo> #include <typeinfo>
@ -47,7 +47,7 @@ IconMenu::IconMenu(BScreen &screen):
FbMenu(screen.menuTheme(), FbMenu(screen.menuTheme(),
screen.imageControl(), screen.imageControl(),
*screen.layerManager(). *screen.layerManager().
getLayer(Fluxbox::instance()->getMenuLayer())) { getLayer(Layer::MENU)) {
_FB_USES_NLS; _FB_USES_NLS;
setLabel(_FBTEXT(Menu, Icons, "Icons", "Iconic windows menu title")); setLabel(_FBTEXT(Menu, Icons, "Icons", "Iconic windows menu title"));

View file

@ -29,12 +29,13 @@
#include "Window.hh" #include "Window.hh"
#include "IconButton.hh" #include "IconButton.hh"
#include "Workspace.hh" #include "Workspace.hh"
#include "fluxbox.hh"
#include "FbMenu.hh" #include "FbMenu.hh"
#include "BoolMenuItem.hh" #include "BoolMenuItem.hh"
#include "CommandParser.hh" #include "CommandParser.hh"
#include "WinClient.hh" #include "WinClient.hh"
#include "FocusControl.hh" #include "FocusControl.hh"
#include "FbCommands.hh"
#include "Layer.hh"
#include "FbTk/I18n.hh" #include "FbTk/I18n.hh"
#include "FbTk/Menu.hh" #include "FbTk/Menu.hh"
@ -236,9 +237,7 @@ void setupModeMenu(FbTk::Menu &menu, IconbarTool &handler) {
menu.setLabel(_FBTEXT(Toolbar, IconbarMode, "Iconbar Mode", "Menu title - chooses which set of icons are shown in the iconbar")); 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>( RefCount<Command> saverc_cmd(new FbCommands::SaveResources());
*Fluxbox::instance(),
&Fluxbox::save_rc));
menu.insert(new ToolbarModeMenuItem(_FBTEXT(Toolbar, IconbarModeNone, menu.insert(new ToolbarModeMenuItem(_FBTEXT(Toolbar, IconbarModeNone,
@ -382,7 +381,7 @@ IconbarTool::IconbarTool(const FbTk::FbWindow &parent, IconbarTheme &theme, BScr
m_rc_use_pixmap(screen.resourceManager(), true, m_rc_use_pixmap(screen.resourceManager(), true,
screen.name() + ".iconbar.usePixmap", screen.altName() + ".Iconbar.UsePixmap"), screen.name() + ".iconbar.usePixmap", screen.altName() + ".Iconbar.UsePixmap"),
m_menu(screen.menuTheme(), screen.imageControl(), m_menu(screen.menuTheme(), screen.imageControl(),
*screen.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())) { *screen.layerManager().getLayer(Layer::MENU)) {
// setup mode menu // setup mode menu
setupModeMenu(m_menu, *this); setupModeMenu(m_menu, *this);

52
src/Layer.hh Normal file
View file

@ -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

View file

@ -1,6 +1,7 @@
#include "LayerMenu.hh" #include "LayerMenu.hh"
#include "fluxbox.hh" #include "FbCommands.hh"
#include "Layer.hh"
#include "FbTk/RefCount.hh" #include "FbTk/RefCount.hh"
#include "FbTk/SimpleCommand.hh" #include "FbTk/SimpleCommand.hh"
@ -11,7 +12,6 @@ LayerMenu::LayerMenu(MenuTheme &tm, FbTk::ImageControl &imgctrl,
ToggleMenu(tm, imgctrl, layer) { ToggleMenu(tm, imgctrl, layer) {
_FB_USES_NLS; _FB_USES_NLS;
Fluxbox *fluxbox = Fluxbox::instance();
struct { struct {
int set; int set;
@ -20,17 +20,15 @@ LayerMenu::LayerMenu(MenuTheme &tm, FbTk::ImageControl &imgctrl,
int layernum; int layernum;
} layer_menuitems[] = { } layer_menuitems[] = {
//TODO: nls //TODO: nls
{0, 0, _FBTEXT(Layer, AboveDock, "Above Dock", "Layer above dock"), fluxbox->getAboveDockLayer()}, {0, 0, _FBTEXT(Layer, AboveDock, "Above Dock", "Layer above dock"), Layer::ABOVE_DOCK},
{0, 0, _FBTEXT(Layer, Dock, "Dock", "Layer dock"), fluxbox->getDockLayer()}, {0, 0, _FBTEXT(Layer, Dock, "Dock", "Layer dock"), Layer::DOCK},
{0, 0, _FBTEXT(Layer, Top, "Top", "Layer top"), fluxbox->getTopLayer()}, {0, 0, _FBTEXT(Layer, Top, "Top", "Layer top"), Layer::TOP},
{0, 0, _FBTEXT(Layer, Normal, "Normal", "Layer normal"), fluxbox->getNormalLayer()}, {0, 0, _FBTEXT(Layer, Normal, "Normal", "Layer normal"), Layer::NORMAL},
{0, 0, _FBTEXT(Layer, Bottom, "Bottom", "Layer bottom"), fluxbox->getBottomLayer()}, {0, 0, _FBTEXT(Layer, Bottom, "Bottom", "Layer bottom"), Layer::BOTTOM},
{0, 0, _FBTEXT(Layer, Desktop, "Desktop", "Layer desktop"), fluxbox->getDesktopLayer()}, {0, 0, _FBTEXT(Layer, Desktop, "Desktop", "Layer desktop"), Layer::DESKTOP},
}; };
FbTk::RefCount<FbTk::Command> saverc_cmd(new FbTk::SimpleCommand<Fluxbox>( FbTk::RefCount<FbTk::Command> saverc_cmd(new FbCommands::SaveResources());
*Fluxbox::instance(),
&Fluxbox::save_rc));
for (size_t i=0; i < 6; ++i) { for (size_t i=0; i < 6; ++i) {
// TODO: fetch nls string // TODO: fetch nls string

View file

@ -36,6 +36,7 @@
#include "WorkspaceMenu.hh" #include "WorkspaceMenu.hh"
#include "LayerMenu.hh" #include "LayerMenu.hh"
#include "SendToMenu.hh" #include "SendToMenu.hh"
#include "Layer.hh"
#include "FbMenuParser.hh" #include "FbMenuParser.hh"
#include "StyleMenuItem.hh" #include "StyleMenuItem.hh"
@ -364,8 +365,7 @@ FbTk::Menu *MenuCreator::createMenu(const std::string &label, int screen_number)
FbTk::Menu *menu = new FbMenu(screen->menuTheme(), FbTk::Menu *menu = new FbMenu(screen->menuTheme(),
screen->imageControl(), screen->imageControl(),
*screen->layerManager(). *screen->layerManager().getLayer(Layer::MENU));
getLayer(Fluxbox::instance()->getMenuLayer()));
if (!label.empty()) if (!label.empty())
menu->setLabel(label.c_str()); menu->setLabel(label.c_str());
@ -511,24 +511,41 @@ bool MenuCreator::createWindowMenuItem(const std::string &type,
menu.insert(maximize_item); menu.insert(maximize_item);
} else if (type == "iconify") { } else if (type == "iconify") {
RefCmd iconify_cmd(new WindowCmd<void>(&FluxboxWindow::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") { } else if (type == "close") {
RefCmd close_cmd(new WindowCmd<void>(&FluxboxWindow::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") { } else if (type == "kill" || type == "killwindow") {
RefCmd kill_cmd(new WindowCmd<void>(&FluxboxWindow::kill)); 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") { } else if (type == "lower") {
RefCmd lower_cmd(new WindowCmd<void>(&FluxboxWindow::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") { } else if (type == "raise") {
RefCmd raise_cmd(new WindowCmd<void>(&FluxboxWindow::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") { } else if (type == "stick") {
RefCmd stick_cmd(new WindowCmd<void>(&FluxboxWindow::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); menu.insert(label.empty() ?
} _FBTEXT(Windowmenu, Stick,
else if (type == "extramenus") { "Stick", "Stick the window"):
label.c_str(), stick_cmd);
} else if (type == "extramenus") {
BScreen *screen = Fluxbox::instance()->findScreen(menu.screenNumber()); BScreen *screen = Fluxbox::instance()->findScreen(menu.screenNumber());
BScreen::ExtraMenus::iterator it = screen->extraWindowMenus().begin(); BScreen::ExtraMenus::iterator it = screen->extraWindowMenus().begin();
BScreen::ExtraMenus::iterator it_end = screen->extraWindowMenus().end(); BScreen::ExtraMenus::iterator it_end = screen->extraWindowMenus().end();
@ -540,7 +557,7 @@ bool MenuCreator::createWindowMenuItem(const std::string &type,
} else if (type == "sendto") { } else if (type == "sendto") {
menu.insert(label.empty() ? _FBTEXT(Windowmenu, SendTo, "Send To...", "Send to menu item name"): menu.insert(label.empty() ? _FBTEXT(Windowmenu, SendTo, "Send To...", "Send to menu item name"):
label.c_str(), new SendToMenu(*Fluxbox::instance()->findScreen(menu.screenNumber()))); 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()); BScreen *screen = Fluxbox::instance()->findScreen(menu.screenNumber());
if (screen == 0) if (screen == 0)
return false; return false;
@ -549,8 +566,7 @@ bool MenuCreator::createWindowMenuItem(const std::string &type,
FbTk::Menu *submenu = new LayerMenu(screen->menuTheme(), FbTk::Menu *submenu = new LayerMenu(screen->menuTheme(),
screen->imageControl(), screen->imageControl(),
*screen->layerManager(). *screen->layerManager().getLayer(Layer::MENU),
getLayer(Fluxbox::instance()->getMenuLayer()),
&context, &context,
false); false);
submenu->disableTitle(); submenu->disableTitle();

View file

@ -32,6 +32,7 @@
#include "FbCommands.hh" #include "FbCommands.hh"
#include "fluxbox.hh" #include "fluxbox.hh"
#include "WindowCmd.hh" #include "WindowCmd.hh"
#include "Layer.hh"
#include "FbTk/I18n.hh" #include "FbTk/I18n.hh"
#include "FbTk/StringUtil.hh" #include "FbTk/StringUtil.hh"
@ -345,19 +346,19 @@ int Remember::parseApp(ifstream &file, Application &app, string *first_line) {
} else if (str_key == "Layer") { } else if (str_key == "Layer") {
unsigned int l; unsigned int l;
if (str_label == "DESKTOP") { if (str_label == "DESKTOP") {
l = Fluxbox::instance()->getDesktopLayer(); l = Layer::DESKTOP;
} else if (str_label == "BOTTOM") { } else if (str_label == "BOTTOM") {
l = Fluxbox::instance()->getBottomLayer(); l = Layer::BOTTOM;
} else if (str_label == "NORMAL") { } else if (str_label == "NORMAL") {
l = Fluxbox::instance()->getNormalLayer(); l = Layer::NORMAL;
} else if (str_label == "TOP") { } else if (str_label == "TOP") {
l = Fluxbox::instance()->getTopLayer(); l = Layer::TOP;
} else if (str_label == "DOCK") { } else if (str_label == "DOCK") {
l = Fluxbox::instance()->getDockLayer(); l = Layer::DOCK;
} else if (str_label == "ABOVEDOCK") { } else if (str_label == "ABOVEDOCK") {
l = Fluxbox::instance()->getAboveDockLayer(); l = Layer::ABOVE_DOCK;
} else if (str_label == "MENU") { } else if (str_label == "MENU") {
l = Fluxbox::instance()->getMenuLayer(); l = Layer::MENU;
} else { } else {
FbTk_istringstream iss(str_label.c_str()); FbTk_istringstream iss(str_label.c_str());
iss >> l; iss >> l;

View file

@ -24,8 +24,11 @@
// holds main resource functions // holds main resource functions
#include "fluxbox.hh"
#include "FbTk/StringUtil.hh" #include "FbTk/StringUtil.hh"
#include "FbTk/Resource.hh"
#include "fluxbox.hh"
#include "Layer.hh"
#include <stdio.h> #include <stdio.h>
#include <string> #include <string>
@ -188,54 +191,55 @@ getString() const {
} }
template<> template<>
void FbTk::Resource<Fluxbox::Layer>:: void FbTk::Resource<Layer>::
setFromString(const char *strval) { setFromString(const char *strval) {
int tempnum = 0; int tempnum = 0;
if (sscanf(strval, "%d", &tempnum) == 1) if (sscanf(strval, "%d", &tempnum) == 1)
m_value = tempnum; m_value = tempnum;
else if (strcasecmp(strval, "Menu") == 0) else if (strcasecmp(strval, "Menu") == 0)
m_value = Fluxbox::instance()->getMenuLayer(); m_value = ::Layer::MENU;
else if (strcasecmp(strval, "AboveDock") == 0) else if (strcasecmp(strval, "AboveDock") == 0)
m_value = Fluxbox::instance()->getAboveDockLayer(); m_value = ::Layer::ABOVE_DOCK;
else if (strcasecmp(strval, "Dock") == 0) else if (strcasecmp(strval, "Dock") == 0)
m_value = Fluxbox::instance()->getDockLayer(); m_value = ::Layer::DOCK;
else if (strcasecmp(strval, "Top") == 0) else if (strcasecmp(strval, "Top") == 0)
m_value = Fluxbox::instance()->getTopLayer(); m_value = ::Layer::TOP;
else if (strcasecmp(strval, "Normal") == 0) else if (strcasecmp(strval, "Normal") == 0)
m_value = Fluxbox::instance()->getNormalLayer(); m_value = ::Layer::NORMAL;
else if (strcasecmp(strval, "Bottom") == 0) else if (strcasecmp(strval, "Bottom") == 0)
m_value = Fluxbox::instance()->getBottomLayer(); m_value = ::Layer::BOTTOM;
else if (strcasecmp(strval, "Desktop") == 0) else if (strcasecmp(strval, "Desktop") == 0)
m_value = Fluxbox::instance()->getDesktopLayer(); m_value = ::Layer::DESKTOP;
else else
setDefaultValue(); setDefaultValue();
} }
template<> template<>
string FbTk::Resource<Fluxbox::Layer>:: std::string FbTk::Resource<Layer>::
getString() const { getString() const {
switch (m_value.getNum()) {
if (m_value.getNum() == Fluxbox::instance()->getMenuLayer()) case Layer::MENU:
return string("Menu"); return std::string("Menu");
else if (m_value.getNum() == Fluxbox::instance()->getAboveDockLayer()) case Layer::ABOVE_DOCK:
return string("AboveDock"); return std::string("AboveDock");
else if (m_value.getNum() == Fluxbox::instance()->getDockLayer()) case Layer::DOCK:
return string("Dock"); return std::string("Dock");
else if (m_value.getNum() == Fluxbox::instance()->getTopLayer()) case Layer::TOP:
return string("Top"); return std::string("Top");
else if (m_value.getNum() == Fluxbox::instance()->getNormalLayer()) case Layer::NORMAL:
return string("Normal"); return std::string("Normal");
else if (m_value.getNum() == Fluxbox::instance()->getBottomLayer()) case Layer::BOTTOM:
return string("Bottom"); return std::string("Bottom");
else if (m_value.getNum() == Fluxbox::instance()->getDesktopLayer()) case Layer::DESKTOP:
return string("Desktop"); return std::string("Desktop");
else { default:
char tmpstr[128]; char tmpstr[128];
sprintf(tmpstr, "%d", m_value.getNum()); sprintf(tmpstr, "%d", m_value.getNum());
return string(tmpstr); return std::string(tmpstr);
} }
} }
template<> template<>
void FbTk::Resource<long>:: void FbTk::Resource<long>::
setFromString(const char *strval) { setFromString(const char *strval) {

View file

@ -362,7 +362,7 @@ BScreen::BScreen(FbTk::ResourceManager &rm,
*resource.gc_join_style); *resource.gc_join_style);
#ifdef SLIT #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())); fluxbox->getSlitlistFilename().c_str()));
#endif // SLIT #endif // SLIT
@ -458,8 +458,6 @@ void BScreen::initWindows() {
Display *disp = FbTk::App::instance()->display(); Display *disp = FbTk::App::instance()->display();
XQueryTree(disp, rootWindow().window(), &r, &p, &children, &nchild); XQueryTree(disp, rootWindow().window(), &r, &p, &children, &nchild);
Fluxbox *fluxbox = Fluxbox::instance();
// preen the window list of all icon windows... for better dockapp support // preen the window list of all icon windows... for better dockapp support
for (unsigned int i = 0; i < nchild; i++) { for (unsigned int i = 0; i < nchild; i++) {
@ -486,6 +484,8 @@ void BScreen::initWindows() {
} }
Fluxbox *fluxbox = Fluxbox::instance();
// manage shown windows // manage shown windows
// complexity: O(n^2) if we have lots of transients to transient_for // complexity: O(n^2) if we have lots of transients to transient_for
// but usually O(n) // but usually O(n)
@ -617,7 +617,7 @@ void BScreen::update(FbTk::Subject *subj) {
FbTk::Menu *BScreen::createMenu(const std::string &label) { FbTk::Menu *BScreen::createMenu(const std::string &label) {
FbTk::Menu *menu = new FbMenu(menuTheme(), FbTk::Menu *menu = new FbMenu(menuTheme(),
imageControl(), imageControl(),
*layerManager().getLayer(Fluxbox::instance()->getMenuLayer())); *layerManager().getLayer(Layer::MENU));
if (!label.empty()) if (!label.empty())
menu->setLabel(label.c_str()); menu->setLabel(label.c_str());
@ -1235,7 +1235,7 @@ FluxboxWindow *BScreen::createWindow(Window client) {
else { else {
win = new FluxboxWindow(*winclient, win = new FluxboxWindow(*winclient,
winFrameTheme(), winFrameTheme(),
*layerManager().getLayer(Fluxbox::instance()->getNormalLayer())); *layerManager().getLayer(Layer::NORMAL));
if (!win->isManaged()) { if (!win->isManaged()) {
delete win; delete win;
@ -1274,7 +1274,7 @@ FluxboxWindow *BScreen::createWindow(WinClient &client) {
FluxboxWindow *win = new FluxboxWindow(client, FluxboxWindow *win = new FluxboxWindow(client,
winFrameTheme(), winFrameTheme(),
*layerManager().getLayer(Fluxbox::instance()->getNormalLayer())); *layerManager().getLayer(Layer::NORMAL));
#ifdef SLIT #ifdef SLIT
if (win->initialState() == WithdrawnState && slit() != 0) { if (win->initialState() == WithdrawnState && slit() != 0) {

View file

@ -26,9 +26,10 @@
#include "Window.hh" #include "Window.hh"
#include "Screen.hh" #include "Screen.hh"
#include "fluxbox.hh"
#include "Workspace.hh" #include "Workspace.hh"
#include "WindowCmd.hh" #include "WindowCmd.hh"
#include "fluxbox.hh"
#include "Layer.hh"
#include "FbTk/MultiButtonMenuItem.hh" #include "FbTk/MultiButtonMenuItem.hh"
#include "FbTk/Command.hh" #include "FbTk/Command.hh"
@ -50,7 +51,7 @@ private:
SendToMenu::SendToMenu(BScreen &screen): SendToMenu::SendToMenu(BScreen &screen):
FbMenu(screen.menuTheme(), FbMenu(screen.menuTheme(),
screen.imageControl(), screen.imageControl(),
*screen.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())) { *screen.layerManager().getLayer(Layer::MENU)) {
// listen to: // listen to:
// workspace count signal // workspace count signal
// workspace names signal // workspace names signal

View file

@ -44,7 +44,6 @@
#include "MacroCommand.hh" #include "MacroCommand.hh"
#include "FbCommands.hh" #include "FbCommands.hh"
#include "LayerMenu.hh" #include "LayerMenu.hh"
#include "fluxbox.hh"
#include "XLayer.hh" #include "XLayer.hh"
#include "RootTheme.hh" #include "RootTheme.hh"
#include "FbTk/Theme.hh" #include "FbTk/Theme.hh"
@ -252,13 +251,13 @@ Slit::Slit(BScreen &scr, FbTk::XLayer &layer, const char *filename)
m_screen(scr), m_screen(scr),
m_slitmenu(scr.menuTheme(), m_slitmenu(scr.menuTheme(),
scr.imageControl(), scr.imageControl(),
*scr.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())), *scr.layerManager().getLayer(Layer::MENU)),
m_placement_menu(scr.menuTheme(), m_placement_menu(scr.menuTheme(),
scr.imageControl(), scr.imageControl(),
*scr.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())), *scr.layerManager().getLayer(Layer::MENU)),
m_clientlist_menu(scr.menuTheme(), m_clientlist_menu(scr.menuTheme(),
scr.imageControl(), scr.imageControl(),
*scr.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())), *scr.layerManager().getLayer(Layer::MENU)),
frame(scr.rootWindow()), frame(scr.rootWindow()),
//For KDE dock applets //For KDE dock applets
m_kwm1_dockwindow(XInternAtom(FbTk::App::instance()->display(), m_kwm1_dockwindow(XInternAtom(FbTk::App::instance()->display(),
@ -284,7 +283,7 @@ Slit::Slit(BScreen &scr, FbTk::XLayer &layer, const char *filename)
scr.name() + ".slit.alpha", scr.altName() + ".Slit.Alpha"), scr.name() + ".slit.alpha", scr.altName() + ".Slit.Alpha"),
m_rc_on_head(scr.resourceManager(), 0, m_rc_on_head(scr.resourceManager(), 0,
scr.name() + ".slit.onhead", scr.altName() + ".Slit.onHead"), 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") { scr.name() + ".slit.layer", scr.altName() + ".Slit.Layer") {
_FB_USES_NLS; _FB_USES_NLS;
@ -317,7 +316,7 @@ Slit::Slit(BScreen &scr, FbTk::XLayer &layer, const char *filename)
m_layermenu.reset(new LayerMenu(scr.menuTheme(), m_layermenu.reset(new LayerMenu(scr.menuTheme(),
scr.imageControl(), scr.imageControl(),
*scr.layerManager(). *scr.layerManager().
getLayer(Fluxbox::instance()->getMenuLayer()), getLayer(Layer::MENU),
this, this,
true)); true));
m_layermenu->setLabel(_FBTEXT(Slit, Layer, "Slit Layer", "Title of Slit Layer Menu")); m_layermenu->setLabel(_FBTEXT(Slit, Layer, "Slit Layer", "Title of Slit Layer Menu"));
@ -1240,7 +1239,7 @@ void Slit::setupMenu() {
screen().menuTheme(), screen().menuTheme(),
screen(), screen(),
screen().imageControl(), screen().imageControl(),
*screen().layerManager().getLayer(Fluxbox::instance()->getMenuLayer()), *screen().layerManager().getLayer(Layer::MENU),
*this, *this,
_FBTEXT(Slit, OnHead, "Slit on Head", "Title of Slits On Head menu") _FBTEXT(Slit, OnHead, "Slit on Head", "Title of Slits On Head menu")
)); ));

View file

@ -29,7 +29,7 @@
#include "LayerMenu.hh" #include "LayerMenu.hh"
#include "fluxbox.hh" #include "Layer.hh"
#include "FbTk/Menu.hh" #include "FbTk/Menu.hh"
#include "FbTk/FbWindow.hh" #include "FbTk/FbWindow.hh"
@ -49,6 +49,7 @@ class SlitClient;
class BScreen; class BScreen;
class FbMenu; class FbMenu;
class Strut; class Strut;
class Layer;
/// Handles dock apps /// Handles dock apps
class Slit: public FbTk::EventHandler, public FbTk::Observer, public LayerObject { class Slit: public FbTk::EventHandler, public FbTk::Observer, public LayerObject {
@ -176,7 +177,7 @@ private:
FbTk::Resource<Slit::Placement> m_rc_placement; FbTk::Resource<Slit::Placement> m_rc_placement;
FbTk::Resource<Slit::Direction> m_rc_direction; FbTk::Resource<Slit::Direction> m_rc_direction;
FbTk::Resource<int> m_rc_alpha, m_rc_on_head; FbTk::Resource<int> m_rc_alpha, m_rc_on_head;
FbTk::Resource<Fluxbox::Layer> m_rc_layernum; FbTk::Resource<Layer> m_rc_layernum;
}; };

View file

@ -33,13 +33,13 @@
#include "ToolbarTheme.hh" #include "ToolbarTheme.hh"
#include "FbTk/I18n.hh" #include "FbTk/I18n.hh"
#include "fluxbox.hh"
#include "Screen.hh" #include "Screen.hh"
#include "IntResMenuItem.hh" #include "IntResMenuItem.hh"
#include "BoolMenuItem.hh" #include "BoolMenuItem.hh"
#include "Xinerama.hh" #include "Xinerama.hh"
#include "Strut.hh" #include "Strut.hh"
#include "CommandParser.hh" #include "CommandParser.hh"
#include "Layer.hh"
#include "FbTk/ImageControl.hh" #include "FbTk/ImageControl.hh"
#include "FbTk/MacroCommand.hh" #include "FbTk/MacroCommand.hh"
@ -198,15 +198,15 @@ Toolbar::Toolbar(BScreen &scrn, FbTk::XLayer &layer, size_t width):
m_layeritem(frame.window, layer), m_layeritem(frame.window, layer),
m_layermenu(scrn.menuTheme(), m_layermenu(scrn.menuTheme(),
scrn.imageControl(), scrn.imageControl(),
*scrn.layerManager().getLayer(Fluxbox::instance()->getMenuLayer()), *scrn.layerManager().getLayer(Layer::MENU),
this, this,
true), true),
m_placementmenu(scrn.menuTheme(), m_placementmenu(scrn.menuTheme(),
scrn.imageControl(), scrn.imageControl(),
*scrn.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())), *scrn.layerManager().getLayer(Layer::MENU)),
m_toolbarmenu(scrn.menuTheme(), m_toolbarmenu(scrn.menuTheme(),
scrn.imageControl(), scrn.imageControl(),
*scrn.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())), *scrn.layerManager().getLayer(Layer::MENU)),
m_theme(scrn.screenNumber()), m_theme(scrn.screenNumber()),
m_tool_factory(scrn), m_tool_factory(scrn),
m_strut(0), m_strut(0),
@ -220,7 +220,7 @@ Toolbar::Toolbar(BScreen &scrn, FbTk::XLayer &layer, size_t width):
scrn.name() + ".toolbar.widthPercent", scrn.altName() + ".Toolbar.WidthPercent"), scrn.name() + ".toolbar.widthPercent", scrn.altName() + ".Toolbar.WidthPercent"),
m_rc_alpha(scrn.resourceManager(), 255, m_rc_alpha(scrn.resourceManager(), 255,
scrn.name() + ".toolbar.alpha", scrn.altName() + ".Toolbar.Alpha"), 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"), scrn.name() + ".toolbar.layer", scrn.altName() + ".Toolbar.Layer"),
m_rc_on_head(scrn.resourceManager(), 0, m_rc_on_head(scrn.resourceManager(), 0,
scrn.name() + ".toolbar.onhead", scrn.altName() + ".Toolbar.onHead"), scrn.name() + ".toolbar.onhead", scrn.altName() + ".Toolbar.onHead"),
@ -799,7 +799,8 @@ void Toolbar::setupMenus() {
visible_macro->add(reconfig_toolbar); visible_macro->add(reconfig_toolbar);
visible_macro->add(save_resources); visible_macro->add(save_resources);
RefCommand toggle_visible_cmd(visible_macro); 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)); *m_rc_visible, toggle_visible_cmd));
menu().insert(new BoolMenuItem(_FBTEXT(Common, AutoHide, menu().insert(new BoolMenuItem(_FBTEXT(Common, AutoHide,
@ -807,27 +808,33 @@ void Toolbar::setupMenus() {
*m_rc_auto_hide, *m_rc_auto_hide,
reconfig_toolbar_and_save_resource)); reconfig_toolbar_and_save_resource));
MenuItem *toolbar_menuitem = new IntResMenuItem(_FBTEXT(Toolbar, WidthPercent, "Toolbar width percent", "Percentage of screen width taken by toolbar"), MenuItem *toolbar_menuitem =
m_rc_width_percent, new IntResMenuItem(_FBTEXT(Toolbar, WidthPercent,
0, 100, menu()); // min/max value "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); toolbar_menuitem->setCommand(reconfig_toolbar_and_save_resource);
menu().insert(toolbar_menuitem); 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, *m_rc_maximize_over,
reconfig_toolbar_and_save_resource)); reconfig_toolbar_and_save_resource));
menu().insert(_FBTEXT(Menu, Layer, "Layer...", "Title of Layer menu"), &layerMenu()); menu().insert(_FBTEXT(Menu, Layer, "Layer...", "Title of Layer menu"), &layerMenu());
if (screen().hasXinerama()) { if (screen().hasXinerama()) {
menu().insert(_FBTEXT(Menu, OnHead, "On Head...", "Title of On Head menu"), menu().insert(_FBTEXT(Menu, OnHead, "On Head...", "Title of On Head menu"),
new XineramaHeadMenu<Toolbar>(screen().menuTheme(), new XineramaHeadMenu<Toolbar>(screen().menuTheme(),
screen(), screen(),
screen().imageControl(), screen().imageControl(),
*screen().layerManager().getLayer(Fluxbox::instance()->getMenuLayer()), *screen().layerManager().getLayer(::Layer::MENU),
*this, *this,
_FBTEXT(Toolbar, OnHead, "Toolbar on Head", "Title of toolbar on head menu"))); _FBTEXT(Toolbar, OnHead, "Toolbar on Head",
"Title of toolbar on head menu")));
} }
typedef pair<const char*, Toolbar::Placement> PlacementP; typedef pair<const char*, Toolbar::Placement> PlacementP;

View file

@ -31,7 +31,7 @@
#include "LayerMenu.hh" #include "LayerMenu.hh"
#include "ToolFactory.hh" #include "ToolFactory.hh"
#include "ToolTheme.hh" #include "ToolTheme.hh"
#include "fluxbox.hh" #include "Layer.hh"
#include "FbTk/Timer.hh" #include "FbTk/Timer.hh"
#include "FbTk/Resource.hh" #include "FbTk/Resource.hh"
@ -183,7 +183,7 @@ private:
FbTk::Resource<bool> m_rc_auto_hide, m_rc_maximize_over, m_rc_visible; 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_width_percent;
FbTk::Resource<int> m_rc_alpha; 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<int> m_rc_on_head;
FbTk::Resource<Placement> m_rc_placement; FbTk::Resource<Placement> m_rc_placement;
FbTk::Resource<int> m_rc_height; FbTk::Resource<int> m_rc_height;

View file

@ -41,6 +41,7 @@
#include "MenuCreator.hh" #include "MenuCreator.hh"
#include "StringUtil.hh" #include "StringUtil.hh"
#include "FocusControl.hh" #include "FocusControl.hh"
#include "Layer.hh"
#include "FbTk/TextButton.hh" #include "FbTk/TextButton.hh"
#include "FbTk/Compose.hh" #include "FbTk/Compose.hh"
@ -1595,7 +1596,7 @@ void FluxboxWindow::setFullscreen(bool flag) {
// be xinerama aware // be xinerama aware
moveResize(screen().getHeadX(head), screen().getHeadY(head), moveResize(screen().getHeadX(head), screen().getHeadY(head),
screen().getHeadWidth(head), screen().getHeadHeight(head)); screen().getHeadWidth(head), screen().getHeadHeight(head));
moveToLayer(Fluxbox::instance()->getAboveDockLayer()); moveToLayer(::Layer::ABOVE_DOCK);
fullscreen = true; fullscreen = true;
@ -1612,7 +1613,7 @@ void FluxboxWindow::setFullscreen(bool flag) {
moveToLayer(m_old_layernum); moveToLayer(m_old_layernum);
m_old_decoration_mask = 0; m_old_decoration_mask = 0;
m_old_layernum = Fluxbox::instance()->getNormalLayer(); m_old_layernum = ::Layer::NORMAL;
stateSig().notify(); stateSig().notify();
} }
@ -1886,7 +1887,7 @@ void FluxboxWindow::tempRaise() {
void FluxboxWindow::raiseLayer() { void FluxboxWindow::raiseLayer() {
// don't let it up to menu layer // don't let it up to menu layer
if (layerNum() == (Fluxbox::instance()->getMenuLayer()+1)) if (layerNum() == ::Layer::MENU + 1)
return; return;
if (!isInitialized()) { if (!isInitialized()) {
@ -1968,11 +1969,9 @@ void FluxboxWindow::moveToLayer(int layernum) {
cerr<<"FluxboxWindow("<<title()<<")::moveToLayer("<<layernum<<")"<<endl; cerr<<"FluxboxWindow("<<title()<<")::moveToLayer("<<layernum<<")"<<endl;
#endif // DEBUG #endif // DEBUG
Fluxbox * fluxbox = Fluxbox::instance();
// don't let it set its layer into menu area // don't let it set its layer into menu area
if (layernum <= fluxbox->getMenuLayer()) { if (layernum <= ::Layer::MENU) {
layernum = fluxbox->getMenuLayer() + 1; layernum = ::Layer::MENU + 1;
} }
if (!isInitialized()) { if (!isInitialized()) {

View file

@ -26,7 +26,6 @@
#include "Workspace.hh" #include "Workspace.hh"
#include "fluxbox.hh"
#include "Screen.hh" #include "Screen.hh"
#include "Window.hh" #include "Window.hh"
#include "WinClient.hh" #include "WinClient.hh"
@ -34,6 +33,7 @@
#include "WindowCmd.hh" #include "WindowCmd.hh"
#include "FocusControl.hh" #include "FocusControl.hh"
#include "PlacementStrategy.hh" #include "PlacementStrategy.hh"
#include "Layer.hh"
#include "FbTk/I18n.hh" #include "FbTk/I18n.hh"
#include "FbTk/MenuItem.hh" #include "FbTk/MenuItem.hh"
@ -136,7 +136,7 @@ Workspace::Workspace(BScreen &scrn, FbTk::MultLayers &layermanager,
m_screen(scrn), m_screen(scrn),
m_lastfocus(0), m_lastfocus(0),
m_clientmenu(scrn.menuTheme(), scrn.imageControl(), m_clientmenu(scrn.menuTheme(), scrn.imageControl(),
*scrn.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())), *scrn.layerManager().getLayer(Layer::MENU)),
m_layermanager(layermanager), m_layermanager(layermanager),
m_name(name), m_name(name),
m_id(id) { m_id(id) {

View file

@ -24,12 +24,12 @@
#include "WorkspaceMenu.hh" #include "WorkspaceMenu.hh"
#include "Screen.hh" #include "Screen.hh"
#include "fluxbox.hh"
#include "Workspace.hh" #include "Workspace.hh"
#include "WorkspaceCmd.hh" #include "WorkspaceCmd.hh"
#include "MenuCreator.hh" #include "MenuCreator.hh"
#include "CommandParser.hh" #include "CommandParser.hh"
#include "FbCommands.hh" #include "FbCommands.hh"
#include "Layer.hh"
#include "FbTk/I18n.hh" #include "FbTk/I18n.hh"
#include "FbTk/SimpleCommand.hh" #include "FbTk/SimpleCommand.hh"
@ -57,8 +57,7 @@
WorkspaceMenu::WorkspaceMenu(BScreen &screen): WorkspaceMenu::WorkspaceMenu(BScreen &screen):
FbMenu(screen.menuTheme(), FbMenu(screen.menuTheme(),
screen.imageControl(), screen.imageControl(),
*screen.layerManager(). *screen.layerManager().getLayer(Layer::MENU)) {
getLayer(Fluxbox::instance()->getMenuLayer())) {
init(screen); init(screen);

View file

@ -35,6 +35,7 @@
#include "Keys.hh" #include "Keys.hh"
#include "FbAtoms.hh" #include "FbAtoms.hh"
#include "FocusControl.hh" #include "FocusControl.hh"
#include "Layer.hh"
#include "defaults.hh" #include "defaults.hh"
@ -491,7 +492,7 @@ int Fluxbox::initScreen(int scrnr) {
#ifdef USE_TOOLBAR #ifdef USE_TOOLBAR
m_toolbars.push_back(new Toolbar(*screen, m_toolbars.push_back(new Toolbar(*screen,
*screen->layerManager(). *screen->layerManager().
getLayer(Fluxbox::instance()->getNormalLayer()))); getLayer(::Layer::NORMAL)));
#endif // USE_TOOLBAR #endif // USE_TOOLBAR
// must do this after toolbar is created // must do this after toolbar is created

View file

@ -136,26 +136,6 @@ public:
// we have a special resource type because we need to be able to name certain layers // we have a special resource type because we need to be able to name certain layers
// a Resource<int> wouldn't allow this // 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; } time_t getAutoRaiseDelay() const { return *m_rc_auto_raise_delay; }