bylee20 / bomi

bomi - a powerful and easy-to-use multimedia player
http://bomi-player.github.io
Other
425 stars 89 forks source link

HiDPI Theme Support #367

Open ValdikSS opened 9 years ago

ValdikSS commented 9 years ago

Although Qt5 scales fonts and menu elements correctly, not a single theme support HiDPI. All the elements are tiny and it's hard to pixel hunt.

bylee20 commented 9 years ago

This will take time because I have to reproduce all icons in doubled-up resolution. Since I don't have HiDPI display, can you do me a favor to test it? I attach a pause button image file for Tethys skin. Please replace /usr/share/bomi/skins/Tethys/pause.png with attached file and check the icon looks fine in playing state (not-hovered and not-pressed).

pause

ValdikSS commented 9 years ago

Sure, I can test. This is how it looks in a fullscreen http://ovrload.ru/t/51830_screen114.png

bylee20 commented 9 years ago

That screenshot is not what I've expected for an HiDPI. I've only tested HiDPI once before in OS X so maybe HiDPI implementation is largely different on Linux.

How did you configure your PC to enable HiDPI?

ValdikSS commented 9 years ago

I have DPI set to 185 in xrandr (xrandr --dpi 185) and in Xft configuration (~/.Xresources). Bomi menus are properly scaled. http://i.imgur.com/YVJbR7V.png

bylee20 commented 9 years ago

I did some research and the conclusion is: There's no proper support for HiDPI on Linux. xrandr --dpi only applied for font rendering size. Your screenshot shows this(for cmparision, see the buttons in titlebar). Menu is not properly scaled, either. It's just stretched for large font. You would notice the margin around text is unusually narrow.

I cannot see what can I do for this.

ValdikSS commented 9 years ago

http://blog.davidedmundson.co.uk/blog/kde_apps_high_dpi http://doc-snapshot.qt-project.org/qt5-5.4/highdpi.html

bylee20 commented 9 years ago

http://doc-snapshot.qt-project.org/qt5-5.4/highdpi.html

This is for platforms which provide proper HiDPI support and Linux is not.

http://blog.davidedmundson.co.uk/blog/kde_apps_high_dpi

As you can see in that screenshot, there's no scaling for icons in first screenshots. In other screenshots, the icons sizes are just doubled manually by QT_DEVICE_PIXEL_RATIO env. This is only for icons whose size is given by theme of KDE. And of course, there no pixel metrics in KDE theme for bomi.

bylee20 commented 9 years ago

FYI, if your system supported HiDPI properly, the screen resolution should be something close 1080p not 4k. The key concept for HiDPI is macro pixel which consists of severl micro pixels. xrandr --dpi changes just dpi which is used for calculation of font size. If this enabled HiDPI, everything should be rescaled by the ratio of new DPI/physcial DPI.

ValdikSS commented 9 years ago

I know what pixel density is and I don't confuse resolution and font/elements size like many others. Not all applications scale, but many of them do. Maybe for now it's better to set QT_DEVICE_PIXEL_RATIO to auto somewhere inside bomi code? If QT_DEVICE_PIXEL_RATIO is set, bomi can't detect real resolution and thinks that it renders to 1921×1081 instead of 3840×2160 in my case. It's not really bothers me, but still.

bylee20 commented 9 years ago

Have you tested QT_DEVICE_PIXEL_RATIO=2? I've tested it but it broke global coordinate translation, for instance, when you move the window by dragging, the position is not calculated properly.

ValdikSS commented 9 years ago

Yes, QT_DEVICE_PIXEL_RATIO=2 is an equal to QT_DEVICE_PIXEL_RATIO=auto on my system. The theme is scaled if this environment variable is set. Window dragging in indeed broken.

ahjolinna commented 9 years ago

apparently the linux HIDPI support on Qt 5.4 was half backed when they added it, I hope it's fixed in 5.5 (..according to bluesystem dev.)

More details about HIDPI: http://blog.davidedmundson.co.uk/blog/kde_apps_high_dpi

bylee20 commented 9 years ago

@ValdikSS

Window dragging in indeed broken.

Yeah, that's because the global coordinate is not in proper HiDPI resolution, my guess.

@ahjolinna

I don't think it's possible for Qt to support HiDPI becuase there's no real HiDPI on Linux. You cannot support something which doesn't exist. This should be fixed in some level of DE/WM/X.

ValdikSS commented 9 years ago

@xylosper

I don't think it's possible for Qt to support HiDPI becuase there's no real HiDPI on Linux.

What do you call support? Scaling support? Global scaling is a bad way of implementing HiDPI support.

bylee20 commented 9 years ago

As I already said, the key point of HiDPI is macro pixel concept which consists of micro pixels. The OS or graphics layer should provide proper scaling factor for application. It doesn't matter the scaling factor is applied globally or not. At least, there should be something to tell 'HiDPI is enabled by some factor'. There's no macro pixel concept on Linux(maybe X11 only?) and there's no scaling factor support for application on Linux. It's not HiDPI just to change DPI something high value. In fact, the behavior by xrandr --dpi is exactly what it should be because DPI should be considered only for converting point size of font to pixel size.

FYI, both of OS X and Windows provide scaling factor for HiDPI mode.

ahjolinna commented 9 years ago

@xylosper : If you're wanting to learn more about Qt's high DPI resolution support improvements coming down the pipe for release in Qt 5.6 later this year, read this mailing list post that was submitted a short time ago: http://lists.qt-project.org/pipermail/development/2015-June/021631.html