From 3a23ff8bdce8b53e3b87eb74f894dacb5ca7cbc8 Mon Sep 17 00:00:00 2001 From: fluxgen Date: Mon, 18 Mar 2002 19:58:06 +0000 Subject: added isLowerTab() and lastFocusTime --- src/Window.cc | 20 ++++++++++++++++++-- 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 @@ // Window.cc for Fluxbox Window Manager -// Copyright (c) 2001 - 2002 Henrik Kinnunen (fluxgen@linuxmail.org) +// Copyright (c) 2001 - 2002 Henrik Kinnunen (fluxgen@linuxmail.org) // // Window.cc for Blackbox - an X11 Window manager // Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net) @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Window.cc,v 1.31 2002/02/27 22:04:01 fluxgen Exp $ +// $Id: Window.cc,v 1.32 2002/03/18 19:58:06 fluxgen Exp $ //use GNU extensions #ifndef _GNU_SOURCE @@ -79,6 +79,7 @@ tab(0) ,gnome_hints(0) #endif { + lastFocusTime.tv_sec = lastFocusTime.tv_usec = 0; #ifdef DEBUG fprintf(stderr, @@ -2372,6 +2373,10 @@ void FluxboxWindow::stick(void) { void FluxboxWindow::setFocusFlag(bool focus) { focused = focus; + // Record focus timestamp for window cycling enhancements, such as skipping lower tabs + if (focused) + gettimeofday(&lastFocusTime, 0); + if (decorations.titlebar) { if (focused) { if (frame.ftitle) @@ -2699,6 +2704,17 @@ void FluxboxWindow::restoreGravity(void) { } } +bool FluxboxWindow::isLowerTab(void) const { + Tab* chkTab = (tab ? tab->first() : 0); + while (chkTab) { + FluxboxWindow* chkWin = chkTab->getWindow(); + if (chkWin && chkWin != this && + timercmp(&chkWin->lastFocusTime, &lastFocusTime, >)) + return true; + chkTab = chkTab->next(); + } + return false; +} void FluxboxWindow::redrawLabel(void) { 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 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Window.hh,v 1.11 2002/02/26 22:35:58 fluxgen Exp $ +// $Id: Window.hh,v 1.12 2002/03/18 19:58:06 fluxgen Exp $ #ifndef WINDOW_HH #define WINDOW_HH @@ -168,6 +168,8 @@ public: inline void setWindowNumber(int n) { window_number = n; } + inline const timeval& getLastFocusTime() const {return lastFocusTime;} + bool validateClient(void); bool setInputFocus(void); void setTab(bool flag); @@ -187,6 +189,7 @@ public: void setWorkspace(int n); void changeBlackboxHints(BaseDisplay::BlackboxHints *); void restoreAttributes(void); + bool isLowerTab(void) const; void buttonPressEvent(XButtonEvent *); void buttonReleaseEvent(XButtonEvent *); @@ -227,6 +230,8 @@ private: Time lastButtonPressTime; Windowmenu *windowmenu; + timeval lastFocusTime; + int focus_mode, window_number, workspace_number; unsigned long current_state; WinLayer m_layer; -- cgit v0.11.2