--Boundary-00=_i/RiMpEHrCc4N7s Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: quoted-printable Sorry for the delay. Updated patch attached. I took the opportunity to release the highlight setting from the tabbox (no= =20 strings changed or added), therefore added rootwindow property support to t= he=20 highlight effect. I hope i didn't miss any file in the patch (when does KDE move to git again= ?) Am Saturday 28 August 2010 schrieb Martin Gr=E4=DFlin: > good point. So I have some comments to the patch: > * I think it should be side effect free. That is when the tabbox is clos= ed > with Escape it should return to the state as before. check. > * It should only be used when compositing is not active=20 check. > (maybe even combined with the highligh option?).=20 check. > * I fear it will crash when a window is closed. You can > easily test by middle clicking the items in the tabbox ;-) Nope, the restack function digs for the window in the stacking order itself. Since the stacking order has been updated, the window is gone. (At least i wasn't able to make it segfault by the undetected feature to cl= ose=20 windows by mbc) The remaining "issue" is that the "highlighted" window is then either =2D not restacked (if .succ is gone and therefore the hook to where it shou= ld be=20 restacked) =2D by a mega-tiny chance restacked to a wrong position (/theoretically/ it= 's=20 possible that you close a window, open a new one and that get's the pointer= of=20 the lost one. if the lost one was one of the two involved you will "mess up= "=20 the stack on the next switch) Ignoring the second case (for being "near" imposible) i wonder whether the= =20 first one is worth adding layer monitoring to the tabbox (to make it "corre= ct"=20 it should monitor all external restacks as well and update the .succ client= =20 respectively) or we'd argue that the stack was manipulated by the user anyw= ay=20 and one cannot say whether keeping or restacking the selected client would = be=20 the expected/"right" behaviour. =2D> Opinions? Cheers, Thomas --Boundary-00=_i/RiMpEHrCc4N7s Content-Type: text/x-patch; charset="UTF-8"; name="general_tabbox_highlight.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="general_tabbox_highlight.diff" Index: tabbox.cpp =================================================================== --- tabbox.cpp (Revision 1171839) +++ tabbox.cpp (Arbeitskopie) @@ -180,7 +180,19 @@ } return ret; } + +void TabBoxHandlerImpl::raiseClient( TabBoxClient* c ) const + { + Workspace::self()->raiseClient( static_cast(c)->client() ); + } +void TabBoxHandlerImpl::restack( TabBoxClient *c, TabBoxClient *under ) +{ + Workspace::self()->restack( static_cast(c)->client(), + static_cast(under)->client() ); +} + + TabBoxClient* TabBoxHandlerImpl::desktopClient() const { foreach( const Client* client, Workspace::self()->stackingOrder() ) @@ -480,7 +492,7 @@ /*! Notify effects that the tab box is being hidden. */ -void TabBox::hide() +void TabBox::hide(bool abort) { delayedShowTimer.stop(); if( m_isShown ) @@ -493,7 +505,7 @@ if( isDisplayed()) kDebug( 1212 ) << "Tab box was not properly closed by an effect"; m_index = QModelIndex(); - m_tabBox->hide(); + m_tabBox->hide( abort ); QApplication::syncX(); XEvent otherEvent; while (XCheckTypedEvent (display(), EnterNotify, &otherEvent ) ) @@ -1096,7 +1108,7 @@ if ( ((keyQt & ~Qt::KeyboardModifierMask) == Qt::Key_Escape) && !(forward || backward) ) { // if Escape is part of the shortcut, don't cancel - closeTabBox(); + closeTabBox( true ); } else if( !(forward || backward) ) { @@ -1118,10 +1130,10 @@ tab_box->unrefDisplay(); } -void Workspace::closeTabBox() +void Workspace::closeTabBox( bool abort ) { removeTabBoxGrab(); - tab_box->hide(); + tab_box->hide( abort ); modalActionsSwitch( true ); tab_grab = false; control_grab = false; Index: tabbox.h =================================================================== --- tabbox.h (Revision 1171839) +++ tabbox.h (Arbeitskopie) @@ -54,6 +54,8 @@ virtual int nextDesktopFocusChain( int desktop ) const; virtual int numberOfDesktops() const; virtual TabBoxClientList stackingOrder() const; + virtual void raiseClient( TabBoxClient *client ) const; + virtual void restack( TabBoxClient *c, TabBoxClient *under ); virtual TabBoxClient* clientToAddToList( TabBoxClient* client, int desktop, bool allDesktops ) const; virtual TabBoxClient* desktopClient() const; }; @@ -102,7 +104,7 @@ void nextPrev( bool next = true); void delayedShow(); - void hide(); + void hide( bool abort = false ); void refDisplay(); void unrefDisplay(); Index: workspace.h =================================================================== --- workspace.h (Revision 1171839) +++ workspace.h (Arbeitskopie) @@ -157,6 +157,7 @@ void raiseClientRequest( Client* c, NET::RequestSource src, Time timestamp ); void lowerClientRequest( Client* c, NET::RequestSource src, Time timestamp ); void restackClientUnderActive( Client* ); + void restack( Client *c, Client *under ); void updateClientLayer( Client* c ); void raiseOrLowerClient( Client* ); void restoreSessionStackingOrder( Client* c ); @@ -355,7 +356,7 @@ int previousDesktopStatic( int iDesktop ) const; void refTabBox(); void unrefTabBox(); - void closeTabBox(); + void closeTabBox( bool abort = false ); // Tabbing void addClientGroup( ClientGroup* group ); Index: layers.cpp =================================================================== --- layers.cpp (Revision 1171839) +++ layers.cpp (Arbeitskopie) @@ -456,21 +456,14 @@ lowerClientWithinApplication( c ); } -void Workspace::restackClientUnderActive( Client* c ) + +void Workspace::restack( Client* c, Client* under ) { - if( c->isTopMenu()) - return; - if( !active_client || active_client == c ) - { - raiseClient( c ); - return; - } - - assert( unconstrained_stacking_order.contains( active_client )); - if( Client::belongToSameApplication( active_client, c )) + assert( unconstrained_stacking_order.contains( under )); + if( Client::belongToSameApplication( under, c )) { // put it below the active window if it's the same app unconstrained_stacking_order.removeAll( c ); - unconstrained_stacking_order.insert( unconstrained_stacking_order.indexOf( active_client ), c ); + unconstrained_stacking_order.insert( unconstrained_stacking_order.indexOf( under ), c ); } else { // put in the stacking order below _all_ windows belonging to the active application @@ -478,7 +471,7 @@ it != unconstrained_stacking_order.end(); ++it ) { // TODO ignore topmenus? - if( Client::belongToSameApplication( active_client, *it )) + if( Client::belongToSameApplication( under, *it )) { if( *it != c ) { @@ -494,12 +487,12 @@ desktop <= numberOfDesktops(); ++desktop ) { // do for every virtual desktop to handle the case of onalldesktop windows - if( c->wantsTabFocus() && c->isOnDesktop( desktop ) && focus_chain[ desktop ].contains( active_client )) + if( c->wantsTabFocus() && c->isOnDesktop( desktop ) && focus_chain[ desktop ].contains( under )) { - if( Client::belongToSameApplication( active_client, c )) + if( Client::belongToSameApplication( under, c )) { // put it after the active window if it's the same app focus_chain[ desktop ].removeAll( c ); - focus_chain[ desktop ].insert( focus_chain[ desktop ].indexOf( active_client ), c ); + focus_chain[ desktop ].insert( focus_chain[ desktop ].indexOf( under ), c ); } else { // put it in focus_chain[currentDesktop()] after all windows belonging to the active applicationa @@ -508,7 +501,7 @@ i >= 0; --i ) { - if( Client::belongToSameApplication( active_client, focus_chain[ desktop ].at( i ))) + if( Client::belongToSameApplication( under, focus_chain[ desktop ].at( i ))) { focus_chain[ desktop ].insert( i, c ); break; @@ -518,12 +511,12 @@ } } // the same for global_focus_chain - if( c->wantsTabFocus() && global_focus_chain.contains( active_client )) + if( c->wantsTabFocus() && global_focus_chain.contains( under )) { - if( Client::belongToSameApplication( active_client, c )) + if( Client::belongToSameApplication( under, c )) { global_focus_chain.removeAll( c ); - global_focus_chain.insert( global_focus_chain.indexOf( active_client ), c ); + global_focus_chain.insert( global_focus_chain.indexOf( under ), c ); } else { @@ -532,7 +525,7 @@ i >= 0; --i ) { - if( Client::belongToSameApplication( active_client, global_focus_chain.at( i ) )) + if( Client::belongToSameApplication( under, global_focus_chain.at( i ) )) { global_focus_chain.insert( i, c ); break; @@ -543,6 +536,18 @@ updateStackingOrder(); } +void Workspace::restackClientUnderActive( Client* c ) + { + if( c->isTopMenu()) + return; + if( !active_client || active_client == c ) + { + raiseClient( c ); + return; + } + restack( c, active_client ); + } + void Workspace::restoreSessionStackingOrder( Client* c ) { if( c->sessionStackingOrder() < 0 ) Index: tabbox/tabboxhandler.cpp =================================================================== --- tabbox/tabboxhandler.cpp (Revision 1171839) +++ tabbox/tabboxhandler.cpp (Arbeitskopie) @@ -39,6 +39,7 @@ // KDE #include #include +#include namespace KWin { @@ -48,7 +49,7 @@ class TabBoxHandlerPrivate { public: - TabBoxHandlerPrivate(); + TabBoxHandlerPrivate( TabBoxHandler *q ); ~TabBoxHandlerPrivate(); @@ -67,12 +68,13 @@ /** * Ends window highlighting */ - void endHighlightWindows(); + void endHighlightWindows( bool abort = false ); ClientModel* clientModel() const; DesktopModel* desktopModel() const; void parseConfig( const QString& fileName ); + TabBoxHandler *q; // public pointer // members TabBoxConfig config; TabBoxView* view; @@ -87,11 +89,15 @@ */ bool isShown; QMap< QString, ItemLayoutConfig > tabBoxLayouts; + TabBoxClient *lastRaisedClient, *lastRaisedClientSucc; }; -TabBoxHandlerPrivate::TabBoxHandlerPrivate() +TabBoxHandlerPrivate::TabBoxHandlerPrivate( TabBoxHandler *q ) { + this->q = q; isShown = false; + lastRaisedClient = 0; + lastRaisedClientSucc = 0; config = TabBoxConfig(); view = new TabBoxView(); XSetWindowAttributes attr; @@ -230,11 +236,46 @@ { if( !isShown || config.tabBoxMode() != TabBoxConfig::ClientTabBox ) return; - QVector< WId > data( 2 ); + Display *dpy = QX11Info::display(); - const WId wId = view->winId(); - data[ 0 ] = wId; - data[ 1 ] = view->clientModel()->data( index, ClientModel::WIdRole ).toULongLong(); + TabBoxClient *currentClient = q->client( index ); + + if( !KWindowSystem::compositingActive() ) + { + if( lastRaisedClient ) + { + if ( lastRaisedClientSucc ) + q->restack( lastRaisedClient, lastRaisedClientSucc ); +// if ( lastRaisedClientWasMinimized ) +// lastRaisedClient->setMinimized( true ); + } + + lastRaisedClient = currentClient; + if( lastRaisedClient ) + { +// if ( (lastRaisedClientWasMinimized = lastRaisedClient->isMinimized()) ) +// lastRaisedClient->setMinimized( false ); + TabBoxClientList order = q->stackingOrder(); + int succIdx = order.indexOf( lastRaisedClient ) + 1; // this is likely related to the index parameter?! + lastRaisedClientSucc = ( succIdx < order.count() ) ? order.at( succIdx ) : 0; + q->raiseClient( lastRaisedClient ); + } + } + + WId wId; + QVector< WId > data; + if ( config.isShowTabBox() ) + { + wId = view->winId(); + data.resize(2); + data[ 1 ] = wId; + } + else + { + wId = QX11Info::appRootWindow(); + data.resize(1); + } + data[ 0 ] = currentClient ? currentClient->window() : 0L; if( config.isShowOutline() ) { data.resize( 6 ); @@ -248,12 +289,16 @@ reinterpret_cast(data.data()), data.size()); } -void TabBoxHandlerPrivate::endHighlightWindows() +void TabBoxHandlerPrivate::endHighlightWindows( bool abort ) { + if ( abort && lastRaisedClient && lastRaisedClientSucc ) + q->restack( lastRaisedClient, lastRaisedClientSucc ); + lastRaisedClient = 0; + lastRaisedClientSucc = 0; // highlight windows Display *dpy = QX11Info::display(); Atom atom = XInternAtom(dpy, "_KDE_WINDOW_HIGHLIGHT", False); - XDeleteProperty( dpy, view->winId(), atom ); + XDeleteProperty( dpy, config.isShowTabBox() ? view->winId() : QX11Info::appRootWindow(), atom ); } /*********************************************************** @@ -411,7 +456,7 @@ : QObject() { KWin::TabBox::tabBox = this; - d = new TabBoxHandlerPrivate; + d = new TabBoxHandlerPrivate( this ); } TabBoxHandler::~TabBoxHandler() @@ -448,6 +493,8 @@ void TabBoxHandler::show() { d->isShown = true; + d->lastRaisedClient = 0; + d->lastRaisedClientSucc = 0; // show the outline if( d->config.isShowOutline() ) { @@ -457,19 +504,19 @@ { d->view->show(); d->view->updateGeometry(); - if( d->config.isHighlightWindows() ) - { - d->updateHighlightWindows(); - } } + if( d->config.isHighlightWindows() ) + { + d->updateHighlightWindows(); + } } -void TabBoxHandler::hide() +void TabBoxHandler::hide( bool abort ) { d->isShown = false; if( d->config.isHighlightWindows() ) { - d->endHighlightWindows(); + d->endHighlightWindows( abort ); } if( d->config.isShowOutline() ) { @@ -577,7 +624,7 @@ { d->updateOutline(); } - if( d->config.isShowTabBox() && d->config.isHighlightWindows() ) + if( d->config.isHighlightWindows() ) { d->updateHighlightWindows(); } Index: tabbox/tabboxhandler.h =================================================================== --- tabbox/tabboxhandler.h (Revision 1171839) +++ tabbox/tabboxhandler.h (Arbeitskopie) @@ -136,7 +136,19 @@ * @return The next desktop in the current focus chain. */ virtual int nextDesktopFocusChain( int desktop ) const = 0; + /** + * Raise a client (w/o activating it) + */ + virtual void raiseClient( TabBoxClient* c ) const = 0; + + /** + * @param c The client to be restacked + * @param under The client the other one will be placed below + */ + virtual void restack( TabBoxClient *c, TabBoxClient *under ) = 0; + + /** * @return The current stacking order of TabBoxClients */ virtual TabBoxClientList stackingOrder() const = 0; @@ -191,7 +203,7 @@ * Removes the outline if active. * @see show */ - void hide(); + void hide( bool abort = false ); /** * Sets the current model index in the view and updates Index: effects/highlightwindow/highlightwindow.cpp =================================================================== --- effects/highlightwindow/highlightwindow.cpp (Revision 1171839) +++ effects/highlightwindow/highlightwindow.cpp (Arbeitskopie) @@ -129,10 +129,11 @@ void HighlightWindowEffect::propertyNotify( EffectWindow* w, long a ) { - if( !w || a != m_atom ) + if( a != m_atom ) return; // Not our atom - QByteArray byteData = w->readProperty( m_atom, m_atom, 32 ); + QByteArray byteData = w ? w->readProperty( m_atom, m_atom, 32 ) : + effects->readRootProperty( m_atom, m_atom, 32 ); if( byteData.length() < 1 ) { // Property was removed, clearing highlight finishHighlighting(); @@ -174,7 +175,8 @@ return; } prepareHighlighting(); - m_windowOpacity[w] = 1.0; // Because it's not in stackingOrder() yet + if( w ) + m_windowOpacity[w] = 1.0; // Because it's not in stackingOrder() yet /* TODO: Finish thumbnails of offscreen windows, not sure if it's worth it though if( !m_highlightedWindow->isOnCurrentDesktop() ) Index: kcmkwin/kwintabbox/main.ui =================================================================== --- kcmkwin/kwintabbox/main.ui (Revision 1171839) +++ kcmkwin/kwintabbox/main.ui (Arbeitskopie) @@ -6,8 +6,8 @@ 0 0 - 490 - 332 + 541 + 305 @@ -19,187 +19,212 @@ - - - General - - - - QFormLayout::ExpandingFieldsGrow - - - + + + + + List windows: + + + listModeCombo + + + + + + + + 0 + 0 + + + - List windows: + Current Desktop - - listModeCombo + + + + All Desktops - - - - - - - 0 - 0 - - - - - Current Desktop - - - - - All Desktops - - - - - Current Desktop Grouped by Applications - - - - - All Desktops Grouped by Applications - - - - - - + + - Sort order: + Current Desktop Grouped by Applications - - switchingModeCombo - - - - - - - - 0 - 0 - - - - - Recently used - - - - - Stacking order - - - - - - + + - Show outline of selected window + All Desktops Grouped by Applications - - - - + + + + + + + Sort order: + + + switchingModeCombo + + + + + + + + 0 + 0 + + + - Effect: + Recently used - - effectCombo - - - - - - - - - - 0 - 0 - - - - The effect to replace the list window when desktop effects are active. - - - - - - - - 0 - 0 - - - - - - - - - - - - - Adds an entry to minimize all windows. - + + - Include desktop + Stacking order - - - + + + + + + + + + Adds an entry to minimize all windows. + + + Include desktop + - - - Display list while switching + + + Qt::Horizontal - - true + + + + + + The currently selected window will be highlighted by fading out all other windows. This option requires desktop effects to be active. - - - - - The currently selected window will be highlighted by fading out all other windows. This option requires desktop effects to be active. - - - Highlight selected window - - - - - - - Configure Layout... - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - + + Highlight selected window + + + + Show outline of selected window + + + + + + + + + Effect: + + + effectCombo + + + + + + + + + + 0 + 0 + + + + The effect to replace the list window when desktop effects are active. + + + + + + + + 0 + 0 + + + + + + + + + + + + + + + Qt::Horizontal + + + + + + + + + Display list while switching + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + false + + + Configure Layout... + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + Qt::Vertical @@ -238,9 +263,24 @@ effectCombo effectConfigButton effectInfoButton - showTabBox - highlightWindowCheck - + + + showTabBox + toggled(bool) + layoutConfigButton + setEnabled(bool) + + + 81 + 211 + + + 295 + 216 + + + + --Boundary-00=_i/RiMpEHrCc4N7s Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ kwin mailing list kwin@kde.org https://mail.kde.org/mailman/listinfo/kwin --Boundary-00=_i/RiMpEHrCc4N7s--