summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Screen.cc39
-rw-r--r--src/Screen.hh8
2 files changed, 36 insertions, 11 deletions
diff --git a/src/Screen.cc b/src/Screen.cc
index 39b15b8..60c8a63 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.64 2002/08/24 18:12:54 fluxgen Exp $ 25// $Id: Screen.cc,v 1.65 2002/08/30 14:03:31 fluxgen Exp $
26 26
27//use GNU extensions 27//use GNU extensions
28#ifndef _GNU_SOURCE 28#ifndef _GNU_SOURCE
@@ -794,16 +794,20 @@ void BScreen::changeWorkspaceID(unsigned int id) {
794 794
795 if (id != current_workspace->workspaceID()) { 795 if (id != current_workspace->workspaceID()) {
796 XSync(fluxbox->getXDisplay(), true); 796 XSync(fluxbox->getXDisplay(), true);
797 797 FluxboxWindow *focused = fluxbox->getFocusedWindow();
798
799 if (focused && focused->isMoving()) {
800 reassociateGroup(focused, id, true);
801 focused->pauseMoving();
802 }
803
798 current_workspace->hideAll(); 804 current_workspace->hideAll();
799 805
800 workspacemenu->setItemSelected(current_workspace->workspaceID() + 2, false); 806 workspacemenu->setItemSelected(current_workspace->workspaceID() + 2, false);
801 807
802 if (fluxbox->getFocusedWindow() && 808 if (focused && focused->getScreen() == this &&
803 fluxbox->getFocusedWindow()->getScreen() == this && 809 (! focused->isStuck()) && (!focused->isMoving())) {
804 (! fluxbox->getFocusedWindow()->isStuck())) { 810 current_workspace->setLastFocusedWindow(focused);
805
806 current_workspace->setLastFocusedWindow(fluxbox->getFocusedWindow());
807 fluxbox->setFocusedWindow((FluxboxWindow *) 0); 811 fluxbox->setFocusedWindow((FluxboxWindow *) 0);
808 812
809 } 813 }
@@ -815,9 +819,14 @@ void BScreen::changeWorkspaceID(unsigned int id) {
815 819
816 current_workspace->showAll(); 820 current_workspace->showAll();
817 821
818 if (*resource.focus_last && current_workspace->getLastFocusedWindow()) 822 if (*resource.focus_last && current_workspace->getLastFocusedWindow() &&
823 !(focused && focused->isMoving())) {
819 current_workspace->getLastFocusedWindow()->setInputFocus(); 824 current_workspace->getLastFocusedWindow()->setInputFocus();
820 825 }
826
827 if (focused && focused->isMoving()) {
828 focused->resumeMoving();
829 }
821 } 830 }
822 831
823 updateNetizenCurrentWorkspace(); 832 updateNetizenCurrentWorkspace();
@@ -1091,6 +1100,18 @@ string BScreen::getNameOfWorkspace(unsigned int workspace) const {
1091 1100
1092} 1101}
1093 1102
1103void BScreen::reassociateGroup(FluxboxWindow *w, unsigned int wkspc_id, bool ignore_sticky) {
1104 if (w->hasTab() && (w->getTab()->next() || w->getTab()->prev())) {
1105 Tab *tab_it = w->getTab()->first();
1106 for (; tab_it; tab_it = tab_it->next()) {
1107 reassociateWindow(tab_it->getWindow(), wkspc_id, ignore_sticky);
1108 }
1109 } else {
1110 // no tab, juts move this one
1111 reassociateWindow(w, wkspc_id, ignore_sticky);
1112 }
1113}
1114
1094 1115
1095void BScreen::reassociateWindow(FluxboxWindow *w, unsigned int wkspc_id, bool ignore_sticky) { 1116void BScreen::reassociateWindow(FluxboxWindow *w, unsigned int wkspc_id, bool ignore_sticky) {
1096 if (! w) return; 1117 if (! w) return;
diff --git a/src/Screen.hh b/src/Screen.hh
index b85a1b4..967804e 100644
--- a/src/Screen.hh
+++ b/src/Screen.hh
@@ -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.hh,v 1.42 2002/08/11 22:11:42 fluxgen Exp $ 25// $Id: Screen.hh,v 1.43 2002/08/30 14:03:31 fluxgen Exp $
26 26
27#ifndef SCREEN_HH 27#ifndef SCREEN_HH
28#define SCREEN_HH 28#define SCREEN_HH
@@ -126,11 +126,14 @@ public:
126 inline unsigned int getCurrentWorkspaceID() const { return current_workspace->workspaceID(); } 126 inline unsigned int getCurrentWorkspaceID() const { return current_workspace->workspaceID(); }
127 127
128 typedef std::vector<FluxboxWindow *> Icons; 128 typedef std::vector<FluxboxWindow *> Icons;
129
130 /// @return number of workspaces
129 inline unsigned int getCount() const { return workspacesList.size(); } 131 inline unsigned int getCount() const { return workspacesList.size(); }
132 /// @return number of icons
130 inline unsigned int getIconCount() const { return iconList.size(); } 133 inline unsigned int getIconCount() const { return iconList.size(); }
131 inline const Icons &getIconList() const { return iconList; } 134 inline const Icons &getIconList() const { return iconList; }
132 inline Icons &getIconList() { return iconList; } 135 inline Icons &getIconList() { return iconList; }
133 136 /// @return the resource value of number of workspace
134 inline int getNumberOfWorkspaces() const { return *resource.workspaces; } 137 inline int getNumberOfWorkspaces() const { return *resource.workspaces; }
135 inline Toolbar::Placement getToolbarPlacement() const { return *resource.toolbar_placement; } 138 inline Toolbar::Placement getToolbarPlacement() const { return *resource.toolbar_placement; }
136#ifdef XINERAMA 139#ifdef XINERAMA
@@ -219,6 +222,7 @@ public:
219 void changeWorkspaceID(unsigned int); 222 void changeWorkspaceID(unsigned int);
220 void sendToWorkspace(unsigned int workspace, FluxboxWindow *win=0, bool changeworkspace=true); 223 void sendToWorkspace(unsigned int workspace, FluxboxWindow *win=0, bool changeworkspace=true);
221 void raiseWindows(Window *workspace_stack, int num); 224 void raiseWindows(Window *workspace_stack, int num);
225 void reassociateGroup(FluxboxWindow *window, unsigned int workspace_id, bool ignore_sticky);
222 void reassociateWindow(FluxboxWindow *window, unsigned int workspace_id, bool ignore_sticky); 226 void reassociateWindow(FluxboxWindow *window, unsigned int workspace_id, bool ignore_sticky);
223 void prevFocus(int = 0); 227 void prevFocus(int = 0);
224 void nextFocus(int = 0); 228 void nextFocus(int = 0);