Dpi awareness functions not included?

Windows specific questions.
St_W
Posts: 1619
Joined: Feb 11, 2009 14:24
Location: Austria
Contact:

Re: Dpi awareness functions not included?

Post by St_W »

Landeel wrote:A desktop environment that by default stretches a fullscreen OpenGL game out of the screen, now that's what I call bad design.
There's no good solution from a OS's perspective in that case: not scaling makes the application unusable because of unreadable tiny texts and controls and scaling may also make it unusable because parts may be cut off (e.g. for your example of fullscreen applications).

The only good solution can be implemented by the application itself: mark your application as (per-monitor) DPI-Aware in the manifest, listen to dpi change events in your application and scale texts and controls yourself. If the application was designed well it shouldn't be hard to make your UI scalable.

Here's a minimal dpiAware example application:
http://users.freebasic-portal.de/stw/fi ... e-demo.zip
Landeel
Posts: 777
Joined: Jan 25, 2007 10:32
Location: Brazil
Contact:

Re: Dpi awareness functions not included?

Post by Landeel »

Give the user an option to scale up. Maybe a magnifying glass button in the window. That's good design.
Scaling without asking is just bad design.
A fullscreen game should never be scaled out of the screen. That's beyond bad design.
Tourist Trap
Posts: 2958
Joined: Jun 02, 2015 16:24

Re: Dpi awareness functions not included?

Post by Tourist Trap »

St_W wrote:@Tourist Trap:
The recommended way (according to Microsoft) to make your application dpi-aware (or explicitly dpi-unaware, which is the default when you specify nothing) is to add an entry to your application manifest. That's a better method than calling the API methods you mentioned. It should not be necessary to use them - if so you most likely have some other bad design choice in your application and should try to fix that.
Hi St_W,

I tried the manifest settings from the microsoft sites. It simply didn't work.
I don't have anymore the link at hand but they also mention the Setdpiawareness functions with only one warning, if I read well: call it very early in the program. For now, it is a working solution.

The problem from which that started is that screenres 1920,1080 won't return the promised size. And for now there is no help I can see from any part of fb to anticipate the faulty behaviour. This means then that we can hardly make any plane about this affair of dpi before we meet it on win10, win8.1+ maybe, and with the proper screenres setting. I never knew about this issue before Landeel brought it to light during the game testing for the contest.

Thanks for the demo zip, we'll look at it!
Josep Roca
Posts: 564
Joined: Sep 27, 2016 18:20
Location: Valencia, Spain

Re: Dpi awareness functions not included?

Post by Josep Roca »

> I tried the manifest settings from the microsoft sites. It simply didn't work.

Try this one:

Code: Select all

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
   <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">

      <assemblyIdentity version="1.0.0.0"
         processorArchitecture="*"
         name="ApplicationName"
         type="win32"/>
      <description>Optional description of your application</description>

      <asmv3:application>
         <asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
            <dpiAware>true</dpiAware>
         </asmv3:windowsSettings>
      </asmv3:application>

      <!-- Compatibility section -->
      <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
         <application>
            <!--The ID below indicates application support for Windows Vista -->
            <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
            <!--The ID below indicates application support for Windows 7 -->
            <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
            <!--This Id value indicates the application supports Windows 8 functionality-->
            <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
            <!--This Id value indicates the application supports Windows 8.1 functionality-->
            <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
            <!--This Id value indicates the application supports Windows 10 functionality-->
            <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
         </application>
       </compatibility>

      <!-- Trustinfo section -->
      <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
         <security>
            <requestedPrivileges>
               <requestedExecutionLevel
                  level="asInvoker"
                  uiAccess="false"/>
               </requestedPrivileges>
         </security>
      </trustInfo>

      <dependency>
         <dependentAssembly>
            <assemblyIdentity
               type="win32"
               name="Microsoft.Windows.Common-Controls"
               version="6.0.0.0"
               processorArchitecture="*"
               publicKeyToken="6595b64144ccf1df"
               language="*" />
         </dependentAssembly>
      </dependency>

   </assembly>
Tourist Trap
Posts: 2958
Joined: Jun 02, 2015 16:24

Re: Dpi awareness functions not included?

Post by Tourist Trap »

Josep Roca wrote:> I tried the manifest settings from the microsoft sites. It simply didn't work.

Try this one:
Hello Josep Roca,

For some reason this time it started to work. I say for some reason because, after many tries with no result on WinFBE with the default manifest or yours, it finally started to be ok, even with the default manifest. I can only think of a kind of bug of the IDE then, because I had some difficulties to create a project just for the simple testing purpose. I had to close it and reopen it once (with no success with DPI). I had to delete also a new project that wanted to add "Untitled5" as a command line parameter. Then after 3 tries, I started a project and just with the screenres 1920 etc... it was rightly displaying, with the manifest by default or with yours as well.

I tend to think that project creation is not stable too much on WinFBE (the only IDE where a manifest is created on my system), unless I just don't use it correctly.

Thanks for the help anyway! I don't master ressources files out of visual studio (or without a hex editor to watch in the exe directly!), so maybe I have to learn more about this stuff. What is sure is that the classical IDEs like FBIDE won't pay any attention to this.
PaulSquires
Posts: 999
Joined: Jul 14, 2005 23:41

Re: Dpi awareness functions not included?

Post by PaulSquires »

Tourist Trap wrote:
Josep Roca wrote:> I tried the manifest settings from the microsoft sites. It simply didn't work.
I tend to think that project creation is not stable too much on WinFBE (the only IDE where a manifest is created on my system), unless I just don't use it correctly.
Yeah, you're not using WinFBE correctly.
Post Reply