video: Refresh Windows display list on WM_DISPLAYCHANGE

- Displays may have been added, removed or changed and all cached monitor
  handles are invalidated as a result.

- Display events are handled in three steps:
  1. Mark all currently know displays as invalid
  2. Enumerate all displays, adding new ones and marking known displays as valid
  3. Remove all displays still invalid after enumeration

- Display connect/disconnect events are sent when displays are added or removed
  after initial setup
This commit is contained in:
Sam Lantinga
2020-10-13 21:08:20 -07:00
parent a558409b2e
commit b9cbea354f
3 changed files with 59 additions and 8 deletions

View File

@@ -1057,6 +1057,13 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
}
break;
case WM_DISPLAYCHANGE:
{
// Reacquire displays if any were added or removed
WIN_RefreshDisplays(SDL_GetVideoDevice());
}
break;
case WM_NCCALCSIZE:
{
Uint32 window_flags = SDL_GetWindowFlags(data->window);