mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-25 05:21:16 +00:00
Better solution for DwmDefWindowProc on mingw64
On mingw, create our own thunk for DwmDefWindowProc. It should exist in libdwmapi.a (and exists in MSVC), but doesn't.
This commit is contained in:
parent
709d5dd742
commit
699bef1316
2 changed files with 25 additions and 3 deletions
|
@ -120,6 +120,9 @@ include_directories(include include/zwidget src)
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
set(ZWIDGET_SOURCES ${ZWIDGET_SOURCES} ${ZWIDGET_WIN32_SOURCES})
|
set(ZWIDGET_SOURCES ${ZWIDGET_SOURCES} ${ZWIDGET_WIN32_SOURCES})
|
||||||
add_definitions(-DUNICODE -D_UNICODE)
|
add_definitions(-DUNICODE -D_UNICODE)
|
||||||
|
if(MINGW)
|
||||||
|
add_definitions(-DMINGW)
|
||||||
|
endif()
|
||||||
elseif(APPLE)
|
elseif(APPLE)
|
||||||
set(ZWIDGET_SOURCES ${ZWIDGET_SOURCES} ${ZWIDGET_COCOA_SOURCES})
|
set(ZWIDGET_SOURCES ${ZWIDGET_SOURCES} ${ZWIDGET_COCOA_SOURCES})
|
||||||
set(ZWIDGET_LIBS ${CMAKE_DL_LIBS} -ldl)
|
set(ZWIDGET_LIBS ${CMAKE_DL_LIBS} -ldl)
|
||||||
|
|
|
@ -29,6 +29,26 @@
|
||||||
#define RIDEV_INPUTSINK (0x100)
|
#define RIDEV_INPUTSINK (0x100)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef MINGW
|
||||||
|
// MinGW's library doesn't contain a thunk for DwmDefWindowProc, so we need to create our own
|
||||||
|
|
||||||
|
BOOL DwmDefWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, LRESULT *plResult )
|
||||||
|
{
|
||||||
|
typedef LRESULT(* dwmdwp)(HWND, UINT, WPARAM, LPARAM );
|
||||||
|
BOOL result(false);
|
||||||
|
HMODULE module = LoadLibrary( _T( "dwmapi.dll" ) );
|
||||||
|
if( module ) {
|
||||||
|
dwmdwp proc = reinterpret_cast<dwmdwp>( GetProcAddress( module, "DwmDefWindowProc" ) );
|
||||||
|
if( proc ) {
|
||||||
|
*plResult = proc( hWnd, msg, wParam, lParam );
|
||||||
|
}
|
||||||
|
FreeLibrary(module);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
static std::string from_utf16(const std::wstring& str)
|
static std::string from_utf16(const std::wstring& str)
|
||||||
{
|
{
|
||||||
if (str.empty()) return {};
|
if (str.empty()) return {};
|
||||||
|
@ -389,9 +409,8 @@ LRESULT Win32Window::OnWindowMessage(UINT msg, WPARAM wparam, LPARAM lparam)
|
||||||
{
|
{
|
||||||
LPARAM result = 0;
|
LPARAM result = 0;
|
||||||
|
|
||||||
// DwmDefWindowProc is not a publicly defined symbol on Windows 11
|
if (DwmDefWindowProc(WindowHandle, msg, wparam, lparam, &result))
|
||||||
/*if (DwmDefWindowProc(WindowHandle, msg, wparam, lparam, &result))
|
return result;
|
||||||
return result;*/
|
|
||||||
|
|
||||||
if (msg == WM_INPUT)
|
if (msg == WM_INPUT)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue