Menu

#1477 Windows Font scaling on resolution change

KeePass_2.x
closed
nobody
None
5
2017-04-05
2016-02-11
Pat C
No

I have a Microsoft Surface book with a 3000x2000 display. I dock this system using a Surface Dock to 2x 1080p displays. When docked, th keypass main window scales fonts properly, but any pop up windows (Add entry, initial system login, options) the window and font size is very, very small to the point of being unreadable. Screencap of this behavior attached.

1 Attachments

Discussion

  • wellread1

    wellread1 - 2016-02-11

    Check to see how or if the Surface Book default display settings change when you attach your external displys. The Surface Book default display settings of "text, of apps and other items" is 200% and can be set as high as 300%, see 'Start Menu>Settings>System>Display'. KeePass dialogs use the system fonts and are affected by this setting. The dialog font size can not be adjusted independently like KeePass' main entry/group list interface.

    You might also want to see if an alternate display resolution can mitigate the problem. In the Windows 10 Display settings dialog, select "Advanced display settings" and select an alternate resolution.

     
  • Pat C

    Pat C - 2016-02-11

    Yes, am very familiar with this setting: it’s set to 200% for 3k and 100% for 1080p. It switches automatically when I dock/undock.

    Some apps, including their modal dialog boxes, properly acclimate to this transition. Discovered that I can get Keepass dialog boxes to appear correctly with the same font size as the main window if I sign out/back in to Windows 10 (not restart). This is a very painful workaround.

    I suspect there is a new code path in Win10 that would allow this dynamic resizing that Keepass has yet to embrace, but I’m not a developer and so am only speculating.

     
  • wellread1

    wellread1 - 2016-02-12

    I have attached a 1920x1200 second monitor to the Surface Book via a display port to HDMI adapter and configured the secondary monitor as an extended desktop. The Surface Book display is at 200% and the 1920x1200 automatically set up as 100%. When I move the KeePass 2.31 main window or one if its modal dialogs from one screen to another the effective magnification shifts to magnifcation of the destination monitor once the window is approximately 50% accross the threshold. If I move KeePass main windows to one screen from the other before opening a modal dialog, the modal dialog is at the correct magnification when it opens.

    The only unreadable state occurs while a window is moved from the 1920x1200 screen to the 3000x2000 screen. Until the window is more the 50% across the threshold, the portion of the window displayed on the 3000x2000 screen is at 100% magnification and too small to read. This seems like an unavoidable consequence of symetrial behavior.

    Essentially I am unable to reproduce the behavior you describe in the slightly less complex two monitor eviornment. Could you describe the issue you are observing in a little more detail?

     

    Last edit: wellread1 2016-02-12
  • Pat C

    Pat C - 2016-02-12

    Thanks for working hard on it. :-)

    I think this configuration is pretty close - I think the dock is using a DP passthough and then I also have a converter to HDMI.

    There are a couple things that may be relevant:
    1) I am using display on second monitor mode only (not exetnd) - the surfacebook screen is completely off when docked. I happen to have two 1080p monitors thanks to the dock but I don't think that is not material to the issue. So, you can more accurately reproduce the conditions using this mode.
    2) I have keepass running during this docking transition in the taskbar. I wonder if that is somehow related. I never deal with the threshold you describe in my config. It just isn't painted right when the resolution switches

    Let me know any additional experiments you'd like me to try.

     

    Last edit: Pat C 2016-02-12
  • wellread1

    wellread1 - 2016-02-12

    ...the surfacebook screen is completely off when docked.

    If the surface book display is off, when does the problem occur?... when you undock? If so describe your undocking procedure.

     

    Last edit: wellread1 2016-02-12
  • wellread1

    wellread1 - 2016-02-12

    I have experimented a little with docking/undocking sequences and KeePass modes while using a Surface Dock to connect a Surface Book to an external monitor. So far I have not been able to reproduce a problem with KeePass. It would be helpful it you could provide an exact sequence of events that leads to the scaling issue. Beginning with initial docking, describe all actions required to reproduce the improper scaling. At each action describe the state of all relevant elements including the state of the Surface Dock screen, external display(s), and KeePass state (minimized, displaying dialog etc.).

    Also what version of KeePass 2.x are you using?

     

    Last edit: wellread1 2016-02-12
  • Pat C

    Pat C - 2016-02-20

    I am working to characterize this better. Beginning to think it's not related to docking at all - I was able to make it happen on a clean reboott without the dock. - will post back when can get you a consistent recipie to reproduce.

     
  • Dominik Reichl

    Dominik Reichl - 2016-03-28
    • status: open --> closed
     
  • Dominik Reichl

    Dominik Reichl - 2016-03-28

    I cannot reproduce this. I'm also not sure what I could do, as Windows/.NET handles the UI scaling. KeePass simply declares that it is compatible with UI scaling based on DPI, and almost all of the actual scaling, like for instance using larger fonts, is done by Windows/.NET. KeePass needs to provide images with higher resolution (to avoid ugly enlarged images), but controls and fonts are resized by Windows/.NET.

    We recently had a similar issue, and it was resolved by installing system/driver updates:
    https://sourceforge.net/p/keepass/discussion/329221/thread/c3f2e9cf/
    In addition to system and driver updates, I also recommend installing the .NET Framework 4.6, if it's not installed already.

    Best regards,
    Dominik

     
  • Timothy

    Timothy - 2017-04-05

    I'm experiencing all kinds of DPI issues with KeePass. I've written .net apps that had to do scaling based on different scenarios and I can tell you it's a real PIA for WinForms. Since Windows 8.1 and now Windows 10, the best approach I've found if you can't spend a lot of time on it, is to simply mark the app as NOT compatible with DPI scaling (omit the <dpiAware>true</dpiAware> section from the manifest). The reason is that with Windows 8.1, Windows will automatically scale the app pixel for pixel. The app becomes usable, though sometimes blurry if the DPI isn't scaled by a factor of 2 because it has to antialias the not-pixel perfect graphics. It would be inifinitely better than the way KeePass operates now where windows may be gigantic on 100% DPI or microscopic on 200% DPI seemingly randomly, particularly like myself and folks upthread that use Surface devices both docked to 1080p monitors and undocked with the 3000x2000 display.

    An alternative approach to declaring DPI scalability in the manifest, which prevents the user from cusotmizing the behavior, is to call the SetProcessDPIAware() function. This has to be done before any graphics are displayed by the application. If you call this function, you are telling Windows your app is DPI aware. If you don't call it, Windows will scale the app itself. So if you use this method, rather than the manifest declaration, you can create a configuration option to enable or disable DPI Awareness. Then when they restart the app, it will either use built-in Windows scaling, or internally use the DPI forms scaling method that's being used now (and is unreliable).

    I hope you consider it.

    http://www.pinvoke.net/default.aspx/user32/SetProcessDPIAware.html

     

    Last edit: Timothy 2017-04-05

Log in to post a comment.