Make sure the display list is up to date for window placement
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
diff --git a/src/video/SDL_sysvideo.h b/src/video/SDL_sysvideo.h
index abc0360..8a08ba0 100644
--- a/src/video/SDL_sysvideo.h
+++ b/src/video/SDL_sysvideo.h
@@ -188,6 +188,11 @@ struct SDL_VideoDevice
*/
/*
+ * Refresh the display list
+ */
+ void (*RefreshDisplays)(_THIS);
+
+ /*
* Get the bounds of a display
*/
int (*GetDisplayBounds)(_THIS, SDL_VideoDisplay *display, SDL_Rect *rect);
diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c
index 6ec7ef5..1dcd199 100644
--- a/src/video/SDL_video.c
+++ b/src/video/SDL_video.c
@@ -1584,6 +1584,11 @@ SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags)
}
}
+ /* Make sure the display list is up to date for window placement */
+ if (_this->RefreshDisplays) {
+ _this->RefreshDisplays(_this);
+ }
+
/* ensure no more than one of these flags is set */
type_flags = flags & (SDL_WINDOW_UTILITY | SDL_WINDOW_TOOLTIP | SDL_WINDOW_POPUP_MENU);
if ((type_flags & (type_flags - 1)) != 0) {
diff --git a/src/video/windows/SDL_windowsvideo.c b/src/video/windows/SDL_windowsvideo.c
index 5c8ef42..32e0caf 100644
--- a/src/video/windows/SDL_windowsvideo.c
+++ b/src/video/windows/SDL_windowsvideo.c
@@ -159,6 +159,7 @@ static SDL_VideoDevice *WIN_CreateDevice(void)
device->VideoInit = WIN_VideoInit;
device->VideoQuit = WIN_VideoQuit;
#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
+ device->RefreshDisplays = WIN_RefreshDisplays;
device->GetDisplayBounds = WIN_GetDisplayBounds;
device->GetDisplayUsableBounds = WIN_GetDisplayUsableBounds;
device->GetDisplayDPI = WIN_GetDisplayDPI;