Keep workarea edge distance when turning on/off decoration.
Reduce the maximum distance for keeping it at the edge to 1/10 of workarea size. Update edge distance when changing geometry. svn path=/trunk/kdebase/kwin/; revision=252349
This commit is contained in:
parent
12ec2718cd
commit
a8b5c7365c
2 changed files with 16 additions and 4 deletions
|
@ -267,7 +267,11 @@ void Client::updateDecoration( bool check_workspace_pos, bool force )
|
||||||
XReparentWindow( qt_xdisplay(), decoration->widget()->winId(), frameId(), 0, 0 );
|
XReparentWindow( qt_xdisplay(), decoration->widget()->winId(), frameId(), 0, 0 );
|
||||||
decoration->widget()->lower();
|
decoration->widget()->lower();
|
||||||
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_y = workarea_diff_y;
|
||||||
setGeometry( QRect( calculateGravitation( false ), sizeForClientSize( clientSize())));
|
setGeometry( QRect( calculateGravitation( false ), sizeForClientSize( clientSize())));
|
||||||
|
workarea_diff_x = save_workarea_diff_x;
|
||||||
|
workarea_diff_y = save_workarea_diff_y;
|
||||||
decoration->widget()->show();
|
decoration->widget()->show();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -287,7 +291,11 @@ void Client::destroyDecoration()
|
||||||
border_left = border_right = border_top = border_bottom = 0;
|
border_left = border_right = border_top = border_bottom = 0;
|
||||||
decoration = NULL;
|
decoration = NULL;
|
||||||
setMask( QRegion()); // reset shape mask
|
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 );
|
setGeometry( QRect( calculateGravitation( true ), clientSize()), true );
|
||||||
|
workarea_diff_x = save_workarea_diff_x;
|
||||||
|
workarea_diff_y = save_workarea_diff_y;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
12
geometry.cpp
12
geometry.cpp
|
@ -432,11 +432,12 @@ int Client::computeWorkareaDiff( int left, int right, int a_left, int a_right )
|
||||||
return INT_MIN;
|
return INT_MIN;
|
||||||
else // fully inside workarea in this direction direction
|
else // fully inside workarea in this direction direction
|
||||||
{
|
{
|
||||||
int a_third = ( a_right - a_left ) / 3;
|
// max distance from edge where it's still considered to be close and is kept at that distance
|
||||||
|
int max_diff = ( a_right - a_left ) / 10;
|
||||||
if( left_diff < right_diff )
|
if( left_diff < right_diff )
|
||||||
return left_diff < a_third ? -left_diff - 1 : INT_MAX;
|
return left_diff < max_diff ? -left_diff - 1 : INT_MAX;
|
||||||
else if( left_diff > right_diff )
|
else if( left_diff > right_diff )
|
||||||
return right_diff < a_third ? right_diff + 1 : INT_MAX;
|
return right_diff < max_diff ? right_diff + 1 : INT_MAX;
|
||||||
return INT_MAX; // not close to workarea edge
|
return INT_MAX; // not close to workarea edge
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -520,7 +521,7 @@ void Client::checkWorkspacePosition()
|
||||||
}
|
}
|
||||||
if( final_geom != geometry() )
|
if( final_geom != geometry() )
|
||||||
setGeometry( final_geom );
|
setGeometry( final_geom );
|
||||||
updateWorkareaDiffs( area );
|
// updateWorkareaDiffs( area ); done already by setGeometry()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try to be smart about keeping the clients visible.
|
// Try to be smart about keeping the clients visible.
|
||||||
|
@ -807,6 +808,7 @@ void Client::setGeometry( int x, int y, int w, int h, bool force )
|
||||||
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
|
||||||
client_size = QSize( w - border_left - border_right, client_size.height());
|
client_size = QSize( w - border_left - border_right, client_size.height());
|
||||||
|
updateWorkareaDiffs();
|
||||||
if( block_geometry == 0 )
|
if( block_geometry == 0 )
|
||||||
{
|
{
|
||||||
XMoveResizeWindow( qt_xdisplay(), frameId(), x, y, w, h );
|
XMoveResizeWindow( qt_xdisplay(), frameId(), x, y, w, h );
|
||||||
|
@ -837,6 +839,7 @@ void Client::resize( int w, int h, bool force )
|
||||||
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
|
||||||
client_size = QSize( w - border_left - border_right, client_size.height());
|
client_size = QSize( w - border_left - border_right, client_size.height());
|
||||||
|
updateWorkareaDiffs();
|
||||||
if( block_geometry == 0 )
|
if( block_geometry == 0 )
|
||||||
{
|
{
|
||||||
// FRAME tady poradi tak, at neni flicker
|
// FRAME tady poradi tak, at neni flicker
|
||||||
|
@ -869,6 +872,7 @@ void Client::move( int x, int y, bool force )
|
||||||
if( !force && frame_geometry.topLeft() == QPoint( x, y ))
|
if( !force && frame_geometry.topLeft() == QPoint( x, y ))
|
||||||
return;
|
return;
|
||||||
frame_geometry.moveTopLeft( QPoint( x, y ));
|
frame_geometry.moveTopLeft( QPoint( x, y ));
|
||||||
|
updateWorkareaDiffs();
|
||||||
if( block_geometry == 0 )
|
if( block_geometry == 0 )
|
||||||
{
|
{
|
||||||
XMoveWindow( qt_xdisplay(), frameId(), x, y );
|
XMoveWindow( qt_xdisplay(), frameId(), x, y );
|
||||||
|
|
Loading…
Reference in a new issue