After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 341450 - status icon + libnotify
status icon + libnotify
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: Other
unspecified
Other Linux
: Normal enhancement
: ---
Assigned To: gtk-bugs
gtk-bugs
: 342315 (view as bug list)
Depends on:
Blocks: 341451
 
 
Reported: 2006-05-11 18:40 UTC by Christian Persch
Modified: 2006-05-25 05:55 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement


Attachments
proposed function (2.00 KB, patch)
2006-05-20 03:50 UTC, Matthias Clasen
none Details | Review

Description Christian Persch 2006-05-11 18:40:50 UTC
Libnotify can 'attach' the notification bubble to the icon position on screen, by getting the widget's coordinates and sending them to the notification demon. That works with eggtrayicon since you have access to the real widget; but with gtkstatusicon you have no access to this information.
Thus I'd like to have a way to get the on-screen coordinates and extents (and possibly orientation and text direction) of the status icon from GtkStatusIcon.
Comment 1 Matthias Clasen 2006-05-19 16:26:14 UTC
*** Bug 342315 has been marked as a duplicate of this bug. ***
Comment 2 Matthias Clasen 2006-05-19 16:40:43 UTC
Looking at Havocs bug, I'd propose to add

gtk_status_icon_get_orientation()
gtk_status_icon_get_position()
gtk_status_icon_get_size()

If these can be implemented on win32. Tor ?
Comment 3 Havoc Pennington 2006-05-19 19:34:19 UTC
Messing with this some (I have a cut-and-paste of status icon anyway to work on FC4/FC5) - I did:

status_icon_get_screen_geometry(GtkStatusIcon *icon,
GdkScreen **screen_p,
int *x_p,
int *y_p,
int *width_p,
int *height_p);

Maybe would be nicer with GdkRectangle? Or with two functions as you say, and also add a get_screen()

Owen looked into this on Windows a bit, he says the only way he's found to get the position is to take a screenshot and scan for your icon's pixels. Which seems, uh, bad.

Apps that do their own "notification bubbles" such as Google sidebar or Thunderbird are just basing it on the position of the whole taskbar I think.

The Windows size is always the same I believe (16x16) so that would be easy at least.
Comment 4 Matthias Clasen 2006-05-19 19:41:35 UTC
hmm, then we could maybe do

gboolean gtk_status_icon_get_position (GtkStatusIcon *icon, gint *x, gint *y)

and return FALSE if the position is unknown
Comment 5 Matthias Clasen 2006-05-20 03:50:01 UTC
Created attachment 65874 [details] [review]
proposed function

Does this look reasonable ?
Comment 6 Havoc Pennington 2006-05-20 05:48:49 UTC
It would certainly work for what I'm doing, thanks!

Possible comments:
 - original reporter mentions text direction also
 - the single function wouldn't allow a platform to support 
   only some of the geometry elements, though I don't know
   if any platform would want that
 - if the status icon spec evolves over time, it might still 
   be useful to have a "get the X window id" call, so people
   can get new properties off it ... but of the people
   posting to this bug it sounds like everyone just wants
   the geometry for the moment
 - change notification on geometry seems like a likely future request

Comment 7 Matthias Clasen 2006-05-25 05:55:14 UTC
Fixed in the development version. The fix will be available in the next major release. Thank you for your bug report.

2006-05-25  Matthias Clasen  <mclasen@redhat.com>

        * gtk/gtk.symbols:
        * gtk/gtkstatusicon.h:
        * gtk/gtkstatusicon.c (gtk_status_icon_get_geometry):
        New function that can be used to e.g. position
        notification bubbles wrt to the status icon.
        (#341450, Christian Persch, Havoc Pennington)