When window shade hovering is enabled do not immediately shade the

window once the cursor leaves the window, instead wait a little while.
Patch by Marcel Partap.
BUG: 81085

svn path=/trunk/KDE/kdebase/workspace/; revision=897056
This commit is contained in:
Lucas Murray 2008-12-15 08:27:17 +00:00
parent c5256e6b13
commit d5a630cabd
4 changed files with 29 additions and 14 deletions

View file

@ -808,10 +808,16 @@ void Client::setShade( ShadeMode mode )
void Client::shadeHover() void Client::shadeHover()
{ {
setShade( ShadeHover ); setShade( ShadeHover );
cancelShadeHover(); cancelShadeHoverTimer();
} }
void Client::cancelShadeHover() void Client::shadeUnhover()
{
setShade( ShadeNormal );
cancelShadeHoverTimer();
}
void Client::cancelShadeHoverTimer()
{ {
delete shadeHoverTimer; delete shadeHoverTimer;
shadeHoverTimer = 0; shadeHoverTimer = 0;

View file

@ -271,7 +271,7 @@ class Client
void maximize( MaximizeMode ); void maximize( MaximizeMode );
void toggleShade(); void toggleShade();
void showContextHelp(); void showContextHelp();
void cancelShadeHover(); void cancelShadeHoverTimer();
void cancelAutoRaise(); void cancelAutoRaise();
void checkActiveModal(); void checkActiveModal();
bool hasStrut() const; bool hasStrut() const;
@ -294,6 +294,7 @@ class Client
private slots: private slots:
void autoRaise(); void autoRaise();
void shadeHover(); void shadeHover();
void shadeUnhover();
void shortcutActivated(); void shortcutActivated();
void delayedMoveResize(); void delayedMoveResize();

View file

@ -940,13 +940,16 @@ void Client::enterNotifyEvent( XCrossingEvent* e )
e->mode == NotifyUngrab ) ) e->mode == NotifyUngrab ) )
{ {
if (options->shadeHover && isShade()) if ( options->shadeHover )
{ {
delete shadeHoverTimer; cancelShadeHoverTimer();
shadeHoverTimer = new QTimer( this ); if (isShade())
connect( shadeHoverTimer, SIGNAL( timeout() ), this, SLOT( shadeHover() )); {
shadeHoverTimer->setSingleShot( true ); shadeHoverTimer = new QTimer( this );
shadeHoverTimer->start( options->shadeHoverInterval ); connect( shadeHoverTimer, SIGNAL( timeout() ), this, SLOT( shadeHover() ));
shadeHoverTimer->setSingleShot( true );
shadeHoverTimer->start( options->shadeHoverInterval );
}
} }
if ( options->focusPolicy == Options::ClickToFocus ) if ( options->focusPolicy == Options::ClickToFocus )
@ -1013,9 +1016,14 @@ void Client::leaveNotifyEvent( XCrossingEvent* e )
{ {
cancelAutoRaise(); cancelAutoRaise();
workspace()->cancelDelayFocus(); workspace()->cancelDelayFocus();
cancelShadeHover(); cancelShadeHoverTimer();
if ( shade_mode == ShadeHover && !moveResizeMode && !buttonDown ) if ( shade_mode == ShadeHover && !moveResizeMode && !buttonDown )
setShade( ShadeNormal ); {
shadeHoverTimer = new QTimer( this );
connect( shadeHoverTimer, SIGNAL( timeout() ), this, SLOT( shadeUnhover() ));
shadeHoverTimer->setSingleShot( true );
shadeHoverTimer->start( options->shadeHoverInterval );
}
} }
if ( options->focusPolicy == Options::FocusStrictlyUnderMouse ) if ( options->focusPolicy == Options::FocusStrictlyUnderMouse )
if ( isActive() && lostMouse ) if ( isActive() && lostMouse )

View file

@ -574,15 +574,15 @@ bool Client::performMouseCommand( Options::MouseCommand command, const QPoint &g
break; break;
case Options::MouseShade : case Options::MouseShade :
toggleShade(); toggleShade();
cancelShadeHover(); cancelShadeHoverTimer();
break; break;
case Options::MouseSetShade: case Options::MouseSetShade:
setShade( ShadeNormal ); setShade( ShadeNormal );
cancelShadeHover(); cancelShadeHoverTimer();
break; break;
case Options::MouseUnsetShade: case Options::MouseUnsetShade:
setShade( ShadeNone ); setShade( ShadeNone );
cancelShadeHover(); cancelShadeHoverTimer();
break; break;
case Options::MouseOperationsMenu: case Options::MouseOperationsMenu:
if ( isActive() && options->clickRaise ) if ( isActive() && options->clickRaise )