Re: ClientToWindowSize() doesn't work correctly with minimized windows on MSW
Vadim Zeitlin <[email protected]>
| Newsgroups | gmane.comp.lib.wxwindows.general |
|---|---|
| Message-ID | <[email protected]> |
On Sun, 11 Aug 2024 16:22:29 +0200 Andreas Falkenhahn wrote:
AF> I've noticed that using ClientToWindowSize() or WindowToClientSize()
AF> yields wrong results when the window is minimized on MSW because
AF> minimized windows on MSW have a size of 0/0 so the following
AF> calculation done by ClientToWindowSize()
AF>
AF> const wxSize diff(GetSize() - GetClientSize());
AF>
AF> yields a difference of whatever size is in GetSize() and this
AF> difference is then added to the size passed to ClientToWindowSize()
AF> which obviously leads to completely wrong dimensions returned by
AF> ClientToWindowSize().
This is unfortunate but I don't know what can be done about it, as I don't
know of any way to compute the size of the non-client area reliably for any
window.
AF> The fact that ClientToWindowSize() doesn't work correctly when the
AF> window is minimized also has the implications that functions like
AF> SetMinClientSize() etc. don't work correctly with minimized windows on
AF> MSW...
So the solution would be to remember the size passed to them if the window
is minimized when this function is called and only use it later when the
window is restored.
AF> So I'm wondering if this is this something that should be fixed or are
AF> those functions simply not supposed to be used on minimized windows on
AF> MSW?
For now I think it would be better to assert in them to warn people that
this doesn't work, but ideally they should work in any case, of course.
It's just that somebody would need to implement the correct behaviour...
Regards,
VZ
--
TT-Solutions: wxWidgets consultancy and technical support
https://www.tt-solutions.com/
signature.asc
(application/pgp-signature, 195 B)
-----BEGIN PGP SIGNATURE----- iF0EABECAB0WIQQx+vLQdOwioQqkxtoG6kHeT2wehgUCZrj2VAAKCRAG6kHeT2we hi2zAKCHS8V9rhAWltwjDzK6XdHb3AGyhQCfWNrmpBnYd32ahwv8oiSiYEHQ3BQ= =mUvv -----END PGP SIGNATURE-----