diff --git a/client.cpp b/client.cpp index ed438348a2..d9554ba956 100644 --- a/client.cpp +++ b/client.cpp @@ -43,11 +43,11 @@ void Client::clearbound() void Client::updateShape() { - if ( shape() ) + if ( shape() ) XShapeCombineShape(qt_xdisplay(), winId(), ShapeBounding, windowWrapper()->x(), windowWrapper()->y(), window(), ShapeBounding, ShapeSet); - else + else XShapeCombineMask( qt_xdisplay(), winId(), ShapeBounding, 0, 0, None, ShapeSet); } @@ -332,7 +332,7 @@ void Client::manage( bool isMapped ) // the clever activate() trick is necessary layout()->activate(); -// resize( geom.width() + width() - windowWrapper()->width(), +// resize( geom.width() + width() - windowWrapper()->width(), // geom.height() + height() - windowWrapper()->height() ); resize ( sizeForWindowSize( geom.size() ) ); layout()->activate(); @@ -348,7 +348,7 @@ void Client::manage( bool isMapped ) if ( (is_shape = Shape::hasShape( win )) ) { updateShape(); } - + // ### TODO check XGetWMHints() for initial mapping state, icon, etc. pp. // assume window wants to be visible on the current desktop @@ -539,7 +539,7 @@ bool Client::configureRequest( XConfigureRequestEvent& e ) break; } } - + if ( e.value_mask & CWBorderWidth ) { // first, get rid of a window border XWindowChanges wc; @@ -1055,6 +1055,11 @@ int Client::maximumHeight() const void Client::iconify() { + if ( workspace()->iconifyMeansWithdraw( this ) ) { + setMappingState( WithdrawnState ); + hide(); + return; + } setMappingState( IconicState ); hide(); // TODO animation (virtual function) diff --git a/client.h b/client.h index 33ffca3454..47174bcbeb 100644 --- a/client.h +++ b/client.h @@ -118,8 +118,8 @@ public: // transparent stuff virtual void drawbound( const QRect& geom ); virtual void clearbound(); - - + + // shape extensions bool shape() const; void updateShape(); @@ -130,6 +130,8 @@ public: void move( int x, int y ); void move( const QPoint & p ) { move( p.x(), p.y() ); } + + public slots: void iconify(); diff --git a/workspace.cpp b/workspace.cpp index 9576bcb7e5..32f7f3a4f4 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -2,6 +2,7 @@ #include #include #include +#include #include "workspace.h" #include "client.h" @@ -64,7 +65,7 @@ static Client* clientFactory( Workspace *ws, WId w ) c->setSticky( TRUE ); return c; } - + if ( Shape::hasShape( w ) ){ return new NoBorderClient( ws, w ); } @@ -99,12 +100,12 @@ Workspace::Workspace() int dummy; kwin_has_shape = XShapeQueryExtension(qt_xdisplay(), &kwin_shape_event, &dummy); - + // compatibility long data = 1; XChangeProperty(qt_xdisplay(), qt_xrootwin(), atoms->kwm_running, atoms->kwm_running, 32, PropModeAppend, (unsigned char*) &data, 1); - + init(); control_grab = FALSE; tab_grab = FALSE; @@ -284,7 +285,7 @@ bool Workspace::workspaceEvent( XEvent * e ) wc.stack_mode = Above; value_mask = e->xconfigurerequest.value_mask | CWBorderWidth; XConfigureWindow( qt_xdisplay(), e->xconfigurerequest.window, value_mask, & wc ); - + return TRUE; } break; @@ -336,9 +337,10 @@ Client* Workspace::findClient( WId w ) const return 0; } + /*! Returns the workspace's geometry - + \sa clientArea() */ QRect Workspace::geometry() const @@ -357,14 +359,14 @@ QRect Workspace::geometry() const } /*! - Returns the workspace's client area. - + 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 @@ -895,7 +897,7 @@ void Workspace::raiseClient( Client* c ) XRestackWindows(qt_xdisplay(), new_stack, i); delete [] new_stack; - + propagateClients( TRUE ); } @@ -1088,12 +1090,11 @@ void Workspace::propagateClients( bool onlyStacking ) bool Workspace::addDockwin( WId w ) { - if ( !KWM::isDockWindow( w ) ) + WId dockFor = 0; + if ( !KWin::isDockWindow( w, &dockFor ) ) return FALSE; - dockwins.append( w ); + dockwins.append( DockWindow( w, dockFor ) ); XSelectInput( qt_xdisplay(), w, -// FocusChangeMask | -// PropertyChangeMask | StructureNotifyMask ); propagateDockwins(); @@ -1109,6 +1110,15 @@ bool Workspace::removeDockwin( WId w ) return TRUE; } +bool Workspace::iconifyMeansWithdraw( Client* c) +{ + for ( DockWindowList::ConstIterator it = dockwins.begin(); it != dockwins.end(); ++it ) { + if ( (*it).dockFor == c->window() ) + return TRUE; + } + return FALSE; +} + /*! Propagates the dockwins to the world */ @@ -1116,8 +1126,8 @@ void Workspace::propagateDockwins() { WId* cl = new WId[ dockwins.count()]; int i = 0; - for ( WIdList::ConstIterator it = dockwins.begin(); it != dockwins.end(); ++it ) { - cl[i++] = (*it); + for ( DockWindowList::ConstIterator it = dockwins.begin(); it != dockwins.end(); ++it ) { + cl[i++] = (*it).dockWin; } XChangeProperty(qt_xdisplay(), qt_xrootwin(), atoms->net_kde_docking_windows, XA_WINDOW, 32, @@ -1128,7 +1138,7 @@ void Workspace::propagateDockwins() void Workspace::createKeybindings(){ keys = new KGlobalAccel(); - + #include "kwinbindings.cpp" keys->connectItem( "Switch to desktop 1", this, SLOT( slotSwitchDesktop1() )); diff --git a/workspace.h b/workspace.h index 387235a511..707f8a8ab1 100644 --- a/workspace.h +++ b/workspace.h @@ -13,7 +13,27 @@ class TabBox; class KGlobalAccel; typedef QValueList ClientList; -typedef QValueList WIdList; + +class DockWindow +{ +public: + DockWindow() + : dockWin(0),dockFor(0) + {} + DockWindow( WId w ) + : dockWin(w),dockFor(0) + {} + DockWindow( WId w, WId wf ) + : dockWin(w),dockFor(wf) + {} + + bool operator==( const DockWindow& other ) + { return dockWin == other.dockWin; } + WId dockWin; + WId dockFor; +}; + +typedef QValueList DockWindowList; class Shape { public: @@ -76,8 +96,9 @@ public: void makeFullScreen( Client* ); - -public slots: + bool iconifyMeansWithdraw( Client* ); + +public slots: // keybindings void slotSwitchDesktop1(); void slotSwitchDesktop2(); @@ -126,10 +147,11 @@ private: void propagateClients( bool onlyStacking = FALSE); - WIdList dockwins; + DockWindowList dockwins; bool addDockwin( WId w ); bool removeDockwin( WId w ); void propagateDockwins(); + DockWindow findDockwin( WId w ); }; inline WId Workspace::rootWin() const