diff --git a/projects/cxbx/CMakeLists.txt b/projects/cxbx/CMakeLists.txt index 01dc847fc5..261edc59cd 100644 --- a/projects/cxbx/CMakeLists.txt +++ b/projects/cxbx/CMakeLists.txt @@ -46,7 +46,7 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") # Enable Chihiro work CHIHIRO_WORK ) - + # Reference: https://docs.microsoft.com/en-us/cpp/build/reference/compiler-options-listed-alphabetically add_compile_options( # Catch synchronous (C++) exceptions only @@ -68,7 +68,7 @@ XXH_INLINE_ALL ) file (GLOB RESOURCES - + "${CXBXR_ROOT_DIR}/CONTRIBUTORS" "${CXBXR_ROOT_DIR}/COPYING" "${CXBXR_ROOT_DIR}/README.md" @@ -90,7 +90,7 @@ source_group(TREE ${CXBXR_ROOT_DIR}/import PREFIX import FILES ${CXBXR_SOURCE_EMU_IMPORT} ) -source_group(TREE ${CXBXR_ROOT_DIR}/src PREFIX source FILES +source_group(TREE ${CXBXR_ROOT_DIR}/src PREFIX source FILES ${CXBXR_SOURCE_GUIv1} ${CXBXR_SOURCE_COMMON} ) @@ -142,7 +142,7 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") /Qpar \ " ) - + # disable optimization for CxbxKrnl.cpp file set_source_files_properties( ${CXBXR_KRNL_CPP} PROPERTIES COMPILE_FLAGS "/Od /GL-" @@ -150,7 +150,7 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") endif() # Windows libraries -set(WINS_LIB +set(WINS_LIB legacy_stdio_definitions d3d9 d3dcompiler @@ -170,6 +170,7 @@ set(WINS_LIB comctl32 XINPUT9_1_0 Iphlpapi + Dwmapi ) target_link_libraries(cxbx diff --git a/src/gui/WndMain.cpp b/src/gui/WndMain.cpp index 6f26b26281..7fb786aac7 100644 --- a/src/gui/WndMain.cpp +++ b/src/gui/WndMain.cpp @@ -56,6 +56,8 @@ #undef GetSystemMetrics // Force remove DirectX 8's multimon.h defined function (redirect to xGetSystemMetrics). #include // For GetSystemMetrics +#include + #include #include @@ -323,8 +325,21 @@ LRESULT CALLBACK WndMain::WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lP ChangeWindowMessageFilterEx(hwnd, WM_COPYDATA, MSGFLT_ALLOW, nullptr); ChangeWindowMessageFilterEx(hwnd, 0x0049, MSGFLT_ALLOW, nullptr); - m_bCreated = true; - } + if (hwnd) + { + // Remove rounded corners from the render window on Windows 11 + const DWM_WINDOW_CORNER_PREFERENCE corner_preference = DWMWCP_DONOTROUND; + DwmSetWindowAttribute(hwnd, DWMWA_WINDOW_CORNER_PREFERENCE, &corner_preference, + sizeof(corner_preference)); + // initialize menu + { + HMENU hMenu = LoadMenu(m_hInstance, MAKEINTRESOURCE(IDR_MAINMENU)); + + SetMenu(hwnd, hMenu); + } + } + m_bCreated = true; + } break; // NOTE: WM_PARENTNOTIFY was triggered by kernel process' graphic window creation.