After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 58389 - Add some method of cancellation to GtkRange?
Add some method of cancellation to GtkRange?
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: Other
1.3.x
Other All
: Normal enhancement
: Small feature
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2001-08-01 13:34 UTC by Soren Sandmann Pedersen
Modified: 2006-10-30 13:44 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement


Attachments
Patch to implement an 'active area' for GtkRange (5.77 KB, patch)
2001-08-01 13:37 UTC, Soren Sandmann Pedersen
needs-work Details | Review
Patch fixing the bug (1.09 KB, patch)
2006-10-30 13:11 UTC, Michael Natterer
none Details | Review

Description Soren Sandmann Pedersen 2001-08-01 13:34:43 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.
Comment 1 Soren Sandmann Pedersen 2001-08-01 13:37:30 UTC
Created attachment 829 [details] [review]
Patch to implement an 'active area' for GtkRange
Comment 2 Matthew Thomas (mpt) 2002-02-01 18:17:28 UTC
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.
Comment 3 Owen Taylor 2002-02-21 19:18:13 UTC
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.
Comment 4 Matthias Clasen 2006-03-11 05:47:30 UTC
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)
Comment 5 Michael Natterer 2006-10-29 17:19:15 UTC
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.
Comment 6 Tim Janik 2006-10-30 12:46:14 UTC
(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?
Comment 7 Michael Natterer 2006-10-30 13:11:05 UTC
Created attachment 75659 [details] [review]
Patch fixing the bug
Comment 8 Tim Janik 2006-10-30 13:29:57 UTC
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.
Comment 9 Michael Natterer 2006-10-30 13:44:03 UTC
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.