diff --git a/client.cpp b/client.cpp index b31cd5623b..5b2974a51f 100644 --- a/client.cpp +++ b/client.cpp @@ -1960,7 +1960,7 @@ bool Client::x11Event( XEvent * e) && workspace()->topClientOnDesktop() != this ) { delete autoRaiseTimer; autoRaiseTimer = new QTimer( this ); - connect( autoRaiseTimer, SIGNAL( timeout() ), this, SLOT( autoRaise() ) ); + connect( autoRaiseTimer, SIGNAL( timeout() ), this, SLOT( autoRaiseTimerDone() ) ); autoRaiseTimer->start( options->autoRaiseInterval, TRUE ); } @@ -2810,6 +2810,23 @@ void Client::autoRaise() autoRaiseTimer = 0; } +void Client::autoRaiseTimerDone() +{ + // ensure there's no popup menu open + if ( XGrabPointer( qt_xdisplay(), workspace()->rootWin(), TRUE, + (uint)(ButtonPressMask | ButtonReleaseMask | + ButtonMotionMask | EnterWindowMask | + LeaveWindowMask | PointerMotionMask), + GrabModeAsync, GrabModeAsync, + None, None, kwin_time ) == GrabSuccess ) { + XUngrabPointer( qt_xdisplay(), kwin_time); + autoRaise(); + } else { + // if there is, try again + autoRaiseTimer->start( options->autoRaiseInterval, TRUE ); + } +} + /*! Clones settings from other client. Used in Workspace::slotResetAllClients() diff --git a/client.h b/client.h index 75b8248fb1..2901852ee1 100644 --- a/client.h +++ b/client.h @@ -48,7 +48,7 @@ protected: private slots: void deferredResize(); - + private: WId win; Time lastMouseEventTime; @@ -194,6 +194,7 @@ public slots: void toggleSticky(); void contextHelp(); void autoRaise(); + void autoRaiseTimerDone(); protected: void paintEvent( QPaintEvent * );