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 377349 - gtk_status_icon_position_menu is not implemented for Win32
gtk_status_icon_position_menu is not implemented for Win32
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Backend: Win32
2.10.x
Other Windows
: Normal normal
: ---
Assigned To: gtk-win32 maintainers
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2006-11-20 10:30 UTC by Nikos Kouremenos
Modified: 2007-02-10 10:01 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
see top right (43.81 KB, image/png)
2006-11-20 10:31 UTC, Nikos Kouremenos
Details
sample script (464 bytes, text/x-python)
2006-11-20 10:31 UTC, Nikos Kouremenos
Details

Description Nikos Kouremenos 2006-11-20 10:30:30 UTC
if you run the attached sample in Windows menu is shown in wrong position. in Linux that works great.

I use GTK installer from gladewin32.sf.net
Comment 1 Nikos Kouremenos 2006-11-20 10:31:20 UTC
Created attachment 76906 [details]
see top right
Comment 2 Nikos Kouremenos 2006-11-20 10:31:48 UTC
Created attachment 76907 [details]
sample script
Comment 3 Tor Lillqvist 2006-11-20 11:16:59 UTC
gtk_status_icon_position_menu() is not implemented for Win32. Patches welcome.
Comment 4 Nikos Kouremenos 2006-11-20 11:28:20 UTC
Tor, can't you at least put it under mouse coordinates as opposed to putting it somewhere random or super misplaced? all this until it's hacked in win32 to work.
Comment 5 Tor Lillqvist 2006-11-20 11:37:14 UTC
Apparently there is no documented official way to find out the location of a tray icon. http://www.codeproject.com/shell/ctrayiconposition.asp?df=100&forumid=14631&exp=0&select=1002102 has some relatiely complex and hackish code, maybe that could be used. Don't know how well that can be expected to work in all Windows versions and with various 3rd-party addons and "desktop enhancements" end-users might be running, though.

However, in the special case of wanting to know the tray icon's position right after the user has clicked on it, we can simply call GetCursorPos() in the tray icon's message handler. So maybe what we should do is just do what in wndproc() in gtkstatusicon.c, cache the position, and return it in gtk_status_icon_position_menu()? It's simple, better than nothing (= the current code), and presumably covers the use case in this bug. (I can't run the test program, as the Python gtk module I happen to have doesn't wrap the 2.10 -only gtk_status_icon_position_menu() API, and I'm too lazy to start upgrading that now.)
Comment 6 Nikos Kouremenos 2006-11-20 13:32:12 UTC
Yes, what you propose clearly is better than nothing and seems simple.

FYI http://ftp.gnome.org/pub/GNOME/binaries/win32/pycairo/1.2/ http://ftp.gnome.org/pub/GNOME/binaries/win32/pygobject/2.12/ http://ftp.gnome.org/pub/GNOME/binaries/win32/pygtk/2.10/

I was also wondering if you plan to fix, or if it's even reported, that trayicon menu does not pop down, when user clicks somewhere else (outside of the menu). This happens with normal tray icon menus (from other non GTK related libraries), but not with the Status Icon API ones.
Comment 7 Tor Lillqvist 2006-11-20 15:13:04 UTC
I don't think that other problem has been reported, please open a bug for it (and include a miminal test program).
Comment 8 Tor Lillqvist 2006-12-27 18:20:25 UTC
Thanks for the links, installing fresh GTK+ etc bindings for Python was trivial.

Fixed (well, for the presumably most common use case) in HEAD and gtk-2-10:

2006-12-27  Tor Lillqvist  <tml@novell.com>

	* gtk/gtkstatusicon.c: Implement gtk_status_icon_position_menu()
	on Windows. Keep track of where the last button click on the
	taskbar icon took place, and return that. Obviously not correct if
	no button has ever been clicked on the icon, or if the geometry of
	the taskbar has changed since. But for most use cases where a menu
	is going to be displayed as a direct result of a button click on
	the status icon, works fine. (#377349)
Comment 9 Tor Lillqvist 2007-02-10 10:01:32 UTC
*** Bug 406062 has been marked as a duplicate of this bug. ***