On 13.09.2009, at 00:40, hv wrote:
> The 'HandleAlarmFindPacket()' frame /is/ called as a signal
> handler for SIGALRM on a periodic basis.
Please do not post into this group. This is the auto-reply group for
our bug tracking system. Please post to fltk.general. Thanks.
Nevertheless:
I am not sure if X11 calls are allowed from within a signal handler.
This may also be a treason why your chart drawing is relatively slow
(apart from the fact that the chart widget is quite minimal in its
ways: it was meant to be a simple one-time rendering chart for some
statistics, but that can be improved).
My suggestion would be:
Just before Fl::run(), add a convenient timer, say 25 times a second,
just to verify that my idea works:
Fl::add_timeout(1.0/25.0, update_cb);
then write a function to update the chart which then triggers a redraw
and starts a new timr:
void update_cb(void*) {
if (chart_changed) {
value(3) = new_value[3];
...
redraw();
chart_chnged = 0;
}
Fl::repeat_timeout(1.0/25.0, update_cb);
}
The signal handler should be as minimal as possible, something like
this:
x3 = readPort(3);
if (new_value[3] != x3) {
new_value[3] = x3;
chart_chaged = 1;
}
This has two benefits:
1: the signal handler is minimal
2: you can change your update rate at any time to minimize the
required resources
Matthias
_______________________________________________
fltk-bugs mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-bugs