GNOME Bugzilla – Bug 351600
Can't re-click on button after sensitivity update
Last modified: 2006-10-14 04:17:55 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.
Created attachment 71010 [details] [review] fix for this bug
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.
Created attachment 73138 [details] Testcase for the bug Try this little example to see what it fixes.
(Gtk+ 2.10.3 is concerned too).
Hello!? Is someone here?
*** This bug has been marked as a duplicate of 56070 ***