raise alt+tab selected window w/o compositing (requires highlight windows option to be checked)

unlink composited window highlighting from the tabbox
-> results in semi-legacy behaviour w/o activating the selected window

BUG: 227344

svn path=/trunk/KDE/kdebase/workspace/; revision=1186871
icc-effect-5.14.5
Thomas Lübking 2010-10-17 19:49:07 +00:00
parent 04fc514c52
commit 647eaa8afb
7 changed files with 331 additions and 222 deletions

View File

@ -129,10 +129,12 @@ void HighlightWindowEffect::windowDeleted( EffectWindow* w )
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 );
// if the window is null, the property was set on the root window - see events.cpp
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 +176,8 @@ void HighlightWindowEffect::propertyNotify( EffectWindow* w, long a )
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() )

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>490</width>
<height>332</height>
<width>541</width>
<height>305</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
@ -19,186 +19,211 @@
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>General</string>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>List windows:</string>
</property>
<property name="buddy">
<cstring>listModeCombo</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="KComboBox" name="listModeCombo">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text">
<string>Current Desktop</string>
</property>
</item>
<item>
<property name="text">
<string>All Desktops</string>
</property>
</item>
<item>
<property name="text">
<string>Current Desktop Grouped by Applications</string>
</property>
</item>
<item>
<property name="text">
<string>All Desktops Grouped by Applications</string>
</property>
</item>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Sort order:</string>
</property>
<property name="buddy">
<cstring>switchingModeCombo</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="KComboBox" name="switchingModeCombo">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text">
<string>Recently used</string>
</property>
</item>
<item>
<property name="text">
<string>Stacking order</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="showDesktopBox">
<property name="toolTip">
<string>Adds an entry to minimize all windows.</string>
</property>
<property name="text">
<string>Include desktop</string>
</property>
<layout class="QFormLayout" name="formLayout_2">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>List windows:</string>
</property>
<property name="buddy">
<cstring>listModeCombo</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="KComboBox" name="listModeCombo">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text">
<string>Current Desktop</string>
</property>
</item>
<item>
<property name="text">
<string>All Desktops</string>
</property>
</item>
<item>
<property name="text">
<string>Current Desktop Grouped by Applications</string>
</property>
</item>
<item>
<property name="text">
<string>All Desktops Grouped by Applications</string>
</property>
</item>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Sort order:</string>
</property>
<property name="buddy">
<cstring>switchingModeCombo</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="KComboBox" name="switchingModeCombo">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text">
<string>Recently used</string>
</property>
</item>
<item>
<property name="text">
<string>Stacking order</string>
</property>
</item>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QCheckBox" name="showOutlineCheck">
<property name="text">
<string>Show outline of selected window</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Effect:</string>
</property>
<property name="buddy">
<cstring>effectCombo</cstring>
</property>
</widget>
</item>
<item row="4" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="KComboBox" name="effectCombo">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>The effect to replace the list window when desktop effects are active.</string>
</property>
</widget>
</item>
<item>
<widget class="KPushButton" name="effectConfigButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="KPushButton" name="effectInfoButton"/>
</item>
</layout>
</item>
<item row="2" column="0" colspan="2">
<widget class="QCheckBox" name="showDesktopBox">
<property name="toolTip">
<string>Adds an entry to minimize all windows.</string>
</property>
<property name="text">
<string>Include desktop</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="showTabBox">
<property name="title">
<string>Display list while switching</string>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" colspan="2">
<widget class="QCheckBox" name="highlightWindowCheck">
<property name="toolTip">
<string>The currently selected window will be highlighted by fading out all other windows. This option requires desktop effects to be active.</string>
</property>
<property name="text">
<string>Highlight selected window</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="KPushButton" name="layoutConfigButton">
<property name="text">
<string>Configure Layout...</string>
</property>
</widget>
</item>
<item row="1" column="1">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QCheckBox" name="highlightWindowCheck">
<property name="toolTip">
<string>The currently selected window will be highlighted by fading out all other windows. This option requires desktop effects to be active.</string>
</property>
<property name="text">
<string>Highlight selected window</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="showOutlineCheck">
<property name="text">
<string>Show outline of selected window</string>
</property>
</widget>
</item>
<item>
<layout class="QFormLayout" name="formLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Effect:</string>
</property>
<property name="buddy">
<cstring>effectCombo</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="KComboBox" name="effectCombo">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>The effect to replace the list window when desktop effects are active.</string>
</property>
</widget>
</item>
<item>
<widget class="KPushButton" name="effectConfigButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="KPushButton" name="effectInfoButton"/>
</item>
</layout>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,1,0,2">
<item>
<widget class="QCheckBox" name="showTabBox">
<property name="text">
<string>Display list while switching</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="KPushButton" name="layoutConfigButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Configure Layout...</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
@ -238,9 +263,24 @@
<tabstop>effectCombo</tabstop>
<tabstop>effectConfigButton</tabstop>
<tabstop>effectInfoButton</tabstop>
<tabstop>showTabBox</tabstop>
<tabstop>highlightWindowCheck</tabstop>
</tabstops>
<resources/>
<connections/>
<connections>
<connection>
<sender>showTabBox</sender>
<signal>toggled(bool)</signal>
<receiver>layoutConfigButton</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>81</x>
<y>211</y>
</hint>
<hint type="destinationlabel">
<x>295</x>
<y>216</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -457,21 +457,14 @@ void Workspace::lowerClientRequest( Client* c, NET::RequestSource src, Time /*ti
lowerClientWithinApplication( c );
}
void Workspace::restackClientUnderActive( Client* c )
{
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 ))
void Workspace::restack( Client* c, Client* under )
{
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
@ -479,7 +472,7 @@ void Workspace::restackClientUnderActive( Client* c )
it != unconstrained_stacking_order.end();
++it )
{ // TODO ignore topmenus?
if( Client::belongToSameApplication( active_client, *it ))
if( Client::belongToSameApplication( under, *it ))
{
if( *it != c )
{
@ -495,12 +488,12 @@ void Workspace::restackClientUnderActive( Client* c )
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
@ -509,7 +502,7 @@ void Workspace::restackClientUnderActive( Client* c )
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;
@ -519,12 +512,12 @@ void Workspace::restackClientUnderActive( Client* c )
}
}
// 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
{
@ -533,7 +526,7 @@ void Workspace::restackClientUnderActive( Client* c )
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;
@ -544,6 +537,18 @@ void Workspace::restackClientUnderActive( Client* c )
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 )

View File

@ -54,6 +54,8 @@ class TabBoxHandlerImpl : public TabBoxHandler
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 @@ class TabBox : public QObject
void nextPrev( bool next = true);
void delayedShow();
void hide();
void hide( bool abort = false );
void refDisplay();
void unrefDisplay();

View File

@ -39,6 +39,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// KDE
#include <KDebug>
#include <KStandardDirs>
#include <KWindowSystem>
namespace KWin
{
@ -48,7 +49,7 @@ namespace TabBox
class TabBoxHandlerPrivate
{
public:
TabBoxHandlerPrivate();
TabBoxHandlerPrivate( TabBoxHandler *q );
~TabBoxHandlerPrivate();
@ -67,12 +68,13 @@ class TabBoxHandlerPrivate
/**
* 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 @@ class TabBoxHandlerPrivate
*/
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,45 @@ void TabBoxHandlerPrivate::updateHighlightWindows()
{
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 );
// TODO lastRaisedClient->setMinimized( lastRaisedClientWasMinimized );
}
lastRaisedClient = currentClient;
if( lastRaisedClient )
{
// TODO 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 +288,16 @@ void TabBoxHandlerPrivate::updateHighlightWindows()
reinterpret_cast<unsigned char *>(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 +455,7 @@ TabBoxHandler::TabBoxHandler()
: QObject()
{
KWin::TabBox::tabBox = this;
d = new TabBoxHandlerPrivate;
d = new TabBoxHandlerPrivate( this );
}
TabBoxHandler::~TabBoxHandler()
@ -448,6 +492,8 @@ void TabBoxHandler::setConfig( const TabBoxConfig& config )
void TabBoxHandler::show()
{
d->isShown = true;
d->lastRaisedClient = 0;
d->lastRaisedClientSucc = 0;
// show the outline
if( d->config.isShowOutline() )
{
@ -457,19 +503,19 @@ void TabBoxHandler::show()
{
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 +623,7 @@ void TabBoxHandler::setCurrentIndex( const QModelIndex& index )
{
d->updateOutline();
}
if( d->config.isShowTabBox() && d->config.isHighlightWindows() )
if( d->config.isHighlightWindows() )
{
d->updateHighlightWindows();
}

View File

@ -136,6 +136,18 @@ class TabBoxHandler : public QObject
* @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
*/
@ -191,7 +203,7 @@ class TabBoxHandler : public QObject
* Removes the outline if active.
* @see show
*/
void hide();
void hide( bool abort = false );
/**
* Sets the current model index in the view and updates

View File

@ -158,6 +158,7 @@ class Workspace : public QObject, public KDecorationDefines
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 );
@ -358,7 +359,7 @@ class Workspace : public QObject, public KDecorationDefines
int previousDesktopStatic( int iDesktop ) const;
void refTabBox();
void unrefTabBox();
void closeTabBox();
void closeTabBox( bool abort = false );
// Tabbing
void addClientGroup( ClientGroup* group );