From d5a630cabd125930d6c016b7160ad505ff8ecbaf Mon Sep 17 00:00:00 2001 From: Lucas Murray Date: Mon, 15 Dec 2008 08:27:17 +0000 Subject: [PATCH] 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 --- client.cpp | 10 ++++++++-- client.h | 3 ++- events.cpp | 24 ++++++++++++++++-------- useractions.cpp | 6 +++--- 4 files changed, 29 insertions(+), 14 deletions(-) diff --git a/client.cpp b/client.cpp index 020effe0c5..8f47973da5 100644 --- a/client.cpp +++ b/client.cpp @@ -808,10 +808,16 @@ void Client::setShade( ShadeMode mode ) void Client::shadeHover() { setShade( ShadeHover ); - cancelShadeHover(); + cancelShadeHoverTimer(); } -void Client::cancelShadeHover() +void Client::shadeUnhover() + { + setShade( ShadeNormal ); + cancelShadeHoverTimer(); + } + +void Client::cancelShadeHoverTimer() { delete shadeHoverTimer; shadeHoverTimer = 0; diff --git a/client.h b/client.h index fade99c2c1..f825c5129e 100644 --- a/client.h +++ b/client.h @@ -271,7 +271,7 @@ class Client void maximize( MaximizeMode ); void toggleShade(); void showContextHelp(); - void cancelShadeHover(); + void cancelShadeHoverTimer(); void cancelAutoRaise(); void checkActiveModal(); bool hasStrut() const; @@ -294,6 +294,7 @@ class Client private slots: void autoRaise(); void shadeHover(); + void shadeUnhover(); void shortcutActivated(); void delayedMoveResize(); diff --git a/events.cpp b/events.cpp index 57f27d61a3..a6cc98fac3 100644 --- a/events.cpp +++ b/events.cpp @@ -940,13 +940,16 @@ void Client::enterNotifyEvent( XCrossingEvent* e ) e->mode == NotifyUngrab ) ) { - if (options->shadeHover && isShade()) + if ( options->shadeHover ) { - delete shadeHoverTimer; - shadeHoverTimer = new QTimer( this ); - connect( shadeHoverTimer, SIGNAL( timeout() ), this, SLOT( shadeHover() )); - shadeHoverTimer->setSingleShot( true ); - shadeHoverTimer->start( options->shadeHoverInterval ); + cancelShadeHoverTimer(); + if (isShade()) + { + shadeHoverTimer = new QTimer( this ); + connect( shadeHoverTimer, SIGNAL( timeout() ), this, SLOT( shadeHover() )); + shadeHoverTimer->setSingleShot( true ); + shadeHoverTimer->start( options->shadeHoverInterval ); + } } if ( options->focusPolicy == Options::ClickToFocus ) @@ -1013,9 +1016,14 @@ void Client::leaveNotifyEvent( XCrossingEvent* e ) { cancelAutoRaise(); workspace()->cancelDelayFocus(); - cancelShadeHover(); + cancelShadeHoverTimer(); 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 ( isActive() && lostMouse ) diff --git a/useractions.cpp b/useractions.cpp index 8a26b88d71..a1d765cc4d 100644 --- a/useractions.cpp +++ b/useractions.cpp @@ -574,15 +574,15 @@ bool Client::performMouseCommand( Options::MouseCommand command, const QPoint &g break; case Options::MouseShade : toggleShade(); - cancelShadeHover(); + cancelShadeHoverTimer(); break; case Options::MouseSetShade: setShade( ShadeNormal ); - cancelShadeHover(); + cancelShadeHoverTimer(); break; case Options::MouseUnsetShade: setShade( ShadeNone ); - cancelShadeHover(); + cancelShadeHoverTimer(); break; case Options::MouseOperationsMenu: if ( isActive() && options->clickRaise )