mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-04-28 04:13:44 +02:00
SDL_syswm.h has been removed and replaced with window properties
This commit is contained in:
@@ -30,8 +30,6 @@
|
||||
#include "../SDL_sysrender.h"
|
||||
#include "../SDL_d3dmath.h"
|
||||
|
||||
#include <SDL3/SDL_syswm.h>
|
||||
|
||||
#include <d3d11_1.h>
|
||||
|
||||
#include "SDL_shaders_d3d11.h"
|
||||
@@ -827,18 +825,11 @@ static HRESULT D3D11_CreateSwapChain(SDL_Renderer *renderer, int w, int h)
|
||||
#endif
|
||||
} else {
|
||||
#if defined(__WIN32__) || defined(__WINGDK__)
|
||||
SDL_SysWMinfo windowinfo;
|
||||
|
||||
if (SDL_GetWindowWMInfo(renderer->window, &windowinfo, SDL_SYSWM_CURRENT_VERSION) < 0 ||
|
||||
windowinfo.subsystem != SDL_SYSWM_WINDOWS) {
|
||||
SDL_SetError("Couldn't get window handle");
|
||||
result = E_FAIL;
|
||||
goto done;
|
||||
}
|
||||
HWND hwnd = (HWND)SDL_GetProperty(SDL_GetWindowProperties(renderer->window), "SDL.window.win32.hwnd");
|
||||
|
||||
result = IDXGIFactory2_CreateSwapChainForHwnd(data->dxgiFactory,
|
||||
(IUnknown *)data->d3dDevice,
|
||||
windowinfo.info.win.window,
|
||||
hwnd,
|
||||
&swapChainDesc,
|
||||
NULL,
|
||||
NULL, /* Allow on all displays. */
|
||||
@@ -848,7 +839,7 @@ static HRESULT D3D11_CreateSwapChain(SDL_Renderer *renderer, int w, int h)
|
||||
goto done;
|
||||
}
|
||||
|
||||
IDXGIFactory_MakeWindowAssociation(data->dxgiFactory, windowinfo.info.win.window, DXGI_MWA_NO_WINDOW_CHANGES);
|
||||
IDXGIFactory_MakeWindowAssociation(data->dxgiFactory, hwnd, DXGI_MWA_NO_WINDOW_CHANGES);
|
||||
#else
|
||||
SDL_SetError(__FUNCTION__ ", Unable to find something to attach a swap chain to");
|
||||
goto done;
|
||||
|
||||
@@ -39,35 +39,14 @@ using namespace Windows::Graphics::Display;
|
||||
|
||||
#include <DXGI.h>
|
||||
|
||||
#include <SDL3/SDL_syswm.h>
|
||||
|
||||
#include "SDL_render_winrt.h"
|
||||
|
||||
extern "C" void *
|
||||
D3D11_GetCoreWindowFromSDLRenderer(SDL_Renderer *renderer)
|
||||
{
|
||||
SDL_Window *sdlWindow = renderer->window;
|
||||
if (renderer->window == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SDL_SysWMinfo sdlWindowInfo;
|
||||
if (SDL_GetWindowWMInfo(sdlWindow, &sdlWindowInfo, SDL_SYSWM_CURRENT_VERSION) < 0 ||
|
||||
sdlWindowInfo.subsystem != SDL_SYSWM_WINRT) {
|
||||
SDL_SetError("Couldn't get window handle");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (sdlWindowInfo.subsystem != SDL_SYSWM_WINRT) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!sdlWindowInfo.info.winrt.window) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
IInspectable *window = (IInspectable *)SDL_GetProperty(SDL_GetWindowProperties(renderer->window), "SDL.window.winrt.window");
|
||||
ABI::Windows::UI::Core::ICoreWindow *coreWindow = NULL;
|
||||
if (FAILED(sdlWindowInfo.info.winrt.window->QueryInterface(&coreWindow))) {
|
||||
if (!window || FAILED(window->QueryInterface(&coreWindow))) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user