If I use Fl_Double_Window as the top window, it will take the window several 
seconds to response to keyboard input ('a' or ESC).  If I replace the window 
with Fl_Window, the program can exit at once when I press 'a' or ESC.  Why is 
Fl_Double_Window so slow?

Thanks.

 1 #include <FL/Fl.H>
 2 #include <FL/Fl_Widget.H>
 3 #include <FL/Fl_Double_Window.H>
 4 #include <FL/fl_draw.H>
 5 #define DELAY 0.001
 6 class Test_Draw: public Fl_Widget
 7 {
 8     public:
 9     Test_Draw(int x, int y, int w, int h, char *l=0):Fl_Widget(x,y,w,h,l){
10     }
11     void draw(){
12         static double d=0;
13         d += 0.1;
14         fl_rectf(x(),y(), (int) d%w(), (int)d%h(), 255,255,255);
15     }
16 };
17 Test_Draw *t;
18 static void update(void *)
19 {
20     if(Fl::event_key('a')) exit(0);
21     t->redraw();
22     Fl::add_timeout(DELAY, update, 0);
23 }
24 int main(int argc, char **argv)
25 {
26     Fl_Double_Window w(200,200,Fl::w()/2, Fl::h()/2);
27     //Fl_Window w(200,200,Fl::w()/2, Fl::h()/2);
28     t = new Test_Draw(0,0,w.w(),w.h());
29     w.end();
30     w.show(argc, argv);
31     Fl::add_timeout(DELAY, update, 0);
32     Fl::run();
33 }

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

Reply via email to