aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/FocusModelMenuItem.hh42
-rw-r--r--src/WorkspaceCmd.cc18
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 @@
25#ifndef FOCUSMODELMENUITEM_HH 25#ifndef FOCUSMODELMENUITEM_HH
26#define FOCUSMODELMENUITEM_HH 26#define FOCUSMODELMENUITEM_HH
27 27
28#include "Screen.hh"
29 28
30#include "FbTk/MenuItem.hh" 29#include "FbTk/MenuItem.hh"
31#include "FbTk/RefCount.hh" 30#include "FbTk/RefCount.hh"
32#include "FbTk/Command.hh" 31#include "FbTk/Command.hh"
33 32
33#include "FocusControl.hh"
34
34class FocusModelMenuItem : public FbTk::MenuItem { 35class FocusModelMenuItem : public FbTk::MenuItem {
35public: 36public:
36 FocusModelMenuItem(const char *label, BScreen &screen, 37 FocusModelMenuItem(const char *label, FocusControl &focus_control,
37 BScreen::FocusModel model, 38 FocusControl::FocusModel model,
38 FbTk::RefCount<FbTk::Command> &cmd): 39 FbTk::RefCount<FbTk::Command> &cmd):
39 FbTk::MenuItem(label, cmd), m_screen(screen), m_focusmodel(model) { 40 FbTk::MenuItem(label, cmd),
40 } 41 m_focus_control(focus_control),
41 bool isEnabled() const { return m_screen.getFocusModel() != m_focusmodel; } 42 m_focusmodel(model) { }
43
44 bool isEnabled() const { return m_focus_control.focusModel() != m_focusmodel; }
42 45
43 void click(int button, int time) { 46 void click(int button, int time) {
44 m_screen.saveFocusModel(m_focusmodel); 47 m_focus_control.setFocusModel(m_focusmodel);
45 FbTk::MenuItem::click(button, time); 48 FbTk::MenuItem::click(button, time);
46 } 49 }
47 50
48private: 51private:
49 BScreen &m_screen; 52 FocusControl &m_focus_control;
50 BScreen::FocusModel m_focusmodel; 53 FocusControl::FocusModel m_focusmodel;
51}; 54};
52 55
53class TabFocusModelMenuItem : public FbTk::MenuItem { 56class TabFocusModelMenuItem : public FbTk::MenuItem {
54public: 57public:
55 TabFocusModelMenuItem(const char *label, BScreen &screen, 58 TabFocusModelMenuItem(const char *label,
56 BScreen::TabFocusModel model, 59 FocusControl &focus_control,
57 FbTk::RefCount<FbTk::Command> &cmd): 60 FocusControl::TabFocusModel model,
58 FbTk::MenuItem(label, cmd), m_screen(screen), m_tabfocusmodel(model) { 61 FbTk::RefCount<FbTk::Command> &cmd):
59 } 62 FbTk::MenuItem(label, cmd),
60 bool isEnabled() const { return m_screen.getTabFocusModel() != m_tabfocusmodel; } 63 m_focus_control(focus_control),
64 m_tabfocusmodel(model) { }
65
66 bool isEnabled() const { return m_focus_control.tabFocusModel() != m_tabfocusmodel; }
61 67
62 void click(int button, int time) { 68 void click(int button, int time) {
63 m_screen.saveTabFocusModel(m_tabfocusmodel); 69 m_focus_control.setTabFocusModel(m_tabfocusmodel);
64 FbTk::MenuItem::click(button, time); 70 FbTk::MenuItem::click(button, time);
65 } 71 }
66 72
67private: 73private:
68 BScreen &m_screen; 74 FocusControl &m_focus_control;
69 BScreen::TabFocusModel m_tabfocusmodel; 75 FocusControl::TabFocusModel m_tabfocusmodel;
70}; 76};
71 77
72 78
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() {
50 unsigned int mods = FbTk::KeyUtil::instance().cleanMods(fb->lastEvent().xkey.state); 50 unsigned int mods = FbTk::KeyUtil::instance().cleanMods(fb->lastEvent().xkey.state);
51 mods = FbTk::KeyUtil::instance().isolateModifierMask(mods); 51 mods = FbTk::KeyUtil::instance().isolateModifierMask(mods);
52 if (mods == 0) // can't stacked cycle unless there is a mod to grab 52 if (mods == 0) // can't stacked cycle unless there is a mod to grab
53 screen->nextFocus(m_option | BScreen::CYCLELINEAR); 53 screen->focusControl().nextFocus(m_option | FocusControl::CYCLELINEAR);
54 else { 54 else {
55 // if stacked cycling, then set a watch for 55 // if stacked cycling, then set a watch for
56 // the release of exactly these modifiers 56 // the release of exactly these modifiers
57 if (!fb->watchingScreen() && 57 if (!fb->watchingScreen() &&
58 !(m_option & BScreen::CYCLELINEAR)) 58 !(m_option & FocusControl::CYCLELINEAR))
59 Fluxbox::instance()->watchKeyRelease(*screen, mods); 59 Fluxbox::instance()->watchKeyRelease(*screen, mods);
60 screen->nextFocus(m_option); 60 screen->focusControl().nextFocus(m_option);
61 } 61 }
62 } else 62 } else
63 screen->nextFocus(m_option); 63 screen->focusControl().nextFocus(m_option);
64 } 64 }
65} 65}
66 66
@@ -73,17 +73,17 @@ void PrevWindowCmd::execute() {
73 unsigned int mods = FbTk::KeyUtil::instance().cleanMods(fb->lastEvent().xkey.state); 73 unsigned int mods = FbTk::KeyUtil::instance().cleanMods(fb->lastEvent().xkey.state);
74 mods = FbTk::KeyUtil::instance().isolateModifierMask(mods); 74 mods = FbTk::KeyUtil::instance().isolateModifierMask(mods);
75 if (mods == 0) // can't stacked cycle unless there is a mod to grab 75 if (mods == 0) // can't stacked cycle unless there is a mod to grab
76 screen->prevFocus(m_option | BScreen::CYCLELINEAR); 76 screen->focusControl().prevFocus(m_option | FocusControl::CYCLELINEAR);
77 else { 77 else {
78 // if stacked cycling, then set a watch for 78 // if stacked cycling, then set a watch for
79 // the release of exactly these modifiers 79 // the release of exactly these modifiers
80 if (!fb->watchingScreen() 80 if (!fb->watchingScreen()
81 && !(m_option & BScreen::CYCLELINEAR)) 81 && !(m_option & FocusControl::CYCLELINEAR))
82 Fluxbox::instance()->watchKeyRelease(*screen, mods); 82 Fluxbox::instance()->watchKeyRelease(*screen, mods);
83 screen->prevFocus(m_option); 83 screen->focusControl().prevFocus(m_option);
84 } 84 }
85 } else 85 } else
86 screen->nextFocus(m_option); 86 screen->focusControl().nextFocus(m_option);
87 } 87 }
88} 88}
89 89
@@ -96,7 +96,7 @@ void DirFocusCmd::execute() {
96 if (client == 0 || client->fbwindow() == 0) 96 if (client == 0 || client->fbwindow() == 0)
97 return; 97 return;
98 98
99 screen->dirFocus(*client->fbwindow(), m_dir); 99 screen->focusControl().dirFocus(*client->fbwindow(), m_dir);
100} 100}
101 101
102void NextWorkspaceCmd::execute() { 102void NextWorkspaceCmd::execute() {