[Vm-dev] Unix HostWindowPlugin

Bert Freudenberg bert at freudenbergs.de
Wed Apr 29 21:36:44 UTC 2009

Hi Ian, folks -

I implemented the scaffolding for the HostWindowPlugin in the Unix VM.  
It's a bit more complicated than other platforms because we support  
multiple UI frameworks on Unix. I added the functions to the SqDisplay  
dispatch structure, increasing its minor version to 2. The functions  
are stubbed out in all display modules. In the X11 display module I  
only implemented the one function we need right now, namely setting  
the main window's title.

Since this is primarily for Etoys I attached my patches to this ticket:


There is a tiny changeset allowing for

	DisplayScreen hostWindowTitle: 'Hello World!'

which I tested on a Mac working fine, and now on X11 too, using  
windowIndex 1 for the main window.

The patches are attached as a diff, as well as a tarball of all the  
changed files. Ian: Please integrate as soon as you find time (there  
is a tiny other patch in there, making -xshm not abort if xshm support  
is missing).

David - sorry for not using your HostWindowPlugin code, but it was X11  
only which is not the Right Way to do it. It should be reasonably  
simple for someone to adapt your code to the infrastructure I provided  
now (including generating events for secondary windows). I myself will  
not implement multi-window support any time soon.

Andreas - reading the message below again I still don't know where  
ioGetWindowLabel/ioSetWindowLabel comes from. Which platforms support  
this, where is the primitive code, and how is it exposed in the image?

Thinking about it it might have been simpler to use these functions.  
Is it okay to abuse the HostWindowPlugin for this? One reason I did it  
was that we'll soon need the window-size setting feature, too. And at  
least on the Mac prim #92 is buggy, whereas the HostWindow equivalent  
works fine. In any case having full HostWindow support would be  
useful, me thinks ;)

- Bert -

On 19.07.2008, at 16:28, David T. Lewis wrote:

> Bert,
> Here is a snapshot of a partially implemented HostWindowPlugin
> for X11. I have not looked at this in quite a while, but when
> I last worked on it a number of things were functional (including
> ioSetTitleOfWindow(), for whatever that may be worth).
> Some of the support code is crudely hacked out of Ian's original
> work, and I would anticipate some effort to make this right. In
> particular, it was not clear to me how the X event dispatching
> should ultimately work, and whether the host windows should behave
> analogously to Squeak projects or if they were intended to be
> more like passive display surfaces.
> I could probably be motivated to pick this up again and/or to
> help you with it, but in any case feel free to use this in any
> way you like. MIT license of course, and the plagiarized parts
> should be MIT because I stole them all from Ian ;)
> Dave
> On Fri, Jul 18, 2008 at 06:53:29PM -0700, Bert Freudenberg wrote:
>> Am 05.02.2008 um 02:11 schrieb Bert Freudenberg:
>>> On Feb 5, 2008, at 8:15 , Andreas Raab wrote:
>>>> ioGetWindowLabel/ioSetWindowLabel
>>>> These are support functions that are currently not implemented in
>>>> the Unix/Mac VMs (we use them to get/set the main window title
>>>> directly). Here is how to stub them (best done in sqUnixMain.c):
>>>> char* ioGetWindowLabel(void) {return "";}
>>>> sqInt ioSetWindowLabelOfSize(void* lbl, sqInt size) {return 0;}
>>>> This should do the trick.
>>> Actually, I need to implement these for X11 anyway. Expect this to
>>> soon be supported in the OLPC branch. Unless someone beats me to it
>>> of course :)
>> Hmm, where could I find the code calling this? I'd need both the  
>> slang
>> and image-side code.
>> - Bert -
> <X11HostWindowPlugin-dtl.1.cs.gz><X11HostWindow.tgz>

More information about the Vm-dev mailing list