diff options
author | markt <markt> | 2007-07-17 21:21:17 (GMT) |
---|---|---|
committer | markt <markt> | 2007-07-17 21:21:17 (GMT) |
commit | 8de73d0fd4fde6e6f5349831304fb9a268af8d70 (patch) | |
tree | 2ee5cbbdb283c76db81527cfcfed7c1344d20df0 | |
parent | 5aecf58d47702e6d12ff1174b03a797b516245b7 (diff) | |
download | fluxbox-8de73d0fd4fde6e6f5349831304fb9a268af8d70.zip fluxbox-8de73d0fd4fde6e6f5349831304fb9a268af8d70.tar.bz2 |
updated behavior of alt-tab to match pre-devel, fixing bug #1755698
-rw-r--r-- | src/FbTk/Menu.cc | 1 | ||||
-rw-r--r-- | src/FocusControl.cc | 90 | ||||
-rw-r--r-- | src/FocusControl.hh | 6 | ||||
-rw-r--r-- | src/Screen.cc | 2 | ||||
-rw-r--r-- | src/Window.cc | 4 |
5 files changed, 56 insertions, 47 deletions
diff --git a/src/FbTk/Menu.cc b/src/FbTk/Menu.cc index ec0a061..ee17204 100644 --- a/src/FbTk/Menu.cc +++ b/src/FbTk/Menu.cc | |||
@@ -111,6 +111,7 @@ Menu::Menu(MenuTheme &tm, ImageControl &imgctrl): | |||
111 | 111 | ||
112 | m_internal_menu = | 112 | m_internal_menu = |
113 | m_moving = | 113 | m_moving = |
114 | m_closing = | ||
114 | m_torn = | 115 | m_torn = |
115 | m_visible = false; | 116 | m_visible = false; |
116 | 117 | ||
diff --git a/src/FocusControl.cc b/src/FocusControl.cc index 4de491a..c333005 100644 --- a/src/FocusControl.cc +++ b/src/FocusControl.cc | |||
@@ -86,23 +86,27 @@ bool doSkipWindow(const WinClient &winclient, int opts) { | |||
86 | ); | 86 | ); |
87 | } | 87 | } |
88 | 88 | ||
89 | void FocusControl::cycleFocus(FocusedWindows *window_list, int opts, bool cycle_reverse) { | 89 | void FocusControl::cycleFocus(FocusedWindows &window_list, int opts, bool cycle_reverse) { |
90 | 90 | ||
91 | if (!m_cycling_list) { | 91 | if (!m_cycling_list) { |
92 | if (&m_screen == FbTk::EventManager::instance()->grabbingKeyboard()) | 92 | if (&m_screen == FbTk::EventManager::instance()->grabbingKeyboard()) |
93 | // only set this when we're waiting for modifiers | 93 | // only set this when we're waiting for modifiers |
94 | m_cycling_list = window_list; | 94 | m_cycling_list = &window_list; |
95 | m_was_iconic = 0; | 95 | m_was_iconic = 0; |
96 | m_cycling_last = 0; | 96 | m_cycling_last = 0; |
97 | } else if (m_cycling_list != window_list) | 97 | } else if (m_cycling_list != &window_list) |
98 | m_cycling_list = window_list; | 98 | m_cycling_list = &window_list; |
99 | |||
100 | FocusedWindows::iterator it_begin = window_list.begin(); | ||
101 | FocusedWindows::iterator it_end = window_list.end(); | ||
99 | 102 | ||
100 | // too many things can go wrong with remembering this | 103 | // too many things can go wrong with remembering this |
101 | m_cycling_window = find(window_list->begin(),window_list->end(),s_focused_window); | 104 | m_cycling_window = find(it_begin, it_end, s_focused_window); |
102 | 105 | ||
103 | FocusedWindows::iterator it = m_cycling_window; | 106 | FocusedWindows::iterator it = m_cycling_window; |
104 | FocusedWindows::iterator it_begin = window_list->begin(); | 107 | FluxboxWindow *fbwin = 0; |
105 | FocusedWindows::iterator it_end = window_list->end(); | 108 | WinClient *last_client = 0; |
109 | WinClient *was_iconic = 0; | ||
106 | 110 | ||
107 | // find the next window in the list that works | 111 | // find the next window in the list that works |
108 | while (true) { | 112 | while (true) { |
@@ -114,46 +118,50 @@ void FocusControl::cycleFocus(FocusedWindows *window_list, int opts, bool cycle_ | |||
114 | cycle_reverse ? --it : ++it; | 118 | cycle_reverse ? --it : ++it; |
115 | // give up [do nothing] if we reach the current focused again | 119 | // give up [do nothing] if we reach the current focused again |
116 | if (it == m_cycling_window) | 120 | if (it == m_cycling_window) |
117 | break; | 121 | return; |
118 | if (it == it_end) | 122 | if (it == it_end) |
119 | continue; | 123 | continue; |
120 | 124 | ||
121 | FluxboxWindow *fbwin = (*it)->fbwindow(); | 125 | fbwin = (*it)->fbwindow(); |
122 | if (fbwin && (fbwin->isStuck() | 126 | if (!fbwin) |
123 | || fbwin->workspaceNumber() == m_screen.currentWorkspaceID())) { | 127 | continue; |
124 | // either on this workspace, or stuck | 128 | |
125 | 129 | // keep track of the originally selected window in a group | |
126 | // keep track of the originally selected window in a set | 130 | last_client = &fbwin->winClient(); |
127 | WinClient &last_client = fbwin->winClient(); | 131 | was_iconic = (fbwin->isIconic() ? last_client : 0); |
128 | 132 | ||
129 | if (! (doSkipWindow(**it, opts) || !fbwin->setCurrentClient(**it)) ) { | 133 | // now we actually try to focus the window |
130 | // moved onto a new fbwin | 134 | if (!doSkipWindow(**it, opts) && (*it)->focus()) |
131 | if (!m_cycling_last || m_cycling_last->fbwindow() != fbwin) { | 135 | break; |
132 | if (m_cycling_last) { | 136 | } |
133 | // already cycling, so restack to put windows back in | 137 | |
134 | // their proper order | 138 | // if we're still in the same fbwin, there's nothing else to do |
135 | m_screen.layerManager().restack(); | 139 | if (m_cycling_last && m_cycling_last->fbwindow() == fbwin) |
136 | 140 | return; | |
137 | // set back to orig current Client in that fbwin | 141 | |
138 | m_cycling_last->fbwindow()->setCurrentClient(*m_cycling_last, false); | 142 | // if we were already cycling, then restore the old state |
139 | if (m_was_iconic == m_cycling_last) { | 143 | if (m_cycling_last) { |
140 | s_reverting = true; // little hack | 144 | m_screen.layerManager().restack(); |
141 | m_cycling_last->fbwindow()->iconify(); | 145 | |
142 | s_reverting = false; | 146 | // set back to originally selected window in that group |
143 | } | 147 | m_cycling_last->fbwindow()->setCurrentClient(*m_cycling_last, false); |
144 | } | 148 | |
145 | m_cycling_last = &last_client; | 149 | if (m_was_iconic == m_cycling_last) { |
146 | if (fbwin->isIconic()) | 150 | s_reverting = true; // little hack |
147 | m_was_iconic = m_cycling_last; | 151 | m_cycling_last->fbwindow()->iconify(); |
148 | if (m_cycling_list) | 152 | s_reverting = false; |
149 | // else window will raise itself (if desired) on FocusIn | ||
150 | fbwin->tempRaise(); | ||
151 | } | ||
152 | break; | ||
153 | } | ||
154 | } | 153 | } |
155 | } | 154 | } |
155 | |||
156 | if (isCycling()) | ||
157 | fbwin->tempRaise(); | ||
158 | else | ||
159 | fbwin->raise(); | ||
160 | |||
156 | m_cycling_window = it; | 161 | m_cycling_window = it; |
162 | m_cycling_last = last_client; | ||
163 | m_was_iconic = was_iconic; | ||
164 | |||
157 | } | 165 | } |
158 | 166 | ||
159 | void FocusControl::addFocusBack(WinClient &client) { | 167 | void FocusControl::addFocusBack(WinClient &client) { |
diff --git a/src/FocusControl.hh b/src/FocusControl.hh index c55aa6a..79d16d4 100644 --- a/src/FocusControl.hh +++ b/src/FocusControl.hh | |||
@@ -73,16 +73,16 @@ public: | |||
73 | explicit FocusControl(BScreen &screen); | 73 | explicit FocusControl(BScreen &screen); |
74 | 74 | ||
75 | /// cycle previous focuable | 75 | /// cycle previous focuable |
76 | void prevFocus() { cycleFocus(&m_focused_list, 0, true); } | 76 | void prevFocus() { cycleFocus(m_focused_list, 0, true); } |
77 | /// cycle next focusable | 77 | /// cycle next focusable |
78 | void nextFocus() { cycleFocus(&m_focused_list, 0, false); } | 78 | void nextFocus() { cycleFocus(m_focused_list, 0, false); } |
79 | /** | 79 | /** |
80 | * Cycle focus for a set of windows. | 80 | * Cycle focus for a set of windows. |
81 | * @param winlist the windowlist to cycle through | 81 | * @param winlist the windowlist to cycle through |
82 | * @param options cycle options @see FocusOption | 82 | * @param options cycle options @see FocusOption |
83 | * @param reverse reverse the cycle order | 83 | * @param reverse reverse the cycle order |
84 | */ | 84 | */ |
85 | void cycleFocus(FocusedWindows *winlist, int options, bool reverse = false); | 85 | void cycleFocus(FocusedWindows &winlist, int options, bool reverse = false); |
86 | /// sets the focused window on a screen | 86 | /// sets the focused window on a screen |
87 | void setScreenFocusedWindow(WinClient &win_client); | 87 | void setScreenFocusedWindow(WinClient &win_client); |
88 | /// sets the main focus model | 88 | /// sets the main focus model |
diff --git a/src/Screen.cc b/src/Screen.cc index a37b594..b0575f3 100644 --- a/src/Screen.cc +++ b/src/Screen.cc | |||
@@ -865,7 +865,7 @@ void BScreen::cycleFocus(int options, bool reverse) { | |||
865 | &focusControl().creationOrderList() : | 865 | &focusControl().creationOrderList() : |
866 | &focusControl().focusedOrderList(); | 866 | &focusControl().focusedOrderList(); |
867 | 867 | ||
868 | focusControl().cycleFocus(win_list, options, reverse); | 868 | focusControl().cycleFocus(*win_list, options, reverse); |
869 | } | 869 | } |
870 | 870 | ||
871 | FbTk::Menu *BScreen::createMenu(const string &label) { | 871 | FbTk::Menu *BScreen::createMenu(const string &label) { |
diff --git a/src/Window.cc b/src/Window.cc index 3a2801b..d8a3f46 100644 --- a/src/Window.cc +++ b/src/Window.cc | |||
@@ -780,14 +780,14 @@ void FluxboxWindow::nextClient() { | |||
780 | if (numClients() <= 1) | 780 | if (numClients() <= 1) |
781 | return; | 781 | return; |
782 | 782 | ||
783 | screen().focusControl().cycleFocus(&m_clientlist, 0); | 783 | screen().focusControl().cycleFocus(m_clientlist, 0); |
784 | } | 784 | } |
785 | 785 | ||
786 | void FluxboxWindow::prevClient() { | 786 | void FluxboxWindow::prevClient() { |
787 | if (numClients() <= 1) | 787 | if (numClients() <= 1) |
788 | return; | 788 | return; |
789 | 789 | ||
790 | screen().focusControl().cycleFocus(&m_clientlist, 0, true); | 790 | screen().focusControl().cycleFocus(m_clientlist, 0, true); |
791 | } | 791 | } |
792 | 792 | ||
793 | 793 | ||