diff options
author | rathnor <rathnor> | 2002-09-12 14:55:11 (GMT) |
---|---|---|
committer | rathnor <rathnor> | 2002-09-12 14:55:11 (GMT) |
commit | e54676573689d353bf53a4d6225ba1206ddf10fa (patch) | |
tree | 1f7dcc90b3613f46f469dcece4acf5ebfbe81221 /src/Screen.cc | |
parent | 8a728b46fd05b872b5daf9632af478f1c098dd4f (diff) | |
download | fluxbox-e54676573689d353bf53a4d6225ba1206ddf10fa.zip fluxbox-e54676573689d353bf53a4d6225ba1206ddf10fa.tar.bz2 |
Fixes to sticky window + focus handling. Particularly for
next/prevFocus crashes. Also, sticky windows are now always reassociated
to the active workspace.
Diffstat (limited to 'src/Screen.cc')
-rw-r--r-- | src/Screen.cc | 56 |
1 files changed, 34 insertions, 22 deletions
diff --git a/src/Screen.cc b/src/Screen.cc index ab388ab..e25de0e 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.68 2002/09/10 10:59:57 fluxgen Exp $ | 25 | // $Id: Screen.cc,v 1.69 2002/09/12 14:55:11 rathnor Exp $ |
26 | 26 | ||
27 | //use GNU extensions | 27 | //use GNU extensions |
28 | #ifndef _GNU_SOURCE | 28 | #ifndef _GNU_SOURCE |
@@ -784,6 +784,15 @@ void BScreen::changeWorkspaceID(unsigned int id) { | |||
784 | focused->pauseMoving(); | 784 | focused->pauseMoving(); |
785 | } | 785 | } |
786 | 786 | ||
787 | Workspace *wksp = getCurrentWorkspace(); | ||
788 | Workspace::Windows wins = wksp->getWindowList(); | ||
789 | Workspace::Windows::iterator it = wins.begin(); | ||
790 | for (; it != wins.end(); ++it) { | ||
791 | if ((*it)->isStuck()) { | ||
792 | reassociateGroup(*it,id,true); | ||
793 | } | ||
794 | } | ||
795 | |||
787 | current_workspace->hideAll(); | 796 | current_workspace->hideAll(); |
788 | 797 | ||
789 | workspacemenu->setItemSelected(current_workspace->workspaceID() + 2, false); | 798 | workspacemenu->setItemSelected(current_workspace->workspaceID() + 2, false); |
@@ -805,6 +814,8 @@ void BScreen::changeWorkspaceID(unsigned int id) { | |||
805 | if (*resource.focus_last && current_workspace->getLastFocusedWindow() && | 814 | if (*resource.focus_last && current_workspace->getLastFocusedWindow() && |
806 | !(focused && focused->isMoving())) { | 815 | !(focused && focused->isMoving())) { |
807 | current_workspace->getLastFocusedWindow()->setInputFocus(); | 816 | current_workspace->getLastFocusedWindow()->setInputFocus(); |
817 | } else if (focused && focused->isStuck()) { | ||
818 | focused->setInputFocus(); | ||
808 | } | 819 | } |
809 | 820 | ||
810 | if (focused && focused->isMoving()) { | 821 | if (focused && focused->isMoving()) { |
@@ -1110,7 +1121,7 @@ void BScreen::nextFocus(int opts) { | |||
1110 | int focused_window_number = -1; | 1121 | int focused_window_number = -1; |
1111 | FluxboxWindow *focused = fluxbox->getFocusedWindow(); | 1122 | FluxboxWindow *focused = fluxbox->getFocusedWindow(); |
1112 | const int num_windows = getCurrentWorkspace()->getCount(); | 1123 | const int num_windows = getCurrentWorkspace()->getCount(); |
1113 | 1124 | ||
1114 | if (focused != 0) { | 1125 | if (focused != 0) { |
1115 | if (focused->getScreen()->getScreenNumber() == | 1126 | if (focused->getScreen()->getScreenNumber() == |
1116 | getScreenNumber()) { | 1127 | getScreenNumber()) { |
@@ -1119,14 +1130,17 @@ void BScreen::nextFocus(int opts) { | |||
1119 | } | 1130 | } |
1120 | } | 1131 | } |
1121 | 1132 | ||
1122 | if (num_windows > 1 && have_focused) { | 1133 | if (num_windows >= 1) { |
1123 | Workspace *wksp = getCurrentWorkspace(); | 1134 | Workspace *wksp = getCurrentWorkspace(); |
1124 | Workspace::Windows &wins = wksp->getWindowList(); | 1135 | Workspace::Windows &wins = wksp->getWindowList(); |
1125 | Workspace::Windows::iterator it = wins.begin(); | 1136 | Workspace::Windows::iterator it = wins.begin(); |
1126 | 1137 | ||
1127 | for (; *it != focused; ++it) //get focused window iterator | 1138 | if (!have_focused) { |
1128 | continue; | 1139 | focused = *it; |
1129 | 1140 | } else { | |
1141 | for (; *it != focused; ++it) //get focused window iterator | ||
1142 | continue; | ||
1143 | } | ||
1130 | do { | 1144 | do { |
1131 | ++it; | 1145 | ++it; |
1132 | if (it == wins.end()) | 1146 | if (it == wins.end()) |
@@ -1139,11 +1153,6 @@ void BScreen::nextFocus(int opts) { | |||
1139 | if (*it != focused && it != wins.end()) | 1153 | if (*it != focused && it != wins.end()) |
1140 | wksp->raiseWindow(*it); | 1154 | wksp->raiseWindow(*it); |
1141 | 1155 | ||
1142 | } else if (num_windows >= 1) { | ||
1143 | FluxboxWindow *next = current_workspace->getWindow(0); | ||
1144 | //don't raise next window if input focus fails | ||
1145 | if (next->setInputFocus()) | ||
1146 | current_workspace->raiseWindow(next); | ||
1147 | } | 1156 | } |
1148 | 1157 | ||
1149 | } | 1158 | } |
@@ -1163,28 +1172,31 @@ void BScreen::prevFocus(int opts) { | |||
1163 | } | 1172 | } |
1164 | } | 1173 | } |
1165 | 1174 | ||
1166 | if (num_windows > 1 && have_focused) { | 1175 | if (num_windows >= 1) { |
1167 | Workspace *wksp = getCurrentWorkspace(); | 1176 | Workspace *wksp = getCurrentWorkspace(); |
1168 | Workspace::Windows wins = wksp->getWindowList(); | 1177 | Workspace::Windows &wins = wksp->getWindowList(); |
1169 | Workspace::Windows::iterator it = wins.begin(); | 1178 | Workspace::Windows::iterator it = wins.begin(); |
1170 | for (; *it != focused; ++it); | 1179 | |
1180 | if (!have_focused) { | ||
1181 | focused = *it; | ||
1182 | } else { | ||
1183 | for (; *it != focused; ++it) //get focused window iterator | ||
1184 | continue; | ||
1185 | } | ||
1186 | |||
1171 | do { | 1187 | do { |
1172 | if (it == wins.begin()) | 1188 | if (it == wins.begin()) |
1173 | it = wins.end(); | 1189 | it = wins.end(); |
1174 | --it; | 1190 | --it; |
1175 | // see if the window should be skipped | 1191 | // see if the window should be skipped |
1176 | if (! (doSkipWindow(*it, opts) || !(*it)->setInputFocus()) ) | 1192 | if (! (doSkipWindow(*it, opts) || !(*it)->setInputFocus()) ) |
1177 | break; | 1193 | break; |
1178 | } while (*it != focused); | 1194 | } while (*it != focused); |
1179 | if (*it != focused) | 1195 | |
1196 | if (*it != focused && it != wins.end()) | ||
1180 | wksp->raiseWindow(*it); | 1197 | wksp->raiseWindow(*it); |
1181 | } else if (num_windows >= 1) { | ||
1182 | FluxboxWindow *next = current_workspace->getWindow(0); | ||
1183 | //don't raise next window if input focus fails | ||
1184 | if (next->setInputFocus()) | ||
1185 | current_workspace->raiseWindow(next); | ||
1186 | } | ||
1187 | 1198 | ||
1199 | } | ||
1188 | } | 1200 | } |
1189 | 1201 | ||
1190 | //--------- raiseFocus ----------- | 1202 | //--------- raiseFocus ----------- |