[SHIMGVW] Correctly draw display border (#2687)

Use WS_EX_CLIENTEDGE extended style for display window.
Fix message WM_SIZE handling. CORE-16983
This commit is contained in:
Katayama Hirofumi MZ 2020-04-28 20:56:18 +09:00 committed by GitHub
parent b139bae58d
commit 03c09c9e2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -900,7 +900,7 @@ ImageView_InitControls(HWND hwnd)
if (shiSettings.Maximized) ShowWindow(hwnd, SW_MAXIMIZE);
hDispWnd = CreateWindowEx(0, WC_STATIC, _T(""),
hDispWnd = CreateWindowEx(WS_EX_CLIENTEDGE, WC_STATIC, _T(""),
WS_CHILD | WS_VISIBLE,
0, 0, 0, 0, hwnd, NULL, hInstance, NULL);
@ -919,6 +919,25 @@ ImageView_OnMouseWheel(HWND hwnd, INT x, INT y, INT zDelta, UINT fwKeys)
}
}
static VOID
ImageView_OnSize(HWND hwnd, UINT state, INT cx, INT cy)
{
RECT rc;
SendMessage(hToolBar, TB_AUTOSIZE, 0, 0);
GetWindowRect(hToolBar, &rc);
MoveWindow(hDispWnd, 0, 0, cx, cy - (rc.bottom - rc.top), TRUE);
/* is it maximized or restored? */
if (state == SIZE_MAXIMIZED || state == SIZE_RESTORED)
{
/* reset zoom */
ResetZoom();
}
}
LRESULT CALLBACK
ImageView_WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
@ -1065,17 +1084,8 @@ ImageView_WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
}
case WM_SIZE:
{
RECT rc;
SendMessage(hToolBar, TB_AUTOSIZE, 0, 0);
GetWindowRect(hToolBar, &rc);
MoveWindow(hDispWnd, 1, 1, LOWORD(lParam) - 1, HIWORD(lParam) - (rc.bottom - rc.top) - 1, TRUE);
/* is it maximized or restored? */
if (wParam == SIZE_MAXIMIZED || wParam == SIZE_RESTORED)
{
/* reset zoom */
ResetZoom();
}
return 0L;
ImageView_OnSize(hwnd, (UINT)wParam, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
return 0;
}
case WM_DESTROY:
{