Skip to content

Commit

Permalink
Disable rounded corners
Browse files Browse the repository at this point in the history
  • Loading branch information
Margen67 committed Dec 17, 2024
1 parent b33ed95 commit 8e3e216
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
11 changes: 6 additions & 5 deletions projects/cxbx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -68,7 +68,7 @@ XXH_INLINE_ALL
)

file (GLOB RESOURCES

"${CXBXR_ROOT_DIR}/CONTRIBUTORS"
"${CXBXR_ROOT_DIR}/COPYING"
"${CXBXR_ROOT_DIR}/README.md"
Expand All @@ -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}
)
Expand Down Expand Up @@ -142,15 +142,15 @@ 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-"
)
endif()

# Windows libraries
set(WINS_LIB
set(WINS_LIB
legacy_stdio_definitions
d3d9
d3dcompiler
Expand All @@ -170,6 +170,7 @@ set(WINS_LIB
comctl32
XINPUT9_1_0
Iphlpapi
Dwmapi
)

target_link_libraries(cxbx
Expand Down
19 changes: 17 additions & 2 deletions src/gui/WndMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
#undef GetSystemMetrics // Force remove DirectX 8's multimon.h defined function (redirect to xGetSystemMetrics).
#include <WinUser.h> // For GetSystemMetrics

#include <dwmapi.h>

#include <io.h>
#include <shlobj.h>

Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 8e3e216

Please sign in to comment.