From a982506a7570a4a0ca82f1b3737881231a5e2357 Mon Sep 17 00:00:00 2001 From: Rik Hemsley Date: Sat, 6 May 2000 18:59:43 +0000 Subject: [PATCH] Kicker is now placed _under_ the Mac menubar - it will not obscure it... except if you press the hide buttons. That needs fixing. svn path=/trunk/kdebase/kwin/; revision=48570 --- KWinInterface.h | 2 ++ client.cpp | 19 ++++++++++-------- main.cpp | 2 +- workspace.cpp | 52 +++++++++++++++++++++++++------------------------ workspace.h | 18 +++++++++++++++-- 5 files changed, 57 insertions(+), 36 deletions(-) diff --git a/KWinInterface.h b/KWinInterface.h index 3f1b33c1fe..f98cffa5e2 100644 --- a/KWinInterface.h +++ b/KWinInterface.h @@ -10,6 +10,8 @@ class KWinInterface : virtual public DCOPObject k_dcop: virtual void updateClientArea() = 0; + virtual QRect clientArea() = 0; + virtual QRect edgeClientArea() = 0; }; #endif diff --git a/client.cpp b/client.cpp index ba0e77bc19..235ff83699 100644 --- a/client.cpp +++ b/client.cpp @@ -1217,9 +1217,9 @@ void Client::maximize( MaximizeMode m) { QRect clientArea = workspace()->clientArea(); - qDebug("Client::maximise() - area: l: %d r: %d t: %d b: %d", - clientArea.left(), clientArea.right(), - clientArea.top(), clientArea.bottom()); +// qDebug("Client::maximise() - area: l: %d r: %d t: %d b: %d", +// clientArea.left(), clientArea.right(), +// clientArea.top(), clientArea.bottom()); if (isShade()) setShade(false); @@ -1894,6 +1894,7 @@ QCString Client::sessionId() void Client::updateAvoidPolicy() { +// qDebug("kwin: Client::updateAvoidPolicy() - win id == %x", (int)win); // Find out if we should be avoided. // If this atom isn't set, set it now. @@ -1906,7 +1907,7 @@ void Client::updateAvoidPolicy() if (0 != avoidStatus) { - qDebug("XGetTextProperty worked for atom _NET_AVOID_SPEC"); +// qDebug("XGetTextProperty worked for atom _NET_AVOID_SPEC"); char ** avoidList; int avoidListCount; @@ -1916,17 +1917,18 @@ void Client::updateAvoidPolicy() if (0 != convertStatus) { - qDebug("XTextPropertyToStringList succeded"); +// qDebug("XTextPropertyToStringList succeded"); avoid_ = true; if (avoidListCount != 1) { - qDebug("Extra values in avoidance list. Ignoring."); + qDebug( "kwin: Client::updateAvoidPolicy(): " + "Extra values in avoidance list. Ignoring."); } char * itemZero = avoidList[0]; - qDebug("Anchoring to border %s", itemZero); +// qDebug("Anchoring to border %s", itemZero); switch (*itemZero) { @@ -1950,7 +1952,8 @@ void Client::updateAvoidPolicy() XFreeStringList(avoidList); } else - qDebug("XTextPropertyToStringList failed"); + qDebug( "kwin: Client::updateAvoidPolicy(): " + "XTextPropertyToStringList failed"); } } diff --git a/main.cpp b/main.cpp index 45c242b0d8..c2ad98b90c 100644 --- a/main.cpp +++ b/main.cpp @@ -194,7 +194,7 @@ int main( int argc, char * argv[] ) DCOPClient * client = a.dcopClient(); client->attach(); - client->registerAs(a.name()); + client->registerAs("kwin", false); return a.exec(); diff --git a/workspace.cpp b/workspace.cpp index b7826aaadb..e8a8424e9a 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -517,23 +517,6 @@ QRect Workspace::geometry() const } } -/*! - Returns the workspace's client area. - - This is the area within the geometry() where clients can be placed, - i.e. the full geometry minus space for desktop panels, taskbars, - etc. - - Placement algorithms should refer to clientArea. - - \sa geometry() - */ -QRect Workspace::clientArea() const -{ - return clientArea_; -} - - /* Destroys the client \a c */ @@ -545,10 +528,11 @@ bool Workspace::destroyClient( Client* c) stacking_order.remove( c ); focus_chain.remove( c ); c->invalidateWindow(); - delete c; clientHidden( c ); if ( c == desktop_client ) desktop_client = 0; + delete c; + c = 0; propagateClients(); updateClientArea(); return TRUE; @@ -2245,38 +2229,46 @@ Workspace::updateClientArea() (*it)->updateAvoidPolicy(); if ((*it)->avoid()) { + +// qDebug("Looking at client " + (KWM::title((*it)->winId()))); switch (AnchorEdge((*it)->anchorEdge())) { case AnchorNorth: -// qDebug("KWin: Ignoring a client at edge N"); +// qDebug("KWin: Ignoring at edge N"); clientArea_ .setTop(QMAX(clientArea_.top(), (*it)->geometry().bottom())); break; case AnchorSouth: -// qDebug("KWin: Ignoring a client at edge S"); +// qDebug("KWin: Ignoring at edge S"); clientArea_ - .setBottom(QMIN(clientArea_.bottom(), (*it)->geometry().top())); + .setBottom(QMIN(clientArea_.bottom(), (*it)->geometry().top() - 1)); break; case AnchorEast: -// qDebug("KWin: Ignoring a client at edge E"); +// qDebug("KWin: Ignoring at edge E"); clientArea_ - .setRight(QMIN(clientArea_.right(), (*it)->geometry().left())); + .setRight(QMIN(clientArea_.right(), (*it)->geometry().left() - 1)); break; case AnchorWest: -// qDebug("KWin: Ignoring a client at edge W"); +// qDebug("KWin: Ignoring at edge W"); clientArea_ .setLeft(QMAX(clientArea_.left(), (*it)->geometry().right())); break; default: -// qDebug("KWin: Trying to ignore a client, but don't know which edge"); +// qDebug("KWin: Not ignoring"); break; } } + + // FIXME: Using the hackish method... + if (KWM::title((*it)->winId()) == "MAC MENU [menu]") { + edgeClientArea_ = geometry(); + edgeClientArea_.setTop((*it)->geometry().bottom()); + } } DCOPClient * client = kapp->dcopClient(); @@ -2296,3 +2288,13 @@ Workspace::updateClientArea() // qDebug("clientArea now == l: %d, r: %d, t: %d, b: %d", clientArea_.left(), clientArea_.top(), clientArea_.right(), clientArea_.bottom()); } +QRect Workspace::clientArea() +{ + return clientArea_; +} + +QRect Workspace::edgeClientArea() +{ + return edgeClientArea_; +} + diff --git a/workspace.h b/workspace.h index 1c2b6d3938..3f9a77395a 100644 --- a/workspace.h +++ b/workspace.h @@ -90,7 +90,14 @@ public: Client* findClient( WId w ) const; QRect geometry() const; - QRect clientArea() const; + + /** + * @return the area available for clients. This is the desktop + * geometry adjusted for edge-anchored windows. + * Placement algorithms should refer to this rather than geometry(). + * @sa geometry() + */ + QRect clientArea(); bool destroyClient( Client* ); @@ -167,6 +174,13 @@ public: * have changed, this will recalculate the available space. */ virtual void updateClientArea(); + + /** + * @return the area available for edge-anchored windows. This + * is the desktop geometry adjusted for other edge-anchored + * windows that have priority. + */ + virtual QRect edgeClientArea(); public slots: void setCurrentDesktop( int new_desktop ); @@ -280,7 +294,7 @@ private: PluginMgr mgr; - QRect clientArea_; + QRect clientArea_, edgeClientArea_; }; inline WId Workspace::rootWin() const