diff options
Diffstat (limited to 'src/WorkspaceCmd.cc')
-rw-r--r-- | src/WorkspaceCmd.cc | 66 |
1 files changed, 35 insertions, 31 deletions
diff --git a/src/WorkspaceCmd.cc b/src/WorkspaceCmd.cc index 6c97808..d2bc3b7 100644 --- a/src/WorkspaceCmd.cc +++ b/src/WorkspaceCmd.cc | |||
@@ -42,44 +42,48 @@ | |||
42 | #include <functional> | 42 | #include <functional> |
43 | 43 | ||
44 | void NextWindowCmd::execute() { | 44 | void NextWindowCmd::execute() { |
45 | BScreen *screen = Fluxbox::instance()->keyScreen(); | 45 | Fluxbox *fb = Fluxbox::instance(); |
46 | BScreen *screen = fb->keyScreen(); | ||
46 | if (screen != 0) { | 47 | if (screen != 0) { |
47 | Fluxbox *fb = Fluxbox::instance(); | 48 | // get modifiers from event that causes this for focus order cycling |
48 | // special case for commands from key events | 49 | unsigned int mods = 0; |
49 | if (fb->lastEvent().type == KeyPress) { | 50 | XEvent ev = fb->lastEvent(); |
50 | unsigned int mods = FbTk::KeyUtil::instance().cleanMods(fb->lastEvent().xkey.state); | 51 | if (ev.type == KeyPress) { |
51 | mods = FbTk::KeyUtil::instance().isolateModifierMask(mods); | 52 | mods = FbTk::KeyUtil::instance().cleanMods(ev.xkey.state); |
52 | if (mods == 0) // can't stacked cycle unless there is a mod to grab | 53 | } else if (ev.type == ButtonPress) { |
53 | screen->focusControl().nextFocus(m_option | FocusControl::CYCLELINEAR); | 54 | mods = FbTk::KeyUtil::instance().cleanMods(ev.xbutton.state); |
54 | else { | 55 | } |
55 | // if stacked cycling, then set a watch for | 56 | if (mods == 0) // can't stacked cycle unless there is a mod to grab |
56 | // the release of exactly these modifiers | ||
57 | Fluxbox::instance()->watchKeyRelease(*screen, mods); | ||
58 | screen->focusControl().nextFocus(m_option); | ||
59 | } | ||
60 | } else | ||
61 | screen->focusControl().nextFocus(m_option | FocusControl::CYCLELINEAR); | 57 | screen->focusControl().nextFocus(m_option | FocusControl::CYCLELINEAR); |
58 | else { | ||
59 | // if stacked cycling, then set a watch for | ||
60 | // the release of exactly these modifiers | ||
61 | fb->watchKeyRelease(*screen, mods); | ||
62 | screen->focusControl().nextFocus(m_option); | ||
63 | } | ||
62 | } | 64 | } |
63 | } | 65 | } |
64 | 66 | ||
65 | void PrevWindowCmd::execute() { | 67 | void PrevWindowCmd::execute() { |
66 | BScreen *screen = Fluxbox::instance()->keyScreen(); | 68 | Fluxbox *fb = Fluxbox::instance(); |
69 | BScreen *screen = fb->keyScreen(); | ||
67 | if (screen != 0) { | 70 | if (screen != 0) { |
68 | Fluxbox *fb = Fluxbox::instance(); | 71 | // get modifiers from event that causes this for focus order cycling |
69 | // special case for commands from key events | 72 | unsigned int mods = 0; |
70 | if (fb->lastEvent().type == KeyPress) { | 73 | XEvent ev = fb->lastEvent(); |
71 | unsigned int mods = FbTk::KeyUtil::instance().cleanMods(fb->lastEvent().xkey.state); | 74 | if (ev.type == KeyPress) { |
72 | mods = FbTk::KeyUtil::instance().isolateModifierMask(mods); | 75 | mods = FbTk::KeyUtil::instance().cleanMods(ev.xkey.state); |
73 | if (mods == 0) // can't stacked cycle unless there is a mod to grab | 76 | } else if (ev.type == ButtonPress) { |
74 | screen->focusControl().prevFocus(m_option | FocusControl::CYCLELINEAR); | 77 | mods = FbTk::KeyUtil::instance().cleanMods(ev.xbutton.state); |
75 | else { | 78 | } |
76 | // if stacked cycling, then set a watch for | 79 | if (mods == 0) // can't stacked cycle unless there is a mod to grab |
77 | // the release of exactly these modifiers | 80 | screen->focusControl().prevFocus(m_option | FocusControl::CYCLELINEAR); |
78 | Fluxbox::instance()->watchKeyRelease(*screen, mods); | 81 | else { |
79 | screen->focusControl().prevFocus(m_option); | 82 | // if stacked cycling, then set a watch for |
80 | } | 83 | // the release of exactly these modifiers |
81 | } else | 84 | fb->watchKeyRelease(*screen, mods); |
82 | screen->focusControl().nextFocus(m_option | FocusControl::CYCLELINEAR); | 85 | screen->focusControl().prevFocus(m_option); |
86 | } | ||
83 | } | 87 | } |
84 | } | 88 | } |
85 | 89 | ||