aboutsummaryrefslogtreecommitdiff
path: root/src/Screen.cc
diff options
context:
space:
mode:
authorrathnor <rathnor>2003-05-04 23:38:06 (GMT)
committerrathnor <rathnor>2003-05-04 23:38:06 (GMT)
commit2ac0d82e451abd3cdc92df2a02c0da4eb8638ba1 (patch)
treeacb6c82d00dd1258773c45ef539f38b2f093e191 /src/Screen.cc
parent65bbfbe51b9d8531490708e83ba422c7dc53dc1a (diff)
downloadfluxbox-2ac0d82e451abd3cdc92df2a02c0da4eb8638ba1.zip
fluxbox-2ac0d82e451abd3cdc92df2a02c0da4eb8638ba1.tar.bz2
fix up focus problems
Diffstat (limited to 'src/Screen.cc')
-rw-r--r--src/Screen.cc37
1 files changed, 24 insertions, 13 deletions
diff --git a/src/Screen.cc b/src/Screen.cc
index 7677ec9..28d1506 100644
--- a/src/Screen.cc
+++ b/src/Screen.cc
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: Screen.cc,v 1.143 2003/05/04 13:04:31 rathnor Exp $ 25// $Id: Screen.cc,v 1.144 2003/05/04 23:38:06 rathnor Exp $
26 26
27 27
28#include "Screen.hh" 28#include "Screen.hh"
@@ -1069,12 +1069,6 @@ void BScreen::changeWorkspaceID(unsigned int id) {
1069 1069
1070 workspacemenu->setItemSelected(current_workspace->workspaceID() + 2, false); 1070 workspacemenu->setItemSelected(current_workspace->workspaceID() + 2, false);
1071 1071
1072 if (focused && &focused->getScreen() == this &&
1073 (! focused->isStuck()) && (!focused->isMoving())) {
1074 current_workspace->setLastFocusedWindow(focused);
1075 Fluxbox::instance()->setFocusedWindow(0); // set focused window to none
1076 }
1077
1078 // set new workspace 1072 // set new workspace
1079 current_workspace = getWorkspace(id); 1073 current_workspace = getWorkspace(id);
1080 1074
@@ -1084,13 +1078,10 @@ void BScreen::changeWorkspaceID(unsigned int id) {
1084 1078
1085 current_workspace->showAll(); 1079 current_workspace->showAll();
1086 1080
1087 if (*resource.focus_last && current_workspace->getLastFocusedWindow() && 1081 if (focused && (focused->isStuck() || focused->isMoving())) {
1088 !(focused && focused->isMoving())) {
1089 current_workspace->getLastFocusedWindow()->setInputFocus();
1090
1091 } else if (focused && (focused->isStuck() || focused->isMoving())) {
1092 focused->setInputFocus(); 1082 focused->setInputFocus();
1093 } 1083 } else
1084 Fluxbox::instance()->revertFocus(this);
1094 1085
1095 if (focused && focused->isMoving()) { 1086 if (focused && focused->isMoving()) {
1096 focused->resumeMoving(); 1087 focused->resumeMoving();
@@ -2432,6 +2423,26 @@ void BScreen::notifyReleasedKeys(XKeyEvent &ke) {
2432} 2423}
2433 2424
2434/** 2425/**
2426 * Used to find out which window was last focused on the given workspace
2427 * If workspace is outside the ID range, then the absolute last focused window
2428 * is given.
2429 */
2430WinClient *BScreen::getLastFocusedWindow(int workspace) {
2431 if (focused_list.empty()) return 0;
2432 if (workspace < 0 || workspace >= (int) getCount())
2433 return focused_list.front();
2434
2435 FocusedWindows::iterator it = focused_list.begin();
2436 FocusedWindows::iterator it_end = focused_list.end();
2437 for (; it != it_end; ++it)
2438 if ((*it)->fbwindow() &&
2439 (((int)(*it)->fbwindow()->getWorkspaceNumber()) == workspace
2440 || (*it)->fbwindow()->isStuck()))
2441 return *it;
2442 return 0;
2443}
2444
2445/**
2435 Access and clear the auto-group window 2446 Access and clear the auto-group window
2436*/ 2447*/
2437FluxboxWindow* BScreen::useAutoGroupWindow() { 2448FluxboxWindow* BScreen::useAutoGroupWindow() {