added isLowerTab() and lastFocusTime

This commit is contained in:
fluxgen 2002-03-18 19:58:06 +00:00
parent 981dd0dacf
commit 3a23ff8bdc
2 changed files with 24 additions and 3 deletions

View file

@ -1,5 +1,5 @@
// Window.cc for Fluxbox Window Manager // 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 // Window.cc for Blackbox - an X11 Window manager
// Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net) // 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 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // 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 //use GNU extensions
#ifndef _GNU_SOURCE #ifndef _GNU_SOURCE
@ -79,6 +79,7 @@ tab(0)
,gnome_hints(0) ,gnome_hints(0)
#endif #endif
{ {
lastFocusTime.tv_sec = lastFocusTime.tv_usec = 0;
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, fprintf(stderr,
@ -2372,6 +2373,10 @@ void FluxboxWindow::stick(void) {
void FluxboxWindow::setFocusFlag(bool focus) { void FluxboxWindow::setFocusFlag(bool focus) {
focused = focus; focused = focus;
// Record focus timestamp for window cycling enhancements, such as skipping lower tabs
if (focused)
gettimeofday(&lastFocusTime, 0);
if (decorations.titlebar) { if (decorations.titlebar) {
if (focused) { if (focused) {
if (frame.ftitle) 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) { void FluxboxWindow::redrawLabel(void) {
if (focused) { if (focused) {

View file

@ -22,7 +22,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // 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 #ifndef WINDOW_HH
#define WINDOW_HH #define WINDOW_HH
@ -168,6 +168,8 @@ public:
inline void setWindowNumber(int n) { window_number = n; } inline void setWindowNumber(int n) { window_number = n; }
inline const timeval& getLastFocusTime() const {return lastFocusTime;}
bool validateClient(void); bool validateClient(void);
bool setInputFocus(void); bool setInputFocus(void);
void setTab(bool flag); void setTab(bool flag);
@ -187,6 +189,7 @@ public:
void setWorkspace(int n); void setWorkspace(int n);
void changeBlackboxHints(BaseDisplay::BlackboxHints *); void changeBlackboxHints(BaseDisplay::BlackboxHints *);
void restoreAttributes(void); void restoreAttributes(void);
bool isLowerTab(void) const;
void buttonPressEvent(XButtonEvent *); void buttonPressEvent(XButtonEvent *);
void buttonReleaseEvent(XButtonEvent *); void buttonReleaseEvent(XButtonEvent *);
@ -227,6 +230,8 @@ private:
Time lastButtonPressTime; Time lastButtonPressTime;
Windowmenu *windowmenu; Windowmenu *windowmenu;
timeval lastFocusTime;
int focus_mode, window_number, workspace_number; int focus_mode, window_number, workspace_number;
unsigned long current_state; unsigned long current_state;
WinLayer m_layer; WinLayer m_layer;