New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue with HiDPI #323

Closed
MMXXVII opened this Issue Feb 18, 2017 · 23 comments

Comments

Projects
None yet
5 participants
@MMXXVII

MMXXVII commented Feb 18, 2017

Expected Behavior

That KeePassXC doesn't scale up and make all the icons appear large and blurry. Everything looked fine on KeePassXC 2.1.1.

Current Behavior

With the latest update (KeePassXC 2.1.2), everything looks like it is scaled up and icons are huge and blurry. In reading through the changes for 2.1.2, I believe that this is related to PR #315

This is what it looks like now:
image

Context

KeePassXC 2.1.2 is still usable, but it looks a lot worse than it did before. My laptop screen has a resolution of 1920x1080, and 96 DPI (i.e. not a HiDPI display). I apologize for not being able to contribute more, I'm not really a developer, and I'm not 100% sure what the issue is. But based on what I've read, it seems like it's related to the recent HiDPI change.

Your Environment

  • KeePassXC version: 2.1.2
  • Qt version (e.g. Qt 5.3): 5.8.0
  • Compiler (e.g. Clang++3.6.0):
  • Operating System and version: Antergos. KeePassXC installed from AUR.

image

@TheZ3ro

This comment has been minimized.

Member

TheZ3ro commented Feb 18, 2017

Seems that HiDPI is a problem @phoerious 😄

@phoerious

This comment has been minimized.

Member

phoerious commented Feb 18, 2017

