Bug 174910 - mouseover button, activate another with keyboard, then can't click orig button
mouseover button, activate another with keyboard, then can't click orig button
Product: Fedora
Classification: Fedora
Component: gtk2 (Show other bugs)
i686 Linux
medium Severity medium
: ---
: ---
Assigned To: Matthias Clasen
Test pygtk program: http://struct.org...
Depends On:
  Show dependency treegraph
Reported: 2005-12-03 16:31 EST by travis abbott
Modified: 2007-11-30 17:11 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2005-12-07 12:31:20 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
here's that patch again (342 bytes, patch)
2005-12-03 16:54 EST, travis abbott
no flags Details | Diff

  None (edit)
Description travis abbott 2005-12-03 16:31:45 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050915 Firefox/1.0.7

Description of problem:
Please describe the problem:
The effect of this bug is:
 you mouseover a button and keep the mouse there
 you activate another button with the keyboard
 you then try to click the button you have been hovering over
 it's in_button flag is cleared so it does not get the "clicked" signal.
 moving the mouse out and back in is a workaround.

This happens to me every day in anaconda. I am clicking through pages (next, next, next) and I get a popup window that I acknowledge with the spacebar. Then I have to move the mouse out and back in to be able to click Next again.

The problem is also present in gnome, when you try to click on the panel
menus the first time, you have to mouse in, out, in to get it to work.

This problem emerged in gtk 2.5.4 and is present in 2.8.8.

Version-Release number of selected component (if applicable):
gtk2-2.6.10 (problem came in gtk 2.5.4 and persists in 2.8.8)

How reproducible:

Steps to Reproduce:
1. Run any gtk program that uses buttons.
2. Mouseover a button and stay inside it.
3. Activate another button with the keyboard.
4. Try and click the original button and see that it does not activate.

If you have pygtk installed you can use this program for a visual representation of what signals are firing:

1. Download and run: python gtkbug.py
2. Click button 2 and see that the clicked signal fires
3. Keep the mouse in button 2 and press ALT+1 to fire button 1
4. Now click button 2 and see that only pressed and release signals fire, not clicked as it should.

Actual Results:  The buttons don't activate.

Expected Results:  The buttons should activate.

Additional info:

This has also been filed over on the gtk bugzilla so will hopefully be fixed in a future release, but it'd be nice to get this patch in FC4 in the mean time.
(built against gtk+-2.6.7 but will apply even to 2.8.8 http://struct.org/gtk/gtk+-2.6.7-grab.patch).

diff -rupN a/gtk/gtkbutton.c b/gtk/gtkbutton.c
--- a/gtk/gtkbutton.c	2005-04-06 23:45:30.000000000 -0500
+++ b/gtk/gtkbutton.c	2005-12-03 14:36:38.000000000 -0600
@@ -1735,7 +1735,6 @@ gtk_button_grab_notify (GtkWidget *widge
   if (!was_grabbed)
-      button->in_button = FALSE;
       gtk_real_button_released (button);

The fix is easy to apply to any version of gtk, just remove

  button->in_button = FALSE;

from gtk_button_grab_notify() before calling gtk_real_button_released() in
gtk/gtkbutton.c (near bottom of file). I don't think this function needs to be
setting whether or not the mouse is in the button. I tested that the proper
state of this field is maintained even when removing this line (when you
mouseout it does get set to FALSE properly).
Comment 1 travis abbott 2005-12-03 16:54:08 EST
Created attachment 121807 [details]
here's that patch again

forgot i could attach the patch here ;)
Comment 2 Matthias Clasen 2005-12-07 12:31:20 EST
Tracked upstream in http://bugzilla.gnome.org/show_bug.cgi?id=323146

Note You need to log in before you can comment on or make changes to this bug.