Bug 478256

Summary: When screen resolution or scale changes, hidden Panel in "Auto-Hide" or "Dodge windows" mode sometimes inappropriately un-hides and can't be hidden again
Product: [Plasma] plasmashell Reporter: Tammes Burghard <kde>
Component: PanelAssignee: Niccolò Venerandi <niccolo>
Status: RESOLVED FIXED    
Severity: normal CC: fanzhuyifan, nate, niccolo.venerandi, tuantran1632001
Priority: NOR Keywords: qt6
Version: 5.90.0   
Target Milestone: 1.0   
Platform: Arch Linux   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=478376
https://bugs.kde.org/show_bug.cgi?id=448420
Latest Commit: Version Fixed In: 6.0
Sentry Crash Report:
Bug Depends on:    
Bug Blocks: 478797    

Description Tammes Burghard 2023-12-08 12:18:02 UTC
SUMMARY
***
When I open an application in fullscreen on my tablet with the panel in dodge window mode, it nicely dodges the window. But when I then rotate the screen, the panel reappears in front of the window.
***


STEPS TO REPRODUCE
1. Set panel to dodge window mode
2. open e.g. Dolphin in fullscreen
3. detach keyboard
4. switch to empty workspace (via three finger swipe)
5. come back to previous workspace (via three finger swipe)
6. rotate vertically
7. rotate horizontally

OBSERVED RESULT
3. panel appears in front of dolphin
4. panel stays as it is
5. panel disappears/dodges window
6. panel appears but disappears after a second or so
7. panel appears in front of window and remains there

EXPECTED RESULT
3. nothing happens
4. panel appears as it was not visible before
5. panel disappears/dodges window
6. screen gets rotated, panel is not shown
7. screen gets rotated, panel is not shown

