GNOME Bugzilla – Bug 398183
CTRL modifier on a selection does not snap the starting corner back...
Last modified: 2007-06-29 16:51:31 UTC
Please describe the problem: If you start to drag a selection, then press CTRL to switch to a centered selection, then release CTRL again, It does not snap the corner back to the starting point. Not major, but if you meant to use shift instead, it can be annoying, and it seems more natural that it would snap back... Steps to reproduce: 1. New Image 2. Start a new selection with the rectangle selection tool 3. Press CTRL while dragging 4. Release CTRL while dragging Actual results: The starting corner does not snap back to the original origin... Expected results: The starting corner does snap back to the original origin... Does this happen every time? Yes Other information: Xubuntu 6.10
This is a major usability problem and need to be looked at before 2.4.
I will have a patch in some hours.
Created attachment 90528 [details] [review] Intelligent-Rectangle-Ctrl-Behvaiour.patch A solution based on introducing the logic of "the other side". Works nicely imo, what needs to be done though is to elegantly *not* "reset" the rectangle when the moues is released while Ctrl is being held down (as marked by the we_dont_come_here_from_a_mouse_release "boolean").
Created attachment 90541 [details] [review] Intelligent-Rectangle-Ctrl-Behvaiour-complete.patch Complete patch, now keeps track of if modifier keys were released by a mouse release or not. Please review.
That "mouse_was_released" boolean is not needed and moreover doesn't catch all cases where active_modifier_key() is called to reset the state. Simply look at (state & GDK_BUTTON1_MASK) instad please.
Created attachment 90782 [details] [review] Intelligent-Rectangle-Ctrl-Behvaiour-final-draft-1.patch Uses (state & GDK_BUTTON1_MASK) instead. Also calls gimp_rectangle_tool_configure to update highlight area and handle sizes when the rectangle resets itself.
The tool still doesn't react to shift and control *press* immediately, only to control release after this patch. To see the effect of the other options i still have to move the mouse. Can you fix that too please?
Fixing that in a clean way worth keeping for 2.4 requires extracting relevant code from gimp_rectangle_tool_motion and put it into a stand-alone function that can be called independently. Since that is more natural to do as part of the bigger refactoring I mentioned on the mailing list and intend to do the coming weeks, I suggest I commit this patch as-is (unless you have additional feedback) and consider this particular bug solved. I won't commit with your 'OK' first though, so let me know what you think.
Looks ok, please commit, but please change the new prototypes to properly align with the other prototypes, even if they get longer than 80 chars.
Fixed in trunk, revision 22854. 2007-06-29 Martin Nordholts <martinn@svn.gnome.org> Made GimpRectangleTools remember where the "other side" is when fixed-center is turned on, and reset the "other side" to that position when fixed-center is turned off again. Fixes bug 398183. * app/tools/gimprectangletool.c (gimp_rectangle_tool_button_press): Remember "other side". (gimp_rectangle_tool_active_modifier_key): When fixed-center is turned off, reset "other side". (gimp_rectangle_tool_get_other_side) (gimp_rectangle_tool_get_other_side_coord) (gimp_rectangle_tool_set_other_side_coord): New functions.