<br><br><div class="gmail_quote">On Sat, Sep 22, 2012 at 11:22 AM, Igor Stasenko <span dir="ltr">&lt;<a href="mailto:siguctua@gmail.com" target="_blank">siguctua@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
First, we need to make one thing:<br>
<br>
Change the VM to not call ioProcessEvents function directly, but<br>
rather use a variable which will hold a function pointer.<br>
Initially, when VM starts, that function pointer is NULL, and so,<br>
&quot;process events&quot; is NOP.<br></blockquote><div><br></div><div>Please don&#39;t reinvent the wheel.  The Cog source has a variable inIOProcessEvents that controls this.  If negative it disables inIOProcessEvents.  If non-negative it prevents reentrancy, essential if one is receiving events from the OS.  There&#39;s a primitive, primitiveEventProcessingControl, to flip it between the enabled and disabled states.</div>
<div><br></div><div>This code has been used for years in the Newspeak system which has a full native GUI on Windows.</div><div><br></div><div>Going your own way creates an unnecessary fork.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<br>
Then we need to implement  a module which will manage host windows,<br>
and once image tells it to create a window,<br>
it can change the function pointer to ioProcessEvents to own function.<br>
<br>
This change, would allow us to temporary disable any external event<br>
processing (like in case of callbacks).<br>
<br>
Second, we should move all event-related stuff to new plugin (for<br>
instance, all definitions in sq.h<br>
like sqInputEvent , ioSetInputSemaphore() ioGetNextEvent() etc).<br>
<br>
For all UI-related stuff the image should communicate with a new<br>
plugin, while VM should get rid of all knowledge of any existence of<br>
UI events,<br>
like input semaphores, primitives for fetching them etc.<br>
<br>
Third, of course, all screen update/refresh primitives should be<br>
deprecated, and image should use new primitives to update the contents<br>
of host window(s).<br>
<span class="HOEnZb"><font color="#888888"><br>
<br>
--<br>
Best regards,<br>
Igor Stasenko.<br>
<br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br>best,<div>Eliot</div><br>