Don't resize frame to the full size when shaded.
svn path=/trunk/kdebase/kwin/; revision=253542
This commit is contained in:
parent
f91b62ba2f
commit
2fdf81d4c6
3 changed files with 57 additions and 32 deletions
17
client.cpp
17
client.cpp
|
@ -86,6 +86,7 @@ Client::Client( Workspace *ws )
|
||||||
input_grabbed( false ),
|
input_grabbed( false ),
|
||||||
allowed_actions( 0 ),
|
allowed_actions( 0 ),
|
||||||
block_geometry( 0 ),
|
block_geometry( 0 ),
|
||||||
|
shade_geometry_change( false ),
|
||||||
border_left( 0 ),
|
border_left( 0 ),
|
||||||
border_right( 0 ),
|
border_right( 0 ),
|
||||||
border_top( 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 );
|
decoration->borders( border_left, border_right, border_top, border_bottom );
|
||||||
int save_workarea_diff_x = workarea_diff_x;
|
int save_workarea_diff_x = workarea_diff_x;
|
||||||
int save_workarea_diff_y = workarea_diff_y;
|
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_x = save_workarea_diff_x;
|
||||||
workarea_diff_y = save_workarea_diff_y;
|
workarea_diff_y = save_workarea_diff_y;
|
||||||
do_show = true;
|
do_show = true;
|
||||||
|
@ -269,7 +274,11 @@ void Client::destroyDecoration()
|
||||||
setMask( QRegion()); // reset shape mask
|
setMask( QRegion()); // reset shape mask
|
||||||
int save_workarea_diff_x = workarea_diff_x;
|
int save_workarea_diff_x = workarea_diff_x;
|
||||||
int save_workarea_diff_y = workarea_diff_y;
|
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_x = save_workarea_diff_x;
|
||||||
workarea_diff_y = save_workarea_diff_y;
|
workarea_diff_y = save_workarea_diff_y;
|
||||||
}
|
}
|
||||||
|
@ -764,6 +773,7 @@ void Client::setShade( ShadeMode mode )
|
||||||
if ( isShade())
|
if ( isShade())
|
||||||
{ // shade_mode == ShadeNormal
|
{ // shade_mode == ShadeNormal
|
||||||
int h = height();
|
int h = height();
|
||||||
|
shade_geometry_change = true;
|
||||||
QSize s( sizeForClientSize( QSize( clientSize().width(), 0), TRUE ) );
|
QSize s( sizeForClientSize( QSize( clientSize().width(), 0), TRUE ) );
|
||||||
XSelectInput( qt_xdisplay(), wrapper, ClientWinMask ); // avoid getting UnmapNotify
|
XSelectInput( qt_xdisplay(), wrapper, ClientWinMask ); // avoid getting UnmapNotify
|
||||||
XUnmapWindow( qt_xdisplay(), client );
|
XUnmapWindow( qt_xdisplay(), client );
|
||||||
|
@ -782,6 +792,7 @@ void Client::setShade( ShadeMode mode )
|
||||||
} while ( h > s.height() + step );
|
} while ( h > s.height() + step );
|
||||||
// if ( !wasStaticContents )
|
// if ( !wasStaticContents )
|
||||||
// clearWFlags( WStaticContents );
|
// clearWFlags( WStaticContents );
|
||||||
|
shade_geometry_change = false;
|
||||||
resize( s );
|
resize( s );
|
||||||
if( isActive())
|
if( isActive())
|
||||||
workspace()->focusToNull();
|
workspace()->focusToNull();
|
||||||
|
@ -789,6 +800,7 @@ void Client::setShade( ShadeMode mode )
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int h = height();
|
int h = height();
|
||||||
|
shade_geometry_change = true;
|
||||||
QSize s( sizeForClientSize( clientSize(), TRUE ) );
|
QSize s( sizeForClientSize( clientSize(), TRUE ) );
|
||||||
// FRAME bool wasStaticContents = testWFlags( WStaticContents );
|
// FRAME bool wasStaticContents = testWFlags( WStaticContents );
|
||||||
// setWFlags( WStaticContents );
|
// setWFlags( WStaticContents );
|
||||||
|
@ -805,6 +817,7 @@ void Client::setShade( ShadeMode mode )
|
||||||
} while ( h < s.height() - step );
|
} while ( h < s.height() - step );
|
||||||
// if ( !wasStaticContents )
|
// if ( !wasStaticContents )
|
||||||
// clearWFlags( WStaticContents );
|
// clearWFlags( WStaticContents );
|
||||||
|
shade_geometry_change = false;
|
||||||
resize( s );
|
resize( s );
|
||||||
if( shade_mode == ShadeHover || shade_mode == ShadeActivated )
|
if( shade_mode == ShadeHover || shade_mode == ShadeActivated )
|
||||||
setActive( TRUE );
|
setActive( TRUE );
|
||||||
|
|
1
client.h
1
client.h
|
@ -454,6 +454,7 @@ class Client : public QObject, public KDecorationDefines
|
||||||
QRect frame_geometry;
|
QRect frame_geometry;
|
||||||
QSize client_size;
|
QSize client_size;
|
||||||
int block_geometry; // >0 - new geometry is remembered, but not actually set
|
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;
|
int border_left, border_right, border_top, border_bottom;
|
||||||
friend struct FetchNameInternalPredicate;
|
friend struct FetchNameInternalPredicate;
|
||||||
void show() { assert( false ); } // SELI remove after Client is no longer QWidget
|
void show() { assert( false ); } // SELI remove after Client is no longer QWidget
|
||||||
|
|
71
geometry.cpp
71
geometry.cpp
|
@ -491,39 +491,42 @@ void Client::checkWorkspacePosition()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QRect area = workspace()->clientArea( geometry().center(), desktop());
|
if( !isShade()) // TODO
|
||||||
int old_diff_x = workarea_diff_x;
|
{
|
||||||
int old_diff_y = workarea_diff_y;
|
QRect area = workspace()->clientArea( geometry().center(), desktop());
|
||||||
updateWorkareaDiffs( area );
|
int old_diff_x = workarea_diff_x;
|
||||||
|
int old_diff_y = workarea_diff_y;
|
||||||
|
updateWorkareaDiffs( area );
|
||||||
|
|
||||||
// this can be true only if this window was mapped before KWin
|
// this can be true only if this window was mapped before KWin
|
||||||
// was started - in such case, don't adjust position to workarea,
|
// was started - in such case, don't adjust position to workarea,
|
||||||
// because the window already had its position, and if a window
|
// because the window already had its position, and if a window
|
||||||
// with a strut altering the workarea would be managed in initialization
|
// with a strut altering the workarea would be managed in initialization
|
||||||
// after this one, this window would be moved
|
// after this one, this window would be moved
|
||||||
if( workspace()->initializing())
|
if( workspace()->initializing())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QRect new_geom = geometry();
|
QRect new_geom = geometry();
|
||||||
QRect tmp_rect_x( new_geom.left(), 0, new_geom.width(), 0 );
|
QRect tmp_rect_x( new_geom.left(), 0, new_geom.width(), 0 );
|
||||||
QRect tmp_area_x( area.left(), 0, area.width(), 0 );
|
QRect tmp_area_x( area.left(), 0, area.width(), 0 );
|
||||||
checkDirection( workarea_diff_x, old_diff_x, tmp_rect_x, tmp_area_x );
|
checkDirection( workarea_diff_x, old_diff_x, tmp_rect_x, tmp_area_x );
|
||||||
// the x<->y swapping
|
// the x<->y swapping
|
||||||
QRect tmp_rect_y( new_geom.top(), 0, new_geom.height(), 0 );
|
QRect tmp_rect_y( new_geom.top(), 0, new_geom.height(), 0 );
|
||||||
QRect tmp_area_y( area.top(), 0, area.height(), 0 );
|
QRect tmp_area_y( area.top(), 0, area.height(), 0 );
|
||||||
checkDirection( workarea_diff_y, old_diff_y, tmp_rect_y, tmp_area_y );
|
checkDirection( workarea_diff_y, old_diff_y, tmp_rect_y, tmp_area_y );
|
||||||
new_geom = QRect( tmp_rect_x.left(), tmp_rect_y.left(), tmp_rect_x.width(), tmp_rect_y.width());
|
new_geom = QRect( tmp_rect_x.left(), tmp_rect_y.left(), tmp_rect_x.width(), tmp_rect_y.width());
|
||||||
QRect final_geom( new_geom.topLeft(), adjustedSize( new_geom.size()));
|
QRect final_geom( new_geom.topLeft(), adjustedSize( new_geom.size()));
|
||||||
if( final_geom != new_geom ) // size increments, or size restrictions
|
if( final_geom != new_geom ) // size increments, or size restrictions
|
||||||
{ // adjusted size differing matters only for right and bottom edge
|
{ // adjusted size differing matters only for right and bottom edge
|
||||||
if( old_diff_x != INT_MAX && old_diff_x > 0 )
|
if( old_diff_x != INT_MAX && old_diff_x > 0 )
|
||||||
final_geom.moveRight( area.right() - ( old_diff_x - 1 ));
|
final_geom.moveRight( area.right() - ( old_diff_x - 1 ));
|
||||||
if( old_diff_y != INT_MAX && old_diff_y > 0 )
|
if( old_diff_y != INT_MAX && old_diff_y > 0 )
|
||||||
final_geom.moveBottom( area.bottom() - ( old_diff_y - 1 ));
|
final_geom.moveBottom( area.bottom() - ( old_diff_y - 1 ));
|
||||||
|
}
|
||||||
|
if( final_geom != geometry() )
|
||||||
|
setGeometry( final_geom );
|
||||||
|
// updateWorkareaDiffs( area ); done already by setGeometry()
|
||||||
}
|
}
|
||||||
if( final_geom != geometry() )
|
|
||||||
setGeometry( final_geom );
|
|
||||||
// updateWorkareaDiffs( area ); done already by setGeometry()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try to be smart about keeping the clients visible.
|
// 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())
|
if( !isShade())
|
||||||
client_size = QSize( w - border_left - border_right, h - border_top - border_bottom );
|
client_size = QSize( w - border_left - border_right, h - border_top - border_bottom );
|
||||||
else
|
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());
|
client_size = QSize( w - border_left - border_right, client_size.height());
|
||||||
|
}
|
||||||
updateWorkareaDiffs();
|
updateWorkareaDiffs();
|
||||||
if( block_geometry == 0 )
|
if( block_geometry == 0 )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue