Don't resize frame to the full size when shaded.

svn path=/trunk/kdebase/kwin/; revision=253542
This commit is contained in:
Luboš Luňák 2003-09-24 11:01:14 +00:00
parent f91b62ba2f
commit 2fdf81d4c6
3 changed files with 57 additions and 32 deletions

View file

@ -86,6 +86,7 @@ Client::Client( Workspace *ws )
input_grabbed( false ),
allowed_actions( 0 ),
block_geometry( 0 ),
shade_geometry_change( false ),
border_left( 0 ),
border_right( 0 ),
border_top( 0 ),
@ -243,7 +244,11 @@ void Client::updateDecoration( bool check_workspace_pos, bool force )
decoration->borders( border_left, border_right, border_top, border_bottom );
int save_workarea_diff_x = workarea_diff_x;
int save_workarea_diff_y = workarea_diff_y;
setGeometry( QRect( calculateGravitation( false ), sizeForClientSize( clientSize())));
move( calculateGravitation( false ));
if( !isShade())
resize( sizeForClientSize( clientSize()), true );
else
resize( sizeForClientSize( QSize( clientSize().width(), 0 ), true ), true );
workarea_diff_x = save_workarea_diff_x;
workarea_diff_y = save_workarea_diff_y;
do_show = true;
@ -269,7 +274,11 @@ void Client::destroyDecoration()
setMask( QRegion()); // reset shape mask
int save_workarea_diff_x = workarea_diff_x;
int save_workarea_diff_y = workarea_diff_y;
setGeometry( QRect( calculateGravitation( true ), clientSize()), true );
move( calculateGravitation( true ));
if( !isShade())
resize( clientSize(), true );
else
resize( QSize( clientSize().width(), 0 ), true );
workarea_diff_x = save_workarea_diff_x;
workarea_diff_y = save_workarea_diff_y;
}
@ -764,6 +773,7 @@ void Client::setShade( ShadeMode mode )
if ( isShade())
{ // shade_mode == ShadeNormal
int h = height();
shade_geometry_change = true;
QSize s( sizeForClientSize( QSize( clientSize().width(), 0), TRUE ) );
XSelectInput( qt_xdisplay(), wrapper, ClientWinMask ); // avoid getting UnmapNotify
XUnmapWindow( qt_xdisplay(), client );
@ -782,6 +792,7 @@ void Client::setShade( ShadeMode mode )
} while ( h > s.height() + step );
// if ( !wasStaticContents )
// clearWFlags( WStaticContents );
shade_geometry_change = false;
resize( s );
if( isActive())
workspace()->focusToNull();
@ -789,6 +800,7 @@ void Client::setShade( ShadeMode mode )
else
{
int h = height();
shade_geometry_change = true;
QSize s( sizeForClientSize( clientSize(), TRUE ) );
// FRAME bool wasStaticContents = testWFlags( WStaticContents );
// setWFlags( WStaticContents );
@ -805,6 +817,7 @@ void Client::setShade( ShadeMode mode )
} while ( h < s.height() - step );
// if ( !wasStaticContents )
// clearWFlags( WStaticContents );
shade_geometry_change = false;
resize( s );
if( shade_mode == ShadeHover || shade_mode == ShadeActivated )
setActive( TRUE );

View file

@ -454,6 +454,7 @@ class Client : public QObject, public KDecorationDefines
QRect frame_geometry;
QSize client_size;
int block_geometry; // >0 - new geometry is remembered, but not actually set
bool shade_geometry_change;
int border_left, border_right, border_top, border_bottom;
friend struct FetchNameInternalPredicate;
void show() { assert( false ); } // SELI remove after Client is no longer QWidget

View file

@ -491,6 +491,8 @@ void Client::checkWorkspacePosition()
return;
}
if( !isShade()) // TODO
{
QRect area = workspace()->clientArea( geometry().center(), desktop());
int old_diff_x = workarea_diff_x;
int old_diff_y = workarea_diff_y;
@ -523,7 +525,8 @@ void Client::checkWorkspacePosition()
}
if( final_geom != geometry() )
setGeometry( final_geom );
// updateWorkareaDiffs( area ); done already by setGeometry()
// updateWorkareaDiffs( area ); done already by setGeometry()
}
}
// Try to be smart about keeping the clients visible.
@ -809,7 +812,15 @@ void Client::setGeometry( int x, int y, int w, int h, bool force )
if( !isShade())
client_size = QSize( w - border_left - border_right, h - border_top - border_bottom );
else
{
// check that the frame is not resized to full size when it should be shaded
if( !shade_geometry_change && h != border_top + border_bottom )
{
kdDebug() << "h:" << h << ":t:" << border_top << ":b:" << border_bottom << endl;
assert( false );
}
client_size = QSize( w - border_left - border_right, client_size.height());
}
updateWorkareaDiffs();
if( block_geometry == 0 )
{