moved all focus handling to class FocusControl

This commit is contained in:
fluxgen 2006-02-18 11:40:52 +00:00
parent 330c8c0b09
commit f53c93e5e0
2 changed files with 33 additions and 27 deletions

View file

@ -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,
TabFocusModelMenuItem(const char *label,
FocusControl &focus_control,
FocusControl::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; }
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;
};

View file

@ -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() {