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 133263 - proposal for a new GtkRange signal: slider-moved
proposal for a new GtkRange signal: slider-moved
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: Other
2.4.x
Other Linux
: High normal
: ---
Assigned To: gtk-bugs
gtk-bugs
: 93147 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2004-02-03 00:50 UTC by Thomas Fitzsimmons
Modified: 2011-02-04 16:17 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
implementation of proposed slider-moved signal (4.85 KB, patch)
2004-02-03 00:53 UTC, Thomas Fitzsimmons
needs-work Details | Review
updated patch to add change_value signal (7.06 KB, patch)
2004-07-26 03:07 UTC, Thomas Fitzsimmons
none Details | Review
patch to add GtkRange::change-value signal (8.99 KB, patch)
2004-08-17 06:25 UTC, Thomas Fitzsimmons
none Details | Review

Description Thomas Fitzsimmons 2004-02-03 00:50:28 UTC
I'm using GTK scrollbars to implement an AWT Scrollbar peer in libgcj, but
I've run into a difference in how adjustment events are treated in the two
toolkits.  An AWT AdjustmentEvent carries information about the type of
adjustment that occurred, one of BLOCK_DECREMENT, BLOCK_INCREMENT, TRACK,
UNIT_DECREMENT, UNIT_INCREMENT.

Currently GtkRange doesn't provide information about how an adjustment
happened.  It simply updates its GtkAdjustment with the new value that
resulted from a user's interaction with the range.

I propose a new "slider-moved" signal that will report how a user is
interacting with the range, whether they are clicking on a stepper or the
trough, or dragging the slider.
Comment 1 Thomas Fitzsimmons 2004-02-03 00:53:13 UTC
Created attachment 24010 [details] [review]
implementation of proposed slider-moved signal
Comment 2 Thomas Fitzsimmons 2004-02-03 01:17:48 UTC
2004-02-02  Thomas Fitzsimmons  <fitzsim@redhat.com>

	* gtk/gtkrange.c (gtk_range_class_init): Add "slider-moved"
	signal.
	(gtk_range_internal_set_value): Add GtkScrollType parameter.
	Emit the slider-moved signal when the range's value changes.
	(update_slider_position, gtk_range_scroll_event, step_back,
	step_forward, page_back, page_forward, scroll_begin,
	scroll_end): Update calls to gtk_range_internal_set_value to
	include a GtkScrollType argument.
	* gtk/gtkrange.h (struct _GtkRangeClass): Declare slider_moved
	function.

Patch attached.

Comments?
Comment 3 Federico Mena Quintero 2004-02-03 19:28:29 UTC
*** Bug 93147 has been marked as a duplicate of this bug. ***
Comment 4 Owen Taylor 2004-02-25 15:58:46 UTC
If we are going to add something here, maybe it should
be more flexible. Say, a 

 gboolean
 GtkRange::change-value (GtkRange      *range,
                         GtkScrollType  scroll,
                         gdouble        new_value);

(TRUE==handled, like events)

new_value would be principally meaningful for 
GTK_SCROLL_JUMP, but would be set to the *unclamped*
new value in all cases. Then the default handler does 
most of the work currently in gtk_range_internal_set_value().

The biggest question mark for me would be interaction
with rounding to a certain number of digits and update
policy, since gtk_range_internal_set_value() doesn't
just call gtk_range_set_value(). 

It might be fine to ignore that and say that if you override
::change-value and do something different then:

 a) You are on your own for handling clamping to digits
 b) Delayed update policies aren't possible
 
The alternative probably would involve renaming
and making public gtk_ranger_internal_set_value() but I think 
that's far too confusing.
Comment 5 Owen Taylor 2004-02-27 00:19:22 UTC
Think we should definitely do something here for 2.6.
Comment 6 Thomas Fitzsimmons 2004-07-26 03:07:26 UTC
Created attachment 29888 [details] [review]
updated patch to add change_value signal
Comment 7 Thomas Fitzsimmons 2004-07-26 03:15:00 UTC
I've posted an updated patch that implements the signal Owen described.

To support delayed update policies can't we just expose the bits that
gtk_range_internal_set_value uses?  From what I can see, that would mean making
both gtk_range_reset_update_timer and GtkRange's update_pending field public.
Comment 8 Owen Taylor 2004-08-16 18:59:13 UTC
I'd rather not allow delayed update policies than make
gtk_range_reset_update_timer/update_pending public. If people complain
we can do something later.
Comment 9 Thomas Fitzsimmons 2004-08-17 06:25:52 UTC
Created attachment 30627 [details] [review]
patch to add GtkRange::change-value signal
Comment 10 Thomas Fitzsimmons 2004-08-17 06:27:26 UTC
New patch attached that adds API documentation.
Comment 11 Matthias Clasen 2004-08-27 03:00:24 UTC
Thu Aug 26 22:44:12 2004  Matthias Clasen  <maclas@gmx.de>

	Provide information about how an adjustment change in a range 
	widget happened. Add a "slider-moved" signal which reports how 
	a user is interacting with the range, whether they are clicking 
	on a stepper or the trough, or dragging the slider.  (#133263,
	Thomas Fitzsimmons)

	* gtk/gtkmarshalers.list: Add signal type BOOLEAN:ENUM,DOUBLE.
	* gtk/gtkrange.c (gtk_range_class_init): Add "change-value"
	signal.
	(gtk_range_internal_set_value): Rename to
	gtk_range_real_change_value.  Add GtkScrollType parameter.  Emit
	the change-value signal when the range's value changes.
	(update_slider_position, gtk_range_scroll_event, step_back,
	step_forward, page_back, page_forward, scroll_begin,
	scroll_end): Change gtk_range_internal_set_value to
	gtk_range_real_change_value.
	* gtk/gtkrange.h (struct _GtkRangeClass): Declare change_value
	function.
Comment 12 Felipe Heidrich 2004-10-22 20:48:10 UTC
What version of GTK the signal "GtkRange::"change-value" was added ?
GTK 2.4.10 does not have it and in the GTK 2.5.3 release notes says signal
"slider-moved" was added.
Am I missing something ?
Comment 13 Thomas Fitzsimmons 2004-10-22 21:00:14 UTC
I changed the signal name from "slider-moved" to "change-value" before the patch
was committed.  The ChangeLog entry is incorrect, it seems, and the release
notes were probably generated from it.  So "change-value" is the signal you are
looking for and it is present in gtkrange.c on CVS HEAD.

Comment 14 Matthias Clasen 2004-10-23 21:50:02 UTC
I've corrected the NEWS and ChangeLog entries.