DisplayScreen class>>hostWindowExtent: with HostWindowPlugin on X11 cannot possibly work (was: [squeak-dev] Re: The Trunk: Graphics-mt.332.mcz)

David T. Lewis lewis at mail.msen.com
Wed May 11 03:08:57 UTC 2016


On Tue, May 10, 2016 at 09:59:25PM -0400, David T. Lewis wrote:
> On Mon, May 09, 2016 at 10:44:22AM -0700, tim Rowledge wrote:
> > 
> > > On 09-05-2016, at 3:16 AM, Levente Uzonyi <leves at caesar.elte.hu> wrote:
> > > 
> > > The thing is that there's no HostWindowPlugin at all in http://www.mirandabanda.org/files/Cog/VM/latest/cogspur64linuxht-16.18.3692.tgz .
> > 
> > Dang, he???s right. There is no building of HostWindowPlugin in the linux build trees I???ve checked. Which must mean I???ve only ever set the size of the Scratch window on my iMac, which is seriously weirding me. I would *swear* (loudly) that we???ve been building with it included. Oh well, let???s try it out and see.
> > 
> > {later} damnitstupidmake
> > {later} damnintstupidirritatingmake
> > {time passes???}at last it???s in the buildlist
> > {late}ooh it appears to build???
> > {later} it produces the blank white screen Yoshiki mentioned. Bugger.
> > 
> > 
> > tim
> > --
> > tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
> > "Bother!" said Pooh, as Piglet pressed <START> on the Microwave...
> 
> Background: Marcel updated DisplayScreen methods to use HostWindowPlugin
> to set the Squeak window size and window title. Meanwhile, Tim is trying
> to get the plugin to compile for a Unix VM for Raspberry Pi.
> 
> But this cannot possibly work. The window index used by HostWindowPlugin
> is supposed to be opaque value, known to the plugin but not to the image.
> On a Windows platform, the window index might be 1. This is the value
> that we currently have hard-coded in DisplayScreen class>>hostWindowIndex.
> On a platform with X11 display, the host window index is an integer value
> of type Window, which might be a value such as 16rA00001 (as tested on
> my PC a few minutes ago:
> 
>      xwininfo: Window id: 0x3a00001 "squeak.image"
> 
> For a Unix VM, the HostWindowPlugin delegates to methods in
> platforms/unix/vm-display-X11/sqUnixX11.c, which contains a check to make
> sure that all window handles are are integer values greater than 16rFFFF
> (so of course a value of 1 will fail). Presumably this is because the
> designers of X11 wanted to ensure that their window handles would be values
> that could not be easily confused with integers such as 0, 1, 2, 3, ... and
> most likely Ian Piumarta was aware of this and added the check to fail the
> primitive if the window handle was a value such as 1.
> 
> Therefore if Tim gets the HostWindowPlugin to compile, it is not going
> to work anyway.
> 
> I suspect that we are missing something here with respect to the earlier
> Qwaq code, which presumably did work. The missing thing seems to be a
> way to obtain a handle for the Squeak display window. Possibly we could
> use one additional HostWindowPlugin primitive to provide this information,
> such that DisplayScreen class>>hostWindowIndex could call that primitive
> rather than assuming a hard-coded value of 1.
> 
> I also would guess that Qwaq actually did the Right Thing, which would
> be to let the image open its main display window by requesting it from
> the VM (HostWindowPlugin in this case), and letting the plugin provide
> the window handle as the result of that request. IMO that would be the
> right way to do it for Squeak also, but for purposes of backward compatibility
> in the near term, a HostWindowPlugin>>primitiveDefaultDisplayWindow would
> be sufficient. On Windows, it would probably answer 1, and on X11 it would
> answer the Window handle of the Squeak application window.

One additional follow up: I just confirmed that if I find the Window ID
of my Squeak window (using unix utility xwininfo), and use that value
as the window handle, then the Squeak window resize does work. At least
the window gets resized and the primitive does not fail, although I am
not entirely certain if my window ID is the stWindow or the stParent
window, so the resizing behavior may be off by a few pixels.

I did this:

   hostWindowIndex := 16r3800001.
   [ DisplayScreen
   		primitiveWindow: hostWindowIndex
   		width: 800
   		height: 600 ]
           on: Error
           do: [ :error | error messageText ]

The 16r3800001 window ID is what I got from running xwininfo, so I was
using this as the window handle in the call to the HostWindowPlugin primitive.

Disclaimer: I am testing with an interpreter VM with Qwaq enhancements
harvested from oscog added to sqUnixX11.c on my PC, not committed to SVN.
This is theoretically equivalent to the latest Cog/Spur but YMMV.

Dave



More information about the Squeak-dev mailing list