Fix #33146 - don't create KNotify events e.g. for toplevel menubar.

Introduced Client::isDialog() and Client::isNormalWindow() checking
for NET::Dialog and NET::Normal, including NET::Unknown and workaround
for Qt<3.1 not setting NET::Dialog.

svn path=/trunk/kdebase/kwin/; revision=181308
This commit is contained in:
Luboš Luňák 2002-09-30 13:32:58 +00:00
parent a70edeb06c
commit 1a598b9bc0
2 changed files with 37 additions and 5 deletions

View file

@ -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());
}
/*!

View file

@ -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