Darn. I guess we do need new icons.
@MMXXVII maybe you can work around this problem for now by starting it with the the environment variable QT_AUTO_SCREEN_SCALE_FACTOR=0 set (I don't know, though if it overrides the explicit setting in the code, probably not).

@phoerious

This comment has been minimized.

Member

phoerious commented Feb 18, 2017

Could you test this AppImage and check if the icons are still blurry?

[link removed]
Signature: [link removed]

@MMXXVII

This comment has been minimized.

MMXXVII commented Feb 18, 2017

@phoerious thanks for sharing that Appimage.

The icons up top are no longer blurry. But the icons within my password database are the same and still blurry. And everything is still twice as large (or approximately twice as large) as it was with version 2.1.1.

Perhaps I should have been more clear with my initial post. It's not just that the icons are large and blurry, but the whole window is now much larger than it previously was. This includes the amount of space that each row of text takes up (although I think the text itself is the same size). In the screenshot I posted, the blue folder icons (and all the other icons) are about twice as big as each row of text, and there's a lot of empty space between the rows of text. With version 2.1.1, each icon was about the same size as the text height, and there was much less wasted spaced.

Thanks for looking into this.

@phoerious

This comment has been minimized.

Member

phoerious commented Feb 18, 2017

I think your DPI settings may be messed up. What is the output of

xdpyinfo | grep dots

and

grep DPI /var/log/Xorg.0.log
@MMXXVII

This comment has been minimized.

MMXXVII commented Feb 18, 2017

I don't think my DPI settings are messed up, though I was testing a few DPI settings late last night (to try to fix this issue), so it's possible. But I'm pretty sure that I set everything back to normal. And everything else on my computer looks normal and unchanged. Only KeePassXC now looks different, so I don't think it's system-wide DPI setting that's messed up.

Here's the extra info regarding my DPI settings:

[jason@antergos-ux305 ~]$ xdpyinfo | grep dots
resolution: 96x96 dots per inch

[jason@antergos-ux305 ~]$ grep DPI /var/log/Xorg.0.log
[ 3.465] (==) intel(0): DPI set to (96, 96)

thanks.

@phoerious

This comment has been minimized.

Member

phoerious commented Feb 18, 2017

96 DPI means your screen must be 50cm wide and 28.6cm high. Is that so? That would be about 23" of screen diagonal. Usually physical DPI are a little higher than screen DPI. My monitors report 108x109 DPI.

@MMXXVII

This comment has been minimized.

MMXXVII commented Feb 18, 2017

No, my monitor is not that size. It's a 13" laptop screen (approx. 11in wide and 6.5in high), and as I mentioned it's a 1920x1080 screen. It's possible that it's some other DPI setting unrelated to KeePassXC. But everything else looks normal, and yesterday when I updated KeePassXC, it was immediately obvious that something had changed. I didn't change any screen DPI settings at the same time as updating KeePassXC.

Thanks.

@phoerious

This comment has been minimized.

Member

phoerious commented Feb 18, 2017

Then your DPI are way off. Try setting them to 168:

xrandr --dpi 168

and then start KeePassXC again.

@MMXXVII

This comment has been minimized.

MMXXVII commented Feb 18, 2017

I appreciate your continued help.

after running:

xrandr --dpi 168

and starting KeePassXC again, it looks the same and the issue remains (not the same as version 2.1.1).

the .log file that you previously had me check still shows 96dpi.

[jason@antergos-ux305 ~]$ xdpyinfo | grep dots
resolution: 168x168 dots per inch
[jason@antergos-ux305 ~]$ grep DPI /var/log/Xorg.0.log
[ 3.263] (==) intel(0): DPI set to (96, 96)

Any thoughts?

@phoerious

This comment has been minimized.

Member

phoerious commented Feb 18, 2017

I would have expected the fonts to be about the size of the icons after adjusting the DPI settings via xrandr. That's not the case?
What I suspect is that your high pixel density (> 144ppi) triggers Qt's DPI scaling, but the rest of the system does not follow.

Can you try running the AppImage as follows?

QT_SCREEN_SCALE_FACTORS=1 ./KeePassXC-2.1.2-x86_64.AppImage
@ArchangeGabriel

This comment has been minimized.

ArchangeGabriel commented Feb 18, 2017

This issue is (partially) expected for me, and some of your understandings are wrong.

@MMXXVII The unchanged log file is OK. For it to change you need to change your X server commandline (probably from you DM). But setting your DPI to 168 is probably not a good idea.

For everyone here: 96 DPI is the default X.org DPI, and basically means render pixel for pixel. So if you want a real 1920×1080 resolution like in @MMXXVII case, you should not change it.

To enable HiDPI, the standard way is to set DPI to 192 in Xorg, so that things know they have twice the pixels in each direction and thus do the scaling.

Now, what the change in #315 do is let Qt use the actual DPI to change the UI. Indeed, 13" laptop with FullHD screen will get issues, because you don’t want this kind of scaling.

I advise a reading of this: https://blog.qt.io/blog/2016/01/26/high-dpi-support-in-qt-5-6/.

My conclusion here are that:

  1. You should not be using QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);, but let the system do the scaling correctly. HiDPI works very well with QT_SCALE_FACTOR (Case III) or just correct 192 DPI in Xorg (not mentioned in Case I, but that works) for Linux distros (for mono-screen setups, see after).

  2. The original issue you’ve tried to fix in #221 is on user/system side, because currently all OS (except maybe MacOS) are having difficulties with mixed setup (HiDPI+non-HiDPI displays), but the right solution here is for the user to set QT_SCREEN_SCALE_FACTORS correctly.

  3. QT_AUTO_SCREEN_SCALE_FACTOR is a bad idea from my POV, because nowadays no any system has really 96 DPI, and application should just for in device pixels when there is no HiDPI involved.

@phoerious

This comment has been minimized.

Member

phoerious commented Feb 18, 2017

