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 351600 - Can't re-click on button after sensitivity update
Can't re-click on button after sensitivity update
Status: RESOLVED DUPLICATE of bug 56070
Product: gtk+
Classification: Platform
Component: Widget: Other
2.10.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2006-08-16 07:15 UTC by Colin Leroy
Modified: 2006-10-14 04:17 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
fix for this bug (360 bytes, patch)
2006-08-16 07:16 UTC, Colin Leroy
none Details | Review
Testcase for the bug (1.57 KB, text/plain)
2006-09-21 12:49 UTC, Colin Leroy
  Details

Description Colin Leroy 2006-08-16 07:15:27 UTC
Hi,

If you have a "clicked" handler that sets your button unsensitive, does stuff, and set the button sensitive again, the user has to move the mouse out of the button and in the button again, to be able to click it again. This is kind of annoying ;-)

The following patch fixes it.
Comment 1 Colin Leroy 2006-08-16 07:16:33 UTC
Created attachment 71010 [details] [review]
fix for this bug
Comment 2 Colin Leroy 2006-09-21 12:34:23 UTC
More explanations about this patch:

This code is called on state change.

   if (!GTK_WIDGET_IS_SENSITIVE (widget))
     {
       button->in_button = FALSE;
       gtk_real_button_released (button);
     }
  }

What it does is force a button release, in case the user was currently clicking on the button, but previously it sets in_button to FALSE to make sure no event is fired by gtk_real_button_released().

The problem is that if the button goes sensitive again (end of a network check or something), and the mouse is still over it, the button can't be clicked because in_button is FALSE (it gets set to TRUE accordingly by enter_notify and leave_notify events).

The patch:
   if (!GTK_WIDGET_IS_SENSITIVE (widget))
     {
+      gboolean in_save = button->in_button;
       button->in_button = FALSE;
       gtk_real_button_released (button);
+      button->in_button = in_save;
     }
  }

saves the previous state of in_button, forces the release, and sets in_button back to what it was previously. This way, the button can be reclicked when it is sensitive again.
Comment 3 Colin Leroy 2006-09-21 12:49:23 UTC
Created attachment 73138 [details]
Testcase for the bug

Try this little example to see what it fixes.
Comment 4 Colin Leroy 2006-09-21 12:58:07 UTC
(Gtk+ 2.10.3 is concerned too).
Comment 5 Colin Leroy 2006-10-06 18:56:03 UTC
Hello!? Is someone here?
Comment 6 Bruno Boaventura 2006-10-14 04:17:55 UTC

*** This bug has been marked as a duplicate of 56070 ***