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.
This commit is contained in:
Christoph Oelckers 2024-08-16 12:36:42 +02:00
commit 5fa220219e
3 changed files with 6 additions and 15 deletions

View file

@ -1,7 +1,6 @@
#include "win32window.h" #include "win32window.h"
#include <windowsx.h> #include <windowsx.h>
#include <tchar.h>
#include <stdexcept> #include <stdexcept>
#include <cmath> #include <cmath>
#include <vector> #include <vector>
@ -82,11 +81,11 @@ Win32Window::Win32Window(DisplayWindowHost* windowHost) : WindowHost(windowHost)
Windows.push_front(this); Windows.push_front(this);
WindowsIterator = Windows.begin(); WindowsIterator = Windows.begin();
WNDCLASSEX classdesc = {}; WNDCLASSEXW classdesc = {};
classdesc.cbSize = sizeof(WNDCLASSEX); classdesc.cbSize = sizeof(WNDCLASSEX);
classdesc.hInstance = GetModuleHandle(0); classdesc.hInstance = GetModuleHandle(0);
classdesc.style = CS_VREDRAW | CS_HREDRAW | CS_DBLCLKS; classdesc.style = CS_VREDRAW | CS_HREDRAW | CS_DBLCLKS;
classdesc.lpszClassName = _T( "ZWidgetWindow" ); classdesc.lpszClassName = L"ZWidgetWindow";
classdesc.lpfnWndProc = &Win32Window::WndProc; classdesc.lpfnWndProc = &Win32Window::WndProc;
RegisterClassEx(&classdesc); 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_CAPTION shows the caption (yay! actually a flag that does what it says it does!)
// WS_SYSMENU shows the min/max/close buttons // WS_SYSMENU shows the min/max/close buttons
// WS_THICKFRAME makes the window resizable // 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; RAWINPUTDEVICE rid;
@ -299,7 +298,7 @@ double Win32Window::GetDpiScale() const
static bool done = false; static bool done = false;
if (!done) if (!done)
{ {
HMODULE hMod = GetModuleHandle( _T( "User32.dll" )); HMODULE hMod = GetModuleHandleA("User32.dll");
if (hMod != nullptr) pGetDpiForWindow = reinterpret_cast<GetDpiForWindow_t>(GetProcAddress(hMod, "GetDpiForWindow")); if (hMod != nullptr) pGetDpiForWindow = reinterpret_cast<GetDpiForWindow_t>(GetProcAddress(hMod, "GetDpiForWindow"));
done = true; done = true;
} }

View file

@ -69,20 +69,13 @@ if( WIN32 )
setupapi setupapi
oleaut32 oleaut32
dbghelp dbghelp
dxguid legacy_stdio_definitions )
dwmapi
)
if( NOT MINGW )
list( APPEND PROJECT_LIBRARIES legacy_stdio_definitions )
endif()
if( DEM_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE ) if( DEM_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
if( DX_dxguid_LIBRARY ) if( DX_dxguid_LIBRARY )
list( APPEND PROJECT_LIBRARIES "${DX_dxguid_LIBRARY}" ) list( APPEND PROJECT_LIBRARIES "${DX_dxguid_LIBRARY}" )
endif() endif()
endif() endif()
else() else()
if( APPLE ) if( APPLE )
set( NO_GTK ON ) set( NO_GTK ON )

View file

@ -46,7 +46,6 @@ static void* PosixGetProcAddress (const GLubyte* name)
#undef APIENTRY #undef APIENTRY
#endif #endif
#include <windows.h> #include <windows.h>
#include <tchar.h>
#ifdef _MSC_VER #ifdef _MSC_VER
@ -77,7 +76,7 @@ static void CheckOpenGL(void)
{ {
if (opengl32dll == 0) if (opengl32dll == 0)
{ {
opengl32dll = LoadLibrary(_T("OpenGL32.DLL")); opengl32dll = LoadLibraryA("OpenGL32.DLL");
if (opengl32dll != 0) if (opengl32dll != 0)
{ {
createcontext = (HGLRC(WINAPI*)(HDC)) GetProcAddress(opengl32dll, "wglCreateContext"); createcontext = (HGLRC(WINAPI*)(HDC)) GetProcAddress(opengl32dll, "wglCreateContext");