aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarkt <markt>2007-04-13 18:08:39 (GMT)
committermarkt <markt>2007-04-13 18:08:39 (GMT)
commit905f208007902dc64197240806e4bb519fab66f3 (patch)
tree71d008d32f757bb29ccc43087fb38e056be0fdf0
parentb067423dd9b2070489367c944856223de3f94a9c (diff)
downloadfluxbox-905f208007902dc64197240806e4bb519fab66f3.zip
fluxbox-905f208007902dc64197240806e4bb519fab66f3.tar.bz2
fixed some focus issues with FocusNew off
-rw-r--r--src/FocusControl.cc30
-rw-r--r--src/FocusControl.hh9
-rw-r--r--src/Window.cc25
3 files changed, 32 insertions, 32 deletions
diff --git a/src/FocusControl.cc b/src/FocusControl.cc
index 1a4d74d..27f387c 100644
--- a/src/FocusControl.cc
+++ b/src/FocusControl.cc
@@ -81,16 +81,6 @@ FocusControl::FocusControl(BScreen &screen):
81 81
82} 82}
83 83
84void FocusControl::cycleFocus(FocusedWindows &window_list,
85 const ClientPattern *pat, bool cycle_reverse) {
86 Focusables tmp_list;
87 FocusedWindows::iterator it = window_list.begin();
88 FocusedWindows::iterator it_end = window_list.end();
89 for (; it != it_end; ++it)
90 tmp_list.push_back(*it);
91 cycleFocus(tmp_list, pat, cycle_reverse);
92}
93
94void FocusControl::cycleFocus(Focusables &window_list, const ClientPattern *pat, 84void FocusControl::cycleFocus(Focusables &window_list, const ClientPattern *pat,
95 bool cycle_reverse) { 85 bool cycle_reverse) {
96 86
@@ -114,6 +104,7 @@ void FocusControl::cycleFocus(Focusables &window_list, const ClientPattern *pat,
114 Focusables::iterator it = m_cycling_window; 104 Focusables::iterator it = m_cycling_window;
115 FluxboxWindow *fbwin = 0; 105 FluxboxWindow *fbwin = 0;
116 WinClient *last_client = 0; 106 WinClient *last_client = 0;
107 WinClient *was_iconic = 0;
117 108
118 // find the next window in the list that works 109 // find the next window in the list that works
119 while (true) { 110 while (true) {
@@ -135,14 +126,13 @@ void FocusControl::cycleFocus(Focusables &window_list, const ClientPattern *pat,
135 126
136 // keep track of the originally selected window in a group 127 // keep track of the originally selected window in a group
137 last_client = &fbwin->winClient(); 128 last_client = &fbwin->winClient();
129 was_iconic = (fbwin->isIconic() ? last_client : 0);
138 130
139 // now we actually try to focus the window 131 // now we actually try to focus the window
140 if (!doSkipWindow(**it, pat) && (*it)->focus()) 132 if (!doSkipWindow(**it, pat) && (*it)->focus())
141 break; 133 break;
142 } 134 }
143 135
144 m_cycling_window = it;
145
146 // if we're still in the same fbwin, there's nothing else to do 136 // if we're still in the same fbwin, there's nothing else to do
147 if (m_cycling_last && m_cycling_last->fbwindow() == fbwin) 137 if (m_cycling_last && m_cycling_last->fbwindow() == fbwin)
148 return; 138 return;
@@ -161,12 +151,14 @@ void FocusControl::cycleFocus(Focusables &window_list, const ClientPattern *pat,
161 } 151 }
162 } 152 }
163 153
164 m_cycling_last = last_client; 154 if (isCycling())
165 if (fbwin->isIconic())
166 m_was_iconic = m_cycling_last;
167 if (m_cycling_list)
168 // else window will raise itself (if desired) on FocusIn
169 fbwin->tempRaise(); 155 fbwin->tempRaise();
156 else
157 fbwin->raise();
158
159 m_cycling_window = it;
160 m_cycling_last = last_client;
161 m_was_iconic = was_iconic;
170 162
171} 163}
172 164
@@ -179,8 +171,6 @@ void FocusControl::goToWindowNumber(Focusables &winlist, int num,
179 if (!doSkipWindow(**it, pat) && (*it)->acceptsFocus()) { 171 if (!doSkipWindow(**it, pat) && (*it)->acceptsFocus()) {
180 --num; 172 --num;
181 if (!num) { 173 if (!num) {
182 if ((*it)->fbwindow() && (*it)->fbwindow()->isIconic())
183 (*it)->fbwindow()->deiconify();
184 (*it)->focus(); 174 (*it)->focus();
185 return; 175 return;
186 } 176 }
@@ -193,8 +183,6 @@ void FocusControl::goToWindowNumber(Focusables &winlist, int num,
193 if (!doSkipWindow(**it, pat) && (*it)->acceptsFocus()) { 183 if (!doSkipWindow(**it, pat) && (*it)->acceptsFocus()) {
194 ++num; 184 ++num;
195 if (!num) { 185 if (!num) {
196 if ((*it)->fbwindow() && (*it)->fbwindow()->isIconic())
197 (*it)->fbwindow()->deiconify();
198 (*it)->focus(); 186 (*it)->focus();
199 return; 187 return;
200 } 188 }
diff --git a/src/FocusControl.hh b/src/FocusControl.hh
index 69660f9..0790110 100644
--- a/src/FocusControl.hh
+++ b/src/FocusControl.hh
@@ -40,7 +40,6 @@ class BScreen;
40 */ 40 */
41class FocusControl { 41class FocusControl {
42public: 42public:
43 typedef std::list<WinClient *> FocusedWindows;
44 typedef std::list<Focusable *> Focusables; 43 typedef std::list<Focusable *> Focusables;
45 /// main focus model 44 /// main focus model
46 enum FocusModel { 45 enum FocusModel {
@@ -81,14 +80,6 @@ public:
81 void cycleFocus(Focusables &winlist, const ClientPattern *pat = 0, 80 void cycleFocus(Focusables &winlist, const ClientPattern *pat = 0,
82 bool reverse = false); 81 bool reverse = false);
83 82
84 /**
85 * Cycle focus for a set of windows.
86 * @param winlist the windowlist to cycle through
87 * @param pat pattern for matching focusables
88 * @param reverse reverse the cycle order
89 */
90 void cycleFocus(FocusedWindows &winlist, const ClientPattern *pat = 0,
91 bool reverse = false);
92 void goToWindowNumber(Focusables &winlist, int num, 83 void goToWindowNumber(Focusables &winlist, int num,
93 const ClientPattern *pat = 0); 84 const ClientPattern *pat = 0);
94 /// sets the focused window on a screen 85 /// sets the focused window on a screen
diff --git a/src/Window.cc b/src/Window.cc
index d0f28ce..3b2d11a 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -769,14 +769,32 @@ void FluxboxWindow::nextClient() {
769 if (numClients() <= 1) 769 if (numClients() <= 1)
770 return; 770 return;
771 771
772 screen().focusControl().cycleFocus(m_clientlist, 0); 772 ClientList::iterator it = find(m_clientlist.begin(), m_clientlist.end(),
773 m_client);
774 if (it == m_clientlist.end())
775 return;
776
777 ++it;
778 if (it == m_clientlist.end())
779 it = m_clientlist.begin();
780
781 setCurrentClient(**it, isFocused());
773} 782}
774 783
775void FluxboxWindow::prevClient() { 784void FluxboxWindow::prevClient() {
776 if (numClients() <= 1) 785 if (numClients() <= 1)
777 return; 786 return;
778 787
779 screen().focusControl().cycleFocus(m_clientlist, 0, true); 788 ClientList::iterator it = find(m_clientlist.begin(), m_clientlist.end(),
789 m_client);
790 if (it == m_clientlist.end())
791 return;
792
793 if (it == m_clientlist.begin())
794 it = m_clientlist.end();
795 --it;
796
797 setCurrentClient(**it, isFocused());
780} 798}
781 799
782 800
@@ -1357,6 +1375,9 @@ bool FluxboxWindow::focus() {
1357 screen().changeWorkspaceID(workspaceNumber()); 1375 screen().changeWorkspaceID(workspaceNumber());
1358 } 1376 }
1359 1377
1378 if (isIconic())
1379 deiconify();
1380
1360 // this needs to be here rather than setFocusFlag because 1381 // this needs to be here rather than setFocusFlag because
1361 // FocusControl::revertFocus will return before FocusIn events arrive 1382 // FocusControl::revertFocus will return before FocusIn events arrive
1362 m_screen.focusControl().setScreenFocusedWindow(*m_client); 1383 m_screen.focusControl().setScreenFocusedWindow(*m_client);