[prev in list] [next in list] [prev in thread] [next in thread]
List: kwin
Subject: [PATCH] Make TabBox raise selected window (NO effect)
From: Thomas =?iso-8859-1?q?L=FCbking?= <thomas.luebking () web ! de>
Date: 2010-08-27 20:31:12
Message-ID: 201008272231.13158.thomas.luebking () web ! de
[Download RAW message or body]
Reason:
Deactivate compositing, use alt+tab ... also fixes bug #227344
Background:
The tabbox does no more activate the current window. Though (initially?) for
performance reasons this is actually proper behaviour, however neither the
windowlist (if actually used: tiny icons and nasty long strings :-) nor the
outlining can compensate this at all.
Function: "Poor mans Highlight effect"
Raises client on selection, re-stack when deselected, before raising the next.
(ie. except for the selected one the stack position does not change)
Notes:
- might or might not be bound to the usage of the tabbox list
- the "Workspace::restack()" function might be of use to implement the TODO in
a similar client function, but i don't know how that parameter "Above" should
be treated.
Cheers,
Thomas
["raise_selected_window.diff" (application/octet-stream)]
Index: tabbox.cpp
===================================================================
--- tabbox.cpp (Revision 1167387)
+++ tabbox.cpp (Arbeitskopie)
@@ -180,7 +180,19 @@
}
return ret;
}
+
+void TabBoxHandlerImpl::raiseClient( TabBoxClient* c ) const
+ {
+ Workspace::self()->raiseClient( static_cast<TabBoxClientImpl*>(c)->client() );
+ }
+void TabBoxHandlerImpl::restack( TabBoxClient *c, TabBoxClient *under )
+{
+ Workspace::self()->restack( static_cast<TabBoxClientImpl*>(c)->client(),
+ static_cast<TabBoxClientImpl*>(under)->client() );
+}
+
+
TabBoxClient* TabBoxHandlerImpl::desktopClient() const
{
foreach( const Client* client, Workspace::self()->stackingOrder() )
Index: tabbox.h
===================================================================
--- tabbox.h (Revision 1167387)
+++ 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;
};
Index: workspace.h
===================================================================
--- workspace.h (Revision 1167387)
+++ 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 );
Index: tabbox/tabboxhandler.cpp
===================================================================
--- tabbox/tabboxhandler.cpp (Revision 1167387)
+++ tabbox/tabboxhandler.cpp (Arbeitskopie)
@@ -87,11 +87,14 @@
*/
bool isShown;
QMap< QString, ItemLayoutConfig > tabBoxLayouts;
+ TabBoxClient *lastRaisedClient, *lastRaisedClientSucc;
};
TabBoxHandlerPrivate::TabBoxHandlerPrivate()
{
isShown = false;
+ lastRaisedClient = 0;
+ lastRaisedClientSucc = 0;
config = TabBoxConfig();
view = new TabBoxView();
XSetWindowAttributes attr;
@@ -448,6 +451,8 @@
void TabBoxHandler::show()
{
d->isShown = true;
+ d->lastRaisedClient = 0;
+ d->lastRaisedClientSucc = 0;
// show the outline
if( d->config.isShowOutline() )
{
@@ -467,6 +472,8 @@
void TabBoxHandler::hide()
{
d->isShown = false;
+ d->lastRaisedClient = 0;
+ d->lastRaisedClientSucc = 0;
if( d->config.isHighlightWindows() )
{
d->endHighlightWindows();
@@ -573,6 +580,17 @@
d->index = index;
if( d->config.tabBoxMode() == TabBoxConfig::ClientTabBox )
{
+ if ( d->lastRaisedClient && d->lastRaisedClientSucc )
+ restack( d->lastRaisedClient, d->lastRaisedClientSucc );
+
+ d->lastRaisedClient = client( index );
+ if ( d->lastRaisedClient )
+ {
+ TabBoxClientList order = stackingOrder();
+ int succIdx = order.indexOf( d->lastRaisedClient ) + 1; // this is \
likely related to the index parameter?! + d->lastRaisedClientSucc = ( \
succIdx < order.count() ) ? order.at( succIdx ) : 0; + raiseClient( \
d->lastRaisedClient ); + }
if( d->config.isShowOutline() )
{
d->updateOutline();
Index: tabbox/tabboxhandler.h
===================================================================
--- tabbox/tabboxhandler.h (Revision 1167387)
+++ 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;
Index: layers.cpp
===================================================================
--- layers.cpp (Revision 1167387)
+++ 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 )
_______________________________________________
kwin mailing list
kwin@kde.org
https://mail.kde.org/mailman/listinfo/kwin
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic