[XForms] Resurrecting an old patch for slider.c

Angus Leeming angus.leeming at btopenworld.com
Thu Apr 8 16:41:18 EDT 2004


Below is a mesage and attached is a patch that I originally sent to 
the xforms list 16 months ago. The question is, should I apply this 
simple patch or should I apply the more complex alternative using a 
timer?

Regards,
Angus

The investigation was originally motivated by this bug report:

Clicking in the scrollbar trough to scroll through a document 
auto-repeats after a short delay, as expected. However, the delay 
before auti-repeating kicks in is too short and the repeat rate much 
to fast on my system. Most of the time I cannot use clicking in the 
scrollbar trough to page forward in my documents because the delay 
before auto-repeating is shorter than my single-click time
(and I'm not a slow mouser...)

In fact, the entire sorry saga can be found here:
http://bugzilla.lyx.org/show_bug.cgi?id=747

The upshot was that I posted the message below to the xforms list. 
Nothing came of it...

On Monday 02 December 2002 7:36 pm, John Levon wrote:
> 4. xforms should mediate these callbacks to a reasonable pace using 
a
> timer.

I've spent some time trying to ascertain exactly what we want and what
xforms gives us at the moment. Allow me to take you through it. You'll
find at the end that xforms already gives us what we want --- almost
--- so bear with me...

The problem is that we want quite fine-grained control over the
scrollbar and it's only for one of these interactions that we
need/want the mediation that John is suggesting.

The scrollbar is actually a "complex widget" made up of three "simple
widget"s, a "slider" and two buttons named "up" and "down" that are
the little arrow buttons at the end of the slider.

The user can control the slider position in several different ways:
* Click on and drag the slider to the desired position.
* Click in the slider trough with the LMB
* Click in the slider trough with the RMB
* Click on the up/down buttons with any mouse button.

Each interaction results in a different behaviour. Specifically, if
the scrollbar increment is set:
	fl_set_scrollbar_increment(scrollbar, lmb_inc, rmb_inc);
then clicking in the slider trough with the LMB increments the slider
by lmb_inc. Ditto, clicking in the slider trough with the RMB
increments the slider by rmb_inc.
Finally, clicking on the up and down buttons with any mouse button
increments the slider by rmb_inc.

All four types of "click-interaction" result in a call to the
user-specified scrollbar->object_callback routine. The user has no way
of differentiating between the different possible click behaviours.

I have extracted this information through the use of judiciously
placed print statements in the xforms source. It isn't woolly; it's an
accurate description of the code.

In our particular case,
	lmb_inc is "increment by 1 page" and
	rmb_inc is "increment by 1 line"
Moreover, because the LMB click in the slider trough results in a
large increment, we would like callbacks resulting from it to be
mediated by a reasonable delay between callbacks.

From all this, I conclude that we should focus our attention on the
simple slider widget rather than the complex scrollbar
widget. Moreover, an examination of slider.c's source shows that the
code to do what we want is already there --- almost. We need merely
modify slider.c's handle_mouse routine.

I append the relevant code snippet below. Note how xforms currently
uses a "timdel" variable to ignore the callbacks 1-10 after the mouse
button is pressed. Thereafter, every other mouse event gets through.

Proposal 1
	use the current approach, but reset timdel to 0 after it's reached 
11.
	make 11 tunable from the outside.
Proposal 2
	use a timer instead of timdel.

Does this make sense? Would you like to try and fix the source this 
way or
are you set on your idea still?

Regards,
Angus (who's starting to get to grips with the xforms source...)

ps. We've had similar problem reports about the counter from
users. Note that it too has a handle_mouse routine using a timdel
variable, so it looks to me that we can cure both problems in the same 
way.

That's wasted the morning. Best do some proper work this afternoon.
A.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: xforms-slider.diff
Type: text/x-diff
Size: 910 bytes
Desc: not available
Url : attachments/20040408/74bedffe/attachment-0010.bin 


More information about the Xforms mailing list