[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdebase/workspace
From:       Chani Armitage <chanika () gmail ! com>
Date:       2010-12-16 20:14:22
Message-ID: 20101216201422.DD784AC8A8 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1207069 by chani:

Merge branch 'allactivities'

 M  +33 -3     kwin/client.cpp  
 M  +6 -0      kwin/client.h  
 M  +26 -3     kwin/manage.cpp  
 M  +10 -0     kwin/sm.cpp  
 M  +0 -5      kwin/workspace.h  
 M  +1 -1      libs/taskmanager/task.cpp  


--- trunk/KDE/kdebase/workspace/kwin/client.cpp #1207068:1207069
@@ -128,6 +128,8 @@
     , demandAttentionKNotifyTimer( NULL )
     , paintRedirector( 0 )
     , electricMaximizing( false )
+    , activitiesDefined( false )
+    , needsSessionInteract(false)
     { // TODO: Do all as initialization
     
     scriptCache = new QHash<QScriptEngine*, ClientResolution>();
@@ -1607,6 +1609,9 @@
  */
 int Client::desktop() const
     {
+    if (needsSessionInteract) {
+        return NET::OnAllDesktops;
+    }
     return desk;
     }
 
@@ -1617,6 +1622,9 @@
  */
 QStringList Client::activities() const
     {
+    if (needsSessionInteract) {
+        return QStringList();
+    }
     return activityList;
     }
 
@@ -1646,7 +1654,8 @@
     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 @@
     {
     QStringList newActivitiesList;
     QByteArray prop = getStringProperty(window(), atoms->activities);
-    if ( ! prop.isEmpty() )
+    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 @@
     setOnActivities( newActivitiesList );
     }
 
+void Client::setSessionInteract(bool needed)
+{
+    needsSessionInteract = needed;
+}
+
 } // namespace
 
 #include "client.moc"
--- trunk/KDE/kdebase/workspace/kwin/client.h #1207068:1207069
@@ -400,6 +400,9 @@
 
         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 @@
         friend class SWrapper::Client;
 
         void checkActivities();
+        bool activitiesDefined; //whether the x property was actually set
+
+        bool needsSessionInteract;
     };
 
 /**
--- trunk/KDE/kdebase/workspace/kwin/manage.cpp #1207068:1207069
@@ -207,7 +207,7 @@
             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 @@
         else
             allow = workspace()->allowClientActivation( this, userTime(), false );
 
-        // If session saving, force showing new windows (i.e. "save file?" dialogs \
etc.) +        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() && !isMapped && !session && ( allow || \
workspace()->sessionSaving() )) +                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();
--- trunk/KDE/kdebase/workspace/kwin/sm.cpp #1207068:1207069
@@ -134,6 +134,7 @@
 
 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 @@
         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"
--- trunk/KDE/kdebase/workspace/kwin/workspace.h #1207068:1207069
@@ -1246,11 +1246,6 @@
     session_saving = true;
     }
 
-inline void Workspace::sessionSaveDone()
-    {
-    session_saving = false;
-    }
-
 inline bool Workspace::sessionSaving() const
     {
     return session_saving;
--- trunk/KDE/kdebase/workspace/libs/taskmanager/task.cpp #1207068:1207069
@@ -679,7 +679,7 @@
     unsigned long properties[] = { 0, NET::WM2Activities };
     NETWinInfo info(QX11Info::display(), d->win, QX11Info::appRootWindow(), \
properties, 2);  QString result(info.activities());
-    if (result.isEmpty()) {
+    if (result.isEmpty() || result == "ALL") {
         d->activities.clear();
     } else {
         d->activities = result.split(',');


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic