> So, the logic is:
>
> - Create main window
> - Hide it
> - Create pipe thread
> - Pipe thread Fl::awake()'s the main thread
>    - perhaps show/hide the main window
>    - display what we're told to via the pipe
> - repeat until told to quit
>
>

Something like this may work (untested code follows):

class MainWindow : public Fl_Double_Window {
public:
    MainWindow(int w, int h, char const* label = 0)
        : Fl_Double_Window(w, h, label)
        , visible_(false)
    {;}
    void show()
    {
        Fl_Double_Window::show();
        visible_ = true;
        while(visible_) {
            Fl::wait();
        }
    }
    void hide()
    {
        Fl_Double_Window::hide();
        visible_ = false;
    }
private:
    bool visible_;
};

void main_thread()
{
    MainWindow window(300, 300);  // Create main window (hidden)
    window.end();
    // Create pipe thread
    bool done = false;
    do {
      // Pipe thread Fl::awake()'s the main thread
      if(whatever) window.show();  // perhaps show/hide the main window
      // display what we're told to via the pipe
      if(something) done = true;
    } while(!done);  // repeat until told to quit
}

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

Reply via email to