aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormarkt <markt>2007-01-13 19:24:35 (GMT)
committermarkt <markt>2007-01-13 19:24:35 (GMT)
commit16743aad06e7f8b6c2d3b0aab4311980ce06dc16 (patch)
tree76c039d232794177028d08b0409e4fd8625c328e /src
parentfa2519525aa8e08c4c11393a8734c606a7820ee1 (diff)
downloadfluxbox-16743aad06e7f8b6c2d3b0aab4311980ce06dc16.zip
fluxbox-16743aad06e7f8b6c2d3b0aab4311980ce06dc16.tar.bz2
don't change focus order unless the user specifically focuses a window
Diffstat (limited to 'src')
-rw-r--r--src/FocusControl.cc7
-rw-r--r--src/FocusControl.hh1
-rw-r--r--src/Screen.cc2
-rw-r--r--src/Window.cc12
4 files changed, 15 insertions, 7 deletions
diff --git a/src/FocusControl.cc b/src/FocusControl.cc
index c5441dd..9c82e3e 100644
--- a/src/FocusControl.cc
+++ b/src/FocusControl.cc
@@ -39,6 +39,7 @@ using std::string;
39 39
40WinClient *FocusControl::s_focused_window = 0; 40WinClient *FocusControl::s_focused_window = 0;
41FluxboxWindow *FocusControl::s_focused_fbwindow = 0; 41FluxboxWindow *FocusControl::s_focused_fbwindow = 0;
42bool FocusControl::s_reverting = false;
42 43
43FocusControl::FocusControl(BScreen &screen): 44FocusControl::FocusControl(BScreen &screen):
44 m_screen(screen), 45 m_screen(screen),
@@ -242,7 +243,7 @@ void FocusControl::setScreenFocusedWindow(WinClient &win_client) {
242 243
243 // raise newly focused window to the top of the focused list 244 // raise newly focused window to the top of the focused list
244 // don't change the order if we're cycling or shutting down 245 // don't change the order if we're cycling or shutting down
245 if (!m_cycling_focus && !win_client.screen().isShuttingdown()) { 246 if (!isCycling() && !m_screen.isShuttingdown() && !s_reverting) {
246 m_focused_list.remove(&win_client); 247 m_focused_list.remove(&win_client);
247 m_focused_list.push_front(&win_client); 248 m_focused_list.push_front(&win_client);
248 m_cycling_window = m_focused_list.begin(); 249 m_cycling_window = m_focused_list.begin();
@@ -396,6 +397,8 @@ void FocusControl::revertFocus(BScreen &screen) {
396 if (screen.focusControl().isCycling()) 397 if (screen.focusControl().isCycling())
397 return; 398 return;
398 399
400 FocusControl::s_reverting = true;
401
399 WinClient *next_focus = 402 WinClient *next_focus =
400 screen.focusControl().lastFocusedWindow(screen.currentWorkspaceID()); 403 screen.focusControl().lastFocusedWindow(screen.currentWorkspaceID());
401 404
@@ -412,6 +415,8 @@ void FocusControl::revertFocus(BScreen &screen) {
412 break; 415 break;
413 } 416 }
414 } 417 }
418
419 FocusControl::s_reverting = false;
415} 420}
416 421
417/* 422/*
diff --git a/src/FocusControl.hh b/src/FocusControl.hh
index 708b960..d38ede0 100644
--- a/src/FocusControl.hh
+++ b/src/FocusControl.hh
@@ -127,6 +127,7 @@ private:
127 127
128 static WinClient *s_focused_window; 128 static WinClient *s_focused_window;
129 static FluxboxWindow *s_focused_fbwindow; 129 static FluxboxWindow *s_focused_fbwindow;
130 static bool s_reverting;
130}; 131};
131 132
132#endif // FOCUSCONTROL_HH 133#endif // FOCUSCONTROL_HH
diff --git a/src/Screen.cc b/src/Screen.cc
index e4a58e3..89400fe 100644
--- a/src/Screen.cc
+++ b/src/Screen.cc
@@ -1129,7 +1129,7 @@ void BScreen::changeWorkspaceID(unsigned int id) {
1129 1129
1130 currentWorkspace()->showAll(); 1130 currentWorkspace()->showAll();
1131 1131
1132 if (focused && (focused->isStuck() || focused->isMoving())) 1132 if (focused && focused->isMoving())
1133 focused->setInputFocus(); 1133 focused->setInputFocus();
1134 else 1134 else
1135 FocusControl::revertFocus(*this); 1135 FocusControl::revertFocus(*this);
diff --git a/src/Window.cc b/src/Window.cc
index ff005c3..a3a10c5 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -1053,7 +1053,8 @@ bool FluxboxWindow::setCurrentClient(WinClient &client, bool setinput) {
1053 if (client.fbwindow() != this) 1053 if (client.fbwindow() != this)
1054 return false; 1054 return false;
1055 1055
1056 m_screen.focusControl().setScreenFocusedWindow(client); 1056 if (&client != m_client)
1057 m_screen.focusControl().setScreenFocusedWindow(client);
1057 m_client = &client; 1058 m_client = &client;
1058 m_client->raise(); 1059 m_client->raise();
1059 m_client->focusSig().notify(); 1060 m_client->focusSig().notify();
@@ -1432,6 +1433,11 @@ bool FluxboxWindow::setInputFocus() {
1432 1433
1433 if (! m_client->validateClient()) 1434 if (! m_client->validateClient())
1434 return false; 1435 return false;
1436
1437 // this needs to be here rather than setFocusFlag because
1438 // FocusControl::revertFocus will return before FocusIn events arrive
1439 m_screen.focusControl().setScreenFocusedWindow(*m_client);
1440
1435#ifdef DEBUG 1441#ifdef DEBUG
1436 cerr<<"FluxboxWindow::"<<__FUNCTION__<<" isModal() = "<<m_client->isModal()<<endl; 1442 cerr<<"FluxboxWindow::"<<__FUNCTION__<<" isModal() = "<<m_client->isModal()<<endl;
1437 cerr<<"FluxboxWindow::"<<__FUNCTION__<<" transient size = "<<m_client->transients.size()<<endl; 1443 cerr<<"FluxboxWindow::"<<__FUNCTION__<<" transient size = "<<m_client->transients.size()<<endl;
@@ -2124,10 +2130,6 @@ void FluxboxWindow::setFocusFlag(bool focus) {
2124#ifdef DEBUG 2130#ifdef DEBUG
2125 cerr<<"FluxboxWindow("<<title()<<")::setFocusFlag("<<focus<<")"<<endl; 2131 cerr<<"FluxboxWindow("<<title()<<")::setFocusFlag("<<focus<<")"<<endl;
2126#endif // DEBUG 2132#endif // DEBUG
2127 // Record focus timestamp for window cycling enhancements
2128 if (focused) {
2129 screen().focusControl().setScreenFocusedWindow(*m_client);
2130 }
2131 2133
2132 installColormap(focus); 2134 installColormap(focus);
2133 2135