summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Screen.cc44
1 files changed, 28 insertions, 16 deletions
diff --git a/src/Screen.cc b/src/Screen.cc
index 492f0d1..9a215bf 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.66 2002/09/07 20:22:08 fluxgen Exp $ 25// $Id: Screen.cc,v 1.67 2002/09/08 19:45:59 fluxgen Exp $
26 26
27//use GNU extensions 27//use GNU extensions
28#ifndef _GNU_SOURCE 28#ifndef _GNU_SOURCE
@@ -390,7 +390,7 @@ resource(rm, screenname, altscreenname)
390 390
391 initMenu(); 391 initMenu();
392 392
393 raiseWindows(0, 0); 393 raiseWindows(Workspace::Stack());
394 394
395 //update menus 395 //update menus
396 rootmenu->update(); 396 rootmenu->update();
@@ -620,7 +620,7 @@ void BScreen::reconfigure() {
620 { 620 {
621 int remember_sub = rootmenu->currentSubmenu(); 621 int remember_sub = rootmenu->currentSubmenu();
622 initMenu(); 622 initMenu();
623 raiseWindows(0, 0); 623 raiseWindows(Workspace::Stack());
624 rootmenu->reconfigure(); 624 rootmenu->reconfigure();
625 rootmenu->drawSubmenu(remember_sub); 625 rootmenu->drawSubmenu(remember_sub);
626 } 626 }
@@ -653,7 +653,7 @@ void BScreen::reconfigure() {
653 653
654void BScreen::rereadMenu() { 654void BScreen::rereadMenu() {
655 initMenu(); 655 initMenu();
656 raiseWindows(0, 0); 656 raiseWindows(Workspace::Stack());
657 657
658 rootmenu->reconfigure(); 658 rootmenu->reconfigure();
659} 659}
@@ -683,7 +683,8 @@ void BScreen::addIcon(FluxboxWindow *w) {
683 683
684 684
685void BScreen::removeIcon(FluxboxWindow *w) { 685void BScreen::removeIcon(FluxboxWindow *w) {
686 if (! w) return; 686 if (! w)
687 return;
687 688
688 { 689 {
689 Icons::iterator it = iconList.begin(); 690 Icons::iterator it = iconList.begin();
@@ -707,6 +708,13 @@ void BScreen::removeIcon(FluxboxWindow *w) {
707 } 708 }
708} 709}
709 710
711void BScreen::removeWindow(FluxboxWindow *win) {
712 Workspaces::iterator it = workspacesList.begin();
713 Workspaces::iterator it_end = workspacesList.end();
714 for (; it != it_end; ++it) {
715 (*it)->removeWindow(win);
716 }
717}
710 718
711FluxboxWindow *BScreen::getIcon(unsigned int index) { 719FluxboxWindow *BScreen::getIcon(unsigned int index) {
712 if (index < iconList.size()) 720 if (index < iconList.size())
@@ -975,9 +983,9 @@ void BScreen::updateNetizenConfigNotify(XEvent *e) {
975} 983}
976 984
977 985
978void BScreen::raiseWindows(Window *workspace_stack, int num) { 986void BScreen::raiseWindows(const Workspace::Stack &workspace_stack) {
979 987
980 Window session_stack[(num + workspacesList.size() + rootmenuList.size() + 30)]; 988 Window session_stack[(workspace_stack.size() + workspacesList.size() + rootmenuList.size() + 30)];
981 int i = 0; 989 int i = 0;
982 XRaiseWindow(getBaseDisplay()->getXDisplay(), iconmenu->windowID()); 990 XRaiseWindow(getBaseDisplay()->getXDisplay(), iconmenu->windowID());
983 session_stack[i++] = iconmenu->windowID(); 991 session_stack[i++] = iconmenu->windowID();
@@ -1029,10 +1037,12 @@ void BScreen::raiseWindows(Window *workspace_stack, int num) {
1029 if (slit->isOnTop()) 1037 if (slit->isOnTop())
1030 session_stack[i++] = slit->getWindowID(); 1038 session_stack[i++] = slit->getWindowID();
1031 #endif // SLIT 1039 #endif // SLIT
1032 1040 if (!workspace_stack.empty()) {
1033 int k=num; 1041 Workspace::Stack::const_reverse_iterator it = workspace_stack.rbegin();
1034 while (k--) 1042 Workspace::Stack::const_reverse_iterator it_end = workspace_stack.rend();
1035 session_stack[i++] = *(workspace_stack + k); 1043 for (; it != it_end; ++it)
1044 session_stack[i++] = (*it);
1045 }
1036 1046
1037 XRestackWindows(getBaseDisplay()->getXDisplay(), session_stack, i); 1047 XRestackWindows(getBaseDisplay()->getXDisplay(), session_stack, i);
1038 1048
@@ -1095,10 +1105,10 @@ void BScreen::reassociateWindow(FluxboxWindow *w, unsigned int wkspc_id, bool ig
1095void BScreen::nextFocus(int opts) { 1105void BScreen::nextFocus(int opts) {
1096 bool have_focused = false; 1106 bool have_focused = false;
1097 int focused_window_number = -1; 1107 int focused_window_number = -1;
1098 FluxboxWindow *focused; 1108 FluxboxWindow *focused = fluxbox->getFocusedWindow();
1099 const int num_windows = getCurrentWorkspace()->getCount(); 1109 const int num_windows = getCurrentWorkspace()->getCount();
1100 1110
1101 if ((focused = fluxbox->getFocusedWindow())) { 1111 if (focused != 0) {
1102 if (focused->getScreen()->getScreenNumber() == 1112 if (focused->getScreen()->getScreenNumber() ==
1103 getScreenNumber()) { 1113 getScreenNumber()) {
1104 have_focused = true; 1114 have_focused = true;
@@ -1108,9 +1118,11 @@ void BScreen::nextFocus(int opts) {
1108 1118
1109 if (num_windows > 1 && have_focused) { 1119 if (num_windows > 1 && have_focused) {
1110 Workspace *wksp = getCurrentWorkspace(); 1120 Workspace *wksp = getCurrentWorkspace();
1111 Workspace::Windows wins = wksp->getWindowList(); 1121 Workspace::Windows &wins = wksp->getWindowList();
1112 Workspace::Windows::iterator it = wins.begin(); 1122 Workspace::Windows::iterator it = wins.begin();
1113 for (; *it != focused; ++it); //get focused window iterator 1123
1124 for (; *it != focused; ++it) //get focused window iterator
1125 continue;
1114 1126
1115 do { 1127 do {
1116 ++it; 1128 ++it;
@@ -1121,7 +1133,7 @@ void BScreen::nextFocus(int opts) {
1121 break; 1133 break;
1122 } while (*it != focused); 1134 } while (*it != focused);
1123 1135
1124 if (*it != focused) 1136 if (*it != focused && it != wins.end())
1125 wksp->raiseWindow(*it); 1137 wksp->raiseWindow(*it);
1126 1138
1127 } else if (num_windows >= 1) { 1139 } else if (num_windows >= 1) {