Don't accidentally set _NET_ACTIVE_WINDOW to 0 when there is an active window.
And r612728 from 3.5 branch. svn path=/trunk/KDE/kdebase/workspace/; revision=630817
This commit is contained in:
parent
1cdcd8956f
commit
12478151a2
2 changed files with 50 additions and 104 deletions
|
@ -29,7 +29,6 @@ License. See the file "COPYING" for the exact licensing terms.
|
||||||
#include "atoms.h"
|
#include "atoms.h"
|
||||||
#include "group.h"
|
#include "group.h"
|
||||||
#include "rules.h"
|
#include "rules.h"
|
||||||
#include "effects.h"
|
|
||||||
#include <QX11Info>
|
#include <QX11Info>
|
||||||
|
|
||||||
namespace KWinInternal
|
namespace KWinInternal
|
||||||
|
@ -222,8 +221,8 @@ void Workspace::setActiveClient( Client* c, allowed_t )
|
||||||
++set_active_client_recursion;
|
++set_active_client_recursion;
|
||||||
if( active_client != NULL )
|
if( active_client != NULL )
|
||||||
{ // note that this may call setActiveClient( NULL ), therefore the recursion counter
|
{ // note that this may call setActiveClient( NULL ), therefore the recursion counter
|
||||||
active_client->setActive( false );
|
active_client->setActive( false );
|
||||||
}
|
}
|
||||||
active_client = c;
|
active_client = c;
|
||||||
Q_ASSERT( c == NULL || c->isActive());
|
Q_ASSERT( c == NULL || c->isActive());
|
||||||
if( active_client != NULL )
|
if( active_client != NULL )
|
||||||
|
@ -246,8 +245,6 @@ void Workspace::setActiveClient( Client* c, allowed_t )
|
||||||
|
|
||||||
rootInfo->setActiveWindow( active_client? active_client->window() : 0 );
|
rootInfo->setActiveWindow( active_client? active_client->window() : 0 );
|
||||||
updateColormap();
|
updateColormap();
|
||||||
if( effects )
|
|
||||||
effects->windowActivated( active_client ? active_client->effectWindow() : NULL );
|
|
||||||
--set_active_client_recursion;
|
--set_active_client_recursion;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -266,6 +263,7 @@ void Workspace::activateClient( Client* c, bool force )
|
||||||
{
|
{
|
||||||
if( c == NULL )
|
if( c == NULL )
|
||||||
{
|
{
|
||||||
|
focusToNull();
|
||||||
setActiveClient( NULL, Allowed );
|
setActiveClient( NULL, Allowed );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -700,7 +698,7 @@ void Client::demandAttentionKNotify()
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO I probably shouldn't be lazy here and do it without the macro, so that people can read it
|
// TODO I probably shouldn't be lazy here and do it without the macro, so that people can read it
|
||||||
KWIN_COMPARE_PREDICATE( SameApplicationActiveHackPredicate, Client, const Client*,
|
KWIN_COMPARE_PREDICATE( SameApplicationActiveHackPredicate, const Client*,
|
||||||
// ignore already existing splashes, toolbars, utilities, menus and topmenus,
|
// ignore already existing splashes, toolbars, utilities, menus and topmenus,
|
||||||
// as the app may show those before the main window
|
// as the app may show those before the main window
|
||||||
!cl->isSplash() && !cl->isToolbar() && !cl->isTopMenu() && !cl->isUtility() && !cl->isMenu()
|
!cl->isSplash() && !cl->isToolbar() && !cl->isTopMenu() && !cl->isUtility() && !cl->isMenu()
|
||||||
|
|
144
workspace.cpp
144
workspace.cpp
|
@ -43,10 +43,6 @@ License. See the file "COPYING" for the exact licensing terms.
|
||||||
#include "group.h"
|
#include "group.h"
|
||||||
#include "rules.h"
|
#include "rules.h"
|
||||||
#include "kwinadaptor.h"
|
#include "kwinadaptor.h"
|
||||||
#include "unmanaged.h"
|
|
||||||
#include "scene.h"
|
|
||||||
#include "deleted.h"
|
|
||||||
#include "effects.h"
|
|
||||||
|
|
||||||
#include <X11/extensions/shape.h>
|
#include <X11/extensions/shape.h>
|
||||||
#include <X11/keysym.h>
|
#include <X11/keysym.h>
|
||||||
|
@ -98,7 +94,6 @@ Workspace::Workspace( bool restore )
|
||||||
popupinfo (0),
|
popupinfo (0),
|
||||||
popup (0),
|
popup (0),
|
||||||
advanced_popup (0),
|
advanced_popup (0),
|
||||||
trans_popup (0),
|
|
||||||
desk_popup (0),
|
desk_popup (0),
|
||||||
desk_popup_index (0),
|
desk_popup_index (0),
|
||||||
keys (0),
|
keys (0),
|
||||||
|
@ -128,17 +123,12 @@ Workspace::Workspace( bool restore )
|
||||||
topmenu_space( NULL ),
|
topmenu_space( NULL ),
|
||||||
set_active_client_recursion( 0 ),
|
set_active_client_recursion( 0 ),
|
||||||
block_stacking_updates( 0 ),
|
block_stacking_updates( 0 ),
|
||||||
forced_global_mouse_grab( false ),
|
forced_global_mouse_grab( false )
|
||||||
cm_selection( NULL ),
|
|
||||||
compositeRate( 0 ),
|
|
||||||
damage_region( None ),
|
|
||||||
overlay( None ),
|
|
||||||
transSlider( NULL ),
|
|
||||||
transButton( NULL )
|
|
||||||
{
|
{
|
||||||
(void) new KWinAdaptor( this );
|
(void) new KWinAdaptor( this );
|
||||||
QDBusConnection::sessionBus().registerObject("/KWin", this);
|
QDBusConnection dbus = QDBusConnection::sessionBus();
|
||||||
|
dbus.registerObject("/KWin", this);
|
||||||
|
dbus.connect(QString(), "/KWin", "org.kde.KWin", "reloadConfig", this, SLOT(slotReloadConfig()));
|
||||||
_self = this;
|
_self = this;
|
||||||
mgr = new PluginMgr;
|
mgr = new PluginMgr;
|
||||||
root = rootWindow();
|
root = rootWindow();
|
||||||
|
@ -179,12 +169,10 @@ Workspace::Workspace( bool restore )
|
||||||
ColormapChangeMask |
|
ColormapChangeMask |
|
||||||
SubstructureRedirectMask |
|
SubstructureRedirectMask |
|
||||||
SubstructureNotifyMask |
|
SubstructureNotifyMask |
|
||||||
FocusChangeMask | // for NotifyDetailNone
|
FocusChangeMask // for NotifyDetailNone
|
||||||
ExposureMask
|
|
||||||
);
|
);
|
||||||
|
|
||||||
Extensions::init();
|
Shape::init();
|
||||||
setupCompositing();
|
|
||||||
|
|
||||||
// compatibility
|
// compatibility
|
||||||
long data = 1;
|
long data = 1;
|
||||||
|
@ -333,7 +321,6 @@ void Workspace::init()
|
||||||
connect(&reconfigureTimer, SIGNAL(timeout()), this,
|
connect(&reconfigureTimer, SIGNAL(timeout()), this,
|
||||||
SLOT(slotReconfigure()));
|
SLOT(slotReconfigure()));
|
||||||
connect( &updateToolWindowsTimer, SIGNAL( timeout()), this, SLOT( slotUpdateToolWindows()));
|
connect( &updateToolWindowsTimer, SIGNAL( timeout()), this, SLOT( slotUpdateToolWindows()));
|
||||||
connect( &compositeTimer, SIGNAL( timeout()), SLOT( performCompositing()));
|
|
||||||
|
|
||||||
connect(KGlobalSettings::self(), SIGNAL(appearanceChanged()), this,
|
connect(KGlobalSettings::self(), SIGNAL(appearanceChanged()), this,
|
||||||
SLOT(slotReconfigure()));
|
SLOT(slotReconfigure()));
|
||||||
|
@ -371,11 +358,7 @@ void Workspace::init()
|
||||||
XWindowAttributes attr;
|
XWindowAttributes attr;
|
||||||
XGetWindowAttributes(display(), wins[i], &attr);
|
XGetWindowAttributes(display(), wins[i], &attr);
|
||||||
if (attr.override_redirect )
|
if (attr.override_redirect )
|
||||||
{
|
|
||||||
if( compositing())
|
|
||||||
createUnmanaged( wins[ i ] );
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
if( topmenu_space && topmenu_space->winId() == wins[ i ] )
|
if( topmenu_space && topmenu_space->winId() == wins[ i ] )
|
||||||
continue;
|
continue;
|
||||||
if (attr.map_state != IsUnmapped)
|
if (attr.map_state != IsUnmapped)
|
||||||
|
@ -437,7 +420,6 @@ void Workspace::init()
|
||||||
|
|
||||||
Workspace::~Workspace()
|
Workspace::~Workspace()
|
||||||
{
|
{
|
||||||
finishCompositing();
|
|
||||||
blockStackingUpdates( true );
|
blockStackingUpdates( true );
|
||||||
// TODO grabXServer();
|
// TODO grabXServer();
|
||||||
// use stacking_order, so that kwin --replace keeps stacking order
|
// use stacking_order, so that kwin --replace keeps stacking order
|
||||||
|
@ -447,12 +429,12 @@ Workspace::~Workspace()
|
||||||
{
|
{
|
||||||
// only release the window
|
// only release the window
|
||||||
(*it)->releaseWindow( true );
|
(*it)->releaseWindow( true );
|
||||||
// no removeClient() is called !
|
// No removeClient() is called, it does more than just removing.
|
||||||
|
// However, remove from some lists to e.g. prevent performTransiencyCheck()
|
||||||
|
// from crashing.
|
||||||
|
clients.remove( *it );
|
||||||
|
desktops.remove( *it );
|
||||||
}
|
}
|
||||||
for( UnmanagedList::ConstIterator it = unmanaged.begin();
|
|
||||||
it != unmanaged.end();
|
|
||||||
++it )
|
|
||||||
(*it)->release();
|
|
||||||
delete desktop_widget;
|
delete desktop_widget;
|
||||||
delete tab_box;
|
delete tab_box;
|
||||||
delete popupinfo;
|
delete popupinfo;
|
||||||
|
@ -496,28 +478,6 @@ Client* Workspace::createClient( Window w, bool is_mapped )
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
addClient( c, Allowed );
|
addClient( c, Allowed );
|
||||||
if( scene )
|
|
||||||
scene->windowAdded( c );
|
|
||||||
if( effects )
|
|
||||||
effects->windowAdded( c->effectWindow());
|
|
||||||
return c;
|
|
||||||
}
|
|
||||||
|
|
||||||
Unmanaged* Workspace::createUnmanaged( Window w )
|
|
||||||
{
|
|
||||||
if( w == overlay )
|
|
||||||
return NULL;
|
|
||||||
Unmanaged* c = new Unmanaged( this );
|
|
||||||
if( !c->track( w ))
|
|
||||||
{
|
|
||||||
Unmanaged::deleteUnmanaged( c, Allowed );
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
addUnmanaged( c, Allowed );
|
|
||||||
if( scene )
|
|
||||||
scene->windowAdded( c );
|
|
||||||
if( effects )
|
|
||||||
effects->windowAdded( c->effectWindow());
|
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -558,11 +518,7 @@ void Workspace::addClient( Client* c, allowed_t )
|
||||||
updateStackingOrder( true ); // propagate new client
|
updateStackingOrder( true ); // propagate new client
|
||||||
if( c->isUtility() || c->isMenu() || c->isToolbar())
|
if( c->isUtility() || c->isMenu() || c->isToolbar())
|
||||||
updateToolWindows( true );
|
updateToolWindows( true );
|
||||||
}
|
checkNonExistentClients();
|
||||||
|
|
||||||
void Workspace::addUnmanaged( Unmanaged* c, allowed_t )
|
|
||||||
{
|
|
||||||
unmanaged.append( c );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -619,28 +575,6 @@ void Workspace::removeClient( Client* c, allowed_t )
|
||||||
updateClientArea();
|
updateClientArea();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Workspace::removeUnmanaged( Unmanaged* c, allowed_t )
|
|
||||||
{
|
|
||||||
assert( unmanaged.contains( c ));
|
|
||||||
unmanaged.removeAll( c );
|
|
||||||
}
|
|
||||||
|
|
||||||
void Workspace::addDeleted( Deleted* c, allowed_t )
|
|
||||||
{
|
|
||||||
assert( !deleted.contains( c ));
|
|
||||||
deleted.append( c );
|
|
||||||
}
|
|
||||||
|
|
||||||
void Workspace::removeDeleted( Deleted* c, allowed_t )
|
|
||||||
{
|
|
||||||
assert( deleted.contains( c ));
|
|
||||||
if( scene )
|
|
||||||
scene->windowDeleted( c );
|
|
||||||
if( effects )
|
|
||||||
effects->windowDeleted( c->effectWindow());
|
|
||||||
deleted.removeAll( c );
|
|
||||||
}
|
|
||||||
|
|
||||||
void Workspace::updateFocusChains( Client* c, FocusChainChange change )
|
void Workspace::updateFocusChains( Client* c, FocusChainChange change )
|
||||||
{
|
{
|
||||||
if( !c->wantsTabFocus()) // doesn't want tab focus, remove
|
if( !c->wantsTabFocus()) // doesn't want tab focus, remove
|
||||||
|
@ -666,7 +600,13 @@ void Workspace::updateFocusChains( Client* c, FocusChainChange change )
|
||||||
focus_chain[ i ].prepend( c );
|
focus_chain[ i ].prepend( c );
|
||||||
}
|
}
|
||||||
else if( !focus_chain[ i ].contains( c ))
|
else if( !focus_chain[ i ].contains( c ))
|
||||||
focus_chain[ i ].prepend( c ); // otherwise add as the last one
|
{ // add it after the active one
|
||||||
|
if( active_client != NULL && active_client != c
|
||||||
|
&& !focus_chain[ i ].isEmpty() && focus_chain[ i ].last() == active_client )
|
||||||
|
focus_chain[ i ].insert( focus_chain[ i ].size() - 1, c );
|
||||||
|
else
|
||||||
|
focus_chain[ i ].append( c ); // otherwise add as the first one
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else //now only on desktop, remove it anywhere else
|
else //now only on desktop, remove it anywhere else
|
||||||
|
@ -686,7 +626,13 @@ void Workspace::updateFocusChains( Client* c, FocusChainChange change )
|
||||||
focus_chain[ i ].prepend( c );
|
focus_chain[ i ].prepend( c );
|
||||||
}
|
}
|
||||||
else if( !focus_chain[ i ].contains( c ))
|
else if( !focus_chain[ i ].contains( c ))
|
||||||
focus_chain[ i ].prepend( c );
|
{ // add it after the active one
|
||||||
|
if( active_client != NULL && active_client != c
|
||||||
|
&& !focus_chain[ i ].isEmpty() && focus_chain[ i ].last() == active_client )
|
||||||
|
focus_chain[ i ].insert( focus_chain[ i ].size() - 1, c );
|
||||||
|
else
|
||||||
|
focus_chain[ i ].append( c ); // otherwise add as the first one
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
focus_chain[ i ].removeAll( c );
|
focus_chain[ i ].removeAll( c );
|
||||||
|
@ -703,7 +649,13 @@ void Workspace::updateFocusChains( Client* c, FocusChainChange change )
|
||||||
global_focus_chain.prepend( c );
|
global_focus_chain.prepend( c );
|
||||||
}
|
}
|
||||||
else if( !global_focus_chain.contains( c ))
|
else if( !global_focus_chain.contains( c ))
|
||||||
global_focus_chain.prepend( c );
|
{ // add it after the active one
|
||||||
|
if( active_client != NULL && active_client != c
|
||||||
|
&& !global_focus_chain.isEmpty() && global_focus_chain.last() == active_client )
|
||||||
|
global_focus_chain.insert( global_focus_chain.size() - 1, c );
|
||||||
|
else
|
||||||
|
global_focus_chain.append( c ); // otherwise add as the first one
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Workspace::updateCurrentTopMenu()
|
void Workspace::updateCurrentTopMenu()
|
||||||
|
@ -921,6 +873,11 @@ void Workspace::updateColormap()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Workspace::slotReloadConfig()
|
||||||
|
{
|
||||||
|
reconfigure();
|
||||||
|
}
|
||||||
|
|
||||||
void Workspace::reconfigure()
|
void Workspace::reconfigure()
|
||||||
{
|
{
|
||||||
reconfigureTimer.start( 200 );
|
reconfigureTimer.start( 200 );
|
||||||
|
@ -937,7 +894,7 @@ void Workspace::slotSettingsChanged(int category)
|
||||||
/*!
|
/*!
|
||||||
Reread settings
|
Reread settings
|
||||||
*/
|
*/
|
||||||
KWIN_PROCEDURE( CheckBorderSizesProcedure, Client, cl->checkBorderSizes() );
|
KWIN_PROCEDURE( CheckBorderSizesProcedure, cl->checkBorderSizes() );
|
||||||
|
|
||||||
void Workspace::slotReconfigure()
|
void Workspace::slotReconfigure()
|
||||||
{
|
{
|
||||||
|
@ -994,11 +951,6 @@ void Workspace::slotReconfigure()
|
||||||
updateTopMenuGeometry();
|
updateTopMenuGeometry();
|
||||||
updateCurrentTopMenu();
|
updateCurrentTopMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
if( options->useTranslucency )
|
|
||||||
setupCompositing();
|
|
||||||
else
|
|
||||||
finishCompositing();
|
|
||||||
|
|
||||||
loadWindowRules();
|
loadWindowRules();
|
||||||
for( ClientList::Iterator it = clients.begin();
|
for( ClientList::Iterator it = clients.begin();
|
||||||
|
@ -1281,15 +1233,16 @@ bool Workspace::setCurrentDesktop( int new_desktop )
|
||||||
// and active_client is on_all_desktops and under mouse (hence == old_active_client),
|
// and active_client is on_all_desktops and under mouse (hence == old_active_client),
|
||||||
// conserve focus (thanks to Volker Schatz <V.Schatz at thphys.uni-heidelberg.de>)
|
// conserve focus (thanks to Volker Schatz <V.Schatz at thphys.uni-heidelberg.de>)
|
||||||
else if( active_client && active_client->isShown( true ) && active_client->isOnCurrentDesktop())
|
else if( active_client && active_client->isShown( true ) && active_client->isOnCurrentDesktop())
|
||||||
c= active_client;
|
c = active_client;
|
||||||
|
|
||||||
|
if( c == NULL && !desktops.isEmpty())
|
||||||
|
c = findDesktop( true, currentDesktop());
|
||||||
|
|
||||||
if( c != active_client )
|
if( c != active_client )
|
||||||
setActiveClient( NULL, Allowed );
|
setActiveClient( NULL, Allowed );
|
||||||
|
|
||||||
if ( c )
|
if ( c )
|
||||||
requestFocus( c );
|
requestFocus( c );
|
||||||
else if( !desktops.isEmpty() )
|
|
||||||
requestFocus( findDesktop( true, currentDesktop()));
|
|
||||||
else
|
else
|
||||||
focusToNull();
|
focusToNull();
|
||||||
|
|
||||||
|
@ -1311,10 +1264,6 @@ bool Workspace::setCurrentDesktop( int new_desktop )
|
||||||
|
|
||||||
if( old_desktop != 0 ) // not for the very first time
|
if( old_desktop != 0 ) // not for the very first time
|
||||||
popupinfo->showInfo( desktopName(currentDesktop()) );
|
popupinfo->showInfo( desktopName(currentDesktop()) );
|
||||||
|
|
||||||
if( effects != NULL && old_desktop != 0 )
|
|
||||||
effects->desktopChanged( old_desktop );
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1697,7 +1646,7 @@ void Workspace::slotGrabWindow()
|
||||||
QPixmap snapshot = QPixmap::grabWindow( active_client->frameId() );
|
QPixmap snapshot = QPixmap::grabWindow( active_client->frameId() );
|
||||||
|
|
||||||
//No XShape - no work.
|
//No XShape - no work.
|
||||||
if( Extensions::shapeAvailable())
|
if( Shape::available())
|
||||||
{
|
{
|
||||||
//As the first step, get the mask from XShape.
|
//As the first step, get the mask from XShape.
|
||||||
int count, order;
|
int count, order;
|
||||||
|
@ -1898,7 +1847,7 @@ bool Workspace::keyPressMouseEmulation( XKeyEvent& ev )
|
||||||
bool is_alt = km & Mod1Mask;
|
bool is_alt = km & Mod1Mask;
|
||||||
bool is_shift = km & ShiftMask;
|
bool is_shift = km & ShiftMask;
|
||||||
int delta = is_control?1:is_alt?32:8;
|
int delta = is_control?1:is_alt?32:8;
|
||||||
QPoint pos = cursorPos();
|
QPoint pos = QCursor::pos();
|
||||||
|
|
||||||
switch ( kc )
|
switch ( kc )
|
||||||
{
|
{
|
||||||
|
@ -2050,8 +1999,7 @@ void Workspace::createBorderWindows()
|
||||||
XSetWindowAttributes attributes;
|
XSetWindowAttributes attributes;
|
||||||
unsigned long valuemask;
|
unsigned long valuemask;
|
||||||
attributes.override_redirect = True;
|
attributes.override_redirect = True;
|
||||||
attributes.event_mask = (EnterWindowMask | LeaveWindowMask |
|
attributes.event_mask = ( EnterWindowMask | LeaveWindowMask );
|
||||||
VisibilityChangeMask);
|
|
||||||
valuemask= (CWOverrideRedirect | CWEventMask | CWCursor );
|
valuemask= (CWOverrideRedirect | CWEventMask | CWCursor );
|
||||||
attributes.cursor = XCreateFontCursor(display(),
|
attributes.cursor = XCreateFontCursor(display(),
|
||||||
XC_sb_up_arrow);
|
XC_sb_up_arrow);
|
||||||
|
|
Loading…
Reference in a new issue