System tray "close" dialog needs work

Sébastien Laoût slaout at linux62.org
Fri Jan 7 21:40:27 GMT 2005


Le ven 07/01/2005 à 13:34, Lubos Lunak a écrit :
> > > 	QPoint p = systemtray->mapToGlobal(QPoint(0,0));
> > > 	if (QApplication::desktop()->screenGeometry()->contains(p))
> [...]
>  This is not going to work when the systray icon is obscured by another window 
> (at least, maybe in more cases).

Of course.
And it's not its purpose.
When kicker is hidden, it get out of screen (but still shown).
This code detects the icon has coordinates out of screen.
Nothing more, nothing less.

>  If I'm not mistaken, isVisible() means "show() was called for the widget". 

Yes.

>  I don't see how this should help. Waldo's problem is that the screenshot 
> given is bogus, because the whole systray area is hidden by KMail. How is a 
> pixmap of a systray icon going to help? Besides, the app knows its own icon, 
> so why DCOP?

My idea was to use kapp->widgetAt(g) (where g is a QPoint).
It returns a pointer to a widget at point g, UNTIL the pixel g isn't
owned by any widget/window in the current application.

So, I was wanting to call kapp->widgetAt(g) at each corners of the icon
and if at least eg. 50% is visible, we assume user can recognize the
icon (even if 50% hidden).

But since kapp->widgetAt(g) returns 0, I think kicker itself should do
the calls, and return true or false.

The pixmap idea, if I understand it well, was the same but don't returns
a boolean, but a pixmap or NULL.

>  I think the best possible solution is:
> 1) check the systray icon is within the screen geometry and visible [*] , if 
> yes, simply take the screenshot
> 2) if not, check the systray is managed by Kicker, and if yes, ask Kicker  to 
> apply the standard raise procedure, show the systray icon, then wait for a 
> moment, and try step 1 once more
> 3) bad luck

Yes, of course.
But kicker currently doesn't provide DCOP call to raise it.
Perhapse it can be added to kicker in KDE 3.4?

And, as I said in a previous mail, I tryed to raise kicker
programatically, but it doesn't work: even if I wait 1 or 2 seconds,
kicker it is raised AFTER the message box is shown.

Perhapse the messagebox showing should be delayed like this:
- Compute if screenshot is showable
- If yes and if kicker isn't raised:
  * call QTimer::singleShot(500ms, slotThatShowTheMessage)
- else (kicker is raised (but how to know that?))
  * show the message directly.
In slotThatShowTheMessage (called 500ms after):
  * show the message.

>  P.S. Where is the code for this stuff actually? Are we going to have half a 
> dozen half-broken implementations scattered all over CVS again?

It is in aKregator and Konversation (but old versions).
It's also in BasKet, but this app isn't in CVS yet.
I don't know any other software using it.

--
Séb.






More information about the kde-core-devel mailing list