From 0e29799dda01961603e5dbd790681b0e0303f485 Mon Sep 17 00:00:00 2001 From: Bill Spitzak Date: Sat, 17 Apr 1999 01:02:30 +0000 Subject: Fl::add_fd() structures are dynamically allocated so you can listen to as many connections as you want (up to the maximum number handled by select()). Fl::remove_fd(fd, when) added. This allows you to remove the read, write, and error callbacks individually. Fl::remove_fd(fd) does Fl::remove_fd(fd,-1). Fl::add_fd() calls Fl::remove_fd(), so it can be used safely to replace callbacks with new ones for the same file descriptor. Fl::add_timeout() also dynamically allocates it's array so there is no limit on the number of pending timeouts. I cut/pasted the changes into the Windoze version but this is UNTESTED! Somebody please do a test compile. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.0@544 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- test/button.cxx | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'test/button.cxx') diff --git a/test/button.cxx b/test/button.cxx index 23e266bc3..c765eb8c6 100644 --- a/test/button.cxx +++ b/test/button.cxx @@ -1,5 +1,5 @@ // -// "$Id: button.cxx,v 1.4 1999/01/07 19:17:50 mike Exp $" +// "$Id: button.cxx,v 1.4.2.1 1999/04/17 01:02:30 bill Exp $" // // Button/callback test program for the Fast Light Tool Kit (FLTK). // @@ -37,6 +37,15 @@ void exitcb(Fl_Widget *, void *) { exit(0); } +#if 0 +// test Fl::add_fd()... +void stdin_cb(int, void*) { + char buf[1000]; + gets(buf); + printf("stdin callback\n"); +} +#endif + int main(int argc, char ** argv) { Fl_Window *window = new Fl_Window(320,65); Fl_Button *b1 = new Fl_Button(20, 20, 80, 25, "&Beep"); @@ -46,9 +55,12 @@ int main(int argc, char ** argv) { b3->callback(exitcb,0); window->end(); window->show(argc,argv); +#if 0 + Fl::add_fd(0, stdin_cb); +#endif return Fl::run(); } // -// End of "$Id: button.cxx,v 1.4 1999/01/07 19:17:50 mike Exp $". +// End of "$Id: button.cxx,v 1.4.2.1 1999/04/17 01:02:30 bill Exp $". // -- cgit v1.2.3