Another final attempt at sorting out the shaded geometry problems.
This time at least the code should detect properly all attempts to use shaded geometry when the normal one is needed. BUG: 96602 svn path=/trunk/KDE/kdebase/kwin/; revision=425377
This commit is contained in:
parent
d48f71f2af
commit
30cab17748
3 changed files with 21 additions and 7 deletions
1
client.h
1
client.h
|
@ -102,6 +102,7 @@ class Client : public QObject, public KDecorationDefines
|
||||||
SizemodeMax // try not to make it larger in either direction
|
SizemodeMax // try not to make it larger in either direction
|
||||||
};
|
};
|
||||||
QSize adjustedSize( const QSize&, Sizemode mode = SizemodeAny ) const;
|
QSize adjustedSize( const QSize&, Sizemode mode = SizemodeAny ) const;
|
||||||
|
QSize adjustedSize() const;
|
||||||
|
|
||||||
QPixmap icon() const;
|
QPixmap icon() const;
|
||||||
QPixmap miniIcon() const;
|
QPixmap miniIcon() const;
|
||||||
|
|
25
geometry.cpp
25
geometry.cpp
|
@ -1010,6 +1010,13 @@ QSize Client::adjustedSize( const QSize& frame, Sizemode mode ) const
|
||||||
return sizeForClientSize( wsize, mode, false );
|
return sizeForClientSize( wsize, mode, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// this helper returns proper size even if the window is shaded
|
||||||
|
// see also the comment in Client::setGeometry()
|
||||||
|
QSize Client::adjustedSize() const
|
||||||
|
{
|
||||||
|
return sizeForClientSize( clientSize());
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Calculate the appropriate frame size for the given client size \a
|
Calculate the appropriate frame size for the given client size \a
|
||||||
wsize.
|
wsize.
|
||||||
|
@ -1022,6 +1029,11 @@ QSize Client::sizeForClientSize( const QSize& wsize, Sizemode mode, bool noframe
|
||||||
{
|
{
|
||||||
int w = wsize.width();
|
int w = wsize.width();
|
||||||
int h = wsize.height();
|
int h = wsize.height();
|
||||||
|
if( w < 1 || h < 1 )
|
||||||
|
{
|
||||||
|
kdWarning() << "sizeForClientSize() with empty size!" << endl;
|
||||||
|
kdWarning() << kdBacktrace() << endl;
|
||||||
|
}
|
||||||
if (w<1) w = 1;
|
if (w<1) w = 1;
|
||||||
if (h<1) h = 1;
|
if (h<1) h = 1;
|
||||||
|
|
||||||
|
@ -1247,7 +1259,7 @@ void Client::getWmNormalHints()
|
||||||
xSizeHint.win_gravity = NorthWestGravity;
|
xSizeHint.win_gravity = NorthWestGravity;
|
||||||
if( isManaged())
|
if( isManaged())
|
||||||
{ // update to match restrictions
|
{ // update to match restrictions
|
||||||
QSize new_size = adjustedSize( size());
|
QSize new_size = adjustedSize();
|
||||||
if( new_size != size() && !isFullScreen())
|
if( new_size != size() && !isFullScreen())
|
||||||
resizeWithChecks( new_size );
|
resizeWithChecks( new_size );
|
||||||
}
|
}
|
||||||
|
@ -1447,8 +1459,8 @@ void Client::resizeWithChecks( int w, int h, ForceGeometry_t force )
|
||||||
{
|
{
|
||||||
if( h == border_top + border_bottom )
|
if( h == border_top + border_bottom )
|
||||||
{
|
{
|
||||||
kdDebug() << "Shaded geometry passed for size:" << endl;
|
kdWarning() << "Shaded geometry passed for size:" << endl;
|
||||||
kdDebug() << kdBacktrace() << endl;
|
kdWarning() << kdBacktrace() << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int newx = x();
|
int newx = x();
|
||||||
|
@ -1614,7 +1626,8 @@ void Client::setGeometry( int x, int y, int w, int h, ForceGeometry_t force )
|
||||||
// shading. Then the frame geometry is adjusted for the shaded geometry.
|
// shading. Then the frame geometry is adjusted for the shaded geometry.
|
||||||
// This gets more complicated in the case the code does only something like
|
// This gets more complicated in the case the code does only something like
|
||||||
// setGeometry( geometry()) - geometry() will return the shaded frame geometry.
|
// setGeometry( geometry()) - geometry() will return the shaded frame geometry.
|
||||||
// Such code is wrong and should be changed to handle the case when the window is shaded.
|
// Such code is wrong and should be changed to handle the case when the window is shaded,
|
||||||
|
// for example using Client::clientSize().
|
||||||
if( shade_geometry_change )
|
if( shade_geometry_change )
|
||||||
; // nothing
|
; // nothing
|
||||||
else if( isShade())
|
else if( isShade())
|
||||||
|
@ -1664,7 +1677,7 @@ void Client::setGeometry( int x, int y, int w, int h, ForceGeometry_t force )
|
||||||
|
|
||||||
void Client::plainResize( int w, int h, ForceGeometry_t force )
|
void Client::plainResize( int w, int h, ForceGeometry_t force )
|
||||||
{
|
{
|
||||||
// this code is also duplicated in Client::setGeometry()
|
// this code is also duplicated in Client::setGeometry(), and it's also commented there
|
||||||
if( shade_geometry_change )
|
if( shade_geometry_change )
|
||||||
; // nothing
|
; // nothing
|
||||||
else if( isShade())
|
else if( isShade())
|
||||||
|
@ -1752,7 +1765,7 @@ void Client::postponeGeometryUpdates( bool postpone )
|
||||||
if( pending_geometry_update )
|
if( pending_geometry_update )
|
||||||
{
|
{
|
||||||
if( isShade())
|
if( isShade())
|
||||||
setGeometry( QRect( pos(), sizeForClientSize( clientSize())), ForceGeometrySet );
|
setGeometry( QRect( pos(), adjustedSize()), ForceGeometrySet );
|
||||||
else
|
else
|
||||||
setGeometry( geometry(), ForceGeometrySet );
|
setGeometry( geometry(), ForceGeometrySet );
|
||||||
pending_geometry_update = false;
|
pending_geometry_update = false;
|
||||||
|
|
|
@ -828,7 +828,7 @@ void Client::applyWindowRules()
|
||||||
workspace()->activateNextClient( this );
|
workspace()->activateNextClient( this );
|
||||||
// MoveResizeMode
|
// MoveResizeMode
|
||||||
// Closeable
|
// Closeable
|
||||||
QSize s = adjustedSize( sizeForClientSize( clientSize())); // handle shading
|
QSize s = adjustedSize();
|
||||||
if( s != size())
|
if( s != size())
|
||||||
resizeWithChecks( s );
|
resizeWithChecks( s );
|
||||||
setShortcut( rules()->checkShortcut( shortcut().toString()));
|
setShortcut( rules()->checkShortcut( shortcut().toString()));
|
||||||
|
|
Loading…
Reference in a new issue