Renamed SDL_WINDOW_FOREIGN to SDL_WINDOW_EXTERNAL
This commit is contained in:
@@ -783,8 +783,8 @@ static void SDLTest_PrintWindowFlag(char *text, size_t maxlen, Uint32 flag)
|
||||
case SDL_WINDOW_MOUSE_FOCUS:
|
||||
SDL_snprintfcat(text, maxlen, "MOUSE_FOCUS");
|
||||
break;
|
||||
case SDL_WINDOW_FOREIGN:
|
||||
SDL_snprintfcat(text, maxlen, "FOREIGN");
|
||||
case SDL_WINDOW_EXTERNAL:
|
||||
SDL_snprintfcat(text, maxlen, "EXTERNAL");
|
||||
break;
|
||||
case SDL_WINDOW_HIGH_PIXEL_DENSITY:
|
||||
SDL_snprintfcat(text, maxlen, "HIGH_PIXEL_DENSITY");
|
||||
@@ -835,7 +835,7 @@ static void SDLTest_PrintWindowFlags(char *text, size_t maxlen, Uint32 flags)
|
||||
SDL_WINDOW_MOUSE_GRABBED,
|
||||
SDL_WINDOW_INPUT_FOCUS,
|
||||
SDL_WINDOW_MOUSE_FOCUS,
|
||||
SDL_WINDOW_FOREIGN,
|
||||
SDL_WINDOW_EXTERNAL,
|
||||
SDL_WINDOW_HIGH_PIXEL_DENSITY,
|
||||
SDL_WINDOW_MOUSE_CAPTURE,
|
||||
SDL_WINDOW_ALWAYS_ON_TOP,
|
||||
|
||||
@@ -2170,15 +2170,15 @@ int SDL_RecreateWindow(SDL_Window *window, Uint32 flags)
|
||||
return SDL_ContextNotSupported("Metal");
|
||||
}
|
||||
|
||||
if (window->flags & SDL_WINDOW_FOREIGN) {
|
||||
/* Can't destroy and re-create foreign windows, hrm */
|
||||
flags |= SDL_WINDOW_FOREIGN;
|
||||
if (window->flags & SDL_WINDOW_EXTERNAL) {
|
||||
/* Can't destroy and re-create external windows, hrm */
|
||||
flags |= SDL_WINDOW_EXTERNAL;
|
||||
} else {
|
||||
flags &= ~SDL_WINDOW_FOREIGN;
|
||||
flags &= ~SDL_WINDOW_EXTERNAL;
|
||||
}
|
||||
|
||||
/* Restore video mode, etc. */
|
||||
if (!(window->flags & SDL_WINDOW_FOREIGN)) {
|
||||
if (!(window->flags & SDL_WINDOW_EXTERNAL)) {
|
||||
const SDL_bool restore_on_show = window->restore_on_show;
|
||||
SDL_HideWindow(window);
|
||||
window->restore_on_show = restore_on_show;
|
||||
@@ -2223,7 +2223,7 @@ int SDL_RecreateWindow(SDL_Window *window, Uint32 flags)
|
||||
SDL_Vulkan_UnloadLibrary();
|
||||
}
|
||||
|
||||
if (_this->DestroyWindow && !(flags & SDL_WINDOW_FOREIGN)) {
|
||||
if (_this->DestroyWindow && !(flags & SDL_WINDOW_EXTERNAL)) {
|
||||
_this->DestroyWindow(_this, window);
|
||||
}
|
||||
|
||||
@@ -2244,7 +2244,7 @@ int SDL_RecreateWindow(SDL_Window *window, Uint32 flags)
|
||||
window->flags = ((flags & CREATE_FLAGS) | SDL_WINDOW_HIDDEN);
|
||||
window->is_destroying = SDL_FALSE;
|
||||
|
||||
if (_this->CreateSDLWindow && !(flags & SDL_WINDOW_FOREIGN)) {
|
||||
if (_this->CreateSDLWindow && !(flags & SDL_WINDOW_EXTERNAL)) {
|
||||
if (_this->CreateSDLWindow(_this, window, 0) < 0) {
|
||||
if (loaded_opengl) {
|
||||
SDL_GL_UnloadLibrary();
|
||||
@@ -2258,8 +2258,8 @@ int SDL_RecreateWindow(SDL_Window *window, Uint32 flags)
|
||||
}
|
||||
}
|
||||
|
||||
if (flags & SDL_WINDOW_FOREIGN) {
|
||||
window->flags |= SDL_WINDOW_FOREIGN;
|
||||
if (flags & SDL_WINDOW_EXTERNAL) {
|
||||
window->flags |= SDL_WINDOW_EXTERNAL;
|
||||
}
|
||||
|
||||
if (_this->SetWindowTitle && window->title) {
|
||||
@@ -3556,7 +3556,7 @@ void SDL_DestroyWindow(SDL_Window *window)
|
||||
|
||||
/* Restore video mode, etc. */
|
||||
SDL_UpdateFullscreenMode(window, SDL_FALSE);
|
||||
if (!(window->flags & SDL_WINDOW_FOREIGN)) {
|
||||
if (!(window->flags & SDL_WINDOW_EXTERNAL)) {
|
||||
SDL_HideWindow(window);
|
||||
}
|
||||
|
||||
|
||||
@@ -256,7 +256,7 @@ SDL_bool Cocoa_Vulkan_CreateSurface(SDL_VideoDevice *_this,
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
if (window->flags & SDL_WINDOW_FOREIGN) {
|
||||
if (window->flags & SDL_WINDOW_EXTERNAL) {
|
||||
@autoreleasepool {
|
||||
SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)window->driverdata;
|
||||
if (![data.sdlContentView.layer isKindOfClass:[CAMetalLayer class]]) {
|
||||
|
||||
@@ -1861,7 +1861,7 @@ static int SetupWindowData(SDL_VideoDevice *_this, SDL_Window *window, NSWindow
|
||||
*/
|
||||
[nswindow setOneShot:NO];
|
||||
|
||||
if (window->flags & SDL_WINDOW_FOREIGN) {
|
||||
if (window->flags & SDL_WINDOW_EXTERNAL) {
|
||||
/* Query the title from the existing window */
|
||||
NSString *title = [nswindow title];
|
||||
if (title) {
|
||||
@@ -1883,7 +1883,7 @@ int Cocoa_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_Propertie
|
||||
{
|
||||
@autoreleasepool {
|
||||
SDL_CocoaVideoData *videodata = (__bridge SDL_CocoaVideoData *)_this->driverdata;
|
||||
const void *data = SDL_GetProperty(create_props, "native.data", NULL);
|
||||
const void *data = SDL_GetProperty(create_props, "sdl2-compat.external_window", NULL);
|
||||
NSWindow *nswindow = nil;
|
||||
NSView *nsview = nil;
|
||||
|
||||
@@ -1896,8 +1896,8 @@ int Cocoa_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_Propertie
|
||||
SDL_assert(false);
|
||||
}
|
||||
} else {
|
||||
nswindow = (__bridge NSWindow *)SDL_GetProperty(create_props, "native.cocoa.window", NULL);
|
||||
nsview = (__bridge NSView *)SDL_GetProperty(create_props, "native.cocoa.view", NULL);
|
||||
nswindow = (__bridge NSWindow *)SDL_GetProperty(create_props, "cocoa.window", NULL);
|
||||
nsview = (__bridge NSView *)SDL_GetProperty(create_props, "cocoa.view", NULL);
|
||||
}
|
||||
if (nswindow && !nsview) {
|
||||
nsview = [nswindow contentView];
|
||||
@@ -1906,7 +1906,7 @@ int Cocoa_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_Propertie
|
||||
nswindow = [nsview window];
|
||||
}
|
||||
if (nswindow) {
|
||||
window->flags |= SDL_WINDOW_FOREIGN;
|
||||
window->flags |= SDL_WINDOW_EXTERNAL;
|
||||
} else {
|
||||
int x, y;
|
||||
NSScreen *screen;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -379,7 +379,7 @@ static int SetupWindowData(SDL_VideoDevice *_this, SDL_Window *window, Window w)
|
||||
}
|
||||
}
|
||||
|
||||
if (window->flags & SDL_WINDOW_FOREIGN) {
|
||||
if (window->flags & SDL_WINDOW_EXTERNAL) {
|
||||
/* Query the title from the existing window */
|
||||
window->title = X11_GetWindowTitle(_this, w);
|
||||
}
|
||||
@@ -427,9 +427,10 @@ static void SetWindowBordered(Display *display, int screen, Window window, SDL_b
|
||||
|
||||
int X11_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID create_props)
|
||||
{
|
||||
Window w = (Window)SDL_GetNumberProperty(create_props, "native.x11.window", (Window)SDL_GetProperty(create_props, "native.data", NULL));
|
||||
Window w = (Window)SDL_GetNumberProperty(create_props, "x11.window",
|
||||
(Window)SDL_GetProperty(create_props, "sdl2-compat.external_window", NULL));
|
||||
if (w) {
|
||||
window->flags |= SDL_WINDOW_FOREIGN;
|
||||
window->flags |= SDL_WINDOW_EXTERNAL;
|
||||
|
||||
if (SetupWindowData(_this, window, w) < 0) {
|
||||
return -1;
|
||||
@@ -1335,7 +1336,7 @@ void X11_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||
/* Blocking wait for "MapNotify" event.
|
||||
* We use X11_XIfEvent because pXWindowEvent takes a mask rather than a type,
|
||||
* and XCheckTypedWindowEvent doesn't block */
|
||||
if (!(window->flags & SDL_WINDOW_FOREIGN)) {
|
||||
if (!(window->flags & SDL_WINDOW_EXTERNAL)) {
|
||||
X11_XIfEvent(display, &event, &isMapNotify, (XPointer)&data->xwindow);
|
||||
}
|
||||
X11_XFlush(display);
|
||||
@@ -1371,7 +1372,7 @@ void X11_HideWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||
if (X11_IsWindowMapped(_this, window)) {
|
||||
X11_XWithdrawWindow(display, data->xwindow, displaydata->screen);
|
||||
/* Blocking wait for "UnmapNotify" event */
|
||||
if (!(window->flags & SDL_WINDOW_FOREIGN)) {
|
||||
if (!(window->flags & SDL_WINDOW_EXTERNAL)) {
|
||||
X11_XIfEvent(display, &event, &isUnmapNotify, (XPointer)&data->xwindow);
|
||||
}
|
||||
X11_XFlush(display);
|
||||
@@ -1845,7 +1846,7 @@ void X11_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||
X11_XDestroyIC(data->ic);
|
||||
}
|
||||
#endif
|
||||
if (!(window->flags & SDL_WINDOW_FOREIGN)) {
|
||||
if (!(window->flags & SDL_WINDOW_EXTERNAL)) {
|
||||
X11_XDestroyWindow(display, data->xwindow);
|
||||
X11_XFlush(display);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user