all repos — fluxbox @ f53c93e5e0add69771204056550d07b4fee4efef

custom fork of the fluxbox windowmanager

moved all focus handling to class FocusControl
fluxgen fluxgen
commit

f53c93e5e0add69771204056550d07b4fee4efef

parent

330c8c0b09f10effa9a80245a99dde691a9bc501

2 files changed, 33 insertions(+), 27 deletions(-)

jump to
M src/FocusModelMenuItem.hhsrc/FocusModelMenuItem.hh

@@ -25,48 +25,54 @@

#ifndef FOCUSMODELMENUITEM_HH #define FOCUSMODELMENUITEM_HH -#include "Screen.hh" #include "FbTk/MenuItem.hh" #include "FbTk/RefCount.hh" #include "FbTk/Command.hh" + +#include "FocusControl.hh" class FocusModelMenuItem : public FbTk::MenuItem { public: - FocusModelMenuItem(const char *label, BScreen &screen, - BScreen::FocusModel model, + FocusModelMenuItem(const char *label, FocusControl &focus_control, + FocusControl::FocusModel model, FbTk::RefCount<FbTk::Command> &cmd): - FbTk::MenuItem(label, cmd), m_screen(screen), m_focusmodel(model) { - } - bool isEnabled() const { return m_screen.getFocusModel() != m_focusmodel; } + FbTk::MenuItem(label, cmd), + m_focus_control(focus_control), + m_focusmodel(model) { } + + bool isEnabled() const { return m_focus_control.focusModel() != m_focusmodel; } void click(int button, int time) { - m_screen.saveFocusModel(m_focusmodel); + m_focus_control.setFocusModel(m_focusmodel); FbTk::MenuItem::click(button, time); } private: - BScreen &m_screen; - BScreen::FocusModel m_focusmodel; + FocusControl &m_focus_control; + FocusControl::FocusModel m_focusmodel; }; class TabFocusModelMenuItem : public FbTk::MenuItem { public: - TabFocusModelMenuItem(const char *label, BScreen &screen, - BScreen::TabFocusModel model, - FbTk::RefCount<FbTk::Command> &cmd): - FbTk::MenuItem(label, cmd), m_screen(screen), m_tabfocusmodel(model) { - } - bool isEnabled() const { return m_screen.getTabFocusModel() != m_tabfocusmodel; } + TabFocusModelMenuItem(const char *label, + FocusControl &focus_control, + FocusControl::TabFocusModel model, + FbTk::RefCount<FbTk::Command> &cmd): + FbTk::MenuItem(label, cmd), + m_focus_control(focus_control), + m_tabfocusmodel(model) { } + + bool isEnabled() const { return m_focus_control.tabFocusModel() != m_tabfocusmodel; } void click(int button, int time) { - m_screen.saveTabFocusModel(m_tabfocusmodel); + m_focus_control.setTabFocusModel(m_tabfocusmodel); FbTk::MenuItem::click(button, time); } private: - BScreen &m_screen; - BScreen::TabFocusModel m_tabfocusmodel; + FocusControl &m_focus_control; + FocusControl::TabFocusModel m_tabfocusmodel; };
M src/WorkspaceCmd.ccsrc/WorkspaceCmd.cc

@@ -50,17 +50,17 @@ if (fb->lastEvent().type == KeyPress) {

unsigned int mods = FbTk::KeyUtil::instance().cleanMods(fb->lastEvent().xkey.state); mods = FbTk::KeyUtil::instance().isolateModifierMask(mods); if (mods == 0) // can't stacked cycle unless there is a mod to grab - screen->nextFocus(m_option | BScreen::CYCLELINEAR); + screen->focusControl().nextFocus(m_option | FocusControl::CYCLELINEAR); else { // if stacked cycling, then set a watch for // the release of exactly these modifiers if (!fb->watchingScreen() && - !(m_option & BScreen::CYCLELINEAR)) + !(m_option & FocusControl::CYCLELINEAR)) Fluxbox::instance()->watchKeyRelease(*screen, mods); - screen->nextFocus(m_option); + screen->focusControl().nextFocus(m_option); } } else - screen->nextFocus(m_option); + screen->focusControl().nextFocus(m_option); } }

@@ -73,17 +73,17 @@ if (fb->lastEvent().type == KeyPress) {

unsigned int mods = FbTk::KeyUtil::instance().cleanMods(fb->lastEvent().xkey.state); mods = FbTk::KeyUtil::instance().isolateModifierMask(mods); if (mods == 0) // can't stacked cycle unless there is a mod to grab - screen->prevFocus(m_option | BScreen::CYCLELINEAR); + screen->focusControl().prevFocus(m_option | FocusControl::CYCLELINEAR); else { // if stacked cycling, then set a watch for // the release of exactly these modifiers if (!fb->watchingScreen() - && !(m_option & BScreen::CYCLELINEAR)) + && !(m_option & FocusControl::CYCLELINEAR)) Fluxbox::instance()->watchKeyRelease(*screen, mods); - screen->prevFocus(m_option); + screen->focusControl().prevFocus(m_option); } } else - screen->nextFocus(m_option); + screen->focusControl().nextFocus(m_option); } }

@@ -96,7 +96,7 @@ WinClient *client = Fluxbox::instance()->getFocusedWindow();

if (client == 0 || client->fbwindow() == 0) return; - screen->dirFocus(*client->fbwindow(), m_dir); + screen->focusControl().dirFocus(*client->fbwindow(), m_dir); } void NextWorkspaceCmd::execute() {