[squeak-dev] Host Window Support

Bert Freudenberg bert at freudenbergs.de
Fri Jan 6 18:56:51 UTC 2012


On 06.01.2012, at 19:43, Eliot Miranda wrote:

> 
> 
> On Fri, Jan 6, 2012 at 8:13 AM, Bert Freudenberg <bert at freudenbergs.de> wrote:
> 
> On 06.01.2012, at 16:55, John McKeon wrote:
> 
> > I thought I would help out and test it on Windows.
> > For some reason the mouse events from the HostWindow never reflect the button press. evt at: 5 always returns 0.
> 
> That's strange. HostWindowPlugin uses the same code to record mouse events as the regular window ...
> 
> > One other thing I noticed is the main Squeak window title changes to "Paint Test" and the host window title is "Squeak!".
> > Tested on Win7 and XP with the cog vm v2522 13 Dec 2011
> 
> Hehe. Okay, that one is obviously a bug in the VM. It should really use SetWindowTextW(hwnd, ...:
> 
> sqInt ioSetTitleOfWindow(sqInt windowIndex, char * newTitle, sqInt sizeOfTitle) {
>  HWND hwnd = (windowIndex == 1 ? stWindow : ((HWND)windowIndex));
>  char titleString[1024];
>  WCHAR wideTitle[1024];
> 
>  if(!IsWindow(hwnd)) return 0;
>  if (sizeOfTitle > 1023) sizeOfTitle = 1023;
>  strncpy(titleString, newTitle, sizeOfTitle);
>  titleString[sizeOfTitle] = 0;
>  MultiByteToWideChar(CP_UTF8, 0, titleString, -1, wideTitle, 1024);
>  if(SetWindowTextW(stWindow, wideTitle) == 0) return -1;
>  return sizeOfTitle;
> }
> 
> But the code in platforms/win32/plugins/HostWindowPlugin/sqWin32HostWindowPlugin.c in the Cog sources looks to be exactly that, and the code hasn't changed since April 2010...  Which version of the sources contains the bug?

That version. It needs to say this instead:

SetWindowTextW(hwnd, ...

It should use hwnd instead of stWindow.

- Bert -

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20120106/5b707138/attachment.htm


More information about the Squeak-dev mailing list