From df5a3cee4ae9bb7287297e7f25f7080b6079be36 Mon Sep 17 00:00:00 2001 From: Jonathan Marler Date: Fri, 18 Apr 2025 07:41:36 -0600 Subject: [PATCH] [rcore][win32] fixes from review/for gcc --- src/Makefile | 7 +++++++ src/platforms/rcore_desktop_win32.c | 23 +---------------------- 2 files changed, 8 insertions(+), 22 deletions(-) diff --git a/src/Makefile b/src/Makefile index 833f955a9..ef0001186 100644 --- a/src/Makefile +++ b/src/Makefile @@ -342,6 +342,10 @@ ifeq ($(PLATFORM_OS), LINUX) CFLAGS += -fPIC endif +ifeq ($(PLATFORM_OS),WINDOWS) + CFLAGS += -DUNICODE +endif + ifeq ($(RAYLIB_BUILD_MODE),DEBUG) CFLAGS += -g -D_DEBUG endif @@ -628,6 +632,9 @@ ifeq ($(TARGET_PLATFORM),PLATFORM_DRM) LDLIBS += -latomic endif endif +ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_WIN32) + LDLIBS = -lgdi32 -lwinmm -lopengl32 -lshcore +endif ifeq ($(TARGET_PLATFORM),PLATFORM_ANDROID) LDLIBS = -llog -landroid -lEGL -lGLESv2 -lOpenSLES -lc -lm endif diff --git a/src/platforms/rcore_desktop_win32.c b/src/platforms/rcore_desktop_win32.c index 9171a7d23..e47f0cf76 100644 --- a/src/platforms/rcore_desktop_win32.c +++ b/src/platforms/rcore_desktop_win32.c @@ -129,7 +129,6 @@ static bool ResizableFromStyle(DWORD style) } static bool DecoratedFromStyle(DWORD style) { - bool is_off; if (style & STYLE_FLAGS_UNDECORATED_ON) { if (style & STYLE_FLAGS_UNDECORATED_OFF) { TRACELOG(LOG_ERROR, "style 0x%x has both undecorated on/off flags", style); @@ -471,7 +470,7 @@ static BOOL IsWindows10Version1703OrGreaterWin32(void) LogFail("GetProcAddress 'RtlVerifyVersionInfo'", GetLastError()); return 0; } - OSVERSIONINFOEX osvi = { 0 }; + RTL_OSVERSIONINFOEXW osvi = { 0 }; osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); osvi.dwMajorVersion = 10; osvi.dwMinorVersion = 0; @@ -713,26 +712,6 @@ static LPCWSTR GetCursorName(int cursor) } -static UINT GetMonitorDpi(HMONITOR monitor) -{ - UINT dpi_x; - UINT dpi_y; - HRESULT hr = GetDpiForMonitor(monitor, MDT_EFFECTIVE_DPI, &dpi_x, &dpi_y); - if (hr < 0) { - LogFailHr("GetDpiForMonitor", hr); - abort(); - } - if (dpi_x != dpi_y) { - TRACELOG(LOG_ERROR, "DPI X (%lu) != DPI Y (%lu)", dpi_x, dpi_y); - abort(); - } - if (dpi_x < 96) { - TRACELOG(LOG_ERROR, "unexpected dpi %lu", dpi_x); - abort(); - } - return dpi_x; -} - static BOOL CALLBACK CountMonitorsProc(HMONITOR handle, HDC _, LPRECT rect, LPARAM lparam) { int* count = (int*)lparam;