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
This commit is contained in:
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_name);
XFree(xch.res_class); XFree(xch.res_class);
} }
workspace()->updateClientArea();
} }
@ -1268,31 +1270,54 @@ void Client::closeWindow()
void Client::maximize( MaximizeMode m) void Client::maximize( MaximizeMode m)
{ {
if ( isShade() ) QRect clientArea = workspace()->clientArea();
setShade( FALSE );
if ( geom_restore.isNull() ) { qDebug("Client::maximise() - area: l: %d r: %d t: %d b: %d",
geom_restore = geometry(); clientArea.left(), clientArea.right(),
switch ( m ) { clientArea.top(), clientArea.bottom());
case MaximizeVertical:
setGeometry( QRect( QPoint( x(), workspace()->geometry().top() ), if (isShade())
adjustedSize( QSize( width(), workspace()->geometry().height()) ) ) ); setShade(false);
break;
case MaximizeHorizontal: if (geom_restore.isNull()) {
setGeometry( QRect( QPoint( workspace()->geometry().left(), y() ),
adjustedSize( QSize( workspace()->geometry().width(), height() ) ) ) ); geom_restore = geometry();
break;
default: switch (m) {
setGeometry( QRect( workspace()->geometry().topLeft(), adjustedSize(workspace()->geometry().size()) ) );
} case MaximizeVertical:
maximizeChange( TRUE );
} setGeometry(
else { QRect(QPoint(x(), clientArea.top()),
setGeometry( geom_restore ); adjustedSize(QSize(width(), clientArea.height())))
QRect invalid; );
geom_restore = invalid; break;
maximizeChange( FALSE );
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; inf.row = 0;
cci.append(inf); cci.append(inf);
} }
updateClientArea();
} }
Workspace::~Workspace() Workspace::~Workspace()
@ -344,7 +343,6 @@ bool Workspace::workspaceEvent( XEvent * e )
if ( addDockwin( e->xmaprequest.window ) ) if ( addDockwin( e->xmaprequest.window ) )
return TRUE; return TRUE;
c = clientFactory( this, e->xmaprequest.window ); c = clientFactory( this, e->xmaprequest.window );
updateClientArea();
if ( root != qt_xrootwin() ) { if ( root != qt_xrootwin() ) {
// TODO may use QWidget:.create // TODO may use QWidget:.create
XReparentWindow( qt_xdisplay(), c->winId(), root, 0, 0 ); XReparentWindow( qt_xdisplay(), c->winId(), root, 0, 0 );
@ -526,6 +524,7 @@ bool Workspace::destroyClient( Client* c)
if ( c == desktop_client ) if ( c == desktop_client )
desktop_client = 0; desktop_client = 0;
propagateClients(); propagateClients();
updateClientArea();
return TRUE; return TRUE;
} }
@ -1333,6 +1332,10 @@ void Workspace::deskCleanup(CleanupType ct)
*/ */
void Workspace::lowerClient( Client* c ) void Workspace::lowerClient( Client* c )
{ {
// This isn't working yet and the window disappears, so don't
// do anything for now.
return;
if ( !c ) if ( !c )
return; return;
@ -2110,7 +2113,6 @@ void Workspace::slotResetAllClients()
delete oldClient; delete oldClient;
newClient->manage( TRUE ); newClient->manage( TRUE );
} }
updateClientArea();
} }
/*! /*!
@ -2190,7 +2192,7 @@ Workspace::updateClientArea()
for (ClientList::ConstIterator it(clients.begin()); it != clients.end(); ++it) for (ClientList::ConstIterator it(clients.begin()); it != clients.end(); ++it)
{ {
if ((*it)->avoid()) { if ((*it)->avoid()) {
switch (AnchorEdge((*it)->anchorEdge())) { switch (AnchorEdge((*it)->anchorEdge())) {
case AnchorNorth: 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 ); void storeSession( KConfig* config );
SessionInfo* takeSessionInfo( Client* ); SessionInfo* takeSessionInfo( Client* );
void updateClientArea();
public slots: public slots:
void setCurrentDesktop( int new_desktop ); void setCurrentDesktop( int new_desktop );
@ -238,7 +240,6 @@ private:
PluginMgr mgr; PluginMgr mgr;
void updateClientArea();
QRect clientArea_; QRect clientArea_;
}; };