From 5fa220219e2e00a65d72e05f883d470db5b01a26 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 16 Aug 2024 12:36:42 +0200 Subject: [PATCH] Reverted use of tchar.h which should be considered deprecated. GZDoom is Unicode only - as should be the norm for any Windows application - and will not work when compiled as ANSI so there's no good reason to use this wrapper. --- libraries/ZWidget/src/window/win32/win32window.cpp | 9 ++++----- src/CMakeLists.txt | 9 +-------- src/common/rendering/gl_load/gl_load.c | 3 +-- 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/libraries/ZWidget/src/window/win32/win32window.cpp b/libraries/ZWidget/src/window/win32/win32window.cpp index 48531372c..6ad09ef60 100644 --- a/libraries/ZWidget/src/window/win32/win32window.cpp +++ b/libraries/ZWidget/src/window/win32/win32window.cpp @@ -1,7 +1,6 @@ #include "win32window.h" #include -#include #include #include #include @@ -82,11 +81,11 @@ Win32Window::Win32Window(DisplayWindowHost* windowHost) : WindowHost(windowHost) Windows.push_front(this); WindowsIterator = Windows.begin(); - WNDCLASSEX classdesc = {}; + WNDCLASSEXW classdesc = {}; classdesc.cbSize = sizeof(WNDCLASSEX); classdesc.hInstance = GetModuleHandle(0); classdesc.style = CS_VREDRAW | CS_HREDRAW | CS_DBLCLKS; - classdesc.lpszClassName = _T( "ZWidgetWindow" ); + classdesc.lpszClassName = L"ZWidgetWindow"; classdesc.lpfnWndProc = &Win32Window::WndProc; RegisterClassEx(&classdesc); @@ -95,7 +94,7 @@ Win32Window::Win32Window(DisplayWindowHost* windowHost) : WindowHost(windowHost) // WS_CAPTION shows the caption (yay! actually a flag that does what it says it does!) // WS_SYSMENU shows the min/max/close buttons // WS_THICKFRAME makes the window resizable - CreateWindowEx(WS_EX_APPWINDOW | WS_EX_DLGMODALFRAME, _T( "ZWidgetWindow" ), _T( "" ), WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX, 0, 0, 100, 100, 0, 0, GetModuleHandle(0), this); + CreateWindowExW(WS_EX_APPWINDOW | WS_EX_DLGMODALFRAME, L"ZWidgetWindow", L"", WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX, 0, 0, 100, 100, 0, 0, GetModuleHandle(0), this); /* RAWINPUTDEVICE rid; @@ -299,7 +298,7 @@ double Win32Window::GetDpiScale() const static bool done = false; if (!done) { - HMODULE hMod = GetModuleHandle( _T( "User32.dll" )); + HMODULE hMod = GetModuleHandleA("User32.dll"); if (hMod != nullptr) pGetDpiForWindow = reinterpret_cast(GetProcAddress(hMod, "GetDpiForWindow")); done = true; } diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e10d2cd1f..37d5d4839 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -69,20 +69,13 @@ if( WIN32 ) setupapi oleaut32 dbghelp - dxguid - dwmapi - ) - - if( NOT MINGW ) - list( APPEND PROJECT_LIBRARIES legacy_stdio_definitions ) - endif() + legacy_stdio_definitions ) if( DEM_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE ) if( DX_dxguid_LIBRARY ) list( APPEND PROJECT_LIBRARIES "${DX_dxguid_LIBRARY}" ) endif() endif() - else() if( APPLE ) set( NO_GTK ON ) diff --git a/src/common/rendering/gl_load/gl_load.c b/src/common/rendering/gl_load/gl_load.c index f50830528..d5ba4e49f 100644 --- a/src/common/rendering/gl_load/gl_load.c +++ b/src/common/rendering/gl_load/gl_load.c @@ -46,7 +46,6 @@ static void* PosixGetProcAddress (const GLubyte* name) #undef APIENTRY #endif #include -#include #ifdef _MSC_VER @@ -77,7 +76,7 @@ static void CheckOpenGL(void) { if (opengl32dll == 0) { - opengl32dll = LoadLibrary(_T("OpenGL32.DLL")); + opengl32dll = LoadLibraryA("OpenGL32.DLL"); if (opengl32dll != 0) { createcontext = (HGLRC(WINAPI*)(HDC)) GetProcAddress(opengl32dll, "wglCreateContext");