GNOME Bugzilla – Bug 533492
GtkMenuItem in submenu will not mouse click activate when clicked on with a different mouse button than what is passed to gtk_menu_popup().
Last modified: 2018-04-14 23:57:47 UTC
Please describe the problem: The 'activate' signal will not emit on mouse click of a menu item in a submenu in PyGTK. Pressing ENTER while the submenu is highlighted *will* activate the menuitem. Clicking on the parent menu item of the sub menu twice (to make the submenu disappear and reappear) will make the mouse click of the submenu's menu item emit the activate signal. Steps to reproduce: See Attached examples. Actual results: Expected results: Does this happen every time? Yes. Other information:
Created attachment 111015 [details] Python example showing the issue.
Created attachment 111016 [details] C example which exhibits the bug.
The Python code is commented better than the C code, I started getting sick of writing this example over and over again. I hope the C code shows that this must be a PyGTK problem. Additionally there appear to be other people that have seen this in the past: http://www.daa.com.au/pipermail/pygtk/2006-December/013303.html http://www.mail-archive.com/pygtk@daa.com.au/msg13840.html
Someone has also pointed out that connecting to the 'button-press-event' does not exhibit this bug behavior. (ie, that supplies a work-around if you're experiencing this issue and no one has fixed this bug yet.)
Hi Philippe, the python code works properly here (ubuntu Hardy)
What version of Python, PyGTK, & GTK+ are you running on Hardy? I'm running Gentoo with Python 2.4.4, PyGTK 2.12.0, & GTK+ 2.12.8.
I can also reproduce it on a CentOS 4.6 box (have to comment out the label.set_width_chars(40) line). Python 2.3.4, PyGTK 2.4.0, & GTK+ 2.4.13.
Additionally able to reproduce on Fedora Core 8. Python 2.5.1, PyGTK 2.12.0, & GTK+ 2.12.5.
I just downloaded and tried the python script on Ubuntu on the LiveCD. It was random whether it happened or not, but of the ~40 times I tried, it only printed like it was supposed to about 5 times. I couldn't figure out what I was doing different those times. So, Gian, I'd urge you to try it again and even if it works right off for you, try a handful more times to make sure you can't reproduce it. And make sure you're not clicking on the "parent" item when you're on your way to the "child" item.
Philippe, I've experimented a bit on Ubuntu Hardy, Fedora 9 and Windows. They all behave the same, the problem is not random, if you click with the "left" mouse button on the window it works properly, if you click on the window with the "right" mouse button, Child is never printed on screen.
Okay, yes, I see that left-click vs. right-click behavior here too on my original Gentoo box. Sorry, popup == right-click is so ingrained in my head that I never even thought that the text didn't specify it. So you are able to reproduce the bug now?
I can still reproduce the bug with in Ubuntu Jaunty pygtk 2.15.2-0ubuntu1.
Finally, the bug seems to be solved in Ubuntu Karmic, pygtk 2.16.0 (tried ~50 times without being able to reproduce). I'm closing the bug as fixed, but please reopen it if you discover I was just lucky.
I still see this on PyGTK 2.16.0 (GTK 2.16.6 & Python 2.6.2) on Gentoo. Pietro, are you **RIGHT-CLICKING** to get the initial pop-up dialog? (See comment#11.)
Created attachment 146911 [details] Updated Python example showing the issue (warns against left-clicking and shows version info.) Here, I've updated the test example to warn on the console when you left-click (since that seems to be common), it also explicitly says you should right-click. I also output the GTK, PyGTK, & Python versions so I don't have to hunt around for them. ;) As a footnote, the bug also happens if you middle-click.
I was plain wrong, thanks for reopening.
Okay, I did a little more digging and have a clarification. Basically, if you click with any button to bring up the initial popup menu, going to child and clicking with any button other than the initial button will not be registered. (Unless you make the child menu disappear and reappear.) So it's not a left-click vs right-click thing, it's a initial-click-button != child-click-button thing.
Can someone confirm if the C test-app I posted actually *does* or *does not* exhibit the bug? Compilation line: gcc -o test `pkg-config --cflags --libs gtk+-2.0` test.c Run: ./test
It *does*! For sake of clarity: ./text right-click cursor on "Parent" click on "Child" result: NO message in console. So it's not a pygtk problem!
Thanks Pietro. That's what I just found myself. It just goes to show, never trust the bug submitter. ;) I must have done the whole left-click thing that you and Gian did before when I was testing my own C version. I feel like such a fool! [Moving to GTK.] P.S. Thanks to all the PyGTK guys! Sorry about making you tear your hair out about this one.
Howdy GTK fellas, This is a bug that I originally though was in PyGTK, but later found was actually in GTK (after first thinking it was not in GTK). You start with a popup menu with a sub-menu and a child item in it. You display on mouse button *release* (button == N). If you try to select the child submenu item with any mouse button other than N, the activation will not happen. So if you right-click to get the pop-up menu, and then attempt to left-click on the child submenu item, nothing will happen. If you explicitly hide and reshow the child menu by interacting with it's menu item in the original popup, everything will work as expected. If you popup the menu on mouse button press, this bug does not happen. There are both Python and C examples that illustrate the bug attached.
Seems to be an old bug, but still presenting itself in 2014... I am experiencing it with indicator menus in Ubuntu 14.04. The bug presents itself even in official indicators like the network manager. We have: "Indicator menu / Submenu / Submenu item". These combinations work: "Left-click indicator / Just hover to open submenu / Left-click submenu item", "Right-click indicator/ hover to open submenu / right-click submenu item", "Any-click indicator / Explicitly any-click to open submenu / Any-click submenu item" work. Anything else doesn't work, for example: "Left-click indicator / Just hover to open submenu / Right-click submenu item".
We're moving to gitlab! As part of this move, we are moving bugs to NEEDINFO if they haven't seen activity in more than a year. If this issue is still important to you and still relevant with GTK+ 3.22 or master, please reopen it and we will migrate it to gitlab.
As announced a while ago, we are migrating to gitlab, and bugs that haven't seen activity in the last year or so will be not be migrated, but closed out in bugzilla. If this bug is still relevant to you, you can open a new issue describing the symptoms and how to reproduce it with gtk 3.22.x or master in gitlab: https://gitlab.gnome.org/GNOME/gtk/issues/new