From 4cd961af5655dbcd7d21a59b9ef76e53bcfe74fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Mon, 29 Sep 2003 11:20:32 +0000 Subject: [PATCH] When the original request causing removal of a decoration comes from the decoration, use delayed delete. svn path=/trunk/kdebase/kwin/; revision=254813 --- client.cpp | 19 +++++++++++++------ client.h | 4 ++-- geometry.cpp | 2 +- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/client.cpp b/client.cpp index 6662d9c5b6..be8d3c044b 100644 --- a/client.cpp +++ b/client.cpp @@ -224,7 +224,7 @@ void Client::destroyClient() deleteClient( this, Allowed ); } -void Client::updateDecoration( bool check_workspace_pos, bool force ) +void Client::updateDecoration( bool check_workspace_pos, bool force, bool delay_delete ) { if( !force && (( decoration == NULL && noBorder()) || ( decoration != NULL && !noBorder()))) @@ -232,7 +232,7 @@ void Client::updateDecoration( bool check_workspace_pos, bool force ) bool do_show = false; ++block_geometry; if( force ) - destroyDecoration(); + destroyDecoration( delay_delete ); if( !noBorder()) { decoration = workspace()->createDecoration( bridge ); @@ -254,7 +254,7 @@ void Client::updateDecoration( bool check_workspace_pos, bool force ) do_show = true; } else - destroyDecoration(); + destroyDecoration( delay_delete ); if( check_workspace_pos ) checkWorkspacePosition(); --block_geometry; @@ -264,11 +264,18 @@ void Client::updateDecoration( bool check_workspace_pos, bool force ) updateFrameStrut(); } -void Client::destroyDecoration() +void Client::destroyDecoration( bool delay_delete ) { if( decoration != NULL ) { - delete decoration; + // When selecting the noborder operation from the popup menu after clicking on the menu + // button, the decoration should be deleted. But after closing the popup, the flow + // of control is still in the decoration, and the decorations usually do + // "button->setDown( false )". Therefore, delay the actual deleting. + if( delay_delete ) + decoration->deleteLater(); + else + delete decoration; border_left = border_right = border_top = border_bottom = 0; decoration = NULL; setMask( QRegion()); // reset shape mask @@ -452,7 +459,7 @@ void Client::setUserNoBorder( bool set ) if( user_noborder == set ) return; user_noborder = set; - updateDecoration( true ); + updateDecoration( true, false, true ); // delayed deletion of decoration } bool Client::grabInput() diff --git a/client.h b/client.h index d6fdd02bf3..632e78508f 100644 --- a/client.h +++ b/client.h @@ -181,7 +181,7 @@ class Client : public QObject, public KDecorationDefines void setMask( const QRegion& r, int mode = X::Unsorted ); - void updateDecoration( bool check_workspace_pos, bool force = false ); + void updateDecoration( bool check_workspace_pos, bool force = false, bool delay_delete = false ); void checkBorderSizes(); // shape extensions @@ -343,7 +343,7 @@ class Client : public QObject, public KDecorationDefines void embedClient( Window w ); void detectNoBorder(); - void destroyDecoration(); + void destroyDecoration( bool delay_delete = false ); void updateFrameStrut(); void rawShow(); // just shows it diff --git a/geometry.cpp b/geometry.cpp index d467a33c36..651ed0ac68 100644 --- a/geometry.cpp +++ b/geometry.cpp @@ -1098,7 +1098,7 @@ void Client::setFullScreen( bool set, bool user ) StackingUpdatesBlocker blocker( workspace()); workspace()->updateClientLayer( this ); // active fullscreens get different layer info->setState( isFullScreen() ? NET::FullScreen : 0, NET::FullScreen ); - updateDecoration( false ); + updateDecoration( false, false, true ); // delayed deletion of decoration if( isFullScreen()) setGeometry( workspace()->geometry()); // XINERAMA only on one screen