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
This commit is contained in:
Rik Hemsley 2000-05-14 01:58:13 +00:00
parent 3b81ace1ea
commit 5fc7cf3f1f
3 changed files with 35 additions and 3 deletions

View file

@ -9,6 +9,9 @@ Copyright (C) 1999, 2000 Matthias Ettrich <ettrich@kde.org>
#include <qpainter.h> #include <qpainter.h>
#include <qlabel.h> #include <qlabel.h>
#include <qdrawutil.h> #include <qdrawutil.h>
#undef Bool // f**king X11
#include <kglobal.h>
#include <kconfig.h>
const bool options_traverse_all = FALSE; // TODO const bool options_traverse_all = FALSE; // TODO
@ -17,6 +20,7 @@ TabBox::TabBox( Workspace *ws, const char *name )
{ {
wspace = ws; wspace = ws;
reset(); reset();
connect(&delayedShowTimer, SIGNAL(timeout()), this, SLOT(show()));
} }
TabBox::~TabBox() 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);
}

View file

@ -6,6 +6,7 @@ Copyright (C) 1999, 2000 Matthias Ettrich <ettrich@kde.org>
#ifndef TABBOX_H #ifndef TABBOX_H
#define TABBOX_H #define TABBOX_H
#include <qwidget.h> #include <qwidget.h>
#include <qtimer.h>
class Workspace; class Workspace;
class Client; class Client;
@ -29,6 +30,9 @@ public:
void reset(); void reset();
void nextPrev( bool next = TRUE); void nextPrev( bool next = TRUE);
void delayedShow();
void hide();
Workspace* workspace() const; Workspace* workspace() const;
protected: protected:
@ -45,7 +49,7 @@ private:
int desk; int desk;
QLabel* icon; QLabel* icon;
int wmax; int wmax;
QTimer delayedShowTimer;
}; };

View file

@ -617,7 +617,7 @@ bool Workspace::keyPress(XKeyEvent key)
tab_box->reset(); tab_box->reset();
} }
tab_box->nextPrev( (km & ShiftMask) == 0 ); 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->reset();
} }
tab_box->nextPrev( (km & ShiftMask) == 0 ); tab_box->nextPrev( (km & ShiftMask) == 0 );
tab_box->show(); tab_box->delayedShow();
} }
} }