diff --git a/client.cpp b/client.cpp index 4af1e45731..61c265d196 100644 --- a/client.cpp +++ b/client.cpp @@ -177,6 +177,7 @@ void Client::releaseWindow( bool on_shutdown ) if (moveResizeMode) leaveMoveResize(); finishWindowRules(); + ++block_geometry; setModal( false ); // otherwise its mainwindow wouldn't get focus hidden = true; // so that it's not considered visible anymore (can't use hideClient(), it would set flags) if( !on_shutdown ) @@ -215,6 +216,7 @@ void Client::releaseWindow( bool on_shutdown ) wrapper = None; XDestroyWindow( qt_xdisplay(), frame ); frame = None; + --block_geometry; deleteClient( this, Allowed ); } diff --git a/client.h b/client.h index f0e6dcd783..60411558a6 100644 --- a/client.h +++ b/client.h @@ -356,6 +356,7 @@ class Client : public QObject, public KDecorationDefines void resizeWithChecks( const QSize& s, ForceGeometry_t force = NormalGeometrySet ); NETExtendedStrut strut() const; bool hasStrut() const; + int checkShadeGeometry( int w, int h ); bool startMoveResize(); void finishMoveResize( bool cancel ); diff --git a/geometry.cpp b/geometry.cpp index 56f4a0cd47..f1064d5407 100644 --- a/geometry.cpp +++ b/geometry.cpp @@ -1230,7 +1230,7 @@ void Client::getWmNormalHints() if( isManaged()) { // update to match restrictions QSize new_size = adjustedSize( size()); - if( new_size != size() && !isShade() && !isFullScreen()) // SHADE + if( new_size != size() && !isFullScreen()) resizeWithChecks( new_size ); } updateAllowedActions(); // affects isResizeable() @@ -1395,9 +1395,6 @@ void Client::configureRequest( int value_mask, int rx, int ry, int rw, int rh, i if ( value_mask & (CWWidth | CWHeight ) && ! ( value_mask & ( CWX | CWY )) ) // pure resize { - if ( isShade()) // SELI SHADE - setShade( ShadeNone ); - int nw = clientSize().width(); int nh = clientSize().height(); if ( value_mask & CWWidth ) @@ -1586,19 +1583,12 @@ void Client::setGeometry( int x, int y, int w, int h, ForceGeometry_t force ) { if( force == NormalGeometrySet && frame_geometry == QRect( x, y, w, h )) return; + h = checkShadeGeometry( w, h ); frame_geometry = QRect( x, y, w, h ); 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 ) { @@ -1631,23 +1621,15 @@ void Client::plainResize( int w, int h, ForceGeometry_t force ) } if( force == NormalGeometrySet && frame_geometry.size() == QSize( w, h )) return; + h = checkShadeGeometry( w, h ); frame_geometry.setSize( QSize( w, h )); 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 ) { - // FRAME tady poradi tak, at neni flicker XResizeWindow( qt_xdisplay(), frameId(), w, h ); resizeDecoration( QSize( w, h )); if( !isShade()) @@ -1666,6 +1648,24 @@ void Client::plainResize( int w, int h, ForceGeometry_t force ) } } +// There may be cases when an application requests resizing while shaded, +// and even KWin itself may do so somewhere (too many places to check :-/ ). +// If the requested geometry doesn't fit shaded geometry, adjust the height +// of the requested geometry and return it. +int Client::checkShadeGeometry( int w, int h ) + { + // check that the frame is not resized to full size when it should be shaded + if( isShade() && !shade_geometry_change && h != border_top + border_bottom ) + { + kdDebug() << "Fixing shaded geometry:" << this << endl; + // adjust the client size to match the newly requested geometry + client_size = adjustedSize( QSize( w, h )); +// checkMaximizeGeometry(); // doesn't work, actual setting of geometry changes this again + h = border_top + border_bottom; + } + return h; + } + /*! Reimplemented to inform the client about the new window position. */ @@ -1720,9 +1720,6 @@ void Client::changeMaximize( bool vertical, bool horizontal, bool adjust ) if( !adjust && max_mode == old_mode ) return; - if( isShade()) // SELI SHADE - setShade( ShadeNone ); - ++block_geometry; // TODO GeometryBlocker class? // maximing one way and unmaximizing the other way shouldn't happen @@ -2225,7 +2222,7 @@ void Client::handleMoveResize( int x, int y, int x_root, int y_root ) } // ShadeHover or ShadeActive, ShadeNormal was already avoided above - if ( mode != PositionCenter && shade_mode != ShadeNone ) // SHADE + if ( mode != PositionCenter && shade_mode != ShadeNone ) setShade( ShadeNone ); QPoint globalPos( x_root, y_root ); diff --git a/useractions.cpp b/useractions.cpp index d3b4fd6d25..5d84fdc3b0 100644 --- a/useractions.cpp +++ b/useractions.cpp @@ -372,7 +372,7 @@ bool Client::performMouseCommand( Options::MouseCommand command, QPoint globalPo case Options::MouseResize: case Options::MouseUnrestrictedResize: { - if (!isResizable() || isShade()) // SHADE + if (!isResizable() || isShade()) break; if( moveResizeMode ) finishMoveResize( false );