GNOME Bugzilla – Bug 341450
status icon + libnotify
Last modified: 2006-05-25 05:55:14 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.
*** Bug 342315 has been marked as a duplicate of this bug. ***
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 ?
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.
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
Created attachment 65874 [details] [review] proposed function Does this look reasonable ?
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
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)