GNOME Bugzilla – Bug 74221
GtkDialog automatically emits the response GTK_RESPONSE_DELETE_EVENT when ESC is pressed
Last modified: 2004-12-22 21:47:04 UTC
To Reproduce : 1) Start gedit2 & 2) Select Tools ->Plugins Manager & press Esc key. Actual Result: Close button is activated and Plugin Manager dialog is dismissed. Expected result Esc should only operate Cancel buttons, not Close buttons.
Hmmm... so, in this case, if the user presses the ESC key, the dialog should not dismiss itself. Right?
Yeah, according to our keynev guidelines Esc should only activated Cancel buttons (which it does), but not Close buttons.
Yeah, I think I agree with this, but Calum would be the best person to consult on keynav issues. My feeling is that "esc" very much connotes some form of cancellation, and that we're better off having a consist shortcut for "close".
Note that GtkDialog automatically emits the response GTK_RESPONSE_DELETE_EVENT when you press ESC.
Paolo: so by your last comment, you're suggesting that this is a gtk issue? Should we close this then, or refer the HIG people to gtk?
Here there are 2 problems: 1. gedit problem: if the user presses the ESC key, the dialog should not dismiss itself 2. gtk+ problem: GtkDialog automatically emits the response GTK_RESPONSE_DELETE_EVENT when you press ESC. So I cannot know if the user has pressed ESC or the WM close button. To solve problem n.1 (in a general way) gtk+ guys should first solve problem n. 2.
I've attached a patch to gtk+ that fixes this by only closing the dialog when the Esc key is pressed if there is a cancel button in the dialog. It still gives GTK_RESPONSE_DELETE (for compat. reasons). I've been unable to get an answer one way or another from gtk people on whether this is ok, so I'm putting it here for now.
Created attachment 7607 [details] [review] Patch for gtk+ that fixes this bug.
With the code taken on 30th may, if the above steps are executed, tag list window is not getting closed.
venkat: please add your comment to the right bug report.
James: any news about your patch? Owen: Do you think we should file a bug against gtk+?
James: could you please file a bug against gtk+ and put your patch there?
For more info read the thread at: http://mail.gnome.org/archives/gtk-devel-list/2002-March/msg00563.html
Fri Dec 13 18:57:20 2002 Owen Taylor <otaylor@redhat.com> * gtk/gtkdialog.c: Change the Escape key binding to only close if the dialog contains a cancel button. (Patch from James Willcox, #74221)
I would tend to make the Escape key send GTK_RESPONSE_CANCEL in this case; I don't see how it would be incompatible to do so really.
It seems very easy to me to have logic that depended on knowing what the possible set of responses are. I can't think of anything I've written that exactly would break here, but I've certainly written gtk_dialog_run() calls that have some expectation of what the result would be.
Sure, but GTK_RESPONSE_CANCEL is already known to be a possible response in this case.
Ah, you just mean change the current synthetic delete event to a response signal. It break a user who didn't listen to ::response, but instead used the return from gtk_dialog_add_widget() to g_signal_connect (..."clicked"). That probably doesn't matter. Be my guest if you want to fix it or open a new bug...
Looking at the code, it seems hard/impossible to make rational in a simple way. I filed http://bugzilla.gnome.org/show_bug.cgi?id=101293 to deal with it later.