Re: [fltk.coredev] Fl_Choice initiates infinite loop

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.coredev  ]
Previous Message ]New Message | Reply ]Next Message ]

Re: Fl_Choice initiates infinite loop Albrecht Schlosser 09:49 Jun 17 top right image
On 6/17/22 17:23 Rob McDonald wrote:
On Friday, June 17, 2022 at 3:25:38 AM UTC-7 Albrecht Schlosser wrote:
On 6/17/22 01:36 Rob McDonald wrote:
On Thursday, June 16, 2022 at 3:00:55 PM UTC-7 Albrecht Schlosser wrote:

(5) Another attempt to fix all known issues is my a new patch Fl_Counter_v2.patch (attached). It's likely not the final solution (fixing symptoms only) but it's a start.

Rob, can you please:

(a) test and (hopefully) confirm that this patch fixes your issue too?

I tried this patch (thanks for the prompt work).  It helps, but isn't a fix...

When I click the counter, it now increments two values (usually) and then stops.  It doesn't skip from 2 to 4, I see the intermediate 3.  It goes 2, 3, 4 and then stops -- for a single click.

Occasionally (once out of 20+ attempts) it will only increment by one (my sequence switched from even to odd).

In my demo I need to hold the mouse button for a "significant" time. This time is presumably longer than 0.1 sec which is the repeat timer of Fl_Counter. This can be seen clearly in the existing code: if the FL_RELEASE event is delivered before the timer event the internal variable `mouseobj` is reset and the timer repetition is terminated.

Is it possible that your mouse button "click" lasts longer than 0.1 sec?

I am just clicking the mouse in a normal way.  I am not dwelling on the button in any way.  I don't have a millisecond stopwatch connected to my mouse finger -- but I'm not doing anything unusual as a user.

Yes, I see this too now on macOS under certain conditions. I pushed two commits that solve (AFAICT) all problems I could see on Linux and Windows (the latter tested only shortly using Wine on Linux). There was indeed an issue with the new timeout handling (thanks for pointing this out) but there was also something going awry in the Fl_Counter code. The two mentioned commits fix the obvious issues.

Please update your FLTK repo and try the latest commits with your program and please try also my latest demo program which I posted to GitHub issue #450 which you created.

The behavior on macOS is weird and I'd like to get feedback from others testing my tiny demo program on their macOS systems. Instructions can be found at . Thanks in advance for all feedback.

Is a counter supposed to repeat events if you hold down the button?  I guess I'm failing to see how it doesn't behave like a normal button press and why we don't see this problem for all kinds of FLTK events.

Yes, it is supposed to repeat if you keep the mouse button pressed: once every 0.1 seconds after an initial delay of 0.5 seconds. This is also true if you drag the mouse over the buttons (while keeping the mouse button down, of course).

If it is 'supposed' to repeat, then I should probably avoid Fl_Counter in the first place and just use normal buttons.

What did you want to achieve with the Fl_Counter in the first place? Do you handle different buttons differently?

Anyway, clicking on one of the buttons in a "normal" way should never trigger the auto-repeat function and this is what I don't understand (yet) in the macOS implementation. This is really a strange and unexpected behavior.

You received this message because you are subscribed to the Google Groups "fltk.coredev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit
Direct Link to Message ]
bottom left image   bottom right image
Previous Message ]New Message | Reply ]Next Message ]

Comments are owned by the poster. All other content is copyright 1998-2022 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to ''.