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
Thu May 12 02:45:49 UTC 2016


On Wed, May 11, 2016 at 03:35:49PM +0200, Bert Freudenberg wrote:
> On 11.05.2016, at 15:02, David T. Lewis <lewis at mail.msen.com> wrote:
> > 
> > On Wed, May 11, 2016 at 10:47:11AM +0200, Bert Freudenberg wrote:
> >> On 11.05.2016, at 07:32, tim Rowledge <tim at rowledge.org> wrote:
> >> 
> >>>> 
> >>>> 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.
> >>> 
> >>> IIRC (after all, I wrote this 12 years ago) we defined that the ???root??? window had to have a 1 index just so we could rely upon something.
> >> 
> >> Yep. That's why it's hard-coded in DisplayScreen but a variable in HostWindowProxy.
> >> 
> > 
> > Hmmm... it looks to me like it may take some work to make the unix
> > plugin work that way. But maybe I was just overlooking something.
> 
> The version I see here actually works *only* for the main Squeak window:
> 
> static int display_hostWindowSetTitle(int windowIndex, char *newTitle, int sizeOfTitle)
> { 
>   if (windowIndex != 1)
>     return -1;
> 
>   XChangeProperty(stDisplay, stParent,
> 		  XInternAtom(stDisplay, "_NET_WM_NAME", False),
> 		  XInternAtom(stDisplay, "UTF8_STRING",  False),
> 		  8, PropModeReplace, newTitle, sizeOfTitle);
> 
>   return 0;
> }
> 
> (and setting the size is not implemented)
> 
> static int display_hostWindowSetSize(int windowIndex, int w, int h)
> { return -1; }
> 

Aha, that gives me an idea. If the established convention is that window
handle 1 refers to the Squeak display window, then maybe we can maintain
the convention by having sqUnixX11.c check for this and convert it to the
actual X11 Window of the display window.

The code that you quote above is the current SVN trunk. The oscog branch
has the same implementation for display_hostWindowSetTitle, and adds various
things from Qwaq including a display_hostWindowSetSize(). The Qwaq methods
all to use the X11 Window as the handle, and that is the part that does
not yet work.

So maybe there is an easy fix, convert index 1 to the window handle
of the display window, stParent. For all other cases, treat the handles
as opaque values. Yes, I think it will work :-)

Dave



More information about the Squeak-dev mailing list