If a window is resized manually to geometry equal to workspace size,
make it automatically also maximized. svn path=/trunk/kdebase/kwin/; revision=362476
This commit is contained in:
parent
db62c7a9b9
commit
ca061ffb57
3 changed files with 53 additions and 11 deletions
|
@ -781,6 +781,7 @@ void Client::setShade( ShadeMode mode )
|
||||||
if ( isActive() )
|
if ( isActive() )
|
||||||
workspace()->requestFocus( this );
|
workspace()->requestFocus( this );
|
||||||
}
|
}
|
||||||
|
checkMaximizeGeometry();
|
||||||
--block_geometry;
|
--block_geometry;
|
||||||
setGeometry( geometry(), ForceGeometrySet );
|
setGeometry( geometry(), ForceGeometrySet );
|
||||||
info->setState( isShade() ? NET::Shaded : 0, NET::Shaded );
|
info->setState( isShade() ? NET::Shaded : 0, NET::Shaded );
|
||||||
|
|
1
client.h
1
client.h
|
@ -331,6 +331,7 @@ class Client : public QObject, public KDecorationDefines
|
||||||
void updateAllowedActions( bool force = false );
|
void updateAllowedActions( bool force = false );
|
||||||
QSize sizeForClientSize( const QSize&, Sizemode mode = SizemodeAny ) const;
|
QSize sizeForClientSize( const QSize&, Sizemode mode = SizemodeAny ) const;
|
||||||
void changeMaximize( bool horizontal, bool vertical, bool adjust );
|
void changeMaximize( bool horizontal, bool vertical, bool adjust );
|
||||||
|
void checkMaximizeGeometry();
|
||||||
bool checkFullScreenHack( const QRect& geom ) const;
|
bool checkFullScreenHack( const QRect& geom ) const;
|
||||||
void updateFullScreenHack( const QRect& geom );
|
void updateFullScreenHack( const QRect& geom );
|
||||||
void getWmNormalHints();
|
void getWmNormalHints();
|
||||||
|
|
62
geometry.cpp
62
geometry.cpp
|
@ -1372,7 +1372,6 @@ void Client::configureRequest( int value_mask, int rx, int ry, int rw, int rh, i
|
||||||
{
|
{
|
||||||
QRect orig_geometry = geometry();
|
QRect orig_geometry = geometry();
|
||||||
++block_geometry;
|
++block_geometry;
|
||||||
resetMaximize();
|
|
||||||
move( new_pos );
|
move( new_pos );
|
||||||
plainResize( ns );
|
plainResize( ns );
|
||||||
setGeometry( QRect( calculateGravitation( false, gravity ), size()));
|
setGeometry( QRect( calculateGravitation( false, gravity ), size()));
|
||||||
|
@ -1411,7 +1410,6 @@ void Client::configureRequest( int value_mask, int rx, int ry, int rw, int rh, i
|
||||||
{
|
{
|
||||||
QRect orig_geometry = geometry();
|
QRect orig_geometry = geometry();
|
||||||
++block_geometry;
|
++block_geometry;
|
||||||
resetMaximize();
|
|
||||||
int save_gravity = xSizeHint.win_gravity;
|
int save_gravity = xSizeHint.win_gravity;
|
||||||
xSizeHint.win_gravity = gravity;
|
xSizeHint.win_gravity = gravity;
|
||||||
resizeWithChecks( ns );
|
resizeWithChecks( ns );
|
||||||
|
@ -1620,6 +1618,7 @@ void Client::setGeometry( int x, int y, int w, int h, ForceGeometry_t force )
|
||||||
updateWorkareaDiffs();
|
updateWorkareaDiffs();
|
||||||
sendSyntheticConfigureNotify();
|
sendSyntheticConfigureNotify();
|
||||||
updateWindowRules();
|
updateWindowRules();
|
||||||
|
checkMaximizeGeometry();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1663,6 +1662,7 @@ void Client::plainResize( int w, int h, ForceGeometry_t force )
|
||||||
updateWorkareaDiffs();
|
updateWorkareaDiffs();
|
||||||
sendSyntheticConfigureNotify();
|
sendSyntheticConfigureNotify();
|
||||||
updateWindowRules();
|
updateWindowRules();
|
||||||
|
checkMaximizeGeometry();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1680,6 +1680,7 @@ void Client::move( int x, int y, ForceGeometry_t force )
|
||||||
XMoveWindow( qt_xdisplay(), frameId(), x, y );
|
XMoveWindow( qt_xdisplay(), frameId(), x, y );
|
||||||
sendSyntheticConfigureNotify();
|
sendSyntheticConfigureNotify();
|
||||||
updateWindowRules();
|
updateWindowRules();
|
||||||
|
checkMaximizeGeometry();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1728,25 +1729,25 @@ void Client::changeMaximize( bool vertical, bool horizontal, bool adjust )
|
||||||
Q_ASSERT( !( vertical && horizontal )
|
Q_ASSERT( !( vertical && horizontal )
|
||||||
|| (( max_mode & MaximizeVertical != 0 ) == ( max_mode & MaximizeHorizontal != 0 )));
|
|| (( max_mode & MaximizeVertical != 0 ) == ( max_mode & MaximizeHorizontal != 0 )));
|
||||||
|
|
||||||
|
QRect clientArea = workspace()->clientArea( MaximizeArea, this );
|
||||||
|
|
||||||
// save sizes for restoring, if maximalizing
|
// save sizes for restoring, if maximalizing
|
||||||
bool maximalizing = false;
|
if( !( y() == clientArea.top() && height() == clientArea.height()))
|
||||||
if( vertical && !(old_mode & MaximizeVertical ))
|
|
||||||
{
|
{
|
||||||
geom_restore.setTop( y());
|
geom_restore.setTop( y());
|
||||||
geom_restore.setHeight( height());
|
geom_restore.setHeight( height());
|
||||||
maximalizing = true;
|
|
||||||
}
|
}
|
||||||
if( horizontal && !( old_mode & MaximizeHorizontal ))
|
if( !( x() == clientArea.left() && width() == clientArea.width()))
|
||||||
{
|
{
|
||||||
geom_restore.setLeft( x());
|
geom_restore.setLeft( x());
|
||||||
geom_restore.setWidth( width());
|
geom_restore.setWidth( width());
|
||||||
maximalizing = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !adjust )
|
if( !adjust )
|
||||||
{
|
{
|
||||||
if( maximalizing )
|
if(( vertical && !(old_mode & MaximizeVertical ))
|
||||||
Notify::raise( Notify::Maximize );
|
|| ( horizontal && !( old_mode & MaximizeHorizontal )))
|
||||||
|
Notify::raise( Notify::Maximize );
|
||||||
else
|
else
|
||||||
Notify::raise( Notify::UnMaximize );
|
Notify::raise( Notify::UnMaximize );
|
||||||
}
|
}
|
||||||
|
@ -1754,8 +1755,6 @@ void Client::changeMaximize( bool vertical, bool horizontal, bool adjust )
|
||||||
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 );
|
decoration->borders( border_left, border_right, border_top, border_bottom );
|
||||||
|
|
||||||
QRect clientArea = workspace()->clientArea( MaximizeArea, this );
|
|
||||||
|
|
||||||
switch (max_mode)
|
switch (max_mode)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -1869,6 +1868,46 @@ void Client::resetMaximize()
|
||||||
decoration->maximizeChange();
|
decoration->maximizeChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Client::checkMaximizeGeometry()
|
||||||
|
{
|
||||||
|
// when adding new bail-out conditions here, checkMaximizeGeometry() needs to be called
|
||||||
|
// when after the condition is no longer true
|
||||||
|
if( isShade())
|
||||||
|
return;
|
||||||
|
if( isMove() || isResize()) // this is because of the option to disallow moving/resizing of max-ed windows
|
||||||
|
return;
|
||||||
|
// Just in case.
|
||||||
|
static int recursion_protection = 0;
|
||||||
|
if( recursion_protection > 3 )
|
||||||
|
{
|
||||||
|
kdWarning( 1212 ) << "Check maximize overflow - you loose!" << endl;
|
||||||
|
kdWarning( 1212 ) << kdBacktrace() << endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
++recursion_protection;
|
||||||
|
QRect max_area = workspace()->clientArea( MaximizeArea, this );
|
||||||
|
if( geometry() == max_area )
|
||||||
|
{
|
||||||
|
if( max_mode != MaximizeFull )
|
||||||
|
maximize( MaximizeFull );
|
||||||
|
}
|
||||||
|
else if( x() == max_area.left() && width() == max_area.width())
|
||||||
|
{
|
||||||
|
if( max_mode != MaximizeHorizontal )
|
||||||
|
maximize( MaximizeHorizontal );
|
||||||
|
}
|
||||||
|
else if( y() == max_area.top() && height() == max_area.height())
|
||||||
|
{
|
||||||
|
if( max_mode != MaximizeVertical )
|
||||||
|
maximize( MaximizeVertical );
|
||||||
|
}
|
||||||
|
else if( max_mode != MaximizeRestore )
|
||||||
|
{
|
||||||
|
resetMaximize(); // not maximize( MaximizeRestore ), that'd change geometry - this is called from setGeometry()
|
||||||
|
}
|
||||||
|
--recursion_protection;
|
||||||
|
}
|
||||||
|
|
||||||
bool Client::isFullScreenable( bool fullscreen_hack ) const
|
bool Client::isFullScreenable( bool fullscreen_hack ) const
|
||||||
{
|
{
|
||||||
if( !rules()->checkFullScreen( true ))
|
if( !rules()->checkFullScreen( true ))
|
||||||
|
@ -2088,6 +2127,7 @@ void Client::finishMoveResize( bool cancel )
|
||||||
setGeometry( initialMoveResizeGeom );
|
setGeometry( initialMoveResizeGeom );
|
||||||
else
|
else
|
||||||
setGeometry( moveResizeGeom );
|
setGeometry( moveResizeGeom );
|
||||||
|
checkMaximizeGeometry();
|
||||||
// FRAME update();
|
// FRAME update();
|
||||||
Notify::raise( isResize() ? Notify::ResizeEnd : Notify::MoveEnd );
|
Notify::raise( isResize() ? Notify::ResizeEnd : Notify::MoveEnd );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue