Ensure that KDecoration::width() etc. and KDecoration::widget()->width are

in sync.

svn path=/trunk/kdebase/kwin/; revision=252350
This commit is contained in:
Luboš Luňák 2003-09-19 11:13:24 +00:00
parent a8b5c7365c
commit d5dd99ba82
3 changed files with 20 additions and 2 deletions

View file

@ -138,6 +138,9 @@ Client::Client( Workspace *ws )
cmap = None; cmap = None;
frame_geometry = QRect( 0, 0, 100, 100 ); // so that decorations don't start with size being (0,0)
client_size = QSize( 100, 100 );
// SELI initialize xsizehints?? // SELI initialize xsizehints??
} }
@ -255,6 +258,7 @@ void Client::updateDecoration( bool check_workspace_pos, bool force )
if( !force && (( decoration == NULL && noBorder()) if( !force && (( decoration == NULL && noBorder())
|| ( decoration != NULL && !noBorder()))) || ( decoration != NULL && !noBorder())))
return; return;
bool do_show = false;
++block_geometry; ++block_geometry;
if( force ) if( force )
destroyDecoration(); destroyDecoration();
@ -272,7 +276,7 @@ void Client::updateDecoration( bool check_workspace_pos, bool force )
setGeometry( QRect( calculateGravitation( false ), sizeForClientSize( clientSize()))); setGeometry( QRect( calculateGravitation( false ), sizeForClientSize( clientSize())));
workarea_diff_x = save_workarea_diff_x; workarea_diff_x = save_workarea_diff_x;
workarea_diff_y = save_workarea_diff_y; workarea_diff_y = save_workarea_diff_y;
decoration->widget()->show(); do_show = true;
} }
else else
destroyDecoration(); destroyDecoration();
@ -280,6 +284,8 @@ void Client::updateDecoration( bool check_workspace_pos, bool force )
checkWorkspacePosition(); checkWorkspacePosition();
--block_geometry; --block_geometry;
setGeometry( geometry(), true ); setGeometry( geometry(), true );
if( do_show )
decoration->widget()->show();
updateFrameStrut(); updateFrameStrut();
} }

View file

@ -1064,6 +1064,19 @@ bool Client::eventFilter( QObject* o, QEvent* e )
return motionNotifyEvent( decorationId(), qtToX11State( ev->state()), return motionNotifyEvent( decorationId(), qtToX11State( ev->state()),
ev->x(), ev->y(), ev->globalX(), ev->globalY() ); ev->x(), ev->y(), ev->globalX(), ev->globalY() );
} }
if( e->type() == QEvent::Resize )
{
QResizeEvent* ev = static_cast< QResizeEvent* >( e );
// Filter out resize events that inform about size different than frame size.
// This will ensure that decoration->width() etc. and decoration->widget()->width() will be in sync.
// These events only seem to be delayed events from initial resizing before show() was called
// on the decoration widget.
if( ev->size() != size())
{
kdDebug( 1212 ) << "Filtering out decoration resize event:" << size() << ":" << ev->size() << ":" << ev->oldSize() << endl;
return true;
}
}
return false; return false;
} }

View file

@ -281,7 +281,6 @@ bool Client::manage( Window w, bool isMapped )
if ( placementDone ) if ( placementDone )
move( geom.x(), geom.y() ); // before gravitating move( geom.x(), geom.y() ); // before gravitating
resize( 100, 100 ); // so that the decoration doesn't get the size as (0,0) CHECKME
updateDecoration( false ); // also gravitates updateDecoration( false ); // also gravitates
resize ( sizeForClientSize( geom.size() ) ); resize ( sizeForClientSize( geom.size() ) );