Use HWND for Windows

Use HWND for Windows
This commit is contained in:
Andy Vandijck 2025-07-02 16:34:36 +02:00
parent 9c36ed6550
commit 15619e9e43
1 changed files with 24 additions and 12 deletions

View File

@ -2284,8 +2284,13 @@ SDLDrawingPanel::~SDLDrawingPanel()
{
if (did_init)
{
if (sdlwindow != NULL)
SDL_DestroyWindow(sdlwindow);
if (texture != NULL)
SDL_DestroyTexture(texture);
if (renderer != NULL)
SDL_DestroyRenderer(renderer);
SDL_QuitSubSystem(SDL_INIT_VIDEO);
@ -2396,6 +2401,8 @@ void SDLDrawingPanel::DrawingPanelInit()
if (SDL_SetNumberProperty(props, SDL_PROP_WINDOW_CREATE_X11_WINDOW_NUMBER, xid) == false)
#elif defined(__WXMAC__)
if (SDL_SetPointerProperty(props, SDL_PROP_WINDOW_CREATE_COCOA_VIEW_POINTER, wxGetApp().frame->GetPanel()->GetHandle()) == false)
#elif defined(__WXMSW__)
if (SDL_SetPointerProperty(props, SDL_PROP_WINDOW_CREATE_WIN32_HWND_POINTER, GetHWND()) == false)
#else
if (SDL_SetPointerProperty(props, "sdl2-compat.external_window", GetWindow()->GetHandle()) == false)
#endif
@ -2423,6 +2430,7 @@ void SDLDrawingPanel::DrawingPanelInit()
return;
}
if (props != NULL)
SDL_DestroyProperties(props);
if (OPTION(kSDLRenderer) == wxString("default")) {
@ -2582,6 +2590,7 @@ void SDLDrawingPanel::DrawArea()
}
}
if (texture != NULL)
SDL_UpdateTexture(texture, NULL, todraw_argb, srcPitch);
} else if ((OPTION(kSDLRenderer) == wxString("direct3d")) && (systemColorDepth == 16)) {
todraw_rgb565 = (uint16_t *)(todraw + srcPitch);
@ -2592,11 +2601,14 @@ void SDLDrawingPanel::DrawArea()
}
}
if (texture != NULL)
SDL_UpdateTexture(texture, NULL, todraw_rgb565, srcPitch);
} else {
if (texture != NULL)
SDL_UpdateTexture(texture, NULL, todraw + srcPitch, srcPitch);
}
if (texture != NULL)
#ifdef ENABLE_SDL3
SDL_RenderTexture(renderer, texture, NULL, NULL);
#else