This is the mail archive of the
cygwin-apps@cygwin.com
mailing list for the Cygwin project.
[Patch] Resizing fixes
- From: Frank Richter <frichter at gmx dot li>
- To: Cygwin Apps <cygwin-apps at cygwin dot com>
- Date: Fri, 31 Oct 2003 13:33:14 +0100
- Subject: [Patch] Resizing fixes
This patch now properly deals with minimizing the window - before, some
sizes/positions were slightly off when the window was minimized and
restored. It also constraints the size of the property sheet, it now
can't get smaller than it's initial size.
-f.r.
2003-10-31 Frank Richter <frichter@gmx.li>
* propsheet.cc (PropSheetWndProc): Don't do child resizing if a the
window gets minimized. Otherwise some glitches (e.g. wrong child
sizes) occur.
Added support for WM_GETMINMAXINFO. Prevents the property sheet from
getting smaller than the original size.
Index: propsheet.cc
===================================================================
RCS file: /cvs/cygwin-apps/setup/propsheet.cc,v
retrieving revision 2.7
diff -r2.7 propsheet.cc
111a112,113
> bool hasMinRect;
> RECTWrapper minRect;
117a120
> hasMinRect = false;
171c174,177
< The first time we get a WM_SIZE, the client rect will be all zeros.
---
> When the window is minimized, the client rect is reduced to
> (0,0-0,0), which causes child adjusting to screw slightly up. Work
> around by not adjusting child upon minimization - it isn't really
> needed then, anyway.
173c179
< if (psd.clientRectValid)
---
> if (wParam != SIZE_MINIMIZED)
175,185d180
< const int dX =
< clientRect.width () - psd.lastClientRect.width ();
< const int dY =
< clientRect.height () - psd.lastClientRect.height ();
<
< ControlAdjuster::AdjustControls (hwnd, PropSheetControlsInfo,
< dX, dY);
<
< psd.pageRect.right += dX;
< psd.pageRect.bottom += dY;
<
187,189c182,210
< The pages are child windows, but don't have IDs.
< So change them by enumerating all childs and adjust all dilogs
< among them.
---
> The first time we get a WM_SIZE, the client rect will be all zeros.
> */
> if (psd.clientRectValid)
> {
> const int dX =
> clientRect.width () - psd.lastClientRect.width ();
> const int dY =
> clientRect.height () - psd.lastClientRect.height ();
>
> ControlAdjuster::AdjustControls (hwnd, PropSheetControlsInfo,
> dX, dY);
>
> psd.pageRect.right += dX;
> psd.pageRect.bottom += dY;
>
> /*
> The pages are child windows, but don't have IDs.
> So change them by enumerating all childs and adjust all
> dialogs among them.
> */
> if (psd.gotPage)
> EnumChildWindows (hwnd, &EnumPages, 0);
> }
> else
> {
> psd.clientRectValid = true;
> }
> /*
> Store away the current size and use it as the minmal window size.
191,192c212,218
< if (psd.gotPage)
< EnumChildWindows (hwnd, &EnumPages, 0);
---
> if (!psd.hasMinRect)
> {
> GetWindowRect (hwnd, &psd.minRect);
> psd.hasMinRect = true;
> }
>
> psd.lastClientRect = clientRect;
194c220,224
< else
---
> }
> break;
> case WM_GETMINMAXINFO:
> {
> if (psd.hasMinRect)
196c226,228
< psd.clientRectValid = true;
---
> LPMINMAXINFO mmi = (LPMINMAXINFO)lParam;
> mmi->ptMinTrackSize.x = psd.minRect.width ();
> mmi->ptMinTrackSize.y = psd.minRect.height ();
198,199d229
<
< psd.lastClientRect = clientRect;
359c389
< the final metrucs of the page. So, the first time this method is called,
---
> the final metrics of the page. So, the first time this method is called,