I'm not sure whether this is a bug or I'm doing something wrong.
fltk version: fltk-1.3.x-r6101 (and 2.0 behaves the same).

It could be demonstrated with very simple example. I have a program which does 
wait() and then handles events.

If there are no timer callbacks - everything is fine. But if there are timers 
callbacks (add_timeout), then last event is repeated on every timer callback.

Here is a part of main body:

  Fl::add_timeout(1.0, timerCallback);
  int running = 1, counter = 0;
  while (running) {
    ///// Fl::e_number = 0;
    running = Fl::wait();
    if (int event = Fl::event()) printf("%7d event %04x\n", ++counter, event);
  }

callback is simple, it could be even empty.

Important thing is - not to move mouse during execution (otherwise mouse events 
stops unwanted behaviour).

Start program (for example I just replace run() in hello.cxx with this part). 
Then press key (for example F5) and see how it is reproduced after every timer 
callback (put printf in timer callback too to see when it happens).

Notice commented line Fl::e_number = 0; - after I put this line then I receive 
again event, but it is 0 and is OK (I ignore 0 events).

Shall I do something special in timer callback to prevent such behaviour? My 
solutions seems like workaround and perhaps there is some correct solution.

_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to