From f53c93e5e0add69771204056550d07b4fee4efef Mon Sep 17 00:00:00 2001 From: fluxgen Date: Sat, 18 Feb 2006 11:40:52 +0000 Subject: moved all focus handling to class FocusControl --- src/FocusModelMenuItem.hh | 42 ++++++++++++++++++++++++------------------ src/WorkspaceCmd.cc | 18 +++++++++--------- 2 files changed, 33 insertions(+), 27 deletions(-) diff --git a/src/FocusModelMenuItem.hh b/src/FocusModelMenuItem.hh index 0c62a09..6121432 100644 --- a/src/FocusModelMenuItem.hh +++ b/src/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 &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 &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 &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; }; diff --git a/src/WorkspaceCmd.cc b/src/WorkspaceCmd.cc index ede790a..70044c8 100644 --- a/src/WorkspaceCmd.cc +++ b/src/WorkspaceCmd.cc @@ -50,17 +50,17 @@ void NextWindowCmd::execute() { 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 @@ void PrevWindowCmd::execute() { 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 @@ void DirFocusCmd::execute() { if (client == 0 || client->fbwindow() == 0) return; - screen->dirFocus(*client->fbwindow(), m_dir); + screen->focusControl().dirFocus(*client->fbwindow(), m_dir); } void NextWorkspaceCmd::execute() { -- cgit v0.11.2