Make border sizes while maximizing take effect even when the actual

geometry does not change.
BUG: 158252


svn path=/trunk/KDE/kdebase/workspace/; revision=787741
This commit is contained in:
Luboš Luňák 2008-03-19 19:32:32 +00:00
parent 7a2fbfa2e0
commit 38291eb82c
4 changed files with 35 additions and 14 deletions

View file

@ -381,15 +381,23 @@ void Client::destroyDecoration()
} }
} }
void Client::checkBorderSizes() bool Client::checkBorderSizes( bool also_resize )
{ {
if( decoration == NULL ) if( decoration == NULL )
return; return false;
int new_left, new_right, new_top, new_bottom; int new_left, new_right, new_top, new_bottom;
decoration->borders( new_left, new_right, new_top, new_bottom ); decoration->borders( new_left, new_right, new_top, new_bottom );
if( new_left == border_left && new_right == border_right if( new_left == border_left && new_right == border_right
&& new_top == border_top && new_bottom == border_bottom ) && new_top == border_top && new_bottom == border_bottom )
return; return false;
if( !also_resize )
{
border_left = new_left;
border_right = new_right;
border_top = new_top;
border_bottom = new_bottom;
return true;
}
GeometryUpdatesBlocker blocker( this ); GeometryUpdatesBlocker blocker( this );
move( calculateGravitation( true )); move( calculateGravitation( true ));
border_left = new_left; border_left = new_left;
@ -399,6 +407,7 @@ void Client::checkBorderSizes()
move( calculateGravitation( false )); move( calculateGravitation( false ));
plainResize( sizeForClientSize( clientSize()), ForceGeometrySet ); plainResize( sizeForClientSize( clientSize()), ForceGeometrySet );
checkWorkspacePosition(); checkWorkspacePosition();
return true;
} }
void Client::detectNoBorder() void Client::detectNoBorder()

View file

@ -195,7 +195,7 @@ class Client
QRegion mask() const; QRegion mask() const;
void updateDecoration( bool check_workspace_pos, bool force = false ); void updateDecoration( bool check_workspace_pos, bool force = false );
void checkBorderSizes(); bool checkBorderSizes( bool also_resize );
void updateShape(); void updateShape();

View file

@ -1942,8 +1942,12 @@ void Client::changeMaximize( bool vertical, bool horizontal, bool adjust )
Notify::raise( Notify::UnMaximize ); Notify::raise( Notify::UnMaximize );
} }
ForceGeometry_t geom_mode = NormalGeometrySet;
if( decoration != NULL ) // decorations may turn off some borders when maximized if( decoration != NULL ) // decorations may turn off some borders when maximized
decoration->borders( border_left, border_right, border_top, border_bottom ); {
if( checkBorderSizes( false )) // only query, don't resize
geom_mode = ForceGeometrySet;
}
// restore partial maximizations // restore partial maximizations
if ( old_mode==MaximizeFull && max_mode==MaximizeRestore ) if ( old_mode==MaximizeFull && max_mode==MaximizeRestore )
@ -1969,16 +1973,20 @@ void Client::changeMaximize( bool vertical, bool horizontal, bool adjust )
{ {
if( geom_restore.width() == 0 ) if( geom_restore.width() == 0 )
{ // needs placement { // needs placement
plainResize( adjustedSize( QSize( width() * 2 / 3, clientArea.height()), SizemodeFixedH )); plainResize( adjustedSize( QSize( width() * 2 / 3, clientArea.height()), SizemodeFixedH ), geom_mode );
workspace()->placeSmart( this, clientArea ); workspace()->placeSmart( this, clientArea );
} }
else else
{
setGeometry( QRect(QPoint( geom_restore.x(), clientArea.top()), setGeometry( QRect(QPoint( geom_restore.x(), clientArea.top()),
adjustedSize(QSize( geom_restore.width(), clientArea.height()), SizemodeFixedH ))); adjustedSize(QSize( geom_restore.width(), clientArea.height()), SizemodeFixedH )), geom_mode );
}
} }
else else
{
setGeometry( QRect(QPoint(x(), clientArea.top()), setGeometry( QRect(QPoint(x(), clientArea.top()),
adjustedSize(QSize(width(), clientArea.height()), SizemodeFixedH ))); adjustedSize(QSize(width(), clientArea.height()), SizemodeFixedH )), geom_mode );
}
info->setState( NET::MaxVert, NET::Max ); info->setState( NET::MaxVert, NET::Max );
break; break;
} }
@ -1989,16 +1997,20 @@ void Client::changeMaximize( bool vertical, bool horizontal, bool adjust )
{ {
if( geom_restore.height() == 0 ) if( geom_restore.height() == 0 )
{ // needs placement { // needs placement
plainResize( adjustedSize( QSize( clientArea.width(), height() * 2 / 3 ), SizemodeFixedW )); plainResize( adjustedSize( QSize( clientArea.width(), height() * 2 / 3 ), SizemodeFixedW ), geom_mode );
workspace()->placeSmart( this, clientArea ); workspace()->placeSmart( this, clientArea );
} }
else else
{
setGeometry( QRect( QPoint(clientArea.left(), geom_restore.y()), setGeometry( QRect( QPoint(clientArea.left(), geom_restore.y()),
adjustedSize(QSize(clientArea.width(), geom_restore.height()), SizemodeFixedW ))); adjustedSize(QSize(clientArea.width(), geom_restore.height()), SizemodeFixedW )), geom_mode );
}
} }
else else
{
setGeometry( QRect( QPoint(clientArea.left(), y()), setGeometry( QRect( QPoint(clientArea.left(), y()),
adjustedSize(QSize(clientArea.width(), height()), SizemodeFixedW ))); adjustedSize(QSize(clientArea.width(), height()), SizemodeFixedW )), geom_mode );
}
info->setState( NET::MaxHoriz, NET::Max ); info->setState( NET::MaxHoriz, NET::Max );
break; break;
} }
@ -2032,7 +2044,7 @@ void Client::changeMaximize( bool vertical, bool horizontal, bool adjust )
if( geom_restore.height() > 0 ) if( geom_restore.height() > 0 )
restore.moveTop( geom_restore.y()); restore.moveTop( geom_restore.y());
} }
setGeometry( restore ); setGeometry( restore, geom_mode );
info->setState( 0, NET::Max ); info->setState( 0, NET::Max );
break; break;
} }
@ -2048,7 +2060,7 @@ void Client::changeMaximize( bool vertical, bool horizontal, bool adjust )
} }
QSize adjSize = adjustedSize(clientArea.size(), SizemodeMax ); QSize adjSize = adjustedSize(clientArea.size(), SizemodeMax );
QRect r = QRect(clientArea.topLeft(), adjSize); QRect r = QRect(clientArea.topLeft(), adjSize);
setGeometry( r ); setGeometry( r, geom_mode );
info->setState( NET::Max, NET::Max ); info->setState( NET::Max, NET::Max );
break; break;
} }

View file

@ -973,7 +973,7 @@ void Workspace::slotSettingsChanged(int category)
/*! /*!
Reread settings Reread settings
*/ */
KWIN_PROCEDURE( CheckBorderSizesProcedure, Client, cl->checkBorderSizes() ); KWIN_PROCEDURE( CheckBorderSizesProcedure, Client, cl->checkBorderSizes( true ) );
void Workspace::slotReconfigure() void Workspace::slotReconfigure()
{ {