SDL/src/video
Sam Lantinga 6e1b11bae4 Fixed bug 3714 - Windows: SDL_WINDOW_FULLSCREEN_DESKTOP broken on 3 monitor setup w/ DPI scaling
Eric Wasylishen 2017-07-26 18:42:58 UTC
I set up an (admittedly exotic) 3-monitor setup, and when I enter fullscreen-desktop on the middle display (#2), the SDL window is off center. (covers half of monitor #2 and most of monitor #3).

The displays are arranged from left to right:

Display #1 (main): 2880x1800, 200% scaling
Display #2: 1920x1200, 150% scaling
Display #3: 1920x1080, 100% scaling

SDL display bounds:
INFO: Bounds: 1440x900 at 0,0
INFO: Bounds: 1281x801 at 1921,0  (these are incorrect)
INFO: Bounds: 1920x1080 at 4800,0

Correct bounds reported by calling EnumDisplayMonitors and printing the LPRECT param of the callback:
1440x900 at (0, 0)
1280x800 at (2880, 0)
1920x1080 at (4800, 0)

It seems like you need 3 displays to reproduce this, and the left two need DPI scaling, and the 3rd display needs to have a different scale factor than the others.

Related: https://bugzilla.libsdl.org/show_bug.cgi?id=3709

SDL: current hg (11235:6a587b9e0ec8)
Windows 10, Version 10.0.15063 Build 15063
Tested with testdraw2 and testgl2, and pressing alt+enter to enter fullscreen desktop.

This patch reworks SDL_windowsmodes.c to use EnumDisplayMonitors instead of EnumDisplayDevices, so we always have an HMONITOR for each SDL display.

With access to an HMONITOR, we can get the monitor bounds in virtual screen coordinates the proper way, by calling GetMonitorInfo. (whereas the original code was doing some calculations - e.g. "data->DeviceMode.dmPosition.x * data->ScaleX" - to try to get virtual screen coordinates. These worked in simple cases, but failed in more complex cases like this bug)

The one potential problem with my patch is, the ChangeDisplaySettingsEx docs say that you're supposed to get the display name from EnumDisplayDevices, but I'm getting the display name from GetMonitorInfo now.
2017-08-11 10:18:45 -07:00
..
android Fixed bug 3690 - SDL2 KMS/DRM render context support 2017-08-02 10:22:48 -07:00
cocoa Fixed bug 3697 - Main thread gets stuck on left mouse down 2017-08-01 20:16:10 -07:00
directfb directfb: Fixed quitting keyboard twice. 2017-06-16 23:30:30 +02:00
dummy Updated copyright for 2017 2017-01-01 18:33:28 -08:00
emscripten emscripten: Fixed compiling without OpenGL support. 2017-08-05 22:10:48 +02:00
haiku haiku: Fixed compiler warning. 2017-08-09 18:30:48 -04:00
kmsdrm Fixed bug 3723 - Possible double free in kmsdrm init code on certain errors 2017-08-11 10:05:45 -07:00
mir mir: Removed unnecessary function declaration. 2017-08-05 22:10:15 +02:00
nacl nacl: Fixed freeing static memory on video quit. 2017-08-05 22:10:25 +02:00
pandora pandora: Fixed compile error. 2017-06-16 23:30:38 +02:00
psp Fixed SDL_GetWindowWMInfo() returning success on three unsupported platforms. 2017-06-15 23:30:29 +02:00
qnx Fixed compiler warnings on QNX. 2017-07-23 19:25:16 -04:00
raspberry Fixed bug 3690 - SDL2 KMS/DRM render context support 2017-08-02 10:22:48 -07:00
uikit iOS: Use modern replacements for deprecated functions, when available. 2017-07-15 17:41:58 -03:00
vivante Fixed bug 3690 - SDL2 KMS/DRM render context support 2017-08-02 10:22:48 -07:00
wayland Fixed bug 3690 - SDL2 KMS/DRM render context support 2017-08-02 10:22:48 -07:00
windows Fixed bug 3714 - Windows: SDL_WINDOW_FULLSCREEN_DESKTOP broken on 3 monitor setup w/ DPI scaling 2017-08-11 10:18:45 -07:00
winrt Fixed bug 3690 - SDL2 KMS/DRM render context support 2017-08-02 10:22:48 -07:00
x11 Fixed bug 3722 - Fall back to xinerama/xvidmode if xrandr modes initialization fails 2017-08-02 10:28:13 -07:00
SDL_blit.c Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_blit.h Really fixed blit issue for capehill 2017-01-07 16:51:48 -08:00
SDL_blit_0.c Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_blit_1.c Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_blit_A.c Fix some more compiler warnings on armcc. 2017-03-03 16:38:17 -05:00
SDL_blit_auto.c Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_blit_auto.h Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_blit_copy.c Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_blit_copy.h Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_blit_N.c Fixed comment style. 2017-02-26 21:20:39 +01:00
SDL_blit_slow.c Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_blit_slow.h Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_bmp.c Fix some more compiler warnings on armcc. 2017-03-03 16:38:17 -05:00
SDL_clipboard.c Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_egl.c emscripten: Fixed compiler warnings about integer to pointer conversions. 2017-08-05 22:10:55 +02:00
SDL_egl_c.h Fixed bug 3690 - SDL2 KMS/DRM render context support 2017-08-02 10:22:48 -07:00
SDL_fillrect.c Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_pixels.c Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_pixels_c.h Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_rect.c Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_rect_c.h Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_RLEaccel.c Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_RLEaccel_c.h Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_shape.c Fixed bug 3699 - Shaped windows are distorted unless width is divisible by 8 2017-07-11 08:16:00 -07:00
SDL_shape_internals.h Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_stretch.c Removed newlines from error messages. 2017-03-26 21:00:19 +02:00
SDL_surface.c Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_sysvideo.h Fixed bug 3690 - SDL2 KMS/DRM render context support 2017-08-02 10:22:48 -07:00
SDL_video.c Temporary hack to fix bug 3725 - Call made to glGetString before context creation 2017-08-04 13:06:56 -07:00
sdlgenblit.pl Updated copyright for 2017 2017-01-01 18:33:28 -08:00