Wrong (?) usage of deprecated and usage of setActiveWindow vs. activateWindow (was: Re: kdelibs/kdecore)

Lubos Lunak l.lunak at suse.cz
Wed Oct 29 14:27:38 GMT 2003


On Monday 27 of October 2003 20:49, Ingo Klöcker wrote:
> On Monday 27 October 2003 14:55, Lubos Lunak wrote:
> > On Saturday 25 of October 2003 15:56, Ingo Klöcker wrote:
[snip]
>
> > Not that it really explains the matter in detail, because it can get
> > a bit complicated and it wouldn't quite fit there - an attempt to
> > explain that in detail is a section in kdebase/kwin/README.
>
> The explanation should be part of the API, e.g. in the Detailed
> Description of the KWin class, and not "hidden" in some README. Is it
> really in kdebase/kwin? I would have never looked there because the
> KWin class is in kdelibs/kdecore.

 I cannot put the whole explanation in kwin.h, it's way too long. But I guess 
I could at least mention it.

>
> > > 1. The user clicks on KMail's system tray icon -> KMail's main
> > > window should be activated.
> >
> >  Use KSystemTray.
>
> We use KSystemTray, but we can't use it for activation because KMail
> needs a more sophisticated behavior. Anyway, I'll have a look at how
> KSystemTray does it.
>
> > > 2. The user wants to search for messages and presses 's'. In case
> > > the search window is already open it should be activated.
> >
> >  "applications should use activateWindow()"
>
> Okay, but does it even matter? AFAIU the stuff about "focus stealing" in
> the REAME it's pretty much irrelevant whether we use setActiveWindow()
> or activateWindow() because there's no other application involved so
> that KWin's "focus stealing prevention" doesn't come into play.

 It does. If the application is the active one, setActiveWindow() and 
activateWindow() are really the same. But if not, then setActiveWindow() will 
activate the window anyway, while activateWindow() will not. That's why the 
sooner one is for pagers etc., which indeed should always do that, while 
activateWindow() is for the latter, because applications should not get 
activated whenever they feel like they should. E.g. if you decided KMail 
should activate its main window after every new mail check if there's new 
mail, you'd get a lot of hate mails from people using periodic mail check if 
you used setActiveWindow(), while with activateWindow() KWin would step in 
and refuse activation.

>
> > > 3. The user starts KMail a second time
> >
> >  Hmm, the a bit complicated case. Use KUniqueApplication. If you
> > insist on doing it yourself for some strange reason, consult
> > KStartupInfo::setNewStartupId().
>
> Yeah. We are of course using KUniqueApplication.

 Then you don't need to mess with activating the windows at all, do you?

>
> > > or the dcop call openReader is
> > > used -> KMail's main window should be activated.
> >
> >  Even more complicated, probably worth reading the relevant part of
> > kwin's README. I don't know what openReader() is exactly supposed to
> > be. You'll have to explain what it is, or you'll have to consult the
> > README. Maybe both ... I invented this stuff few months back, and I'm
> > still unsure about few details myself.
>
> Okay, I read kwin's README. openReader() is supposed to open KMail's
> main window. Currently I can't think of a reason why it should be ever
> called by anyone. I guess I'll just use activateWindow() until someone
> shows up with a valid complaint.


-- 
Lubos Lunak
KDE developer
---------------------------------------------------------------------
SuSE CR, s.r.o.  e-mail: l.lunak at suse.cz , l.lunak at kde.org
Drahobejlova 27  tel: +420 2 9654 2373
190 00 Praha 9   fax: +420 2 9654 2374
Czech Republic   http://www.suse.cz/





More information about the kde-core-devel mailing list