浏览代码

Only check to see if the ICC profile changes when the display changes or we gain focus

Fixes https://github.com/libsdl-org/SDL/issues/6366
(cherry-picked from commit 61b5360e17107c13749eba8be83f31695e5632cf)
Sam Lantinga 2 年之前
父节点
当前提交
d1dcbfe9e9
共有 1 个文件被更改,包括 6 次插入2 次删除
  1. 6 2
      src/video/windows/SDL_windowsevents.c

+ 6 - 2
src/video/windows/SDL_windowsevents.c

@@ -445,6 +445,7 @@ WIN_UpdateFocus(SDL_Window *window, SDL_bool expect_focus)
         SDL_ToggleModState(KMOD_NUM, (GetKeyState(VK_NUMLOCK) & 0x0001) != 0);
         SDL_ToggleModState(KMOD_NUM, (GetKeyState(VK_NUMLOCK) & 0x0001) != 0);
         SDL_ToggleModState(KMOD_SCROLL, (GetKeyState(VK_SCROLL) & 0x0001) != 0);
         SDL_ToggleModState(KMOD_SCROLL, (GetKeyState(VK_SCROLL) & 0x0001) != 0);
 
 
+        WIN_UpdateWindowICCProfile(data->window, SDL_TRUE);
     } else {
     } else {
         RECT rect;
         RECT rect;
 
 
@@ -693,7 +694,6 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
                actually being the foreground window, but this appears to get called in all cases where
                actually being the foreground window, but this appears to get called in all cases where
                the global foreground window changes to and from this window. */
                the global foreground window changes to and from this window. */
             WIN_UpdateFocus(data->window, !!wParam);
             WIN_UpdateFocus(data->window, !!wParam);
-            WIN_UpdateWindowICCProfile(data->window, SDL_TRUE);
         }
         }
         break;
         break;
 
 
@@ -1163,6 +1163,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
             RECT rect;
             RECT rect;
             int x, y;
             int x, y;
             int w, h;
             int w, h;
+            int display_index = data->window->display_index;
 
 
             if (data->initializing || data->in_border_change) {
             if (data->initializing || data->in_border_change) {
                 break;
                 break;
@@ -1203,7 +1204,10 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
             /* Forces a WM_PAINT event */
             /* Forces a WM_PAINT event */
             InvalidateRect(hwnd, NULL, FALSE);
             InvalidateRect(hwnd, NULL, FALSE);
 
 
-            WIN_UpdateWindowICCProfile(data->window, SDL_TRUE);
+            if (data->window->display_index != display_index) {
+                /* Display changed, check ICC profile */
+                WIN_UpdateWindowICCProfile(data->window, SDL_TRUE);
+            }
         }
         }
         break;
         break;