diff --git a/client.cpp b/client.cpp index 8f4c90872e..769d09d253 100644 --- a/client.cpp +++ b/client.cpp @@ -869,7 +869,10 @@ bool Client::manage( bool isMapped, bool doNotShow, bool isInitial ) workspace()->clientReady( this ); // will call Workspace::propagateClients() if ( showMe && !doNotShow ) { - Events::raise( isTransient() ? Events::TransNew : Events::New ); + if( isDialog()) + Events::raise( Events::TransNew ); + if( isNormalWindow()) + Events::raise( Events::New ); if ( isMapped ) { show(); } else { @@ -1134,7 +1137,10 @@ bool Client::unmapNotify( XUnmapEvent& e ) XEvent ev; if ( XCheckTypedWindowEvent (qt_xdisplay(), windowWrapper()->winId(), DestroyNotify, &ev) ){ - Events::raise( isTransient() ? Events::TransDelete : Events::Delete ); + if( isDialog()) + Events::raise( Events::TransDelete ); + if( isNormalWindow()) + Events::raise( Events::Delete ); workspace()->destroyClient( this ); return TRUE; } @@ -1157,7 +1163,10 @@ bool Client::unmapNotify( XUnmapEvent& e ) */ void Client::withdraw() { - Events::raise( isTransient() ? Events::TransDelete : Events::Delete ); + if( isDialog()) + Events::raise( Events::TransDelete ); + if( isNormalWindow()) + Events::raise( Events::Delete ); // remove early from client list workspace()->removeClient( this ); info->setDesktop( 0 ); @@ -1953,7 +1962,10 @@ void Client::closeWindow() else { // client will not react on wm_delete_window. We have not choice // but destroy his connection to the XServer. - Events::raise( isTransient() ? Events::TransDelete : Events::Delete ); + if( isDialog()) + Events::raise( Events::TransDelete ); + if( isNormalWindow()) + Events::raise( Events::Delete ); XKillClient(qt_xdisplay(), win ); workspace()->destroyClient( this ); } @@ -3050,6 +3062,20 @@ bool Client::isTool() const return isToolbar(); } +bool Client::isDialog() const +{ + return windowType() == NET::Dialog + || ( windowType() == NET::Unknown && isTransient()) + // NET::Normal workaround for Qt<3.1 not setting NET::Dialog + || ( windowType() == NET::Normal && isTransient()); +} + +bool Client::isNormalWindow() const +{ + // NET::Normal workaround for Qt<3.1 not setting NET::Dialog + return ( windowType() == NET::Normal && !isTransient()) + || ( windowType() == NET::Unknown && !isTransient()); +} /*! diff --git a/client.h b/client.h index c9d350ed80..527b03248b 100644 --- a/client.h +++ b/client.h @@ -112,9 +112,13 @@ public: return state == IconicState; } // is the window in normal state? - bool isNormal(){ + bool isNormalState(){ return state == NormalState; } + // obsolete, don't use - KDE4 - remove it + bool isNormal(){ + return isNormalState(); + } bool isActive() const; void setActive( bool ); @@ -157,6 +161,8 @@ public: bool isTool() const; // KDE4 remove me bool isToolbar() const; bool isTopMenu() const; + bool isNormalWindow() const; // normal as in 'NET::Normal or NET::Unknown non-transient' + bool isDialog() const; bool isResizable() const; bool isCloseable() const; // may have a close button