diff --git a/hw/xwin/winwndproc.c b/hw/xwin/winwndproc.c index 27fc840b5..04a3a6b86 100644 --- a/hw/xwin/winwndproc.c +++ b/hw/xwin/winwndproc.c @@ -303,7 +303,7 @@ winWindowProc (HWND hwnd, UINT message, winDebug ("winWindowProc - WM_SIZE\n"); #endif - /* Break if we do not use scrollbars */ + /* Break if we do not allow resizing */ if ((s_pScreenInfo->iResizeMode == notAllowed) || !s_pScreenInfo->fDecoration #ifdef XWIN_MULTIWINDOWEXTWM @@ -320,6 +320,17 @@ winWindowProc (HWND hwnd, UINT message, if (wParam == SIZE_MINIMIZED) return 0; + ErrorF ("winWindowProc - WM_SIZE - new client area w: %d h: %d\n", + LOWORD (lParam), HIWORD (lParam)); + + if (s_pScreenInfo->iResizeMode == resizeWithRandr) + { + /* Actual resizing is done on WM_EXITSIZEMOVE */ + return 0; + } + + /* Otherwise iResizeMode == resizeWithScrollbars */ + /* * Get the size of the whole window, including client area, * scrollbars, and non-client area decorations (caption, borders). @@ -337,10 +348,6 @@ winWindowProc (HWND hwnd, UINT message, iWidth = rcWindow.right - rcWindow.left; iHeight = rcWindow.bottom - rcWindow.top; - ErrorF ("winWindowProc - WM_SIZE - window w: %d h: %d, " - "new client area w: %d h: %d\n", - iWidth, iHeight, LOWORD (lParam), HIWORD (lParam)); - /* Subtract the frame size from the window size. */ iWidth -= 2 * GetSystemMetrics (SM_CXSIZEFRAME); iHeight -= (2 * GetSystemMetrics (SM_CYSIZEFRAME) @@ -396,6 +403,37 @@ winWindowProc (HWND hwnd, UINT message, } return 0; + case WM_ENTERSIZEMOVE: + ErrorF("winWindowProc - WM_ENTERSIZEMOVE\n"); + break; + + case WM_EXITSIZEMOVE: + ErrorF("winWindowProc - WM_EXITSIZEMOVE\n"); + + if (s_pScreenInfo->iResizeMode == resizeWithRandr) + { + /* Set screen size to match new client area, if it is different to current */ + RECT rcClient; + DWORD dwWidth, dwHeight; + + GetClientRect (hwnd, &rcClient); + dwWidth = rcClient.right - rcClient.left; + dwHeight = rcClient.bottom - rcClient.top; + + if ((s_pScreenInfo->dwWidth != dwWidth) || + (s_pScreenInfo->dwHeight != dwHeight)) + { + /* mm = dots * (25.4 mm / inch) / (dots / inch) */ + winDoRandRScreenSetSize(s_pScreen, + dwWidth, + dwHeight, + (dwWidth * 25.4) / monitorResolution, + (dwHeight * 25.4) / monitorResolution); + } + } + + break; + case WM_VSCROLL: { SCROLLINFO si;