|
@@ -624,6 +624,28 @@ SDL_SystemTheme SDL_GetSystemTheme(void)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+static void SDL_UpdateDesktopBounds()
|
|
|
+{
|
|
|
+ SDL_Rect rect;
|
|
|
+ SDL_zero(rect);
|
|
|
+
|
|
|
+ SDL_DisplayID *displays = SDL_GetDisplays(NULL);
|
|
|
+ if (displays) {
|
|
|
+ for (int i = 0; displays[i]; ++i) {
|
|
|
+ SDL_Rect bounds;
|
|
|
+ if (SDL_GetDisplayBounds(displays[i], &bounds) == 0) {
|
|
|
+ if (i == 0) {
|
|
|
+ SDL_copyp(&rect, &bounds);
|
|
|
+ } else {
|
|
|
+ SDL_GetRectUnion(&rect, &bounds, &rect);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ SDL_free(displays);
|
|
|
+ }
|
|
|
+ SDL_copyp(&_this->desktop_bounds, &rect);
|
|
|
+}
|
|
|
+
|
|
|
static void SDL_FinalizeDisplayMode(SDL_DisplayMode *mode)
|
|
|
{
|
|
|
/* Make sure all the fields are set up correctly */
|
|
@@ -705,6 +727,8 @@ SDL_DisplayID SDL_AddVideoDisplay(const SDL_VideoDisplay *display, SDL_bool send
|
|
|
SDL_SetFloatProperty(props, SDL_PROP_DISPLAY_HDR_HEADROOM_FLOAT, display->HDR.HDR_headroom);
|
|
|
}
|
|
|
|
|
|
+ SDL_UpdateDesktopBounds();
|
|
|
+
|
|
|
return id;
|
|
|
}
|
|
|
|
|
@@ -718,6 +742,11 @@ void SDL_OnDisplayAdded(SDL_VideoDisplay *display)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+void SDL_OnDisplayMoved(SDL_VideoDisplay *display)
|
|
|
+{
|
|
|
+ SDL_UpdateDesktopBounds();
|
|
|
+}
|
|
|
+
|
|
|
void SDL_DelVideoDisplay(SDL_DisplayID displayID, SDL_bool send_event)
|
|
|
{
|
|
|
SDL_VideoDisplay *display;
|
|
@@ -745,6 +774,8 @@ void SDL_DelVideoDisplay(SDL_DisplayID displayID, SDL_bool send_event)
|
|
|
SDL_memmove(&_this->displays[display_index], &_this->displays[display_index + 1], (_this->num_displays - display_index - 1) * sizeof(_this->displays[display_index]));
|
|
|
}
|
|
|
--_this->num_displays;
|
|
|
+
|
|
|
+ SDL_UpdateDesktopBounds();
|
|
|
}
|
|
|
|
|
|
SDL_DisplayID *SDL_GetDisplays(int *count)
|