[WIN32][VM][BUG] Initial window position

Eddie Cottongim cottonsqueak at earthlink.net
Fri Mar 7 00:06:54 UTC 2003


This has been brought up before, but I'll mention it with as many details as
I can.

1. Set the taskbar height to larger than normal (2 rows high for example)
2. Open a stock image.
3. Maximize the Squeak window.
4. Save & Quit.
5. Re-open the image.

The Squeak window will now open partially off the screen (Its one-half of
the title bar height too high.) The problem apparently manifests itself
mainly with non-standard taskbar heights.

On the IRC channel (openprojects.net#squeak) we found that the problem is
almost certainly in sqWin32Window.c: SetWindowSize.

Here is my suggestion to fix it:

Instead of:
 /* maximum size is screen size */
  maxWidth  = GetSystemMetrics(SM_CXFULLSCREEN);
  maxHeight = GetSystemMetrics(SM_CYFULLSCREEN);

Do this:

/* Get the size of the work area (screen - taskbar ) */
  SystemParametersInfo( SPI_GETWORKAREA, 0, &workArea, 0 ); /* workArea is a
RECT */
  maxWidth = workArea.right - workArea.left;
  maxHeight = workArea.bottom - workArea.top;

Then later,
Instead of
  width  = (width <= (maxWidth + deltaWidth))  ?
    width : (maxWidth  + deltaWidth );
  height = (height <= (maxHeight + deltaHeight)) ?
    height : (maxHeight + deltaHeight);

Do this:
  width  = (width <= maxWidth )  ?
    width : maxWidth;
  height = (height <= maxHeight ) ?
    height : maxHeight;

This seems to do the trick for me.

Thanks,
Eddie







More information about the Squeak-dev mailing list