From kde-commits Thu Dec 16 20:29:19 2010 From: Chani Date: Thu, 16 Dec 2010 20:29:19 +0000 To: kde-commits Subject: Re: KDE/kdebase/workspace Message-Id: X-MARC-Message: https://marc.info/?l=kde-commits&m=129253139225666 sorry, git-svn fail. :( this was actually several commits on two subjects, and should have shown up as such; I'm not sure why it didn't. most of the commits were for better showing of SessionInteract windows; one was for allowing 'ALL' to mean "on all activities" in the x property (as opposed to an empty string, which now only means "this window hasn't thought about it yet" :) here's the git log for the branch (which had itself suffered a merge accident, so it's a bit confused): commit aff3b4c38f086f3abe9b01178e297189cc4edf65 Author: Chani Armitage Date: Thu Dec 16 21:03:11 2010 +0100 show the parent of the sessioninteract window too. it's usually the window with the unsaved document the dialog is asking about. commit 6830301fc03e52a15718fec4a4615f4729b13b20 Author: Chani Armitage Date: Thu Dec 16 12:01:31 2010 +0100 incorporate the 'allow' thing more nicely. it still won't change activities to satisfy that; I'm not convinced it should. commit 0fbc44e8a79fdb4f381b13f350d821c29601a0ef Merge: f9f179b 5a02e44 Author: Chani Armitage Date: Thu Dec 16 11:19:39 2010 +0100 Merge branches 'allactivities' and 'kwin-wip' into allactivities Conflicts: kwin/client.cpp kwin/client.h commit f9f179b4a0c9d2f8a2eb40eb0c858475e123ee01 Author: Chani Armitage Date: Thu Dec 16 11:13:14 2010 +0100 allow windows to be explicitly on all activities, or have no preference. commit 5a02e448d49755873651a5341c73f517e2ee0217 Author: Chani Armitage Date: Mon Dec 13 11:59:28 2010 +0100 unfinished stuff for fixing the sessioninteract request On Thu, Dec 16, 2010 at 9:14 PM, Chani Armitage wrote: > 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(); > @@ -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(','); > -- This message brought to you by evyl bananas and the number 3. www.chani3.com