diff --git a/client.cpp b/client.cpp index 44a33a73c0..7f481e0c7d 100644 --- a/client.cpp +++ b/client.cpp @@ -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); + } } diff --git a/workspace.cpp b/workspace.cpp index 4bec90902a..395d06aec7 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -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()); } diff --git a/workspace.h b/workspace.h index a82965aa7a..fd63948e0a 100644 --- a/workspace.h +++ b/workspace.h @@ -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_; };