diff options
-rw-r--r-- | src/Screen.cc | 56 |
1 files changed, 36 insertions, 20 deletions
diff --git a/src/Screen.cc b/src/Screen.cc index e25de0e..6451aad 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.69 2002/09/12 14:55:11 rathnor Exp $ | 25 | // $Id: Screen.cc,v 1.70 2002/10/11 10:22:06 fluxgen Exp $ |
26 | 26 | ||
27 | //use GNU extensions | 27 | //use GNU extensions |
28 | #ifndef _GNU_SOURCE | 28 | #ifndef _GNU_SOURCE |
@@ -778,6 +778,9 @@ void BScreen::changeWorkspaceID(unsigned int id) { | |||
778 | if (id != current_workspace->workspaceID()) { | 778 | if (id != current_workspace->workspaceID()) { |
779 | XSync(fluxbox->getXDisplay(), true); | 779 | XSync(fluxbox->getXDisplay(), true); |
780 | FluxboxWindow *focused = fluxbox->getFocusedWindow(); | 780 | FluxboxWindow *focused = fluxbox->getFocusedWindow(); |
781 | #ifdef DEBUG | ||
782 | cerr<<__FILE__<<"("<<__FUNCTION__<<"): focused = "<<focused<<endl; | ||
783 | #endif // DEBUG | ||
781 | 784 | ||
782 | if (focused && focused->isMoving()) { | 785 | if (focused && focused->isMoving()) { |
783 | reassociateGroup(focused, id, true); | 786 | reassociateGroup(focused, id, true); |
@@ -800,10 +803,10 @@ void BScreen::changeWorkspaceID(unsigned int id) { | |||
800 | if (focused && focused->getScreen() == this && | 803 | if (focused && focused->getScreen() == this && |
801 | (! focused->isStuck()) && (!focused->isMoving())) { | 804 | (! focused->isStuck()) && (!focused->isMoving())) { |
802 | current_workspace->setLastFocusedWindow(focused); | 805 | current_workspace->setLastFocusedWindow(focused); |
803 | fluxbox->setFocusedWindow((FluxboxWindow *) 0); | 806 | fluxbox->setFocusedWindow(0); // set focused window to none |
804 | |||
805 | } | 807 | } |
806 | 808 | ||
809 | // set new workspace | ||
807 | current_workspace = getWorkspace(id); | 810 | current_workspace = getWorkspace(id); |
808 | 811 | ||
809 | workspacemenu->setItemSelected(current_workspace->workspaceID() + 2, true); | 812 | workspacemenu->setItemSelected(current_workspace->workspaceID() + 2, true); |
@@ -814,6 +817,7 @@ void BScreen::changeWorkspaceID(unsigned int id) { | |||
814 | if (*resource.focus_last && current_workspace->getLastFocusedWindow() && | 817 | if (*resource.focus_last && current_workspace->getLastFocusedWindow() && |
815 | !(focused && focused->isMoving())) { | 818 | !(focused && focused->isMoving())) { |
816 | current_workspace->getLastFocusedWindow()->setInputFocus(); | 819 | current_workspace->getLastFocusedWindow()->setInputFocus(); |
820 | |||
817 | } else if (focused && focused->isStuck()) { | 821 | } else if (focused && focused->isStuck()) { |
818 | focused->setInputFocus(); | 822 | focused->setInputFocus(); |
819 | } | 823 | } |
@@ -835,29 +839,37 @@ void BScreen::sendToWorkspace(unsigned int id, FluxboxWindow *win, bool changeWS | |||
835 | win = fluxbox->getFocusedWindow(); | 839 | win = fluxbox->getFocusedWindow(); |
836 | 840 | ||
837 | if (id != current_workspace->workspaceID()) { | 841 | if (id != current_workspace->workspaceID()) { |
838 | XSync(fluxbox->getXDisplay(), True); | 842 | XSync(BaseDisplay::getXDisplay(), True); |
839 | 843 | ||
840 | if (win && win->getScreen() == this && | 844 | if (win && win->getScreen() == this && |
841 | (! win->isStuck())) { | 845 | (! win->isStuck())) { |
842 | 846 | ||
843 | if ( win->getTab() ) { | 847 | if ( win->getTab() ) { |
844 | Tab *tab = win->getTab(); | 848 | Tab *tab = win->getTab(); |
845 | tab->disconnect(); | 849 | tab->disconnect(); |
846 | tab->setPosition(); | 850 | tab->setPosition(); |
847 | } | 851 | } |
848 | 852 | ||
849 | if (win->isIconic()) | 853 | if (win->isIconic()) { |
850 | win->deiconify(); | 854 | win->deiconify(); |
855 | } | ||
851 | 856 | ||
852 | win->withdraw(); | 857 | win->withdraw(); |
853 | BScreen::reassociateWindow(win, id, true); | 858 | reassociateWindow(win, id, true); |
854 | if (changeWS) { | 859 | |
855 | BScreen::changeWorkspaceID(id); | 860 | // change workspace ? |
856 | win->setInputFocus(); | 861 | if (changeWS) { |
857 | } | 862 | changeWorkspaceID(id); |
858 | } | 863 | win->setInputFocus(); |
864 | } | ||
865 | #ifdef DEBUG | ||
866 | cerr<<"Sending to id = "<<id<<endl; | ||
867 | cerr<<"win->workspaceId="<<win->getWorkspaceNumber()<<endl; | ||
868 | #endif //DEBUG | ||
859 | 869 | ||
860 | } | 870 | } |
871 | |||
872 | } | ||
861 | } | 873 | } |
862 | 874 | ||
863 | 875 | ||
@@ -1100,8 +1112,12 @@ void BScreen::reassociateGroup(FluxboxWindow *w, unsigned int wkspc_id, bool ign | |||
1100 | void BScreen::reassociateWindow(FluxboxWindow *w, unsigned int wkspc_id, bool ignore_sticky) { | 1112 | void BScreen::reassociateWindow(FluxboxWindow *w, unsigned int wkspc_id, bool ignore_sticky) { |
1101 | if (! w) return; | 1113 | if (! w) return; |
1102 | 1114 | ||
1103 | if (wkspc_id >= getCount()) | 1115 | if (wkspc_id >= getCount()) { |
1104 | wkspc_id = current_workspace->workspaceID(); | 1116 | wkspc_id = current_workspace->workspaceID(); |
1117 | #ifdef DEBUG | ||
1118 | cerr<<__FILE__<<"("<<__LINE__<<"): wkspc_id >= getCount()"<<endl; | ||
1119 | #endif // DEBUG | ||
1120 | } | ||
1105 | 1121 | ||
1106 | if (w->getWorkspaceNumber() == wkspc_id) | 1122 | if (w->getWorkspaceNumber() == wkspc_id) |
1107 | return; | 1123 | return; |