aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHendrik Iben <mikro@zvxeb.de>2012-11-18 19:09:35 (GMT)
committerMathias Gumz <akira at fluxbox dot org>2012-11-20 07:04:50 (GMT)
commite65a966d807e6b9b961817a3b160af1d4a765e0d (patch)
tree2ba8f0678bf607bfbb6e544740aefc9c7bade216
parentb4534e0f28664f8b7a6d7a1155b0178232ed4e51 (diff)
downloadfluxbox-e65a966d807e6b9b961817a3b160af1d4a765e0d.zip
fluxbox-e65a966d807e6b9b961817a3b160af1d4a765e0d.tar.bz2
Added option for focus revert to stay on current head
-rw-r--r--nls/de_DE/Translation.m2
-rw-r--r--nls/fluxbox-nls.hh1
-rw-r--r--src/FocusControl.cc12
-rw-r--r--src/FocusControl.hh7
-rw-r--r--src/Screen.cc11
5 files changed, 33 insertions, 0 deletions
diff --git a/nls/de_DE/Translation.m b/nls/de_DE/Translation.m
index 454de0e..9149c10 100644
--- a/nls/de_DE/Translation.m
+++ b/nls/de_DE/Translation.m
@@ -78,6 +78,8 @@ $set 4 #Configmenu
7827 Resize-Increment nicht beachten 7827 Resize-Increment nicht beachten
7928 Position fixieren 7928 Position fixieren
8029 Größe fixieren 8029 Größe fixieren
8130 Fokus folgt Maus (strikt)
8231 Gleicher Head
81 83
82$set 5 #Ewmh 84$set 5 #Ewmh
83 85
diff --git a/nls/fluxbox-nls.hh b/nls/fluxbox-nls.hh
index 7ddc978..13db6b6 100644
--- a/nls/fluxbox-nls.hh
+++ b/nls/fluxbox-nls.hh
@@ -85,6 +85,7 @@ enum {
85 ConfigmenuMaxDisableMove = 28, 85 ConfigmenuMaxDisableMove = 28,
86 ConfigmenuMaxDisableResize = 29, 86 ConfigmenuMaxDisableResize = 29,
87 ConfigmenuStrictMouseFocus = 30, 87 ConfigmenuStrictMouseFocus = 30,
88 ConfigmenuFocusSameHead = 31,
88 89
89 EwmhSet = 5, 90 EwmhSet = 5,
90 EwmhOutOfMemoryClientList = 1, 91 EwmhOutOfMemoryClientList = 1,
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",