From kde-devel Thu May 03 18:13:22 2012 From: Weng Xuetian Date: Thu, 03 May 2012 18:13:22 +0000 To: kde-devel Subject: Re: create activity aware application Message-Id: X-MARC-Message: https://marc.info/?l=kde-devel&m=133606895417181 On Fri, May 4, 2012 at 12:56 AM, David Narvaez wrote: > On Wed, May 2, 2012 at 11:21 AM, Weng Xuetian wrote: >> >> Hi kde world, >> Currently kde have activity that can easily stop and save session. But >> unfortunately there are several issue. >> 1. multi window but single-process application does not work with stop >> activity. >> For example konsole, if we have two konsole window in different >> activity, stop one activity will not stop konsole in the other >> acitivity. >> 2. application does not support save session. >> For example firefox, the window will remain in other activity and stay >> there. >> >> One of the problem is krunner search all window even in stopped >> activity. That might could be think as a bug though. >> >> I wonder if there is a way to make application activity aware from >> code level. That's to say, patch them, even only for KDE level would >> be great as first step, for example, rekonq and konsole and many other >> application will be able to benefit from activity. Is there any >> possible approach right now? > > I implemented activity awareness in Rekonq a couple of months ago. > While working at it, I noticed that many activity-related behaviors > can be easily confused with bugs. For example, suppose an application > has 3 windows open in 3 different activities at logout, but does not > restore the 3 windows on session restore. Then, if you have a window > in one activity and you open a new window from that application, it > will probably be displayed in another activity and the user may think > the window was never opened at all. I gave a lot of thought to that > issue and finally concluded that incorrect session restore code should > be considered a bug in the application and not a bug in Activities > code. > >> If not, should something like "KActivityAwareApplication" to be done >> in order to let developer easily implement this feature? > > How would a "KActivityAwareApplication" be different from a > KApplication? Activity awareness depends very much on the specific > purpose of the application, I think. > > David E. Narvaez > I think the problem is application don't actually know the relationship between window and activity. Let start with this, even for rekonq it doesn't really works. Start open rekonq window in two different activity A and B, then stop activity B. You can close rekonq in activity A, but the rekonq in "stopped" activity B will not actually exit. This is a problem specially for KUniqueApplication with multiple window, they simply not work with activity. Somehow I thought something like activityStopped should be add to KApplication or use a different new class, and told application which window in this activity need to be cared about. I think this might be a problem that make activity not very usable, though the concept is great because people cannot trust activity and don't know when it will work and when it not. I don't know what is the right way, but I think it can be done like this. KWin know the relation between activity and window, so when a activity are going to stop, it notify the application (maybe find application by pid) which activity is going to stop, and what are the windows inside it (maybe by winId). Application can then try to do the save state or move window to other activity. >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<