From 28393cdfd53549c7fc26e012ab29f0e35cf82827 Mon Sep 17 00:00:00 2001 From: Sasha Szpakowski Date: Sun, 6 Oct 2024 20:27:59 -0300 Subject: [PATCH] Fix compilation on Windows when SDL3 is used --- src/modules/graphics/vulkan/Graphics.cpp | 2 +- src/modules/window/sdl/Window.cpp | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/modules/graphics/vulkan/Graphics.cpp b/src/modules/graphics/vulkan/Graphics.cpp index 25e5925ee..c07433546 100644 --- a/src/modules/graphics/vulkan/Graphics.cpp +++ b/src/modules/graphics/vulkan/Graphics.cpp @@ -1875,7 +1875,7 @@ void Graphics::createSurface() auto window = Module::getInstance(M_WINDOW); const void *handle = window->getHandle(); #if SDL_VERSION_ATLEAST(3, 0, 0) - if (SDL_Vulkan_CreateSurface((SDL_Window*)handle, instance, nullptr, &surface) != SDL_TRUE) + if (!SDL_Vulkan_CreateSurface((SDL_Window*)handle, instance, nullptr, &surface)) throw love::Exception("failed to create window surface"); #else if (SDL_Vulkan_CreateSurface((SDL_Window*)handle, instance, &surface) != SDL_TRUE) diff --git a/src/modules/window/sdl/Window.cpp b/src/modules/window/sdl/Window.cpp index 647dc08ef..b3805d143 100644 --- a/src/modules/window/sdl/Window.cpp +++ b/src/modules/window/sdl/Window.cpp @@ -118,8 +118,12 @@ Window::Window() #ifdef LOVE_WINDOWS // Turned off by default, because it (ironically) causes stuttering issues // on some setups. More investigation is needed before enabling it. +#if SDL_VERSION_ATLEAST(3, 0, 0) + canUseDwmFlush = SDL_GetHintBoolean("LOVE_GRAPHICS_VSYNC_DWM", false); +#else canUseDwmFlush = SDL_GetHintBoolean("LOVE_GRAPHICS_VSYNC_DWM", SDL_FALSE) != SDL_FALSE; #endif +#endif } Window::~Window() @@ -1790,7 +1794,7 @@ void Window::requestAttention(bool continuous) FLASHWINFO flashinfo = { sizeof(FLASHWINFO) }; #if SDL_VERSION_ATLEAST(3, 0, 0) - flashinfo.hwnd = (HWND)SDL_GetProperty(SDL_GetWindowProperties(window), SDL_PROP_WINDOW_WIN32_HWND_POINTER, NULL); + flashinfo.hwnd = (HWND)SDL_GetPointerProperty(SDL_GetWindowProperties(window), SDL_PROP_WINDOW_WIN32_HWND_POINTER, nullptr); #else SDL_SysWMinfo wminfo = {}; SDL_VERSION(&wminfo.version);