GNOME Bugzilla – Bug 148026
Set the activates-default property on entries in dialogs
Last modified: 2007-04-22 12:06:53 UTC
The Scale Image dialog doesn't have OK set as the default button. It would be nice to have this, to be able to press Enter to close the dialog and perform the scaling.
The OK button is the default button. It's the spinbuttons that don't have the GtkEntry::activates-default property set. We should probably agree on a policy to implement in all GIMP dialogs instead of changing this individual one...
This is hardly doable. Pressing Enter in a spinbutton accepts the entered value which is then (in almost all GIMP dialogs) used to updated related fields (for example a spinbutton coupled to this one via a chain-button). It would be wrong to just close the dialog as if the OK button was pressed. I suggest resolving as NOTABUG.
Pressing return or enter in a spin button does this: 1. gtk_spin_button_update() - so the value is committed, and it emits the value_changed signal; I assume that in the callback for that is where you update the other spin buttons. 2. It calls the parent's activate handler; here is where GtkEntry would activate the default button in the dialog. It would work just fine.
No, it wouldn't. When the dialog is closed the action that is performed must match what the user sees when she closes the dialog. So we can't implement it the way you suggest since that would mean that pressing Enter would not perform the action indicated by the visible state of the dialog. This would lead to major confusion.
I agree with Sven. In fact, whenever there are multiple numerical entries, it is wrong to activate the default action when Return is pressed in one of them. This is because there are still many poorly written programs out there -- including gtk programs -- that don't recognize that an entry has been changed unless you hit Return after changing it, so some users when in doubt tend to hit Return just to make sure.
Oh, I see Sven's point. Would it be reasonable to focus the next spin button when one gets activated by pressing Return? ("What does Photoshop do?")
How about just setting the focus on the "OK" button when pressing enter in the spinbox? That way, two returns and you're done. Dave.
Dave, I guess that would work nicely.
Both options (focussing the next entry and focussing the default button) sound quite nice. However, isn't this something that should be implemented in a generic way, using the GTK+ focus chain?
Set the property where it is obviously right: 2004-09-14 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpquerybox.c: set the "activates-default" property on the entries in all query boxes so hitting "return" confirms them. Addresses bug #148026.
More of them: 2004-09-15 Michael Natterer <mitch@gimp.org> (...) * app/actions/channels-commands.c * app/actions/layers-commands.c * app/actions/vectors-commands.c: set the "activates-default" property on the name entry in all "New Foo" and "Edit Foo Attributes" dialogs except in the "New Layer" dialog. Addresses bug #148026.
*** Bug 165748 has been marked as a duplicate of this bug. ***
We should at least try to get this correctly in all dialogs for 2.4
At least the Layer New dialog which has been mentioned does intentionally not set "activates-default".
*** Bug 303583 has been marked as a duplicate of this bug. ***
It would be very helpful if someone could collect a list of dialogs that still need this change.
*** Bug 329005 has been marked as a duplicate of this bug. ***
Bumping to Future, because with the progress that has been made, this is no longer a blocker for 2.4.
Closing as FIXED because I think that we have changed all relevant places and it doesn't make sense to keep this open just in case that we missed one.
*** Bug 343583 has been marked as a duplicate of this bug. ***
*** Bug 360380 has been marked as a duplicate of this bug. ***
*** Bug 376435 has been marked as a duplicate of this bug. ***
*** Bug 432224 has been marked as a duplicate of this bug. ***