The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
high dpi window dragged to low dpi monitor
divad


Joined: 09 Jun 2015
Posts: 15
When I create a window with SDL_WINDOW_ALLOW_HIGHDPI, and it is initially on a high dpi display, when I drag the window to a second, low dpi, display the scaling is way off and I wind up seeing only the lower left of the contents of my window zoomed way in. If I create the window without SDL_WINDOW_ALLOW_HIGHDPI the scaling looks correct when I drag between monitors, but it looks like crap on the high dpi monitor. What do I need to do to fix this? Do I need to detect when the window is moved to a new display and recreate it with/without the SDL_WINDOW_ALLOW_HIGHDPI flag or something?
high dpi window dragged to low dpi monitor
Alex Szpakowski
Guest

In OS X when a high-dpi capable OpenGL window moves from a high-dpi monitor to a low-dpi monitor (or vice versa), the dimensions of the window’s main framebuffer are changed. You’ll need to handle the change (by calling glViewport with the correct dimensions etc. if you’re using OpenGL, and by recreating or re-scaling content as necessary.)

SDL 2.0.4 sends a window resize event when that occurs, but unfortunately SDL 2.0.3 and older don’t send any events so you’ll either need up update SDL or compare the output of SDL_GL_GetDrawableSize (or SDL_GetRenderOutputSize if you’re using SDL_Render) every frame.
Quote:
On Jun 22, 2015, at 2:27 PM, divad wrote:
When I create a window with SDL_WINDOW_ALLOW_HIGHDPI, and it is initially on a high dpi display, when I drag the window to a second, low dpi, display the scaling is way off and I wind up seeing only the lower left of the contents of my window zoomed way in. If I create the window without SDL_WINDOW_ALLOW_HIGHDPI the scaling looks correct when I drag between monitors, but it looks like crap on the high dpi monitor. What do I need to do to fix this? Do I need to detect when the window is moved to a new display and recreate it with/without the SDL_WINDOW_ALLOW_HIGHDPI flag or something?
_______________________________________________SDL mailinghttp://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
divad


Joined: 09 Jun 2015
Posts: 15
@Alex great thanks. Is 2.0.3 the latest stable version? https://www.libsdl.org/download-2.0.php seems to imply that. I may just wait until 2.0.4 is deemed "stable" and handle it then.
high dpi window dragged to low dpi monitor
Alex Szpakowski
Guest

2.0.3 is the most recent stable release, but 2.0.4 is right around the corner – it’s currently at release candidate 2. You can download it from http://www.libsdl.org/tmp/download-2.0.php

SDL 2.0.4 has a ton of fixes since 2.0.3, so it’s generally more stable and reliable even though it’s not quite released yet.
Quote:
On Jun 22, 2015, at 3:37 PM, divad wrote:
@Alex great thanks. Is 2.0.3 the latest stable version? https://www.libsdl.org/download-2.0.php seems to imply that. I may just wait until 2.0.4 is deemed "stable" and handle it then.
_______________________________________________SDL mailinghttp://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org