SOFTWARE/OS VERSIONS
Operating System: Arch Linux
KDE Plasma Version: 5.90.0
KDE Frameworks Version: 5.246.0
Qt Version: 6.6.1
Kernel Version: 6.6.3-arch1-1 (64-bit)
Graphics Platform: Wayland
Processors: 4 × Intel® Pentium® CPU 4425Y @ 1.70GHz
Memory: 7.6 GiB of RAM
Graphics Processor: Mesa Intel® UHD Graphics 615
Manufacturer: Microsoft Corporation
Product Name: Surface Go 2
System Version: 1
Comment 1 Tammes Burghard 2023-12-08 12:20:34 UTC
The same thing happens in auto hide mode, except now it does not ever require a full screen window.
Comment 2 Tammes Burghard 2023-12-08 13:24:18 UTC
The observed result 6. varies. I now have enabled automatic rotaion even if not in tablet mode and now the panel (mostly) first disappears and then appears after a second or so.
Comment 3 Nate Graham 2023-12-08 16:48:37 UTC
Can reproduce. When in Tablet Mode, when I rotate the screen, a Dodge Windows panel becomes visible even if there are windows touching its screen edge.
Comment 4 fanzhuyifan 2023-12-09 02:53:43 UTC
*** Bug 477810 has been marked as a duplicate of this bug. ***
Comment 5 fanzhuyifan 2023-12-09 02:54:24 UTC
Can also be reproduced if the display resolution / scaling is changed.
Comment 6 Trần Nam Tuấn (Bill) 2023-12-09 13:33:02 UTC
I can see similar behavior, but with unlocking screen. Is that also considered to be the same bug, or should I make a new report.
Comment 7 fanzhuyifan 2023-12-09 16:50:08 UTC
(In reply to Trần Nam Tuấn (Bill) from comment #6)
> I can see similar behavior, but with unlocking screen. Is that also
> considered to be the same bug, or should I make a new report.

Can't reproduce after either locking or suspending -- dodge windows still work. Could you provide more detailed steps to reproduce it? Also is it consistently reproducible for you?
Comment 8 fanzhuyifan 2023-12-09 20:16:13 UTC
(In reply to fanzhuyifan from comment #5)
> Can also be reproduced if the display resolution / scaling is changed.

For some reason I can't reproduce it now. I don't remember changing anything in between, aside from rebooting the machine....
Comment 9 Trần Nam Tuấn (Bill) 2023-12-09 21:04:26 UTC
I also cannot seem to reproduce it with unlocking screen under normal timeout or force locking from a fresh boot. Must have been under very specific conditions, that I haven't noticed. Will keep a closer look on that. :/

However, I can reproduce this with changing resolution and scaling. So, that's something...
Comment 10 fanzhuyifan 2023-12-10 18:37:01 UTC
Another very interesting discovery. This bug only seems to be triggered if the panel is set to not floating when the computer starts.

And yes, for some reason, it needs to be at the time the computer starts -- simply logging in and logging out doesn't change things.
Comment 11 fanzhuyifan 2023-12-10 19:11:21 UTC
(In reply to fanzhuyifan from comment #10)
> Another very interesting discovery. This bug only seems to be triggered if
> the panel is set to not floating when the computer starts.
> 
> And yes, for some reason, it needs to be at the time the computer starts --
> simply logging in and logging out doesn't change things.

On another set of experiments, this can no longer be reproduced. So I guess this could have been a coincidence..
Comment 12 fanzhuyifan 2023-12-10 22:53:41 UTC
This bug seems to be caused by `d->screenGeometry` having an incorrect value at `plasma-workspace/src/libtaskmanager/taskfilterproxymodel.cpp#L358` [1].

To verify this claim, one could add a debug print of  `d->screenGeometry`, and note that when the bug triggers, its value is different from any valid screen geometry as reported by `kscreen-doctor -o`.

I suspect that this is because when the display configuration changes, the screenGeometry changes value multiple times very quickly (for the snapping and repositioning stuff), causing some sort of race condition and the final change to be missed some how.

[1] https://invent.kde.org/plasma/plasma-workspace/-/blob/01e67537f1e19ff71edbf2aeb5b50c70125fc8e1/libtaskmanager/taskfilterproxymodel.cpp#L358
Comment 13 Bug Janitor Service 2023-12-10 23:06:16 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-desktop/-/merge_requests/1913
Comment 14 fanzhuyifan 2023-12-10 23:16:47 UTC
Git commit ef34561f7c93e122cf14d802917e966f3de98e69 by Yifan Zhu.
Committed on 11/12/2023 at 00:04.
Pushed by davidedmundson into branch 'master'.

Don't filter by screen for touching windows

Windows centered on one screen may extend to other screens. Panels in
dodge windows mode should dodge these windows if touching (BUG 478376).

This is also a work around for BUG 478256, which seems to be caused by
incorrectly updated screen geometries. Removing the screen filter
bypasses the problem.
Related: bug 478376

M  +1    -1    desktoppackage/contents/views/Panel.qml

https://invent.kde.org/plasma/plasma-desktop/-/commit/ef34561f7c93e122cf14d802917e966f3de98e69
Comment 15 fanzhuyifan 2023-12-10 23:19:44 UTC
It would be great if other people could verify if they still have this issue after the commit ef34561f. Thanks!
Comment 16 Nate Graham 2023-12-11 15:12:06 UTC
The patch was reverted; re-opening.
Comment 17 Bug Janitor Service 2023-12-12 00:39:05 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-desktop/-/merge_requests/1917
Comment 18 Bug Janitor Service 2023-12-12 19:55:04 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/libplasma/-/merge_requests/1013
Comment 19 Aleix Pol 2023-12-13 23:00:28 UTC
Git commit edb091855547fa768f4a733504a48816e3434b08 by Aleix Pol Gonzalez, on behalf of Yifan Zhu.
Committed on 13/12/2023 at 23:58.
Pushed by apol into branch 'master'.

Reconnects signals after screen change

When the screen of ContainmentView changes, reconnect its screen related
signal, screenGeometryChanged.

M  +27   -1    src/plasmaquick/containmentview.cpp

https://invent.kde.org/plasma/libplasma/-/commit/edb091855547fa768f4a733504a48816e3434b08
Comment 20 fanzhuyifan 2023-12-13 23:19:01 UTC
Does anyone still have this issue on wayland after https://invent.kde.org/plasma/libplasma/-/commit/edb091855547fa768f4a733504a48816e3434b08? It fixes the issue for me on wayland.

However, for me dodge windows still doesn't work on X11 (multiple monitors, fractional scaling)
Comment 21 Nate Graham 2023-12-18 17:14:40 UTC
This is partially fixed for me on Wayland with multiple monitors now. Rotating a monitor now does the right thing, and a Dodge Windows panel no longer inappropriately un-hides. However I can still reproduce the issue happening when the resolution or scale factor changes. Steps to reproduce:

0. Be on Wayland
1. Have a panel on a screen in Dodge Windows mode
2. Maximize a window so that it hides
3. Go to System Settings > Display & Monitor
4. Increase or decrease the screen's resolution or scale factor

*Sometimes* the panel un-hides. Clicking on it and then clicking elsewhere will make it hide again.

Other times the panel stays hidden as expected.

So overall the behavior feels a bit buggy and glitchy.
Comment 22 fanzhuyifan 2023-12-18 18:04:49 UTC
(In reply to Nate Graham from comment #21)
> *Sometimes* the panel un-hides. Clicking on it and then clicking elsewhere
> will make it hide again.
This sounds like 470760, an existing issue with autohide.

Just to clarify, do you still get cases where the panel does not hide even if you click on it and click elsewhere?
Previously I was having a lot of cases where the panel does not correctly hide even after I click on it and click elsewhere.
Comment 23 Nate Graham 2023-12-20 21:35:42 UTC
I was seeing some of those cases too, yeah. I gather you are as well? Let's use this to track that issue, and Bug 448420 will track the pre-existing issue of panels being un-hidden but hiding again when clicked.
Comment 24 fanzhuyifan 2023-12-20 21:42:32 UTC
(In reply to Nate Graham from comment #23)
> I was seeing some of those cases too, yeah. I gather you are as well? Let's
> use this to track that issue, and Bug 448420 will track the pre-existing
> issue of panels being un-hidden but hiding again when clicked.

Humm at least on wayland I haven't seen any cases where the panel shows up and I cannot hide them, even after mouse over/clicks, after edb09185.
Do you have more detailed steps to reproduce?

X11 seems to be a completely different story though. Last time I checked, on fractional scaling dodge windows doesn't seem to work at all. But since I don't use X11 for my daily drive, I haven't gotten around to taking a closer look yet.
Comment 25 Bug Janitor Service 2024-01-20 18:18:33 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-desktop/-/merge_requests/1986
Comment 26 Bug Janitor Service 2024-01-21 10:30:56 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-desktop/-/merge_requests/1987
Comment 27 Bug Janitor Service 2024-01-21 10:32:06 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-desktop/-/merge_requests/1988
Comment 28 Fushan Wen 2024-01-21 10:39:50 UTC
Git commit ba3995f0859e2fdfe7adb2464867df3b7a1835ec by Fushan Wen, on behalf of Yifan Zhu.
Committed on 21/01/2024 at 11:30.
Pushed by fusionfuture into branch 'master'.

Don't filter by screen for touching windows

Windows centered on one screen may extend to other screens. Panels in
dodge windows mode should dodge these windows if touching (BUG 478376).

This is also a work around for BUG 478256, which seems to be caused by
incorrectly updated screen geometries. Removing the screen filter
bypasses the problem.
Related: bug 478376


(cherry picked from commit ef34561f7c93e122cf14d802917e966f3de98e69)

M  +1    -1    desktoppackage/contents/views/Panel.qml

https://invent.kde.org/plasma/plasma-desktop/-/commit/ba3995f0859e2fdfe7adb2464867df3b7a1835ec
Comment 29 Fushan Wen 2024-01-21 10:43:09 UTC
Git commit 4cdefe5d52b8facb996462f691f2c695288e48d2 by Fushan Wen, on behalf of Yifan Zhu.
Committed on 21/01/2024 at 11:31.
Pushed by fusionfuture into branch 'Plasma/6.0'.

Don't filter by screen for touching windows

Windows centered on one screen may extend to other screens. Panels in
dodge windows mode should dodge these windows if touching (BUG 478376).

This is also a work around for BUG 478256, which seems to be caused by
incorrectly updated screen geometries. Removing the screen filter
bypasses the problem.
Related: bug 478376


(cherry picked from commit ef34561f7c93e122cf14d802917e966f3de98e69)

M  +1    -1    desktoppackage/contents/views/Panel.qml

https://invent.kde.org/plasma/plasma-desktop/-/commit/4cdefe5d52b8facb996462f691f2c695288e48d2