Merge branch 'allactivities'

svn path=/trunk/KDE/kdebase/workspace/; revision=1207069
This commit is contained in:
Chani Armitage 2010-12-16 20:14:22 +00:00
parent 1eea0dee70
commit 7ce380497f
5 changed files with 79 additions and 15 deletions

View file

@ -128,6 +128,8 @@ Client::Client( Workspace* ws )
, demandAttentionKNotifyTimer( NULL )
, paintRedirector( 0 )
, electricMaximizing( false )
, activitiesDefined( false )
, needsSessionInteract(false)
{ // TODO: Do all as initialization
scriptCache = new QHash<QScriptEngine*, ClientResolution>();
@ -1606,9 +1608,12 @@ void Client::updateActivities( bool includeTransients )
* isOnDesktop() instead.
*/
int Client::desktop() const
{
return desk;
{
if (needsSessionInteract) {
return NET::OnAllDesktops;
}
return desk;
}
/**
* Returns the list of activities the client window is on.
@ -1617,6 +1622,9 @@ int Client::desktop() const
*/
QStringList Client::activities() const
{
if (needsSessionInteract) {
return QStringList();
}
return activityList;
}
@ -1646,7 +1654,8 @@ void Client::setOnAllActivities( bool on )
if( on )
{
activityList.clear();
XDeleteProperty( display(), window(), atoms->activities );
XChangeProperty(display(), window(), atoms->activities, XA_STRING, 8,
PropModeReplace, (const unsigned char *)"ALL", 3);
updateActivities( true );
}
else
@ -2247,9 +2256,25 @@ void Client::checkActivities()
{
QStringList newActivitiesList;
QByteArray prop = getStringProperty(window(), atoms->activities);
if ( ! prop.isEmpty() )
newActivitiesList = QString(prop).split(',');
activitiesDefined = !prop.isEmpty();
if (prop == "ALL") {
//copied from setOnAllActivities to avoid a redundant XChangeProperty.
if (!activityList.isEmpty()) {
activityList.clear();
updateActivities( true );
}
return;
}
if (prop.isEmpty()) {
//note: this makes it *act* like it's on all activities but doesn't set the property to 'ALL'
if (!activityList.isEmpty()) {
activityList.clear();
updateActivities( true );
}
return;
}
newActivitiesList = QString(prop).split(',');
if (newActivitiesList == activityList)
return; //expected change, it's ok.
@ -2272,6 +2297,11 @@ void Client::checkActivities()
setOnActivities( newActivitiesList );
}
void Client::setSessionInteract(bool needed)
{
needsSessionInteract = needed;
}
} // namespace
#include "client.moc"

View file

@ -400,6 +400,9 @@ class Client
TabBox::TabBoxClientImpl* tabBoxClient() const { return m_tabBoxClient; }
//sets whether the client should be treated as a SessionInteract window
void setSessionInteract(bool needed);
private slots:
void autoRaise();
void shadeHover();
@ -694,6 +697,9 @@ class Client
friend class SWrapper::Client;
void checkActivities();
bool activitiesDefined; //whether the x property was actually set
bool needsSessionInteract;
};
/**

View file

@ -207,7 +207,7 @@ bool Client::manage( Window w, bool isMapped )
desk = info->desktop(); // Window had the initial desktop property, force it
if( desktop() == 0 && asn_valid && asn_data.desktop() != 0 )
desk = asn_data.desktop();
if (!isMapped && !noborder && isNormalWindow() && isOnAllActivities()) {
if (!isMapped && !noborder && isNormalWindow() && !activitiesDefined) {
//a new, regular window, when we're not recovering from a crash,
//and it hasn't got an activity. let's try giving it the current one.
//TODO: decide whether to keep this before the 4.6 release
@ -551,10 +551,33 @@ bool Client::manage( Window w, bool isMapped )
else
allow = workspace()->allowClientActivation( this, userTime(), false );
// If session saving, force showing new windows (i.e. "save file?" dialogs etc.)
// also force if activation is allowed
if( !isOnCurrentDesktop() && !isMapped && !session && ( allow || workspace()->sessionSaving() ))
workspace()->setCurrentDesktop( desktop() );
if (!(isMapped || session)) {
if (workspace()->sessionSaving()) {
/*
* If we get a new window during session saving, we assume it's some 'save file?' dialog
* which the user really needs to see (to know why logout's stalled).
* We also assume it'll be destroyed when it's done - we never unset this flag.
*
* Given the current session management protocol, I can't see a nicer way of doing this.
* Someday I'd like to see a protocol that tells the windowmanager who's doing SessionInteract.
*/
needsSessionInteract = true;
//show the parent too
ClientList mainclients = mainClients();
for( ClientList::ConstIterator it = mainclients.constBegin();
it != mainclients.constEnd(); ++it ) {
(*it)->setSessionInteract(true);
}
} else if (allow) {
// also force if activation is allowed
if( !isOnCurrentDesktop() ) {
workspace()->setCurrentDesktop( desktop() );
}
/*if (!isOnCurrentActivity()) {
workspace()->setCurrentActivity( activities().first() );
} FIXME no such method*/
}
}
bool belongs_to_desktop = false;
for( ClientList::ConstIterator it = group()->members().constBegin();

10
sm.cpp
View file

@ -134,6 +134,7 @@ void Workspace::storeSession( KConfig* config, SMSavePhase phase )
void Workspace::storeClient( KConfigGroup &cg, int num, Client *c )
{
c->setSessionInteract(false); //make sure we get the real values
QString n = QString::number(num);
cg.writeEntry( QString("sessionId")+n, c->sessionId().constData() );
cg.writeEntry( QString("windowRole")+n, c->windowRole().constData() );
@ -613,6 +614,15 @@ void SessionSaveDoneHelper::processData()
IceProcessMessages( SmcGetIceConnection( conn ), 0, 0 );
}
void Workspace::sessionSaveDone()
{
session_saving = false;
//remove sessionInteract flag from all clients
foreach( Client* c, clients ) {
c->setSessionInteract(false);
}
}
} // namespace
#include "sm.moc"

View file

@ -1246,11 +1246,6 @@ inline void Workspace::sessionSaveStarted()
session_saving = true;
}
inline void Workspace::sessionSaveDone()
{
session_saving = false;
}
inline bool Workspace::sessionSaving() const
{
return session_saving;