Renamed SDL_WINDOW_FOREIGN to SDL_WINDOW_EXTERNAL

This commit is contained in:
Sam Lantinga
2023-11-13 12:21:23 -08:00
parent 229b7b9d50
commit e0c45c6c98
10 changed files with 43 additions and 42 deletions

View File

@@ -347,7 +347,7 @@ static int SetupWindowData(SDL_VideoDevice *_this, SDL_Window *window, HWND hwnd
int w = rect.right;
int h = rect.bottom;
if (window->flags & SDL_WINDOW_FOREIGN) {
if (window->flags & SDL_WINDOW_EXTERNAL) {
window->windowed.w = window->w = w;
window->windowed.h = window->h = h;
} else if ((window->windowed.w && window->windowed.w != w) || (window->windowed.h && window->windowed.h != h)) {
@@ -370,7 +370,7 @@ static int SetupWindowData(SDL_VideoDevice *_this, SDL_Window *window, HWND hwnd
point.x = 0;
point.y = 0;
if (ClientToScreen(hwnd, &point)) {
if (window->flags & SDL_WINDOW_FOREIGN) {
if (window->flags & SDL_WINDOW_EXTERNAL) {
window->windowed.x = point.x;
window->windowed.y = point.y;
}
@@ -443,7 +443,7 @@ static int SetupWindowData(SDL_VideoDevice *_this, SDL_Window *window, HWND hwnd
data->initializing = SDL_FALSE;
if (window->flags & SDL_WINDOW_FOREIGN) {
if (window->flags & SDL_WINDOW_EXTERNAL) {
/* Query the title from the existing window */
LPTSTR title;
int titleLen;
@@ -490,7 +490,7 @@ static void CleanupWindowData(SDL_VideoDevice *_this, SDL_Window *window)
ReleaseDC(data->hwnd, data->hdc);
RemoveProp(data->hwnd, TEXT("SDL_WindowData"));
#endif
if (!(window->flags & SDL_WINDOW_FOREIGN)) {
if (!(window->flags & SDL_WINDOW_EXTERNAL)) {
DestroyWindow(data->hwnd);
if (data->destroy_parent_with_window && data->parent) {
DestroyWindow(data->parent);
@@ -566,10 +566,10 @@ static void WIN_SetKeyboardFocus(SDL_Window *window)
int WIN_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID create_props)
{
HWND hwnd = (HWND)SDL_GetProperty(create_props, "native.win32.hwnd", SDL_GetProperty(create_props, "native.data", NULL));
HWND hwnd = (HWND)SDL_GetProperty(create_props, "win32.hwnd", SDL_GetProperty(create_props, "sdl2-compat.external_window", NULL));
HWND parent = NULL;
if (hwnd) {
window->flags |= SDL_WINDOW_FOREIGN;
window->flags |= SDL_WINDOW_EXTERNAL;
if (SetupWindowData(_this, window, hwnd, parent) < 0) {
return -1;
@@ -643,7 +643,7 @@ int WIN_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesI
}
}
HWND share_hwnd = (HWND)SDL_GetProperty(create_props, "native.win32.pixel_format_hwnd", NULL);
HWND share_hwnd = (HWND)SDL_GetProperty(create_props, "win32.pixel_format_hwnd", NULL);
if (share_hwnd) {
HDC hdc = GetDC(share_hwnd);
int pixel_format = GetPixelFormat(hdc);