diff options
author | fluxgen <fluxgen> | 2002-03-18 19:58:06 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2002-03-18 19:58:06 (GMT) |
commit | 3a23ff8bdce8b53e3b87eb74f894dacb5ca7cbc8 (patch) | |
tree | e72dc51cb4fe1ca076fe59c58717b278768e4bba | |
parent | 981dd0dacfcea16c7c262e174275b96fea9654eb (diff) | |
download | fluxbox-3a23ff8bdce8b53e3b87eb74f894dacb5ca7cbc8.zip fluxbox-3a23ff8bdce8b53e3b87eb74f894dacb5ca7cbc8.tar.bz2 |
added isLowerTab() and lastFocusTime
-rw-r--r-- | src/Window.cc | 20 | ||||
-rw-r--r-- | src/Window.hh | 7 |
2 files changed, 24 insertions, 3 deletions
diff --git a/src/Window.cc b/src/Window.cc index 843687d..be6fcc8 100644 --- a/src/Window.cc +++ b/src/Window.cc | |||
@@ -1,5 +1,5 @@ | |||
1 | // Window.cc for Fluxbox Window Manager | 1 | // Window.cc for Fluxbox Window Manager |
2 | // Copyright (c) 2001 - 2002 Henrik Kinnunen (fluxgen@linuxmail.org) | 2 | // Copyright (c) 2001 - 2002 Henrik Kinnunen (fluxgen@linuxmail.org) |
3 | // | 3 | // |
4 | // Window.cc for Blackbox - an X11 Window manager | 4 | // Window.cc for Blackbox - an X11 Window manager |
5 | // Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net) | 5 | // Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net) |
@@ -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: Window.cc,v 1.31 2002/02/27 22:04:01 fluxgen Exp $ | 25 | // $Id: Window.cc,v 1.32 2002/03/18 19:58:06 fluxgen Exp $ |
26 | 26 | ||
27 | //use GNU extensions | 27 | //use GNU extensions |
28 | #ifndef _GNU_SOURCE | 28 | #ifndef _GNU_SOURCE |
@@ -79,6 +79,7 @@ tab(0) | |||
79 | ,gnome_hints(0) | 79 | ,gnome_hints(0) |
80 | #endif | 80 | #endif |
81 | { | 81 | { |
82 | lastFocusTime.tv_sec = lastFocusTime.tv_usec = 0; | ||
82 | 83 | ||
83 | #ifdef DEBUG | 84 | #ifdef DEBUG |
84 | fprintf(stderr, | 85 | fprintf(stderr, |
@@ -2372,6 +2373,10 @@ void FluxboxWindow::stick(void) { | |||
2372 | void FluxboxWindow::setFocusFlag(bool focus) { | 2373 | void FluxboxWindow::setFocusFlag(bool focus) { |
2373 | focused = focus; | 2374 | focused = focus; |
2374 | 2375 | ||
2376 | // Record focus timestamp for window cycling enhancements, such as skipping lower tabs | ||
2377 | if (focused) | ||
2378 | gettimeofday(&lastFocusTime, 0); | ||
2379 | |||
2375 | if (decorations.titlebar) { | 2380 | if (decorations.titlebar) { |
2376 | if (focused) { | 2381 | if (focused) { |
2377 | if (frame.ftitle) | 2382 | if (frame.ftitle) |
@@ -2699,6 +2704,17 @@ void FluxboxWindow::restoreGravity(void) { | |||
2699 | } | 2704 | } |
2700 | } | 2705 | } |
2701 | 2706 | ||
2707 | bool FluxboxWindow::isLowerTab(void) const { | ||
2708 | Tab* chkTab = (tab ? tab->first() : 0); | ||
2709 | while (chkTab) { | ||
2710 | FluxboxWindow* chkWin = chkTab->getWindow(); | ||
2711 | if (chkWin && chkWin != this && | ||
2712 | timercmp(&chkWin->lastFocusTime, &lastFocusTime, >)) | ||
2713 | return true; | ||
2714 | chkTab = chkTab->next(); | ||
2715 | } | ||
2716 | return false; | ||
2717 | } | ||
2702 | 2718 | ||
2703 | void FluxboxWindow::redrawLabel(void) { | 2719 | void FluxboxWindow::redrawLabel(void) { |
2704 | if (focused) { | 2720 | if (focused) { |
diff --git a/src/Window.hh b/src/Window.hh index c65fa2f..cdab73c 100644 --- a/src/Window.hh +++ b/src/Window.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: Window.hh,v 1.11 2002/02/26 22:35:58 fluxgen Exp $ | 25 | // $Id: Window.hh,v 1.12 2002/03/18 19:58:06 fluxgen Exp $ |
26 | 26 | ||
27 | #ifndef WINDOW_HH | 27 | #ifndef WINDOW_HH |
28 | #define WINDOW_HH | 28 | #define WINDOW_HH |
@@ -168,6 +168,8 @@ public: | |||
168 | 168 | ||
169 | inline void setWindowNumber(int n) { window_number = n; } | 169 | inline void setWindowNumber(int n) { window_number = n; } |
170 | 170 | ||
171 | inline const timeval& getLastFocusTime() const {return lastFocusTime;} | ||
172 | |||
171 | bool validateClient(void); | 173 | bool validateClient(void); |
172 | bool setInputFocus(void); | 174 | bool setInputFocus(void); |
173 | void setTab(bool flag); | 175 | void setTab(bool flag); |
@@ -187,6 +189,7 @@ public: | |||
187 | void setWorkspace(int n); | 189 | void setWorkspace(int n); |
188 | void changeBlackboxHints(BaseDisplay::BlackboxHints *); | 190 | void changeBlackboxHints(BaseDisplay::BlackboxHints *); |
189 | void restoreAttributes(void); | 191 | void restoreAttributes(void); |
192 | bool isLowerTab(void) const; | ||
190 | 193 | ||
191 | void buttonPressEvent(XButtonEvent *); | 194 | void buttonPressEvent(XButtonEvent *); |
192 | void buttonReleaseEvent(XButtonEvent *); | 195 | void buttonReleaseEvent(XButtonEvent *); |
@@ -227,6 +230,8 @@ private: | |||
227 | Time lastButtonPressTime; | 230 | Time lastButtonPressTime; |
228 | Windowmenu *windowmenu; | 231 | Windowmenu *windowmenu; |
229 | 232 | ||
233 | timeval lastFocusTime; | ||
234 | |||
230 | int focus_mode, window_number, workspace_number; | 235 | int focus_mode, window_number, workspace_number; |
231 | unsigned long current_state; | 236 | unsigned long current_state; |
232 | WinLayer m_layer; | 237 | WinLayer m_layer; |