Fixed maximisation. Now kwin really does avoid windows which ask

to be avoided. It also updates nicely. Just move kicker from the
bottom to the left, say, and open a new window. It doesn't cover
kicker. Maximise. Still doesn't cover. Seems to work, then.

svn path=/trunk/kdebase/kwin/; revision=47602
icc-effect-5.14.5
Rik Hemsley 2000-04-26 21:28:51 +00:00
parent 34055e684d
commit f65ca70e0b
3 changed files with 59 additions and 28 deletions

View File

@ -547,6 +547,8 @@ void Client::manage( bool isMapped )
XFree(xch.res_name);
XFree(xch.res_class);
}
workspace()->updateClientArea();
}
@ -1268,31 +1270,54 @@ void Client::closeWindow()
void Client::maximize( MaximizeMode m)
{
if ( isShade() )
setShade( FALSE );
QRect clientArea = workspace()->clientArea();
if ( geom_restore.isNull() ) {
geom_restore = geometry();
switch ( m ) {
case MaximizeVertical:
setGeometry( QRect( QPoint( x(), workspace()->geometry().top() ),
adjustedSize( QSize( width(), workspace()->geometry().height()) ) ) );
break;
case MaximizeHorizontal:
setGeometry( QRect( QPoint( workspace()->geometry().left(), y() ),
adjustedSize( QSize( workspace()->geometry().width(), height() ) ) ) );
break;
default:
setGeometry( QRect( workspace()->geometry().topLeft(), adjustedSize(workspace()->geometry().size()) ) );
}
maximizeChange( TRUE );
}
else {
setGeometry( geom_restore );
QRect invalid;
geom_restore = invalid;
maximizeChange( FALSE );
qDebug("Client::maximise() - area: l: %d r: %d t: %d b: %d",
clientArea.left(), clientArea.right(),
clientArea.top(), clientArea.bottom());
if (isShade())
setShade(false);
if (geom_restore.isNull()) {
geom_restore = geometry();
switch (m) {
case MaximizeVertical:
setGeometry(
QRect(QPoint(x(), clientArea.top()),
adjustedSize(QSize(width(), clientArea.height())))
);
break;
case MaximizeHorizontal:
setGeometry(
QRect(
QPoint(clientArea.left(), y()),
adjustedSize(QSize(clientArea.width(), height())))
);
break;
default:
setGeometry(
QRect(clientArea.topLeft(), adjustedSize(clientArea.size()))
);
}
maximizeChange(true);
} else {
setGeometry(geom_restore);
QRect invalid;
geom_restore = invalid;
maximizeChange(false);
}
}

View File

@ -250,7 +250,6 @@ void Workspace::init()
inf.row = 0;
cci.append(inf);
}
updateClientArea();
}
Workspace::~Workspace()
@ -344,7 +343,6 @@ bool Workspace::workspaceEvent( XEvent * e )
if ( addDockwin( e->xmaprequest.window ) )
return TRUE;
c = clientFactory( this, e->xmaprequest.window );
updateClientArea();
if ( root != qt_xrootwin() ) {
// TODO may use QWidget:.create
XReparentWindow( qt_xdisplay(), c->winId(), root, 0, 0 );
@ -526,6 +524,7 @@ bool Workspace::destroyClient( Client* c)
if ( c == desktop_client )
desktop_client = 0;
propagateClients();
updateClientArea();
return TRUE;
}
@ -1333,6 +1332,10 @@ void Workspace::deskCleanup(CleanupType ct)
*/
void Workspace::lowerClient( Client* c )
{
// This isn't working yet and the window disappears, so don't
// do anything for now.
return;
if ( !c )
return;
@ -2110,7 +2113,6 @@ void Workspace::slotResetAllClients()
delete oldClient;
newClient->manage( TRUE );
}
updateClientArea();
}
/*!
@ -2190,7 +2192,7 @@ Workspace::updateClientArea()
for (ClientList::ConstIterator it(clients.begin()); it != clients.end(); ++it)
{
if ((*it)->avoid()) {
switch (AnchorEdge((*it)->anchorEdge())) {
case AnchorNorth:
@ -2215,5 +2217,8 @@ Workspace::updateClientArea()
}
}
}
// Useful when you want to see whether the client area has been
// updated correctly...
// qDebug("clientArea now == l: %d, r: %d, t: %d, b: %d", clientArea_.left(), clientArea_.right(), clientArea_.top(), clientArea_.bottom());
}

View File

@ -140,6 +140,8 @@ public:
void storeSession( KConfig* config );
SessionInfo* takeSessionInfo( Client* );
void updateClientArea();
public slots:
void setCurrentDesktop( int new_desktop );
@ -238,7 +240,6 @@ private:
PluginMgr mgr;
void updateClientArea();
QRect clientArea_;
};