diff --git a/client.cpp b/client.cpp index e02c23f22c..6692fd2df6 100644 --- a/client.cpp +++ b/client.cpp @@ -594,9 +594,8 @@ bool Client::manage( bool isMapped, bool doNotShow, bool isInitial ) info->setDesktop( desk ); - if (isInitial) - { - setMappingState( init_state ); + if (isInitial) { + setMappingState( init_state ); } bool showMe = (state == NormalState) && isOnDesktop( workspace()->currentDesktop() ); @@ -1861,7 +1860,7 @@ void Client::setShade( bool s ) { if ( shaded == s ) return; - + if ( isVisible() ) Events::raise( s ? Events::ShadeDown : Events::ShadeUp ); @@ -2032,10 +2031,10 @@ void Client::getWindowProtocols(){ Puts the focus on this window. Clients should never calls this themselves, instead they should use Workspace::requestFocus(). */ -void Client::takeFocus() +void Client::takeFocus( bool force ) { - if ( isMenu() ) - return; // menus don't take focus + if ( !force && ( isMenu() || isDock() ) ) + return; // menus and dock windows don't take focus if not forced if ( input ) XSetInputFocus( qt_xdisplay(), win, RevertToPointerRoot, kwin_time ); diff --git a/client.h b/client.h index 25e918ae06..7c7bc0ba68 100644 --- a/client.h +++ b/client.h @@ -133,7 +133,7 @@ public: bool isResizable() const; - void takeFocus(); + void takeFocus( bool force = FALSE ); void setMask( const QRegion & ); const QRegion& getMask() const; @@ -227,7 +227,7 @@ protected: bool configureRequest( XConfigureRequestEvent& e ); bool propertyNotify( XPropertyEvent& e ); bool clientMessage( XClientMessageEvent& e ); - + private: QSize sizeForWindowSize( const QSize&, bool ignore_height = FALSE ) const; void getWmNormalHints(); diff --git a/workspace.cpp b/workspace.cpp index c9a3113465..7898436092 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -974,7 +974,7 @@ void Workspace::setActiveClient( Client* c ) \sa setActiveClient(), requestFocus() */ -void Workspace::activateClient( Client* c) +void Workspace::activateClient( Client* c, bool force ) { if (!c->isOnDesktop(currentDesktop()) ) { setCurrentDesktop( c->desktop() ); @@ -985,7 +985,7 @@ void Workspace::activateClient( Client* c) c->show(); iconifyOrDeiconifyTransientsOf( c ); if ( options->focusPolicyIsReasonable() ) { - requestFocus( c ); + requestFocus( c, force ); } } @@ -1044,7 +1044,7 @@ bool Workspace::hasCaption( const QString& caption ) \sa Workspace::activateClient() */ -void Workspace::requestFocus( Client* c) +void Workspace::requestFocus( Client* c, bool force ) { if (!focusChangeEnabled()) return; @@ -1059,7 +1059,7 @@ void Workspace::requestFocus( Client* c) popup_client = c; if ( c->isVisible() && !c->isShade() ) { - c->takeFocus(); + c->takeFocus( force ); should_get_focus = c; focus_chain.remove( c ); if ( c->wantsTabFocus() ) diff --git a/workspace.h b/workspace.h index de71e7d546..1db569b1b3 100644 --- a/workspace.h +++ b/workspace.h @@ -109,9 +109,9 @@ public: Client* activeClient() const; void setActiveClient( Client* ); - void activateClient( Client* ); - void requestFocus( Client* c); - + void activateClient( Client*, bool force = FALSE ); + void requestFocus( Client* c, bool force = FALSE ); + void updateColormap(); void setFocusChangeEnabled(bool b) { focus_change = b; } @@ -329,7 +329,7 @@ private: // swallowing QStringList doNotManageList; - + // colormap handling Colormap default_colormap; Colormap installed_colormap;