Skip to content

Move work area to screen physical top-left

Frederick Zhang requested to merge frederickzhang/yakuake:bug-425384 into master

First of all, I'm by no means any familiar with GUI development, so please bear with me if you find this PR absurd...

The issue was reported at https://bugs.kde.org/show_bug.cgi?id=425384.

tl;dr When using a 4K display and a 1080p one side-by-side, with Plasma global set to 2.0, Yakuake jumps between 2 displays every time it shows up while my mouse cursor stays on the 1080p one on the right.

To make it clearer, I summarised my problem in a table:

QT_SCREEN_SCALE_FACTORS Secondary Display XRandR Scale Result
HDMI-0=2;DP-0=2;DP-1=2;DP-2=2;DP-3=2;DP-4=2; 2.0 Jumps between 2 displays.
(empty) 2.0 Always shows on correct display. Text, button, etc. are small but window geometry is correct.
HDMI-0=2;DP-0=2;DP-1=2;DP-2=2;DP-3=2;DP-4=2; 1.0 Jumps between 2 displays. When shown on primary display, window is small and lies in the upper-left part of the display; when shown on secondary one, geometry is correct.
(empty) 1.0 Always shows on correct display. Text, button, etc. are small but window geometry is correct.

I bisected it and found the commit where the issue started:

# bad: [e1e49a6e2498c78ed57d0bf14b9efc5d5c11ac20] GIT_SILENT Upgrade release service version to 20.08.0.
# good: [d9a4f52107b0f558ba6a08fe66e8f7063fcffc9f] Merge branch 'release/20.04'
git bisect start 'v20.08.0' 'd9a4f52'
# bad: [481f39fb8f2092a919b1a9f2ba9a408e12ba27e5] Fix missing main menu after disabling systray icon
git bisect bad 481f39fb8f2092a919b1a9f2ba9a408e12ba27e5
# bad: [491f5a2098fae018d35f9095e7675d294eafa9c6] Fix computing screen geometry on multiple HiDPI monitors
git bisect bad 491f5a2098fae018d35f9095e7675d294eafa9c6
# good: [aecc1961d7f291ff59165589176c088eb0ecc78b] GIT_SILENT made messages (after extraction)
git bisect good aecc1961d7f291ff59165589176c088eb0ecc78b
# first bad commit: [491f5a2098fae018d35f9095e7675d294eafa9c6] Fix computing screen geometry on multiple HiDPI monitors

But after skimming through 491f5a20, the maths actually looked correct to me since KWindowSystem::workArea(offScreenWindows) returns 'device independent pixels'. However it seems QWidget::setGeometry still needs the physical x-axis.

Without this patch, first argument of https://invent.kde.org/utilities/yakuake/blob/172cf89e9f773af5a0870e4f45140efed5bbd9f9/app/mainwindow.cpp#L959 is 1920 + 96 = 2016. I then tested hard coding 2016 here and Yakuake did keep jumping between two displays regardless of which display my mouse cursor was on.

With this patch Yakuake behaviours normal in all four scenarios mentioned above.

Merge request reports