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 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().
GtkMenuItem in submenu will not mouse click activate when clicked on with a d...
Status: RESOLVED OBSOLETE
Product: gtk+
Classification: Platform
Component: Widget: GtkMenu
2.16.x
Other All
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2008-05-16 21:19 UTC by Philippe Chaintreuil
Modified: 2018-04-14 23:57 UTC
See Also:
GNOME target: ---
GNOME version: 2.25/2.26


Attachments
Python example showing the issue. (3.11 KB, text/plain)
2008-05-16 21:20 UTC, Philippe Chaintreuil
Details
C example which exhibits the bug. (2.90 KB, text/plain)
2008-05-16 21:20 UTC, Philippe Chaintreuil
Details
Updated Python example showing the issue (warns against left-clicking and shows version info.) (3.60 KB, text/plain)
2009-11-04 13:57 UTC, Philippe Chaintreuil
Details

Description Philippe Chaintreuil 2008-05-16 21:19:16 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:
Comment 1 Philippe Chaintreuil 2008-05-16 21:20:02 UTC
Created attachment 111015 [details]
Python example showing the issue.
Comment 2 Philippe Chaintreuil 2008-05-16 21:20:50 UTC
Created attachment 111016 [details]
C example which exhibits the bug.
Comment 3 Philippe Chaintreuil 2008-05-16 21:23:11 UTC
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
Comment 4 Philippe Chaintreuil 2008-05-16 21:26:03 UTC
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.)
Comment 5 Gian Mario Tagliaretti 2008-05-16 22:06:56 UTC
Hi Philippe,

the python code works properly here (ubuntu Hardy)
Comment 6 Philippe Chaintreuil 2008-05-19 12:36:19 UTC
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.

Comment 7 Philippe Chaintreuil 2008-05-19 12:43:32 UTC
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.
Comment 8 Philippe Chaintreuil 2008-05-19 16:17:22 UTC
Additionally able to reproduce on Fedora Core 8.  Python 2.5.1, PyGTK 2.12.0, & GTK+ 2.12.5.
Comment 9 Philippe Chaintreuil 2008-05-19 17:34:44 UTC
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.
Comment 10 Gian Mario Tagliaretti 2008-05-19 19:55:10 UTC
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.
Comment 11 Philippe Chaintreuil 2008-05-19 20:03:32 UTC
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?
Comment 12 Pietro Battiston 2009-07-16 10:18:59 UTC
I can still reproduce the bug with in Ubuntu Jaunty pygtk 2.15.2-0ubuntu1.
Comment 13 Pietro Battiston 2009-11-04 05:33:25 UTC
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.
Comment 14 Philippe Chaintreuil 2009-11-04 13:49:15 UTC
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.)
Comment 15 Philippe Chaintreuil 2009-11-04 13:57:55 UTC
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.
Comment 16 Pietro Battiston 2009-11-04 14:35:12 UTC
I was plain wrong, thanks for reopening.
Comment 17 Philippe Chaintreuil 2009-11-04 16:47:26 UTC
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.
Comment 18 Philippe Chaintreuil 2009-11-04 17:09:45 UTC
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
Comment 19 Pietro Battiston 2009-11-04 19:54:32 UTC
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!
Comment 20 Philippe Chaintreuil 2009-11-04 19:58:49 UTC
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.
Comment 21 Philippe Chaintreuil 2009-11-04 20:06:55 UTC
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.
Comment 22 Peter Levi 2014-07-24 11:05:24 UTC
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".
Comment 23 Matthias Clasen 2018-02-10 04:54:47 UTC
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.
Comment 24 Matthias Clasen 2018-04-14 23:57:47 UTC
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