Handle struts set by panels that are at xinerama edges that

are inside the virtual area.


svn path=/trunk/KDE/kdebase/workspace/; revision=511696
This commit is contained in:
Luboš Luňák 2006-02-20 17:41:13 +00:00
parent 10775a9763
commit cfb1b5e42d
2 changed files with 28 additions and 6 deletions

View file

@ -300,6 +300,7 @@ class Client : public QObject, public KDecorationDefines
void setBMP(bool b); void setBMP(bool b);
bool touches(const Client* c); bool touches(const Client* c);
void setShapable(bool b); void setShapable(bool b);
bool hasStrut() const;
private slots: private slots:
void autoRaise(); void autoRaise();
@ -381,7 +382,6 @@ class Client : public QObject, public KDecorationDefines
static int computeWorkareaDiff( int left, int right, int a_left, int a_right ); static int computeWorkareaDiff( int left, int right, int a_left, int a_right );
void configureRequest( int value_mask, int rx, int ry, int rw, int rh, int gravity, bool from_tool ); void configureRequest( int value_mask, int rx, int ry, int rw, int rh, int gravity, bool from_tool );
NETExtendedStrut strut() const; NETExtendedStrut strut() const;
bool hasStrut() const;
int checkShadeGeometry( int w, int h ); int checkShadeGeometry( int w, int h );
void postponeGeometryUpdates( bool postpone ); void postponeGeometryUpdates( bool postpone );

View file

@ -87,9 +87,9 @@ void Workspace::updateClientArea( bool force )
} }
for ( ClientList::ConstIterator it = clients.begin(); it != clients.end(); ++it) for ( ClientList::ConstIterator it = clients.begin(); it != clients.end(); ++it)
{ {
QRect r = (*it)->adjustedClientArea( desktopArea, desktopArea ); if( !(*it)->hasStrut())
if( r == desktopArea ) // should be sufficient
continue; continue;
QRect r = (*it)->adjustedClientArea( desktopArea, desktopArea );
if( (*it)->isOnAllDesktops()) if( (*it)->isOnAllDesktops())
for( int i = 1; for( int i = 1;
i <= numberOfDesktops(); i <= numberOfDesktops();
@ -727,6 +727,29 @@ QRect Client::adjustedClientArea( const QRect &desktopArea, const QRect& area )
str . bottom_end - str . bottom_start + 1, str . bottom_end - str . bottom_start + 1,
str . bottom_width); str . bottom_width);
QRect screenarea = workspace()->clientArea( ScreenArea, this );
// HACK: workarea handling is not xinerama aware, so if this strut
// reserves place at a xinerama edge that's inside the virtual screen,
// ignore the strut for workspace setting.
if( area == kapp->desktop()->geometry())
{
if( stareaL.left() < screenarea.left())
stareaL = QRect();
if( stareaR.right() > screenarea.right())
stareaR = QRect();
if( stareaT.top() < screenarea.top())
stareaT = QRect();
if( stareaB.bottom() < screenarea.bottom())
stareaB = QRect();
}
// Handle struts at xinerama edges that are inside the virtual screen.
// They're given in virtual screen coordinates, make them affect only
// their xinerama screen.
stareaL.setLeft( QMAX( stareaL.left(), screenarea.left()));
stareaR.setRight( QMIN( stareaR.right(), screenarea.right()));
stareaT.setTop( QMAX( stareaT.top(), screenarea.top()));
stareaB.setBottom( QMIN( stareaB.bottom(), screenarea.bottom()));
if (stareaL . intersects (area)) { if (stareaL . intersects (area)) {
// kDebug () << "Moving left of: " << r << " to " << stareaL.right() + 1 << endl; // kDebug () << "Moving left of: " << r << " to " << stareaL.right() + 1 << endl;
r . setLeft( stareaL . right() + 1 ); r . setLeft( stareaL . right() + 1 );
@ -781,13 +804,12 @@ NETExtendedStrut Client::strut() const
} }
return ext; return ext;
} }
bool Client::hasStrut() const bool Client::hasStrut() const
{ {
NETExtendedStrut ext = strut(); NETExtendedStrut ext = strut();
if( ext.left_width == 0 && ext.right_width == 0 && ext.top_width == 0 && ext.bottom_width == 0 ) if( ext.left_width == 0 && ext.right_width == 0 && ext.top_width == 0 && ext.bottom_width == 0 )
{
return false; return false;
}
return true; return true;
} }