Bug 502171 - Panel popups are mis-positioned when using QT_USE_PHYSICAL_DPI=1 on Wayland
Summary: Panel popups are mis-positioned when using QT_USE_PHYSICAL_DPI=1 on Wayland
Status: RESOLVED NOT A BUG
Alias: None
Product: plasmashell
Classification: Plasma
Component: Panel (other bugs)
Version First Reported In: master
Platform: openSUSE Linux
: NOR minor
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords: wayland-only
Depends on:
Blocks:
 
Reported: 2025-03-29 19:26 UTC by Michael Hamilton
Modified: 2025-06-25 04:56 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Screenshot (436.30 KB, image/png)
2025-03-29 19:33 UTC, Michael Hamilton
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Hamilton 2025-03-29 19:26:21 UTC
SUMMARY

With kwin-wayland, on a 27" 4K monitor I have set QT_USE_PHYSICAL_DPI=1 causes the panel background to be incorrectly drawn, and the panel dialog to be incorrectly placed.   This does not happen for kwin-x11.

This is only a bug for a special use-case, which you may decide not to support.   However it would be useful to support it for those trying to do print-proofing or image-proofing where 1-inch on the screen needs to match 1-inch on paper.  This is mainly because many linux tools are scaling-unaware, using this variable allows them to be used without waiting for them to support the use-case (if that ever happens).  If a fix is trivial, please consider it.

STEPS TO REPRODUCE
1. echo 'export QT_USE_PHYSICAL_DPI=1' >> $HOME/.config/plasma-workspace/env/hidpi.sh
2. login to kwin_wayland   
3. in a Konsole, check QT_USE_PHYSICAL_DPI is set.
4. Observe and use the panel and launcher (standard launcher).

OBSERVED RESULT

Use launcher and see where the launcher dialog is placed - it is placed way above the panel instead of close to it.
Observe the background placement of the panel (might need to be a floating panel - not sure).

EXPECTED RESULT

Behaves like kwin-X11 with correct launcher dialog placement and correct panel shadowing.

SOFTWARE/OS VERSIONS

Operating System: openSUSE Tumbleweed 20250319
KDE Plasma Version: 6.3.3
KDE Frameworks Version: 6.12.0
Qt Version: 6.8.2
Kernel Version: 6.13.5-1-default (64-bit)
Graphics Platform: X11
Processors: 12 × AMD Ryzen 5 5600 6-Core Processor
Memory: 31.3 GiB of RAM
Graphics Processor: NVIDIA GeForce GTX 1650 SUPER
Manufacturer: ASUS
Comment 1 Michael Hamilton 2025-03-29 19:33:59 UTC
Created attachment 179846 [details]
Screenshot
Comment 2 Nate Graham 2025-03-31 20:56:53 UTC
Is this the only issue you see when using QT_USE_PHYSICAL_DPI=1? Or only the one that's severe enough to report, and there are lots of other issues that are smaller that you just grit your teeth and bear?

Are other panel pop-ups also mis-positioned in similar ways, or only the one for Kickoff?

Does the problem go away if you disable the floating panel feature?
Comment 3 Michael Hamilton 2025-04-02 20:12:04 UTC
(In reply to Nate Graham from comment #2)
> Is this the only issue you see when using QT_USE_PHYSICAL_DPI=1? Or only the
> one that's severe enough to report, and there are lots of other issues that
> are smaller that you just grit your teeth and bear?
> 
> Are other panel pop-ups also mis-positioned in similar ways, or only the one
> for Kickoff?
> 
> Does the problem go away if you disable the floating panel feature?

The popup issue is the only Plasma6 issue I see, otherwise things look good (except for the panel shadowing).  You are correct, I just checked all popups from the panel, are popping up with the same offset - so it's not just the launcher.  

Changing to a non-floating panel doesn't alter the issue - neither the offset, nor the shadowing under the panel.

There are non Plasma issues.  I did had to tweak GTK, set it to scale fonts only (for gimp).  I'm not sure what controls scaling for KDE3 kmail, I need to track that down.  I am only kicking tires at this point, so maybe there are other issues I have not yet encountered.  For the moment I'm staying with X11, where everything seems to just work fine with force font DPI.
Comment 4 David Edmundson 2025-04-16 14:31:00 UTC Comment hidden (spam)
Comment 5 David Edmundson 2025-04-16 14:33:51 UTC
Scaling is already quite complicated, mixing wayland scaling with client-side-decided scaling makes it extremely complicated. I don't intend to support this.  Sorry.
Comment 6 Michael Hamilton 2025-04-16 19:44:37 UTC
(In reply to David Edmundson from comment #5)
> Scaling is already quite complicated, mixing wayland scaling with
> client-side-decided scaling makes it extremely complicated. I don't intend
> to support this.  Sorry.

No worries, thanks for looking into it.  I'm just trying to figure out a possible way to move to Wayland.  I need to make sure that all document and image applications, those that are scaling aware as well as those that aren't,  show content at true printed scale (1cm on screen = 1cm on paper).  I had hoped to set QT_USE_PHYSICAL_DPI globally as a simple approach, possibly I can set it as a per application level.

For the moment we will stay on X11, so this isn't an urgent issue.  When considering the switch to Wayland, we're still undecided on what to do.  We've been using KDE for more than two decades because of its flexibility, that would seem the easiest route.  Perhaps we could stay with X11, maybe move to Trinity/KDE3.  Or try something new like COSMIC.  Wayland related Nvidia GPU driver changes seem to be creating a lot of paper cuts at the moment, we'll at least delay any further thought until they settle down.
Comment 7 Michael Hamilton 2025-06-25 04:56:16 UTC
In case anyone is interested in a work-around for this issue, I found I that disabling scaling works for me  I edited .config/plasma-workspace/env/hidpi.sh and added

export QT_ENABLE_HIGHDPI_SCALING=0

Subsequent logins show panel popups where expected.

Note, this is quite a hack.  It reverts Qt6 spacing, scaling, and the look of some UI elements to match Qt5, so some might not be comfortable with the change in appearance.   

(Having recently ported a PyQt5 application to PyQt6, I can see the horrible complexity scaling introduces.  What I did in the end was to look at the devicePixelRatio and made sure that if it was 1.0, the positioning math remained unscaled.)