@ArchangeGabriel I've read that article earlier.
Letting the X server use 168 dpi is of course not a good idea as it will make the fonts huge. I was trying to figure out why there is such a discrepancy between fonts and pixmaps. 96dpi is only the display font size, but surely not the physical display pixel density (which is what Qt's trying to determine).

The way I understood that article, though, is that Qt::AA_EnableHighDpiScaling opts in for DPI scaling on supported platforms (being X11 and Windows). It seems to work for me on both my Arch Linux (KDE) desktop PC (2x WQHD 27" monitors) and my Windows laptop (having a 1080p resolution at 15") and it appears to make things better in #221.

I'm really not sure how to fix it. No matter what setting I choose, it fails miserably on some platform.

@MMXXVII

This comment has been minimized.

MMXXVII commented Feb 19, 2017

@phoerious and @ArchangeGabriel, I appreciate both of your input. I've read through that blog link a couple of times (I came across is yesterday evening in my google searches as well), but honestly, I don't yet know enough to follow and fully understand everything. @phoerious, it's interesting that everything seems to be working on your Arch Linux KDE setup. I'm not sure if I mentioned it, but I'm using Gnome with my Antergos setup (based on Arch).

Can you try running the AppImage as follows?
QT_SCREEN_SCALE_FACTORS=1 ./KeePassXC-2.1.2-x86_64.AppImage

unfortunately, I can't, as I deleted the AppImage earlier today after it didn't really change anything, and I'm back to using the version that I had installed from the AUR (and now updated today to version 2.1.2-2 and moved to the Arch Community repository, rather than the AUR). And now the AppImage google drive link posted earlier today is no longer active.

I'm happy to test stuff, and I'll certainly be watching closely, but I'm not sure how much more helpful input I'll be able to provide (not a developer, and still sort of new to Linux. I've only been using Antergos for a few weeks, after a year or so using Ubuntu).

Thanks again for your work on this.

@phoerious

This comment has been minimized.

Member

phoerious commented Feb 19, 2017

You can use the official 2.1.2 AppImage for testing that.

@ArchangeGabriel

This comment has been minimized.

ArchangeGabriel commented Feb 19, 2017

@phoerious

This comment has been minimized.

Member

phoerious commented Feb 19, 2017

Yes.

@MMXXVII

This comment has been minimized.

MMXXVII commented Feb 19, 2017

when I launch the system binary from the terminal with:

QT_SCREEN_SCALE_FACTORS=1 ./keepassxc

It doesn't look any different from when I launch keepassxc normally.

TheZ3ro added a commit that referenced this issue Feb 19, 2017

Merge pull request #332 from keepassxreboot/hotfix/323-revert-hidpi-s…
…caling

Revert "Enable High DPI scaling", resolves #323

@phoerious phoerious added this to the v2.1.3 milestone Feb 19, 2017

@phoerious phoerious closed this in cc44a83 Feb 20, 2017

@ArchangeGabriel

This comment has been minimized.

ArchangeGabriel commented Feb 20, 2017

@phoerious I’m interesting in the differences you see on your ArchLinux desktop with the different settings. From what I understand of DPI, you shouldn’t try to play with it unless for scaling in integer multiple for the case of HiDPI, which means Qt is not going the right direction with this Auto-DPI thing. If I have a 1920×1080p panel, I don’t want app to have the same physical size than if I had a 1366x768 display. I want them to have the same pixel size.

However, when it comes to different screens in one setup, I see why some people would want things to display with the same physical size. But making this work should rather be done by setting an non-integer scale factor for the supplemental displays to normalize to the main display size, which AFAIK is support by QT_SCREEN_SCALE_FACTORS.

@phoerious

This comment has been minimized.

Member

phoerious commented Feb 20, 2017

I see no difference at all, that is the point. I also wouldn't expect any difference, because I don't have a HiDPI monitor (except when you count 109 DPI as high). My Windows laptop has higher physical DPI, but even there it works with no visible difference. Maybe 1080p on a 15" screen isn't enough to trigger the effects, while 1080p on a 13" screen is. But generally, those things are hard to compare across different operating systems.

The only difference that was reported after applying #221 was that it worked better on HiDPI screens. The problem with those was not only that things were huge, but also that spacing were completely off (probably because we didn't enable HiDPI Pixmaps, which is another attribute?)
Opting in for scaling makes those things better, but apparently breaks on other systems.

@ArchangeGabriel

This comment has been minimized.

ArchangeGabriel commented Feb 20, 2017

I’m on HiDPI myself, and #221 didn’t changed anything, but I didn’t seem to have any issues whatsoever.… IDK about pixmaps, they’re definitively an issue with the web particularly, not sure about KeePassXC.

@phoerious

This comment has been minimized.

Member

phoerious commented Feb 20, 2017

With Qt::AA_UseHighDpiPixmaps enabled, it would probably also work for people with mixed screen setups (at least that's my guess) with the (BIG) downside, that the window is huge and icons are very mushy. But right now, icons are small with big spaces around which is extremely ugly. With homogeneous screen setups, it seems to work in any case.

I wonder if we could restore the Qt4 behavior with Qt::AA_DisableHighDpiScaling or if that would create even more issues. I know that at least on Windows applications that don't support DPI scaling look very blurry when the user enabled > 100% scaling.

@pskraemer11

This comment has been minimized.

pskraemer11 commented Dec 22, 2017

Well I have the same problem, the font size ist much too small.
I have a chromebook AcerC720 with a flashed custom rom and GalliumOS (Xubuntu-based), the display has 11'.
I just changed to KeePassXC from keepass2 to avoid use of mono. Now I think about reusing keepass2, it is much better readable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment