all repos — fluxbox @ 453e220df91fabd80a2f8e5992ad1a3a73f4efbe

custom fork of the fluxbox windowmanager

Add layer menu to window menu
rathnor rathnor
commit

453e220df91fabd80a2f8e5992ad1a3a73f4efbe

parent

e24348aedb99bb52f350e617de469f7809a49201

5 files changed, 67 insertions(+), 14 deletions(-)

jump to
M ChangeLogChangeLog

@@ -1,5 +1,8 @@

(Format: Year/Month/Day) Changes for 0.1.15: +*03/02/16: + * Added layer submenu to window menu + small fix (Simon) + Screen.cc Window.hh/cc fluxbox.hh *03/02/15: * Added Style menu and fixed theme listeners for FbWinFrame, Menu and Toolbar (Henrik) ToolbarTheme.hh/cc, Toolbar.hh/cc, FbTk Menu.hh/cc, FbTk MenuTheme.hh/cc,
M src/Screen.ccsrc/Screen.cc

@@ -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.106 2003/02/16 13:55:49 fluxgen Exp $ +// $Id: Screen.cc,v 1.107 2003/02/16 15:12:08 rathnor Exp $ #include "Screen.hh"

@@ -137,7 +137,23 @@ *screen.getImageControl(),

*screen.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())); return menu; } + +class WindowLayerMenuItem : public FbTk::MenuItem { +public: + WindowLayerMenuItem(const char *label, FluxboxWindow &win, int layernum): + FbTk::MenuItem(label), m_window(win), m_layernum(layernum) { + } + bool isEnabled() const { return m_window.getLayerNum() != m_layernum; } + void click(int button, int time) { + m_window.moveToLayer(m_layernum); + } + +private: + FluxboxWindow &m_window; + int m_layernum; }; + +}; // End anonymous namespace //---------- resource manipulators --------- template<>

@@ -1107,7 +1123,7 @@ CommandRef maximize_horiz_cmd(new WindowCmd(win, &FluxboxWindow::maximizeHorizontal));

CommandRef close_cmd(new WindowCmd(win, &FluxboxWindow::close)); CommandRef shade_cmd(new WindowCmd(win, &FluxboxWindow::shade)); CommandRef raise_cmd(new WindowCmd(win, &FluxboxWindow::raise)); - CommandRef lower_cmd(new WindowCmd(win, &FluxboxWindow::raise)); + CommandRef lower_cmd(new WindowCmd(win, &FluxboxWindow::lower)); CommandRef stick_cmd(new WindowCmd(win, &FluxboxWindow::stick)); CommandRef show_menu_cmd(new WindowCmd(win, &FluxboxWindow::popupMenu));

@@ -1117,7 +1133,7 @@ //!! TODO: fix this ugly hack

// get titlebar configuration const vector<Fluxbox::Titlebar> *dir = &Fluxbox::instance()->getTitlebarLeft(); for (char c=0; c<2; c++) { - for (int i=0; i< dir->size(); ++i) { + for (unsigned int i=0; i< dir->size(); ++i) { //create new buttons FbTk::Button *newbutton = 0; if (win.isIconifiable() && (*dir)[i] == Fluxbox::MINIMIZE) {

@@ -1175,13 +1191,41 @@ // setup titlebar

frame.setOnClickTitlebar(raise_cmd, 1, false, true); // on press with button 1 frame.setOnClickTitlebar(shade_cmd, 1, true); // doubleclick with button 1 frame.setOnClickTitlebar(show_menu_cmd, 3); // on release with button 3 - frame.setOnClickTitlebar(lower_cmd, 3, false, true); // on press with button 3 + frame.setOnClickTitlebar(lower_cmd, 2, false, true); // on press with button 2 frame.setDoubleClickTime(Fluxbox::instance()->getDoubleClickInterval()); // setup menu FbTk::Menu &menu = win.getWindowmenu(); menu.removeAll(); // clear old items menu.disableTitle(); // not titlebar + // check and setup layer menu + FbTk::Menu &layer_menu = win.getLayermenu(); + // 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);

@@ -1191,6 +1235,7 @@ 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("ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ"); menu.insert("Close", close_cmd);
M src/Window.ccsrc/Window.cc

@@ -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.115 2003/02/09 14:11:13 rathnor Exp $ +// $Id: Window.cc,v 1.116 2003/02/16 15:12:07 rathnor Exp $ #include "Window.hh"

@@ -112,6 +112,7 @@ timer(this),

display(0), lastButtonPressTime(0), m_windowmenu(menutheme, screen_num, imgctrl), + m_layermenu(menutheme, screen_num, imgctrl), old_decoration(DECOR_NORMAL), tab(0), m_frame(tm, imgctrl, screen_num, 0, 0, 100, 100),
M src/Window.hhsrc/Window.hh

@@ -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.45 2003/02/09 14:11:13 rathnor Exp $ +// $Id: Window.hh,v 1.46 2003/02/16 15:12:08 rathnor Exp $ #ifndef WINDOW_HH #define WINDOW_HH

@@ -220,6 +220,9 @@ Window getClientWindow() const { return client.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; } const std::string &getTitle() const { return client.title; } const std::string &getIconTitle() const { return client.icon_title; }

@@ -333,7 +336,7 @@ Display *display; /// display connection (obsolete by FbTk)

BaseDisplay::BlackboxAttributes blackbox_attrib; Time lastButtonPressTime; - FbTk::Menu m_windowmenu; + FbTk::Menu m_windowmenu, m_layermenu; timeval lastFocusTime;
M src/fluxbox.hhsrc/fluxbox.hh

@@ -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.40 2003/02/02 16:32:40 rathnor Exp $ +// $Id: fluxbox.hh,v 1.41 2003/02/16 15:12:08 rathnor Exp $ #ifndef FLUXBOX_HH #define FLUXBOX_HH

@@ -114,12 +114,13 @@ 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 2; } - inline int getSlitLayer() const { return 4; } - inline int getMenuLayer() const { return 0; } + 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; } + inline int getMenuLayer() const { return 0; } inline const timeval &getAutoRaiseDelay() const { return resource.auto_raise_delay; }