From 5fc7cf3f1f0d3620e168a5cfd3181864643045d9 Mon Sep 17 00:00:00 2001 From: Rik Hemsley Date: Sun, 14 May 2000 01:58:13 +0000 Subject: [PATCH] Implemented delayed-show for tab box. Configurable, by default off. To set it, put this in kwinrc: [TabBox] ShowDelay=true DelayTime=200 (or whatever you want, in ms) svn path=/trunk/kdebase/kwin/; revision=49379 --- tabbox.cpp | 28 ++++++++++++++++++++++++++++ tabbox.h | 6 +++++- workspace.cpp | 4 ++-- 3 files changed, 35 insertions(+), 3 deletions(-) diff --git a/tabbox.cpp b/tabbox.cpp index 005618a9fb..6499e9463e 100644 --- a/tabbox.cpp +++ b/tabbox.cpp @@ -9,6 +9,9 @@ Copyright (C) 1999, 2000 Matthias Ettrich #include #include #include +#undef Bool // f**king X11 +#include +#include const bool options_traverse_all = FALSE; // TODO @@ -17,6 +20,7 @@ TabBox::TabBox( Workspace *ws, const char *name ) { wspace = ws; reset(); + connect(&delayedShowTimer, SIGNAL(timeout()), this, SLOT(show())); } TabBox::~TabBox() @@ -258,3 +262,27 @@ void TabBox::paintContents() } } } + + void +TabBox::hide() +{ + delayedShowTimer.stop(); + QWidget::hide(); +} + + void +TabBox::delayedShow() +{ + KConfig * c(KGlobal::config()); + c->setGroup("TabBox"); + bool delay = c->readNumEntry("ShowDelay", false); + + if (!delay) { + show(); + return; + } + + int delayTime = c->readNumEntry("DelayTime", 400); + delayedShowTimer.start(delayTime, true); +} + diff --git a/tabbox.h b/tabbox.h index cd10ba77b1..ab25ff8b68 100644 --- a/tabbox.h +++ b/tabbox.h @@ -6,6 +6,7 @@ Copyright (C) 1999, 2000 Matthias Ettrich #ifndef TABBOX_H #define TABBOX_H #include +#include class Workspace; class Client; @@ -29,6 +30,9 @@ public: void reset(); void nextPrev( bool next = TRUE); + void delayedShow(); + void hide(); + Workspace* workspace() const; protected: @@ -45,7 +49,7 @@ private: int desk; QLabel* icon; int wmax; - + QTimer delayedShowTimer; }; diff --git a/workspace.cpp b/workspace.cpp index 81fbafb28f..056444f06f 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -617,7 +617,7 @@ bool Workspace::keyPress(XKeyEvent key) tab_box->reset(); } tab_box->nextPrev( (km & ShiftMask) == 0 ); - tab_box->show(); + tab_box->delayedShow(); } } @@ -648,7 +648,7 @@ bool Workspace::keyPress(XKeyEvent key) tab_box->reset(); } tab_box->nextPrev( (km & ShiftMask) == 0 ); - tab_box->show(); + tab_box->delayedShow(); } }