diff --git a/client.cpp b/client.cpp index 2da33380e0..194ee8d113 100644 --- a/client.cpp +++ b/client.cpp @@ -137,6 +137,9 @@ Client::Client( Workspace *ws ) max_mode = MaximizeRestore; 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?? } @@ -255,6 +258,7 @@ void Client::updateDecoration( bool check_workspace_pos, bool force ) if( !force && (( decoration == NULL && noBorder()) || ( decoration != NULL && !noBorder()))) return; + bool do_show = false; ++block_geometry; if( force ) destroyDecoration(); @@ -272,7 +276,7 @@ void Client::updateDecoration( bool check_workspace_pos, bool force ) setGeometry( QRect( calculateGravitation( false ), sizeForClientSize( clientSize()))); workarea_diff_x = save_workarea_diff_x; workarea_diff_y = save_workarea_diff_y; - decoration->widget()->show(); + do_show = true; } else destroyDecoration(); @@ -280,6 +284,8 @@ void Client::updateDecoration( bool check_workspace_pos, bool force ) checkWorkspacePosition(); --block_geometry; setGeometry( geometry(), true ); + if( do_show ) + decoration->widget()->show(); updateFrameStrut(); } diff --git a/events.cpp b/events.cpp index bc24d2275c..f3d27b4a97 100644 --- a/events.cpp +++ b/events.cpp @@ -1064,6 +1064,19 @@ bool Client::eventFilter( QObject* o, QEvent* e ) return motionNotifyEvent( decorationId(), qtToX11State( ev->state()), 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; } diff --git a/manage.cpp b/manage.cpp index 8083965fec..e240366d66 100644 --- a/manage.cpp +++ b/manage.cpp @@ -281,7 +281,6 @@ bool Client::manage( Window w, bool isMapped ) if ( placementDone ) 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 resize ( sizeForClientSize( geom.size() ) );