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
SDL 2.03 on Surface 3 screen
alabouza


Joined: 08 Dec 2009
Posts: 48
Location: Sao Paulo , Brasil
Hi, My applications built on top of SDL 2.03 running on Windows 8.1 in a Microsoft Surface Pro 3 are detecting a maximum windowed area with much less pixels than 2560x1440. It is something strange, because the application is using almost the whole physical area of the screen, but the application "sees" 1416x937 pixels. An older application built with SDL 1.2.14 has the same behavior.
On my regular desktop, with 2560x1440 pixels and Windows 7, there is no problem and SDL detects the maximum resolution correctly.
Is there any thing I can do ?
Thanks
SDL 2.03 on Surface 3 screen
eric.w


Joined: 12 Feb 2014
Posts: 38
Hi Armando,
You're probably seeing the effect of DPI virtualization.

I would declare your application per-monitor DPI aware; once you do
that, your app's window sizes will be in physical pixels, so if you
ask SDL for a 640x480 window, you'll get one that's 640x480 actual
pixels.

To do this you can either call a SetProcessDpiAwareness function, or
add something to your application manifest xml file. See:
https://msdn.microsoft.com/en-us/library/windows/desktop/dn302122(v=vs.85).aspx
(there are some documentation errors which are corrected in the
comments.)

MS has a long article on DPI virtualization as well, here:
https://msdn.microsoft.com/en-us/library/windows/desktop/dn469266(v=vs.85).aspx

I'd like to see SDL handle this in the future - I found not declaring
your app DPI aware can break SDL fullscreen mode (see
https://bugzilla.libsdl.org/show_bug.cgi?id=2713 ) - but I haven't
gotten around to contributing a patch for it.

Cheers
Eric


On Sun, Feb 22, 2015 at 6:58 PM, alabouza wrote:
Quote:
Hi, My applications built on top of SDL 2.03 running on Windows 8.1 in a
Microsoft Surface Pro 3 are detecting a maximum windowed area with much less
pixels than 2560x1440. It is something strange, because the application is
using almost the whole physical area of the screen, but the application
"sees" 1416x937 pixels. An older application built with SDL 1.2.14 has the
same behavior.
On my regular desktop, with 2560x1440 pixels and Windows 7, there is no
problem and SDL detects the maximum resolution correctly.
Is there any thing I can do ?
Thanks


________________________________

Armando Alaminos Bouza

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
alabouza


Joined: 08 Dec 2009
Posts: 48
Location: Sao Paulo , Brasil
Hi, Eric,
Thanks ! I will try your solution, first thing in the morning and let you know.
Regards,
Armando
alabouza


Joined: 08 Dec 2009
Posts: 48
Location: Sao Paulo , Brasil
Hi, Eric.
The DPI aware implementation via manifest file works well for me.
I prefered manifest to avoid checking Windows version, because API for DPIaware is not available in older versions of the OS.

For the convenience of other developers, the manifest additional file was:

<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" >
<asmv3:application>
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
<dpiAware>true</dpiAware>
</asmv3:windowsSettings>
</asmv3:application>
</assembly>


Thank you very much,
Armando