mirror of
https://github.com/narzoul/DDrawCompat
synced 2024-12-30 08:55:36 +01:00
Default paint handlers for Edit and ListBox controls
Missing WM_NCPAINT handler for ListBox was causing the non-client area to display incorrectly. Now the same handler is used as for DefWindowProc.
This commit is contained in:
parent
3827007c0c
commit
fd1063defe
@ -11,10 +11,8 @@
|
|||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
LRESULT WINAPI defWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam,
|
LRESULT WINAPI defPaintProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam,
|
||||||
WNDPROC origDefWindowProc, const char* funcName);
|
WNDPROC origWndProc, const char* origWndProcName);
|
||||||
LRESULT WINAPI eraseBackgroundProc(
|
|
||||||
HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, WNDPROC origWndProc, const char* wndProcName);
|
|
||||||
LRESULT onEraseBackground(HWND hwnd, HDC dc, WNDPROC origWndProc);
|
LRESULT onEraseBackground(HWND hwnd, HDC dc, WNDPROC origWndProc);
|
||||||
LRESULT onMenuPaint(HWND hwnd, WNDPROC origWndProc);
|
LRESULT onMenuPaint(HWND hwnd, WNDPROC origWndProc);
|
||||||
LRESULT onNcPaint(HWND hwnd, WPARAM wParam, WNDPROC origWndProc);
|
LRESULT onNcPaint(HWND hwnd, WPARAM wParam, WNDPROC origWndProc);
|
||||||
@ -28,86 +26,67 @@ namespace
|
|||||||
|
|
||||||
LRESULT WINAPI defDlgProcA(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
|
LRESULT WINAPI defDlgProcA(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
return defWindowProc(hdlg, msg, wParam, lParam, CALL_ORIG_FUNC(DefDlgProcA), "defDlgProcA");
|
return defPaintProc(hdlg, msg, wParam, lParam, CALL_ORIG_FUNC(DefDlgProcA), "defDlgProcA");
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT WINAPI defDlgProcW(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
|
LRESULT WINAPI defDlgProcW(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
return defWindowProc(hdlg, msg, wParam, lParam, CALL_ORIG_FUNC(DefDlgProcW), "defDlgProcW");
|
return defPaintProc(hdlg, msg, wParam, lParam, CALL_ORIG_FUNC(DefDlgProcW), "defDlgProcW");
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT WINAPI defWindowProc(
|
LRESULT WINAPI defPaintProc(
|
||||||
HWND hwnd,
|
HWND hwnd,
|
||||||
UINT msg,
|
UINT msg,
|
||||||
WPARAM wParam,
|
WPARAM wParam,
|
||||||
LPARAM lParam,
|
LPARAM lParam,
|
||||||
WNDPROC origDefWindowProc,
|
WNDPROC origWndProc,
|
||||||
const char* funcName)
|
const char* origWndProcName)
|
||||||
{
|
{
|
||||||
Compat::LogEnter(funcName, hwnd, msg, wParam, lParam);
|
Compat::LogEnter(origWndProcName, hwnd, msg, wParam, lParam);
|
||||||
LRESULT result = 0;
|
LRESULT result = 0;
|
||||||
|
|
||||||
switch (msg)
|
switch (msg)
|
||||||
{
|
{
|
||||||
case WM_ERASEBKGND:
|
case WM_ERASEBKGND:
|
||||||
result = onEraseBackground(hwnd, reinterpret_cast<HDC>(wParam), origDefWindowProc);
|
result = onEraseBackground(hwnd, reinterpret_cast<HDC>(wParam), origWndProc);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_NCPAINT:
|
case WM_NCPAINT:
|
||||||
result = onNcPaint(hwnd, wParam, origDefWindowProc);
|
result = onNcPaint(hwnd, wParam, origWndProc);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_PRINT:
|
case WM_PRINT:
|
||||||
case WM_PRINTCLIENT:
|
case WM_PRINTCLIENT:
|
||||||
result = onPrint(hwnd, msg, reinterpret_cast<HDC>(wParam), lParam, origDefWindowProc);
|
result = onPrint(hwnd, msg, reinterpret_cast<HDC>(wParam), lParam, origWndProc);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
result = origDefWindowProc(hwnd, msg, wParam, lParam);
|
result = origWndProc(hwnd, msg, wParam, lParam);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Compat::LogLeave(funcName, hwnd, msg, wParam, lParam) << result;
|
Compat::LogLeave(origWndProcName, hwnd, msg, wParam, lParam) << result;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT WINAPI defWindowProcA(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
LRESULT WINAPI defWindowProcA(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
return defWindowProc(hwnd, msg, wParam, lParam, CALL_ORIG_FUNC(DefWindowProcA), "defWindowProcA");
|
return defPaintProc(hwnd, msg, wParam, lParam, CALL_ORIG_FUNC(DefWindowProcA), "defWindowProcA");
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT WINAPI defWindowProcW(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
LRESULT WINAPI defWindowProcW(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
return defWindowProc(hwnd, msg, wParam, lParam, CALL_ORIG_FUNC(DefWindowProcW), "defWindowProcW");
|
return defPaintProc(hwnd, msg, wParam, lParam, CALL_ORIG_FUNC(DefWindowProcW), "defWindowProcW");
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT WINAPI editWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
LRESULT WINAPI editWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
return eraseBackgroundProc(hwnd, msg, wParam, lParam, g_origEditWndProc, "editWndProc");
|
return defPaintProc(hwnd, msg, wParam, lParam, g_origEditWndProc, "editWndProc");
|
||||||
}
|
|
||||||
|
|
||||||
LRESULT WINAPI eraseBackgroundProc(
|
|
||||||
HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, WNDPROC origWndProc, const char* wndProcName)
|
|
||||||
{
|
|
||||||
Compat::LogEnter(wndProcName, hwnd, msg, wParam, lParam);
|
|
||||||
|
|
||||||
LPARAM result = 0;
|
|
||||||
if (WM_ERASEBKGND == msg)
|
|
||||||
{
|
|
||||||
result = onEraseBackground(hwnd, reinterpret_cast<HDC>(wParam), origWndProc);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
result = origWndProc(hwnd, msg, wParam, lParam);
|
|
||||||
}
|
|
||||||
|
|
||||||
Compat::LogLeave(wndProcName, hwnd, msg, wParam, lParam) << result;
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT WINAPI listBoxWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
LRESULT WINAPI listBoxWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
return eraseBackgroundProc(hwnd, msg, wParam, lParam, g_origListBoxWndProc, "listBoxWndProc");
|
return defPaintProc(hwnd, msg, wParam, lParam, g_origListBoxWndProc, "listBoxWndProc");
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT WINAPI menuWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
LRESULT WINAPI menuWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
@ -142,7 +121,7 @@ namespace
|
|||||||
{
|
{
|
||||||
if (!hwnd || !CompatGdi::beginGdiRendering())
|
if (!hwnd || !CompatGdi::beginGdiRendering())
|
||||||
{
|
{
|
||||||
return origWndProc(hwnd, WM_ERASEBKGND, reinterpret_cast<WPARAM>(dc) , 0);
|
return origWndProc(hwnd, WM_ERASEBKGND, reinterpret_cast<WPARAM>(dc), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT result = 0;
|
LRESULT result = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user