mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-17 23:31:45 +00:00
windows: Track the window display ID locally
Track the current window display ID locally so as not to depend on specific behavior of the video layer, which may change the value at times when it isn't expected.
This commit is contained in:

committed by
Sam Lantinga

parent
9f1a7bb94c
commit
e8fd7f74bd
@@ -1241,7 +1241,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;
|
||||||
SDL_DisplayID displayID = SDL_GetDisplayForWindow(data->window);
|
const SDL_DisplayID original_displayID = data->last_displayID;
|
||||||
|
|
||||||
if (data->initializing || data->in_border_change) {
|
if (data->initializing || data->in_border_change) {
|
||||||
break;
|
break;
|
||||||
@@ -1294,7 +1294,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);
|
||||||
|
|
||||||
if (data->window->last_displayID != displayID) {
|
/* Update the window display position */
|
||||||
|
data->last_displayID = SDL_GetDisplayForWindow(data->window);
|
||||||
|
|
||||||
|
if (data->last_displayID != original_displayID) {
|
||||||
/* Display changed, check ICC profile */
|
/* Display changed, check ICC profile */
|
||||||
WIN_UpdateWindowICCProfile(data->window, SDL_TRUE);
|
WIN_UpdateWindowICCProfile(data->window, SDL_TRUE);
|
||||||
}
|
}
|
||||||
|
@@ -309,6 +309,7 @@ static int SetupWindowData(_THIS, SDL_Window *window, HWND hwnd, HWND parent, SD
|
|||||||
data->last_pointer_update = (LPARAM)-1;
|
data->last_pointer_update = (LPARAM)-1;
|
||||||
data->videodata = videodata;
|
data->videodata = videodata;
|
||||||
data->initializing = SDL_TRUE;
|
data->initializing = SDL_TRUE;
|
||||||
|
data->last_displayID = window->last_displayID;
|
||||||
data->scaling_dpi = WIN_GetScalingDPIForHWND(videodata, hwnd);
|
data->scaling_dpi = WIN_GetScalingDPIForHWND(videodata, hwnd);
|
||||||
|
|
||||||
#ifdef HIGHDPI_DEBUG
|
#ifdef HIGHDPI_DEBUG
|
||||||
|
@@ -62,6 +62,7 @@ struct SDL_WindowData
|
|||||||
RECT cursor_clipped_rect;
|
RECT cursor_clipped_rect;
|
||||||
SDL_Point last_raw_mouse_position;
|
SDL_Point last_raw_mouse_position;
|
||||||
SDL_bool mouse_tracked;
|
SDL_bool mouse_tracked;
|
||||||
|
SDL_DisplayID last_displayID;
|
||||||
WCHAR *ICMFileName;
|
WCHAR *ICMFileName;
|
||||||
struct SDL_VideoData *videodata;
|
struct SDL_VideoData *videodata;
|
||||||
#if SDL_VIDEO_OPENGL_EGL
|
#if SDL_VIDEO_OPENGL_EGL
|
||||||
|
Reference in New Issue
Block a user