diff --git a/ui_windows.h b/ui_windows.h index 41984242..7c24a4d1 100644 --- a/ui_windows.h +++ b/ui_windows.h @@ -35,23 +35,17 @@ struct uiWindowsMakeControlParams { void uiWindowsMakeControl(uiControl *c, uiWindowsMakeControlParams *p); // This contains the Windows-specific parts of the uiSizing structure. -// dwp contains the HDWP to issue a resize request to. -// You only need to worry about it if you are implementing your own Resize(). // baseX and baseY are the dialog base units. // internalLeading is the standard control font's internal leading; labels in uiForms use this for correct Y positioning. struct uiSizingSys { - HDWP dwp; int baseX; int baseY; LONG internalLeading; }; -// Use these in your PreferredSize() implementation with baseX and baseY. +// Use these in your preferredSize() implementation with baseX and baseY. #define uiDlgUnitsToX(dlg, baseX) MulDiv((dlg), baseX, 4) #define uiDlgUnitsToY(dlg, baseY) MulDiv((dlg), baseY, 8) -// Use this in your Resize() implementation. -void uiWindowsResizeHWND(HWND hwnd, intmax_t x, intmax_t y, intmax_t width, intmax_t height, uiSizing *d); - // and use this if you need the text of the window width extern intmax_t uiWindowsWindowTextWidth(HWND hwnd); diff --git a/windows/container.c b/windows/container.c index 5af8c0c1..69ccc360 100644 --- a/windows/container.c +++ b/windows/container.c @@ -127,15 +127,7 @@ static HRESULT resize(uiContainer *cc, RECT *r) d.xPadding = uiDlgUnitsToX(winXPadding, sys.baseX); d.yPadding = uiDlgUnitsToY(winYPadding, sys.baseY); d.sys = &sys; - - // 32 is an arbitrary number to start with, just to be safe - d.sys->dwp = BeginDeferWindowPos(32); - if (d.sys->dwp == NULL) - logLastError("error beginning resize in resize()"); uiContainerResizeChildren(cc, r->left, r->top, r->right - r->left, r->bottom - r->top, &d); - if (EndDeferWindowPos(d.sys->dwp) == 0) - logLastError("error ending resize in resize()"); - return S_OK; } @@ -309,7 +301,8 @@ static void containerResize(uiControl *cc, intmax_t x, intmax_t y, intmax_t widt { struct container *c = (struct container *) (cc->Internal); - uiWindowsResizeHWND(c->hwnd, x, y, width, height, d); + if (MoveWindow(c->hwnd, x, y, width, height, TRUE) == 0) + logLastError("error resizing uiContainer in containerResize()"); } static int containerVisible(uiControl *cc) diff --git a/windows/newcontrol.c b/windows/newcontrol.c index 962695a3..a19b8cc8 100644 --- a/windows/newcontrol.c +++ b/windows/newcontrol.c @@ -56,7 +56,8 @@ static void singleResize(uiControl *c, intmax_t x, intmax_t y, intmax_t width, i { struct singleHWND *s = (struct singleHWND *) (c->Internal); - uiWindowsResizeHWND(s->hwnd, x, y, width, height, d); + if (MoveWindow(s->hwnd, x, y, width, height, TRUE) == 0) + logLastError("error moving control in singleResize()"); } static int singleVisible(uiControl *c) @@ -206,10 +207,3 @@ void uiWindowsControlSetText(uiControl *c, const char *text) logLastError("error setting control text in uiWindowsControlSetText()"); uiFree(wtext); } - -void uiWindowsResizeHWND(HWND hwnd, intmax_t x, intmax_t y, intmax_t width, intmax_t height, uiSizing *d) -{ - d->sys->dwp = DeferWindowPos(d->sys->dwp, hwnd, NULL, x, y, width, height, SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOZORDER); - if (d->sys->dwp == NULL) - logLastError("error queuing window for resize in uiWindowsResizeHWND()"); -}