Displays are now referenced by instance ID instead of index

This commit is contained in:
Sam Lantinga
2023-01-29 13:30:55 -08:00
parent 758c0dd6d8
commit 22c69bccdf
157 changed files with 1620 additions and 1589 deletions

View File

@@ -901,7 +901,7 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeOrientationChanged)(
displayOrientation = (SDL_DisplayOrientation)orientation;
if (Android_Window) {
SDL_VideoDisplay *display = SDL_GetDisplay(0);
SDL_VideoDisplay *display = SDL_GetVideoDisplay(SDL_GetPrimaryDisplay());
SDL_SendDisplayEvent(display, SDL_EVENT_DISPLAY_ORIENTATION, orientation);
}
@@ -1034,7 +1034,7 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeSurfaceCreated)(JNIEnv *env, j
SDL_LockMutex(Android_ActivityMutex);
if (Android_Window) {
SDL_WindowData *data = (SDL_WindowData *)Android_Window->driverdata;
SDL_WindowData *data = Android_Window->driverdata;
data->native_window = Android_JNI_GetNativeWindow();
if (data->native_window == NULL) {
@@ -1053,7 +1053,7 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeSurfaceChanged)(JNIEnv *env, j
#if SDL_VIDEO_OPENGL_EGL
if (Android_Window) {
SDL_VideoDevice *_this = SDL_GetVideoDevice();
SDL_WindowData *data = (SDL_WindowData *)Android_Window->driverdata;
SDL_WindowData *data = Android_Window->driverdata;
/* If the surface has been previously destroyed by onNativeSurfaceDestroyed, recreate it here */
if (data->egl_surface == EGL_NO_SURFACE) {
@@ -1078,7 +1078,7 @@ retry:
if (Android_Window) {
SDL_VideoDevice *_this = SDL_GetVideoDevice();
SDL_WindowData *data = (SDL_WindowData *)Android_Window->driverdata;
SDL_WindowData *data = Android_Window->driverdata;
/* Wait for Main thread being paused and context un-activated to release 'egl_surface' */
if (!data->backup_done) {

View File

@@ -432,16 +432,15 @@ void SDL_SetWindowsMessageHook(SDL_WindowsMessageHook callback, void *userdata)
#endif /* __WIN32__ || __GDK__ */
#if defined(__WIN32__) || defined(__WINGDK__)
int SDL_Direct3D9GetAdapterIndex(int displayIndex)
int SDL_Direct3D9GetAdapterIndex(SDL_DisplayID displayID)
{
(void)displayIndex;
(void)displayID;
return 0; /* D3DADAPTER_DEFAULT */
}
SDL_bool
SDL_DXGIGetOutputInfo(int displayIndex, int *adapterIndex, int *outputIndex)
SDL_bool SDL_DXGIGetOutputInfo(SDL_DisplayID displayID, int *adapterIndex, int *outputIndex)
{
(void)displayIndex;
(void)displayID;
if (adapterIndex) {
*adapterIndex = -1;
}

View File

@@ -114,7 +114,7 @@ static void WINRT_ProcessWindowSizeChange() // TODO: Pass an SDL_Window-identify
if (coreWindow) {
if (WINRT_GlobalSDLWindow) {
SDL_Window *window = WINRT_GlobalSDLWindow;
SDL_WindowData *data = (SDL_WindowData *)window->driverdata;
SDL_WindowData *data = window->driverdata;
int x = (int)SDL_lroundf(data->coreWindow->Bounds.Left);
int y = (int)SDL_lroundf(data->coreWindow->Bounds.Top);
@@ -234,7 +234,7 @@ void SDL_WinRTApp::OnOrientationChanged(Object ^ sender)
// TODO, WinRT: do more extensive research into why orientation changes on Win 8.x don't need D3D changes, or if they might, in some cases
SDL_Window *window = WINRT_GlobalSDLWindow;
if (window) {
SDL_WindowData *data = (SDL_WindowData *)window->driverdata;
SDL_WindowData *data = window->driverdata;
int w = (int)SDL_floorf(data->coreWindow->Bounds.Width);
int h = (int)SDL_floorf(data->coreWindow->Bounds.Height);
SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_EVENT_WINDOW_RESIZED, w, h);