On Monday 06 July 2026 12:57:00 LIU Hao wrote:
> 在 2026-7-6 05:48, Pali Rohár 写道:
> > Hello, in the attachment I'm sending changes for mingw-w64 scrnsave library.
> > 
> > Changes are fixing entrypoint for UNICODE version of library
> > (libscrnsavw.a), disabling win9x compatibility code for non-i386 builds
> > and fixing win9x compatibility code to really work on win9x and winnt.
> > 
> > With those changes the WinSDK sample fractal.c screensaver can be linked
> > with mingw-w64 scrnsave library.
> 
> Does it make sense to apply this change on top of it:
> 
> diff --git a/mingw-w64-crt/libsrc/scrnsave.c b/mingw-w64-crt/libsrc/scrnsave.c
> index 80a483b23..5af6ccac4 100644
> --- a/mingw-w64-crt/libsrc/scrnsave.c
> +++ b/mingw-w64-crt/libsrc/scrnsave.c
> @@ -238,16 +238,14 @@ static int LaunchScreenSaver(HWND hParent)

So for the whole context those are hidden lines above:

     if (hParent)
       {
         style = WS_CHILD;
         GetClientRect(hParent, &rc);
       }
     else
       {
         style = WS_POPUP;

>        hdc = GetDC(NULL);
>        GetClipBox(hdc, &rc);
>        ReleaseDC(NULL, hdc);
> -      rc.right -= rc.left;
> -      rc.bottom -= rc.top;
>        style |= WS_VISIBLE;
>      }
> 
>    /* create main screen saver window */
>    hMainWindow = CreateWindowEx(hParent ? 0 : WS_EX_TOPMOST, CLASS_SCRNSAVE,
>                                 TEXT("SCREENSAVER"), style,
> -                               rc.left, rc.top, rc.right, rc.bottom, 
> hParent, NULL,
> -                               hMainInstance, NULL);
> +                               rc.left, rc.top, rc.right - rc.left, 
> rc.bottom - rc.top,
> +                               hParent, NULL, hMainInstance, NULL);
> 
>    /* display window and start pumping messages */
>    if (hMainWindow)
> 
> 
> Your proposed change stores the width in `right` and height in `bottom`,
> which contradicts the names of those fields.
> 
> `GetClientRect()` sets `left` and `top` to zeros so it happens to work either 
> way.

That sounds like a good idea. I will test this change if everything
would work as expected.


_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to