Added layer menus for windows, toolbar, and slit, plus associated resources. Cleaned up some cruft from the previous layering setup.
@@ -1,6 +1,13 @@
(Format: Year/Month/Day) Changes for 0.1.15: *03/02/17: + * Added layer menus for windows, toolbar, and slit, plus associated + resources. Cleaned up some cruft from the previous layering setup. + Gnome.cc LayerMenu.hh Screen.hh/cc Slit.hh/cc Tab.cc Toolbar.hh/cc Window.hh/cc Workspace.hh fluxbox.hh/cc + * Renamed LayeredMenu to FbMenu + LayeredMenu.hh FbMenu.hh + * Changed XLayerItem to hold FbWindows instead of Windows + XLayerItem.hh/cc XLayer.cc MultLayers.cc Window.cc * Added shade option for button config (Henrik) Screen.cc * Fixed antialias toggle for menus (Henrik)
@@ -22,7 +22,7 @@ // 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. -// $Id: Menu.hh,v 1.8 2003/02/15 01:47:43 fluxgen Exp $ +// $Id: Menu.hh,v 1.9 2003/02/18 15:11:12 rathnor Exp $ #ifndef FBTK_MENU_HH #define FBTK_MENU_HH@@ -121,6 +121,8 @@ bool isTorn() const { return torn; }
bool isVisible() const { return visible; } int screenNumber() const { return m_screen_num; } Window window() const { return menu.window.window(); } + FbTk::FbWindow &fbwindow() { return menu.window; } + const FbTk::FbWindow &fbwindow() const { return menu.window; } const std::string &label() const { return menu.label; } int x() const { return menu.x; } int y() const { return menu.y; }
@@ -19,7 +19,7 @@ // 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. -// $Id: Gnome.cc,v 1.10 2003/02/16 17:57:54 rathnor Exp $ +// $Id: Gnome.cc,v 1.11 2003/02/18 15:11:07 rathnor Exp $ #include "Gnome.hh"@@ -366,9 +366,11 @@ case WIN_LAYER_ONTOP:
layer = Fluxbox::instance()->getTopLayer(); break; case WIN_LAYER_DOCK: - layer = Fluxbox::instance()->getSlitLayer(); + layer = Fluxbox::instance()->getDockLayer(); break; - //case WIN_LAYER_ABOVE_DOCK: + case WIN_LAYER_ABOVE_DOCK: + layer = Fluxbox::instance()->getAboveDockLayer(); + break; case WIN_LAYER_MENU: layer = Fluxbox::instance()->getMenuLayer(); break;
@@ -22,7 +22,7 @@ // 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. -// $Id: Screen.cc,v 1.110 2003/02/17 12:35:59 fluxgen Exp $ +// $Id: Screen.cc,v 1.111 2003/02/18 15:11:07 rathnor Exp $ #include "Screen.hh"@@ -45,7 +45,8 @@ #include "IntResMenuItem.hh"
#include "MacroCommand.hh" #include "XLayerItem.hh" #include "MultLayers.hh" -#include "LayeredMenu.hh" +#include "FbMenu.hh" +#include "LayerMenu.hh" //use GNU extensions #ifndef _GNU_SOURCE@@ -131,13 +132,14 @@ return(-1);
} FbTk::Menu *createMenuFromScreen(BScreen &screen) { - FbTk::Menu *menu = new LayeredMenu(*screen.menuTheme(), + FbTk::Menu *menu = new FbMenu(*screen.menuTheme(), screen.getScreenNumber(), *screen.getImageControl(), *screen.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())); return menu; } +/* class WindowLayerMenuItem : public FbTk::MenuItem { public: WindowLayerMenuItem(const char *label, FluxboxWindow &win, int layernum):@@ -152,6 +154,8 @@ private:
FluxboxWindow &m_window; int m_layernum; }; +*/ + }; // End anonymous namespace@@ -345,7 +349,6 @@
BScreen::ScreenResource::ScreenResource(ResourceManager &rm, const std::string &scrname, const std::string &altscrname): - toolbar_on_top(rm, false, scrname+".toolbar.onTop", altscrname+".Toolbar.OnTop"), toolbar_auto_hide(rm, false, scrname+".toolbar.autoHide", altscrname+".Toolbar.AutoHide"), image_dither(rm, false, scrname+".imageDither", altscrname+".ImageDither"), opaque_move(rm, false, "session.opaqueMove", "Session.OpaqueMove"),@@ -365,6 +368,8 @@ toolbar_width_percent(rm, 65, scrname+".toolbar.widthPercent", altscrname+".Toolbar.WidthPercent"),
edge_snap_threshold(rm, 0, scrname+".edgeSnapThreshold", altscrname+".EdgeSnapThreshold"), tab_width(rm, 64, scrname+".tab.width", altscrname+".Tab.Width"), tab_height(rm, 16, scrname+".tab.height", altscrname+".Tab.Height"), + slit_layernum(rm, Fluxbox::instance()->getDockLayer(), scrname+".slit.layer", altscrname+".Slit.Layer"), + toolbar_layernum(rm, Fluxbox::instance()->getDesktopLayer(), scrname+".toolbar.layer", altscrname+".Toolbar.Layer"), tab_placement(rm, Tab::PTOP, scrname+".tab.placement", altscrname+".Tab.Placement"), tab_alignment(rm, Tab::ALEFT, scrname+".tab.alignment", altscrname+".Tab.Alignment"), toolbar_on_head(rm, 0, scrname+".toolbar.onhead", altscrname+".Toolbar.onHead")@@ -515,10 +520,10 @@
current_workspace = workspacesList.front(); #ifdef SLIT - m_slit.reset(new Slit(*this)); + m_slit.reset(new Slit(*this, *layerManager().getLayer(getSlitLayerNum()))); #endif // SLIT - m_toolbar.reset(new Toolbar(*this)); + m_toolbar.reset(new Toolbar(*this, *layerManager().getLayer(getToolbarLayerNum()))); // setup toolbar width menu item FbTk::MenuItem *toolbar_menuitem = new IntResMenuItem("Toolbar width percent", resource.toolbar_width_percent,@@ -536,6 +541,7 @@
FbTk::RefCount<FbTk::Command> reconfig_toolbar_and_save_resource(toolbar_menuitem_macro); toolbar_menuitem->setCommand(reconfig_toolbar_and_save_resource); + m_toolbar->menu().insert(toolbar_menuitem); setupWorkspacemenu(*this, *workspacemenu);@@ -548,8 +554,6 @@
m_toolbar->reconfigure(); initMenu(); // create and initiate rootmenu - - raiseWindows(Workspace::Stack()); //update menus m_rootmenu->update();@@ -749,7 +753,6 @@ workspacemenu->reconfigure();
m_configmenu->reconfigure(); initMenu(); - raiseWindows(Workspace::Stack()); m_rootmenu->reconfigure();@@ -784,7 +787,6 @@
void BScreen::rereadMenu() { initMenu(); - raiseWindows(Workspace::Stack()); m_rootmenu->reconfigure(); }@@ -1253,35 +1255,6 @@ FbTk::Menu &menu = win.getWindowmenu();
menu.removeAll(); // clear old items menu.disableTitle(); // not titlebar - // check and setup layer menu as a submenu windowmenu - FbTk::Menu &layer_menu = win.getLayermenu(); - layer_menu.disableTitle(); // no titlebar - // if it hasn't already been setup (no need to reset it) - if (layer_menu.numberOfItems() == 0) { - Fluxbox *fluxbox = Fluxbox::instance(); - struct { - int set; - int base; - const char *default_str; - int layernum; - } layer_menuitems[] = { - //TODO: nls - {0, 0, "Above Slit", fluxbox->getAboveSlitLayer()}, - {0, 0, "Slit", fluxbox->getSlitLayer()}, - {0, 0, "Top", fluxbox->getTopLayer()}, - {0, 0, "Normal", fluxbox->getNormalLayer()}, - {0, 0, "Bottom", fluxbox->getBottomLayer()}, - {0, 0, "Desktop", fluxbox->getDesktopLayer()}, - }; - - for (size_t i=0; i < 6; ++i) { - // TODO: fetch nls string - layer_menu.insert(new WindowLayerMenuItem(layer_menuitems[i].default_str, - win, layer_menuitems[i].layernum)); - }; - layer_menu.update(); - } - // set new menu items menu.insert("Shade", shade_cmd); menu.insert("Stick", stick_cmd);@@ -1291,57 +1264,14 @@ menu.insert("Maximize Horizontal", maximize_horiz_cmd);
menu.insert("Iconify", iconify_cmd); menu.insert("Raise", raise_cmd); menu.insert("Lower", lower_cmd); - menu.insert("Layer...", &layer_menu); + menu.insert("Layer...", win.getLayermenu()); menu.insert("ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ"); menu.insert("Close", close_cmd); menu.reconfigure(); // update graphics } -void BScreen::raiseWindows(const Workspace::Stack &workspace_stack) { - - // TODO: I don't think we need this... -#ifdef DEBUG - cerr<<"BScreen::raiseWindows() called"<<endl; -#endif //DEBUG - - /* - - Window session_stack[(workspace_stack.size() + workspacesList.size() + rootmenuList.size() + 30)]; - int i = 0; - - Workspaces::iterator wit = workspacesList.begin(); - Workspaces::iterator wit_end = workspacesList.end(); - for (; wit != wit_end; ++wit) { - session_stack[i++] = (*wit)->menu().windowID(); - } - - session_stack[i++] = workspacemenu->windowID(); - Rootmenus::iterator rit = rootmenuList.begin(); - Rootmenus::iterator rit_end = rootmenuList.end(); - for (; rit != rit_end; ++rit) { - session_stack[i++] = (*rit)->windowID(); - } - session_stack[i++] = m_rootmenu->windowID(); - - if (m_toolbar->isOnTop()) - session_stack[i++] = m_toolbar->getWindowID(); - -#ifdef SLIT - if (m_slit->isOnTop()) - session_stack[i++] = m_slit->getWindowID(); -#endif // SLIT - if (!workspace_stack.empty()) { - Workspace::Stack::const_reverse_iterator it = workspace_stack.rbegin(); - Workspace::Stack::const_reverse_iterator it_end = workspace_stack.rend(); - for (; it != it_end; ++it) - session_stack[i++] = (*it); - } - - XRestackWindows(getBaseDisplay()->getXDisplay(), session_stack, i); - */ -} void BScreen::saveStrftimeFormat(const char *format) { //make sure std::string don't get 0 string
@@ -22,7 +22,7 @@ // 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. -// $Id: Screen.hh,v 1.67 2003/02/16 00:36:17 fluxgen Exp $ +// $Id: Screen.hh,v 1.68 2003/02/18 15:11:08 rathnor Exp $ #ifndef SCREEN_HH #define SCREEN_HH@@ -36,6 +36,7 @@ #include "Subject.hh"
#include "FbWinFrameTheme.hh" #include "MultLayers.hh" #include "XLayerItem.hh" +#include "fluxbox.hh" #include <X11/Xlib.h> #include <X11/Xresource.h>@@ -77,7 +78,6 @@ const std::string &screenname, const std::string &altscreenname,
int scrn, int number_of_layers); ~BScreen(); - inline bool isToolbarOnTop() const { return *resource.toolbar_on_top; } inline bool doToolbarAutoHide() const { return *resource.toolbar_auto_hide; } inline bool isSloppyFocus() const { return resource.sloppy_focus; } inline bool isSemiSloppyFocus() const { return resource.semi_sloppy_focus; }@@ -105,7 +105,6 @@ FbTk::Menu * const getRootmenu() { return m_rootmenu.get(); }
inline const std::string &getRootCommand() const { return *resource.rootcommand; } - inline bool isSlitOnTop() const { return resource.slit_on_top; } inline bool doSlitAutoHide() const { return resource.slit_auto_hide; } #ifdef SLIT inline Slit *getSlit() { return m_slit.get(); }@@ -115,7 +114,6 @@ inline int getSlitPlacement() const { return resource.slit_placement; }
inline int getSlitDirection() const { return resource.slit_direction; } inline void saveSlitPlacement(int p) { resource.slit_placement = p; } inline void saveSlitDirection(int d) { resource.slit_direction = d; } - inline void saveSlitOnTop(bool t) { resource.slit_on_top = t; } inline void saveSlitAutoHide(bool t) { resource.slit_auto_hide = t; } inline unsigned int getSlitOnHead() const { return resource.slit_on_head; }@@ -181,6 +179,10 @@ inline int getRowPlacementDirection() const { return resource.row_direction; }
inline int getColPlacementDirection() const { return resource.col_direction; } inline unsigned int getTabWidth() const { return *resource.tab_width; } inline unsigned int getTabHeight() const { return *resource.tab_height; } + + inline int getSlitLayerNum() const { return (*resource.slit_layernum).getNum(); } + inline int getToolbarLayerNum() const { return (*resource.toolbar_layernum).getNum(); } + inline Tab::Placement getTabPlacement() const { return *resource.tab_placement; } inline Tab::Alignment getTabAlignment() const { return *resource.tab_alignment; }@@ -190,7 +192,6 @@ inline void saveSloppyFocus(bool s) { resource.sloppy_focus = s; }
inline void saveSemiSloppyFocus(bool s) { resource.semi_sloppy_focus = s; } inline void saveAutoRaise(bool a) { resource.auto_raise = a; } inline void saveWorkspaces(int w) { *resource.workspaces = w; } - inline void saveToolbarOnTop(bool r) { *resource.toolbar_on_top = r; } inline void saveToolbarAutoHide(bool r) { *resource.toolbar_auto_hide = r; } inline void saveToolbarWidthPercent(int w) { *resource.toolbar_width_percent = w; }@@ -262,7 +263,6 @@
std::string getNameOfWorkspace(unsigned int workspace) const; void changeWorkspaceID(unsigned int); void sendToWorkspace(unsigned int workspace, FluxboxWindow *win=0, bool changeworkspace=true); - void raiseWindows(const Workspace::Stack &workspace_stack); void reassociateGroup(FluxboxWindow *window, unsigned int workspace_id, bool ignore_sticky); void reassociateWindow(FluxboxWindow *window, unsigned int workspace_id, bool ignore_sticky); void prevFocus() { prevFocus(0); }@@ -375,7 +375,7 @@ struct ScreenResource {
ScreenResource(ResourceManager &rm, const std::string &scrname, const std::string &altscrname); - Resource<bool> toolbar_on_top, toolbar_auto_hide, + Resource<bool> toolbar_auto_hide, image_dither, opaque_move, full_max, max_over_slit, tab_rotate_vertical, sloppy_window_grouping, workspace_warping,@@ -387,13 +387,14 @@ bool auto_raise, sloppy_focus, semi_sloppy_focus,
ordered_dither; Resource<int> workspaces, toolbar_width_percent, edge_snap_threshold, tab_width, tab_height; + Resource<Fluxbox::Layer> slit_layernum, toolbar_layernum; int placement_policy, row_direction, col_direction; Resource<Tab::Placement> tab_placement; Resource<Tab::Alignment> tab_alignment; Resource<int> toolbar_on_head; - bool slit_on_top, slit_auto_hide; + bool slit_auto_hide; int slit_placement, slit_direction; unsigned int slit_on_head;
@@ -22,7 +22,7 @@ // 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. -// $Id: Slit.cc,v 1.34 2003/02/17 12:53:21 fluxgen Exp $ +// $Id: Slit.cc,v 1.35 2003/02/18 15:11:08 rathnor Exp $ #include "Slit.hh"@@ -43,6 +43,9 @@ #include "SimpleCommand.hh"
#include "BoolMenuItem.hh" #include "EventManager.hh" #include "MacroCommand.hh" +#include "LayerMenu.hh" +#include "fluxbox.hh" +#include "XLayer.hh" #include <algorithm> #include <iostream>@@ -104,6 +107,7 @@
} }; + /// holds slit client info class SlitClient { public:@@ -226,8 +230,8 @@
}; // End anonymous namespace -Slit::Slit(BScreen &scr, const char *filename): - m_screen(&scr), timer(this), +Slit::Slit(BScreen &scr, FbTk::XLayer &layer, const char *filename) + : m_screen(&scr), timer(this), slitmenu(*scr.menuTheme(), scr.getScreenNumber(), *scr.getImageControl()),@@ -236,12 +240,20 @@ scr.getScreenNumber(),
*scr.getImageControl()), clientlist_menu(*scr.menuTheme(), scr.getScreenNumber(), - *scr.getImageControl()) { + *scr.getImageControl()), + slit_layermenu(0), + m_layeritem(0) +{ + + slit_layermenu = new LayerMenu<Slit>(*scr.menuTheme(), + scr.getScreenNumber(), + *scr.getImageControl(), + *scr.layerManager().getLayer(Fluxbox::instance()->getMenuLayer()), + this); // default placement and direction m_direction = HORIZONTAL; m_placement = TOPLEFT; - on_top = false; hidden = do_auto_hide = false; frame.pixmap = None;@@ -270,6 +282,7 @@ screen()->getDepth(), InputOutput, screen()->getVisual(),
create_mask, &attrib); FbTk::EventManager::instance()->add(*this, frame.window); + m_layeritem = new FbTk::XLayerItem(frame.window, layer); //For KDE dock applets kwm1_dockwindow = XInternAtom(disp, "KWM_DOCKWINDOW", False); //KDE v1.x@@ -287,6 +300,8 @@
Slit::~Slit() { if (frame.pixmap != 0) screen()->getImageControl()->removeImage(frame.pixmap); + if (m_layeritem) delete m_layeritem; + if (slit_layermenu) delete slit_layermenu; }@@ -904,13 +919,7 @@ void Slit::buttonPressEvent(XButtonEvent &e) {
if (e.window != frame.window.window()) return; - if (e.button == Button1 && (! on_top)) { - Workspace::Stack st; - st.push_back(frame.window.window()); - screen()->raiseWindows(st); - } else if (e.button == Button2 && (! on_top)) { - frame.window.lower(); - } else if (e.button == Button3) { + if (e.button == Button3) { if (! slitmenu.isVisible()) { int x = e.x_root - (slitmenu.width() / 2), y = e.y_root - (slitmenu.height() / 2);@@ -1068,13 +1077,6 @@ prevName = name;
} } -void Slit::setOnTop(bool val) { - if (isOnTop()) - screen()->raiseWindows(Workspace::Stack()); - -} - - void Slit::setAutoHide(bool val) { do_auto_hide = val; }@@ -1091,11 +1093,8 @@ slitmenu.insert(i18n->getMessage(
CommonSet, CommonPlacementTitle, "Placement"), &placement_menu); - slitmenu.insert(new BoolMenuItem(i18n->getMessage( - CommonSet, CommonAlwaysOnTop, - "Always on top"), - on_top, - menu_cmd)); + + slitmenu.insert("Layer...", slit_layermenu); slitmenu.insert(new BoolMenuItem(i18n->getMessage( CommonSet, CommonAutoHide,
@@ -22,7 +22,7 @@ // 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. -/// $Id: Slit.hh,v 1.18 2003/01/12 17:53:10 fluxgen Exp $ +/// $Id: Slit.hh,v 1.19 2003/02/18 15:11:08 rathnor Exp $ #ifndef SLIT_HH #define SLIT_HH@@ -30,6 +30,8 @@
#include "Menu.hh" #include "FbWindow.hh" #include "Timer.hh" +#include "XLayerItem.hh" +#include "LayerMenu.hh" #include <X11/Xlib.h> #include <X11/Xutil.h>@@ -54,10 +56,9 @@ */
enum Placement { TOPLEFT = 1, CENTERLEFT, BOTTOMLEFT, TOPCENTER, BOTTOMCENTER, TOPRIGHT, CENTERRIGHT, BOTTOMRIGHT }; - explicit Slit(BScreen &screen, const char *filename = 0); + explicit Slit(BScreen &screen, FbTk::XLayer &layer, const char *filename = 0); virtual ~Slit(); - inline bool isOnTop() const { return on_top; } inline bool isHidden() const { return hidden; } inline bool doAutoHide() const { return do_auto_hide; } inline Direction direction() const { return m_direction; }@@ -74,7 +75,6 @@ inline unsigned int height() const { return frame.height; }
void setDirection(Direction dir); void setPlacement(Placement place); - void setOnTop(bool val); void setAutoHide(bool val); void addClient(Window clientwin); void removeClient(Window clientwin, bool = true);@@ -101,6 +101,9 @@ void leaveNotifyEvent(XCrossingEvent &event);
void configureRequestEvent(XConfigureRequestEvent &event); //@} + void moveToLayer(int layernum) { m_layeritem->moveToLayer(layernum); } + FbTk::XLayerItem &getLayerItem() { return *m_layeritem; } + virtual void timeout();@@ -111,7 +114,7 @@ void removeClient(SlitClient *client, bool remap, bool destroy);
void loadClientList(const char *filename); void updateClientmenu(); - bool on_top, hidden, do_auto_hide; + bool hidden, do_auto_hide; Direction m_direction; Placement m_placement;@@ -122,6 +125,7 @@ typedef std::list<SlitClient *> SlitClients;
SlitClients clientList; FbTk::Menu slitmenu, placement_menu, clientlist_menu; + LayerMenu<Slit> *slit_layermenu; std::string clientListPath; std::string m_filename;@@ -134,6 +138,8 @@ unsigned int width, height;
} frame; // for KDE Atom kwm1_dockwindow, kwm2_dockwindow; + + FbTk::XLayerItem *m_layeritem; };
@@ -19,7 +19,7 @@ // 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. -// $Id: Tab.cc,v 1.54 2003/02/09 14:11:12 rathnor Exp $ +// $Id: Tab.cc,v 1.55 2003/02/18 15:11:09 rathnor Exp $ #include "Tab.hh"@@ -152,6 +152,7 @@ // Raises the tabs in the tablist
//----------------------------------------- void Tab::raise() { //get first tab + /* Tab *tab = 0; //raise tabs Workspace::Stack st;@@ -159,6 +160,7 @@ for (tab = getFirst(this); tab!=0; tab = tab->m_next) {
st.push_back(tab->m_tabwin); } m_win->getScreen()->raiseWindows(st); + */ } //-------------- lower --------------------
@@ -22,7 +22,7 @@ // 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. -// $Id: Toolbar.cc,v 1.58 2003/02/17 12:32:21 fluxgen Exp $ +// $Id: Toolbar.cc,v 1.59 2003/02/18 15:11:09 rathnor Exp $ #include "Toolbar.hh"@@ -91,6 +91,8 @@ menu.setLabel(i18n->getMessage(
ToolbarSet, ToolbarToolbarTitle, "Toolbar")); menu.setInternalMenu(); + + menu.insert("Layer...", tbar.layermenu()); using namespace FbTk; RefCount<Command> start_edit(new SimpleCommand<Toolbar>(tbar, &Toolbar::edit));@@ -166,8 +168,7 @@ evm.remove(window_label);
evm.remove(clock); } -Toolbar::Toolbar(BScreen &scrn, size_t width): - on_top(scrn.isToolbarOnTop()), +Toolbar::Toolbar(BScreen &scrn, FbTk::XLayer &layer, size_t width): editing(false), hidden(scrn.doToolbarAutoHide()), do_auto_hide(scrn.doToolbarAutoHide()),@@ -177,10 +178,20 @@ image_ctrl(*scrn.getImageControl()),
clock_timer(this), // get the clock updating every minute hide_timer(&hide_handler), m_toolbarmenu(*scrn.menuTheme(), scrn.getScreenNumber(), *scrn.getImageControl()), + m_layermenu(0), m_theme(scrn.getScreenNumber()), m_place(BOTTOMCENTER), - m_themelistener(*this) { + m_themelistener(*this), + m_layeritem(0) +{ + m_layermenu = new LayerMenu<Toolbar>( + *scrn.menuTheme(), + scrn.getScreenNumber(), + *scrn.getImageControl(), + *scrn.layerManager().getLayer(Fluxbox::instance()->getMenuLayer()), + this); + // we need to get notified when the theme is reloaded m_theme.addListener(m_themelistener);@@ -193,6 +204,8 @@ frame.window_label_w =
frame.workspace_label_w = frame.clock_w = width/3; frame.button_w = 20; frame.bevel_w = 1; + + m_layeritem = new FbTk::XLayerItem(frame.window, layer); timeval delay; delay.tv_sec = 1;@@ -247,6 +260,8 @@ if (frame.wlabel) image_ctrl.removeImage(frame.wlabel);
if (frame.clk) image_ctrl.removeImage(frame.clk); if (frame.button) image_ctrl.removeImage(frame.button); if (frame.pbutton) image_ctrl.removeImage(frame.pbutton); + if (m_layeritem) delete m_layeritem; + if (m_layermenu) delete m_layermenu; }@@ -748,13 +763,6 @@ frame.clock.clear();
checkClock(true, true); } #endif // HAVE_STRFTIME - else if (! on_top) { - Workspace::Stack st; - st.push_back(frame.window.window()); - screen().raiseWindows(st); - } - } else if (be.button == 2 && (! on_top)) { - frame.window.lower(); } else if (be.button == 3) { FluxboxWindow *fluxboxwin = 0; // if we clicked on a icon then show window menu
@@ -22,7 +22,7 @@ // 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. -// $Id: Toolbar.hh,v 1.23 2003/02/16 00:08:29 fluxgen Exp $ +// $Id: Toolbar.hh,v 1.24 2003/02/18 15:11:10 rathnor Exp $ #ifndef TOOLBAR_HH #define TOOLBAR_HH@@ -34,11 +34,12 @@ #include "EventHandler.hh"
#include "FbWindow.hh" #include "ArrowButton.hh" #include "Observer.hh" +#include "XLayer.hh" +#include "XLayerItem.hh" +#include "LayerMenu.hh" #include <memory> -class Toolbar; - namespace FbTk { class ImageControl; };@@ -61,7 +62,7 @@ RIGHTCENTER, RIGHTBOTTOM, RIGHTTOP
}; /// create a toolbar on the screen with specific width - explicit Toolbar(BScreen &screen, size_t width = 200); + explicit Toolbar(BScreen &screen, FbTk::XLayer &layer, size_t width = 200); /// destructor virtual ~Toolbar();@@ -73,10 +74,15 @@
inline const FbTk::Menu &menu() const { return m_toolbarmenu; } inline FbTk::Menu &menu() { return m_toolbarmenu; } + inline FbTk::Menu *layermenu() { return m_layermenu; } + inline const FbTk::Menu *layermenu() const { return m_layermenu; } + + void moveToLayer(int layernum) { m_layeritem->moveToLayer(layernum); } + + FbTk::XLayerItem &getLayerItem() { return *m_layeritem; } + /// are we in workspacename editing? inline bool isEditing() const { return editing; } - /// always on top? - inline bool isOnTop() const { return on_top; } /// are we hidden? inline bool isHidden() const { return hidden; } /// do we auto hide the toolbar?@@ -120,7 +126,6 @@
private: - bool on_top; ///< always on top bool editing; ///< edit workspace label mode bool hidden; ///< hidden state bool do_auto_hide; ///< do we auto hide@@ -130,6 +135,7 @@ /// Toolbar frame
struct Frame { Frame(FbTk::EventHandler &evh, int screen_num); ~Frame(); + Pixmap base, label, wlabel, clk, button, pbutton; FbTk::FbWindow window, workspace_label, window_label, clock; ArrowButton psbutton, nsbutton, pwbutton, nwbutton;@@ -152,6 +158,7 @@ FbTk::ImageControl &image_ctrl;
FbTk::Timer clock_timer; ///< timer to update clock FbTk::Timer hide_timer; ///< timer to for auto hide toolbar FbTk::Menu m_toolbarmenu; + LayerMenu<Toolbar> *m_layermenu; std::auto_ptr<IconBar> m_iconbar; std::string new_workspace_name; ///< temp variable in edit workspace name mode@@ -170,6 +177,8 @@ Toolbar &m_tb;
}; ThemeListener m_themelistener; + + FbTk::XLayerItem *m_layeritem; };
@@ -22,7 +22,7 @@ // 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. -// $Id: Window.cc,v 1.119 2003/02/17 22:42:52 fluxgen Exp $ +// $Id: Window.cc,v 1.120 2003/02/18 15:11:10 rathnor Exp $ #include "Window.hh"@@ -112,13 +112,20 @@ timer(this),
display(0), lastButtonPressTime(0), m_windowmenu(menutheme, screen_num, imgctrl), - m_layermenu(menutheme, screen_num, imgctrl), + m_layermenu(0), old_decoration(DECOR_NORMAL), tab(0), m_frame(tm, imgctrl, screen_num, 0, 0, 100, 100), - m_layeritem(getFrameWindow(), layer), - m_layernum(layer.getLayerNum()) { + m_layeritem(m_frame.window(), layer), + m_layernum(layer.getLayerNum()) +{ + m_layermenu = new LayerMenu<FluxboxWindow>( + menutheme, + screen_num, + imgctrl, + *s->layerManager().getLayer(Fluxbox::instance()->getMenuLayer()), + this); // redirect events from frame to us@@ -353,6 +360,8 @@ if (client.window_group) {
fluxbox->removeGroupSearch(client.window_group); client.window_group = 0; } + + if (m_layermenu) delete m_layermenu; if (client.window) fluxbox->removeWindowSearch(client.window);
@@ -22,7 +22,7 @@ // 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. -// $Id: Window.hh,v 1.49 2003/02/17 22:41:24 fluxgen Exp $ +// $Id: Window.hh,v 1.50 2003/02/18 15:11:11 rathnor Exp $ #ifndef WINDOW_HH #define WINDOW_HH@@ -34,6 +34,7 @@ #include "Subject.hh"
#include "FbWinFrame.hh" #include "EventHandler.hh" #include "XLayerItem.hh" +#include "LayerMenu.hh" #include <X11/Xlib.h> #include <X11/Xutil.h>@@ -57,6 +58,7 @@ class MenuTheme;
class ImageControl; class XLayer; }; + /// Creates the window frame and handles any window event for it class FluxboxWindow : public FbTk::TimeoutHandler, public FbTk::EventHandler {@@ -223,11 +225,14 @@
Window getFrameWindow() const { return m_frame.window().window(); } Window getClientWindow() const { return client.window; } + FbTk::FbWindow &getFbWindow() { return m_frame.window(); } + const FbTk::FbWindow &getFbWindow() const { return m_frame.window(); } + FbTk::Menu &getWindowmenu() { return m_windowmenu; } const FbTk::Menu &getWindowmenu() const { return m_windowmenu; } - FbTk::Menu &getLayermenu() { return m_layermenu; } - const FbTk::Menu &getLayermenu() const { return m_layermenu; } + FbTk::Menu *getLayermenu() { return m_layermenu; } + const FbTk::Menu *getLayermenu() const { return m_layermenu; } const std::string &getTitle() const { return client.title; } const std::string &getIconTitle() const { return client.icon_title; }@@ -341,7 +346,8 @@ Display *display; /// display connection (obsolete by FbTk)
BaseDisplay::BlackboxAttributes blackbox_attrib; Time lastButtonPressTime; - FbTk::Menu m_windowmenu, m_layermenu; + FbTk::Menu m_windowmenu; + LayerMenu<FluxboxWindow> *m_layermenu; timeval lastFocusTime;@@ -402,6 +408,11 @@
enum { F_NOINPUT = 0, F_PASSIVE, F_LOCALLYACTIVE, F_GLOBALLYACTIVE }; }; + +template <> +void LayerMenuItem<FluxboxWindow>::click(int button, int time) { + m_object->moveToLayer(m_layernum); +} #endif // WINDOW_HH
@@ -45,7 +45,6 @@ */
class Workspace:private FbTk::NotCopyable { public: typedef std::vector<FluxboxWindow *> Windows; - typedef std::vector<Window> Stack; Workspace(BScreen &screen, FbTk::MultLayers &layermanager, unsigned int workspaceid = 0);
@@ -22,7 +22,7 @@ // 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. -// $Id: fluxbox.cc,v 1.96 2003/02/17 12:31:17 fluxgen Exp $ +// $Id: fluxbox.cc,v 1.97 2003/02/18 15:11:12 rathnor Exp $ #include "fluxbox.hh"@@ -281,6 +281,56 @@ getString() {
char tmpstr[128]; sprintf(tmpstr, "%ul", m_value); return string(tmpstr); +} + +template<> +void Resource<Fluxbox::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(); + else if (strcasecmp(strval, "AboveDock") == 0) + m_value = Fluxbox::instance()->getAboveDockLayer(); + else if (strcasecmp(strval, "Dock") == 0) + m_value = Fluxbox::instance()->getDockLayer(); + else if (strcasecmp(strval, "Top") == 0) + m_value = Fluxbox::instance()->getTopLayer(); + else if (strcasecmp(strval, "Normal") == 0) + m_value = Fluxbox::instance()->getNormalLayer(); + else if (strcasecmp(strval, "Bottom") == 0) + m_value = Fluxbox::instance()->getBottomLayer(); + else if (strcasecmp(strval, "Desktop") == 0) + m_value = Fluxbox::instance()->getDesktopLayer(); + else + setDefaultValue(); +} + + +template<> +string Resource<Fluxbox::Layer>:: +getString() { + + 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 { + char tmpstr[128]; + sprintf(tmpstr, "%d", m_value.getNum()); + return string(tmpstr); + } } //static singleton var
@@ -22,7 +22,7 @@ // 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. -// $Id: fluxbox.hh,v 1.42 2003/02/17 12:29:35 fluxgen Exp $ +// $Id: fluxbox.hh,v 1.43 2003/02/18 15:11:12 rathnor Exp $ #ifndef FLUXBOX_HH #define FLUXBOX_HH@@ -103,7 +103,7 @@ Tab *searchTab(Window);
/// obsolete enum Titlebar{SHADE=0, MINIMIZE, MAXIMIZE, CLOSE, STICK, MENU, EMPTY}; - + inline const std::vector<Fluxbox::Titlebar>& getTitlebarRight() { return *m_rc_titlebar_right; } inline const std::vector<Fluxbox::Titlebar>& getTitlebarLeft() { return *m_rc_titlebar_left; } inline const std::string &getStyleFilename() const { return *m_rc_stylefile; }@@ -113,14 +113,26 @@ inline const std::string &getSlitlistFilename() const { return *m_rc_slitlistfile; }
inline int colorsPerChannel() const { return *m_rc_colors_per_channel; } inline int getNumberOfLayers() const { return *m_rc_numlayers; } - // TODO there probably should be configurable - inline int getDesktopLayer() const { return 12; } - inline int getBottomLayer() const { return 10; } - inline int getNormalLayer() const { return 8; } - inline int getTopLayer() const { return 6; } - inline int getSlitLayer() const { return 4; } - inline int getAboveSlitLayer() const { return 2; } + // class to store layer numbers (special Resource type) + class Layer { + public: + Layer(int i) : m_num(i) {}; + const 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 inline int getMenuLayer() const { return 0; } + inline int getAboveDockLayer() const { return 2; } + inline int getDockLayer() const { return 4; } + inline int getTopLayer() const { return 6; } + inline int getNormalLayer() const { return 8; } + inline int getBottomLayer() const { return 10; } + inline int getDesktopLayer() const { return 12; } inline const timeval &getAutoRaiseDelay() const { return resource.auto_raise_delay; }@@ -216,6 +228,7 @@ Resource<int> m_rc_colors_per_channel, m_rc_numlayers;
Resource<std::string> m_rc_stylefile, m_rc_menufile, m_rc_keyfile, m_rc_slitlistfile, m_rc_groupfile; + Resource<TitlebarList> m_rc_titlebar_left, m_rc_titlebar_right; Resource<unsigned int> m_rc_cache_life, m_rc_cache_max;