Use Qt scaling in Plamsa
ClosedPublic

Authored by davidedmundson on Aug 7 2017, 2:05 PM.

Details

Reviewers
mart
Group Reviewers
Plasma
Commits
R120:bbf7aaf34485: Use Qt scaling in Plamsa
Summary

I've done this only when on Wayland because:

On X, our own scaling to font generally works well.
There are bugs on older Qt, especially when it comes to fractional
scaling, and we can't support per screen scales anyway.
There's advantages to disabling, and (other than small context menu
icons) few advantages in enabling

On wayland, it's different. Everything is simpler as all co-ordinates
are in the same co-ordinate system
we don't have fractional scaling on the client so don't hit most the
remaining bugs and
even if we don't use Qt scaling the compositor will try to scale us
anyway so we have no choice

Test Plan

Had this for about a week on my laptop.
Haven't noticed a single problem.

Diff Detail

Repository
R120 Plasma Workspace
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
davidedmundson created this revision.Aug 7 2017, 2:05 PM
Restricted Application added a project: Plasma. · View Herald TranscriptAug 7 2017, 2:05 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
mart accepted this revision.Aug 7 2017, 3:07 PM
mart added a subscriber: mart.

making fractional scalings work correctly will be fun... sounds fun :)

btw, the final plan is using QT_SCREEN_SCALE_FACTORS with potentially different scalings per screen, right?

This revision is now accepted and ready to land.Aug 7 2017, 3:07 PM

Effectively.
The scale factor is part of the wl_output protocol, which is set by kwin and read by the QtQPA. This all mostly works already. No need for env vars.
.

This revision was automatically updated to reflect the committed changes.
cfeck added a subscriber: cfeck.Aug 7 2017, 8:25 PM

Add some #include KWindowSystem, otherwise the symbol is not defined.

How embarassing, fixed. Thanks

Oh bother.
There's something majorly wrong with that check, which I added in at the last minute. Ironically to reduce potential breakages.

KWindowSystem::platform() can only be called after qApp is made ; otherwise the result is...weird.
QCoreApplication::setAttribute can only be called before qApp is made

I'm stuck on finding a neat solution.

You could check for env variable QT_QPA_PLATFORM

mart added a comment.Aug 8 2017, 9:19 AM

You could check for env variable QT_QPA_PLATFORM

what about when is undefined but platform undetected?

mart added a comment.Aug 8 2017, 9:20 AM

wonder if we'll have to end up adding a command line switch for it? :(

@notmart

If this was generic code, we should care about that.
For plasmashell we can be sure we're launched via startplasma and have the env vars that set. If they're not there, it's the user's fault for being weird.

I might make it an expliticit env var and sell it as a feature so we can re-test X easier.