On 05.09.2012, at 11:28, "MacArthur, Ian (SELEX GALILEO, UK)"
<[email protected]> wrote:
>
>>> I wonder if we need to explicitly unregister the fltk window classes
>> from the Windows context and then re-assert them, or maybe register them
>> with a different name each time, or something...?
>>
>>
>> I am not sure if the entire endeavor will ever work. It's a long time ago
>> that I used the PS plugin API, and it was quite limiting. I believe that
>> there is a good reason for that: it is close to impossible to have
>> independent UI systems running within one application.
>>
>> Even though FLTK is of course based on the same core libraries as
>> Photoshop, there can be only on master. This master captures all the
>> events sent from the OS and decides if they are sent on or not. FLTK
>> requires a lot of events to function correctly, but if Photoshop snaps
>> those events away before they reach FLTK, FLTK will never function
>> correctly.
>
>
> Agree.
>
> But the kicker here is that it (at least appears) to work perfectly the
> *first* time that the fltk window is shown. Then subsequent attempts to show
> the fltk context fail...
>
> So I do wonder if there's something we can do to make every time just like
> the first time, and hence at least give the appearance of working Just Right
> (even if under the covers it is all a bit suspect!)
Has it been tested that the dll is not unloaded? Maybe PS *does* (partially,
thanks to MSWindows) during calls to the plugin? A simple debug breakpoint in
the DLL initialization and deinitialization should clarify that.
On WIN32, this should help:
BOOL APIENTRY DllMain(HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved)
{
switch( ul_reason_for_call ) {
case DLL_PROCESS_ATTACH:
...
case DLL_THREAD_ATTACH:
...
case DLL_THREAD_DETACH:
...
case DLL_PROCESS_DETACH:
...
}
return TRUE;
}
Maybe the original code needs to be replaced in the DLL to avoid destruction of
some statics?
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk