GNOME Bugzilla – Bug 58389
Add some method of cancellation to GtkRange?
Last modified: 2006-10-30 13:44:03 UTC
On Windows and QT, when you drag a scroll bar, there is an invisible active area around the scroll bar. If the cursor is moved outside this area, the slider moves back to its original position. Here is a patch that implements this feature for GTK.
Created attachment 829 [details] [review] Patch to implement an 'active area' for GtkRange
In MS Windows and in Mozilla, the thickness of the active area is proportional to however thick the scrollbar happens to be. This patch makes the thickness of the active area themable, but fixed, which would probably be subtly annoying to anyone who changed their scrollbar thickness. For Mozilla we chose to make the area six times the scrollbar width on each side of the scrollbar.
There was no great enthusiasm for adding this when discussed. See followups to: http://mail.gnome.org/archives/gtk-devel-list/2002-February/msg00012.html One suggestion is that we should implement Esc to cancel as for DND.
2006-03-11 Matthias Clasen <mclasen@redhat.com> * gtk/gtkrange.c (gtk_range_key_press): Allow to cancel a drag with ESC. (#58389, Søren Sandmann)
I just found that Escape doesn't work any more to close some dialogs in GIMP, in a seemingly inconsistent and unpredictable way. In fact, Escape simply doesn't work when a GtkRange is focussed. IMHO the drag cancellation logic should consume the event only if a drag was actually canceled, not unconditionally. The current implementation also has the undesirable side effect that hitting Escape while not dragging will set the range to some value it had before.
(In reply to comment #5) > IMHO the drag cancellation logic should consume the event only > if a drag was actually canceled, not unconditionally. The current > implementation also has the undesirable side effect that hitting > Escape while not dragging will set the range to some value it had > before. right, can you provide a patch to consume escape only to cancel range drags and not when not dragging?
Created attachment 75659 [details] [review] Patch fixing the bug
thanks, the patch looks please apply (assuming you also tested it). however please revert the portion that has: - return GTK_WIDGET_CLASS (parent_class)->key_press_event (widget, event); + return GTK_WIDGET_CLASS (parent_class)->key_press_event (widget, + event); the added line break really is excessive and imho really looks silly. glib/gtk+ code doesn't _have_ to be broken at 80 cols.
Fixed in both branches: 2006-10-30 Michael Natterer <mitch@imendio.com> * gtk/gtkrange.c (gtk_range_key_press): consume the Escape key only if we actually cancel a drag. Fixes bug #58389.