Hi Chris. Sorry for the delay. Ok, so here´s how I solved the situation with FLTK and audio plugins - hope this works for you too:
First, I´m not using FL::run() or FL::wait(). What I do is have something like this: static int FLTK4VST::FLTK4VST_eventDispatcher_(int e, Fl_Window *w) { int ret = Fl::handle_(e, w); if (ret) Fl::flush(); return ret; } Then in the constructon of my plugin I have this: FLTK4VST::FLTK4VST (VstInt16 width, VstInt16 height, void *fx) : AEffEditor ( (AudioEffect*)fx ) { //... fltkWindow_ = 0; Fl::event_dispatch(FLTK4VST::FLTK4VST_eventDispatcher_); //... } So the system will call my event dispatcher method, which in turn will send the events to the standard FLTK event handler, but by checking FLTK´s handler return value, I can force a redraw when it is actually needed). Second, I have to control carefully the name of the window class that is being registered by my plugin´s instance... I have this static function: static void FLTK4VST::getXClassName_(char *name) { static int r1 = rand(); static int r2 = rand(); static int r3 = rand(); sprintf(name, "FLTK4VST_%d_%d_%d", r1, r2, r3); } Which ensures that every object of a given DLL will have a unique class name (and different than the default "FLTK"), and whenever a different DLL is loaded, any object of that other DLL will have a unique class name too (and again, not "FLTK"). Since PS isn´t really unloading the DLL when closing the plugin, this is stil important, even if you can´t have 2 plugins operating at the same time. Of course my function isn´t perfect - relying on rand() isn´t the most elegant solution but works as proof of concept. Now, whenever I´m are ready to build and show my window, I´m doing this: ///////////////////////////////////// if (fltkWindow_ == 0) { Fl::visual(FL_DOUBLE|FL_INDEX); char name[256]; getXClassName_(name); fltkWindow_ = new Fl_VST_Window(windowRect_.left + windowRect_.right, windowRect_.top + windowRect_.bottom); fltkWindow_->xclass(name); fltkWindow_->set_override(); buildEditor_(); // Create the different widgets that make up your GUI } fltkWindow_->show(); ////////////////////////////////////// Finally, when you want to destroy your main plugin´s window: //////////////////////////////////// #ifdef WIN32 char t[256]; getXClassName_(t); BOOL res = UnregisterClass(t, 0); #endif Fl_VST_Window *tmpFltkWindow = fltkWindow_; fltkWindow_ = 0; delete tmpFltkWindow; ///////////////////////////////////// For more information on why or how this is working you can chek the Fl_X::make(Fl_Window* w) in the Fl_win32.cxx file and the Windows API. Hope this works for you. And I really hope that all the code I´ve posted here comes out formated the right way - I´ve had very bad luck with the formatting of my posts in the past. > I'm deeply curious how you solved the problem. And what timezone are you in > that you responded at 6:15am EDT? I´m at GMT -5, but as you can get from the time of both my previous post and this one, I´m not getting much sleep lately. :D Best regards, Carlos
_______________________________________________ fltk mailing list fltk@easysw.com http://lists.easysw.com/mailman/listinfo/fltk