diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/FocusControl.cc | 12 | ||||
-rw-r--r-- | src/FocusControl.hh | 7 | ||||
-rw-r--r-- | src/Screen.cc | 11 |
3 files changed, 30 insertions, 0 deletions
diff --git a/src/FocusControl.cc b/src/FocusControl.cc index 383de61..2dbf289 100644 --- a/src/FocusControl.cc +++ b/src/FocusControl.cc | |||
@@ -76,6 +76,11 @@ FocusControl::FocusControl(BScreen &screen): | |||
76 | m_focus_new(screen.resourceManager(), true, | 76 | m_focus_new(screen.resourceManager(), true, |
77 | screen.name()+".focusNewWindows", | 77 | screen.name()+".focusNewWindows", |
78 | screen.altName()+".FocusNewWindows"), | 78 | screen.altName()+".FocusNewWindows"), |
79 | #ifdef XINERAMA | ||
80 | m_focus_same_head(screen.resourceManager(), false, | ||
81 | screen.name()+".focusSameHead", | ||
82 | screen.altName()+".FocusSameHead"), | ||
83 | #endif // XINERAMA | ||
79 | m_focused_list(screen), m_creation_order_list(screen), | 84 | m_focused_list(screen), m_creation_order_list(screen), |
80 | m_focused_win_list(screen), m_creation_order_win_list(screen), | 85 | m_focused_win_list(screen), m_creation_order_win_list(screen), |
81 | m_cycling_list(0), | 86 | m_cycling_list(0), |
@@ -251,11 +256,18 @@ Focusable *FocusControl::lastFocusedWindow(int workspace) { | |||
251 | if (workspace < 0 || workspace >= (int) m_screen.numberOfWorkspaces()) | 256 | if (workspace < 0 || workspace >= (int) m_screen.numberOfWorkspaces()) |
252 | return m_focused_list.clientList().front(); | 257 | return m_focused_list.clientList().front(); |
253 | 258 | ||
259 | #ifdef XINERAMA | ||
260 | int cur_head = focusSameHead() ? m_screen.getCurrHead() : (-1); | ||
261 | #endif // XINERAMA | ||
262 | |||
254 | Focusables::iterator it = m_focused_list.clientList().begin(); | 263 | Focusables::iterator it = m_focused_list.clientList().begin(); |
255 | Focusables::iterator it_end = m_focused_list.clientList().end(); | 264 | Focusables::iterator it_end = m_focused_list.clientList().end(); |
256 | for (; it != it_end; ++it) { | 265 | for (; it != it_end; ++it) { |
257 | if ((*it)->fbwindow() && (*it)->acceptsFocus() && | 266 | if ((*it)->fbwindow() && (*it)->acceptsFocus() && |
258 | (*it)->fbwindow()->winClient().validateClient() && | 267 | (*it)->fbwindow()->winClient().validateClient() && |
268 | #ifdef XINERAMA | ||
269 | ( (cur_head == -1) || ((*it)->fbwindow()->getOnHead() == cur_head) ) && | ||
270 | #endif // XINERAMA | ||
259 | ((((int)(*it)->fbwindow()->workspaceNumber()) == workspace || | 271 | ((((int)(*it)->fbwindow()->workspaceNumber()) == workspace || |
260 | (*it)->fbwindow()->isStuck()) && !(*it)->fbwindow()->isIconic())) | 272 | (*it)->fbwindow()->isStuck()) && !(*it)->fbwindow()->isIconic())) |
261 | return *it; | 273 | return *it; |
diff --git a/src/FocusControl.hh b/src/FocusControl.hh index c265253..d583d16 100644 --- a/src/FocusControl.hh +++ b/src/FocusControl.hh | |||
@@ -124,6 +124,10 @@ public: | |||
124 | TabFocusModel tabFocusModel() const { return *m_tab_focus_model; } | 124 | TabFocusModel tabFocusModel() const { return *m_tab_focus_model; } |
125 | /// @return true if newly created windows are focused | 125 | /// @return true if newly created windows are focused |
126 | bool focusNew() const { return *m_focus_new; } | 126 | bool focusNew() const { return *m_focus_new; } |
127 | #ifdef XINERAMA | ||
128 | /// @return true if focus reverts to same head only | ||
129 | bool focusSameHead() const { return *m_focus_same_head; } | ||
130 | #endif // XINERAMA | ||
127 | 131 | ||
128 | /// @return last focused client in a specific workspace, or NULL. | 132 | /// @return last focused client in a specific workspace, or NULL. |
129 | Focusable *lastFocusedWindow(int workspace); | 133 | Focusable *lastFocusedWindow(int workspace); |
@@ -161,6 +165,9 @@ private: | |||
161 | FbTk::Resource<FocusModel> m_focus_model; | 165 | FbTk::Resource<FocusModel> m_focus_model; |
162 | FbTk::Resource<TabFocusModel> m_tab_focus_model; | 166 | FbTk::Resource<TabFocusModel> m_tab_focus_model; |
163 | FbTk::Resource<bool> m_focus_new; | 167 | FbTk::Resource<bool> m_focus_new; |
168 | #ifdef XINERAMA | ||
169 | FbTk::Resource<bool> m_focus_same_head; | ||
170 | #endif // XINERAMA | ||
164 | 171 | ||
165 | // This list keeps the order of window focusing for this screen | 172 | // This list keeps the order of window focusing for this screen |
166 | // Screen global so it works for sticky windows too. | 173 | // Screen global so it works for sticky windows too. |
diff --git a/src/Screen.cc b/src/Screen.cc index 6757af0..b2e57ed 100644 --- a/src/Screen.cc +++ b/src/Screen.cc | |||
@@ -1600,6 +1600,17 @@ void BScreen::setupConfigmenu(FbTk::Menu &menu) { | |||
1600 | } catch (FbTk::ResourceException & e) { | 1600 | } catch (FbTk::ResourceException & e) { |
1601 | cerr<<e.what()<<endl; | 1601 | cerr<<e.what()<<endl; |
1602 | } | 1602 | } |
1603 | |||
1604 | #ifdef XINERAMA | ||
1605 | try { | ||
1606 | focus_menu->insert(new FbTk::BoolMenuItem(_FB_XTEXT(Configmenu, FocusSameHead, | ||
1607 | "Keep Head", "Only revert focus on same head"), | ||
1608 | m_resource_manager.getResource<bool>(name() + ".focusSameHead"), | ||
1609 | saverc_cmd)); | ||
1610 | } catch (FbTk::ResourceException e) { | ||
1611 | cerr<<e.what()<<endl; | ||
1612 | } | ||
1613 | #endif // XINERAMA | ||
1603 | 1614 | ||
1604 | _BOOLITEM(*focus_menu, Configmenu, AutoRaise, | 1615 | _BOOLITEM(*focus_menu, Configmenu, AutoRaise, |
1605 | "Auto Raise", "Auto Raise windows on sloppy", | 1616 | "Auto Raise", "Auto Raise windows on sloppy", |