Bug 440571

Summary: On Wayland, struts are incorrect for vertical panels, causing Maliit and new horizontal panels to be mis-positioned
Product: [Plasma] plasmashell Reporter: Nate Graham <nate>
Component: PanelAssignee: Plasma Bugs List <plasma-bugs>
Status: CONFIRMED ---    
Severity: normal CC: benjamin.hennion, bugs.kde.org, cedjo7, dmatteo002, jps.sousa, kde, niccolo.venerandi, niccolo, rob.dyck
Priority: NOR Keywords: wayland
Version: 5.27.8   
Target Milestone: 1.0   
Platform: Other   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=459000
Latest Commit: Version Fixed In:
Attachments: Cover half the panel

Description Nate Graham 2021-08-03 21:18:44 UTC
Created attachment 140494 [details]
Cover half the panel

Fedora 34 with maliit-keyboard in a built-from-source Plasma Wayland session at 200% global scale.

When the virtual keyboard appears, it overlaps half of my vertical left-side panel. See attached screenshot. I suspect that the goal is to avoid covering the panel, because when my panel is horizontal, it succeeds at avoiding covering it. However when my panel is vertical on either side of the screen, the virtual keyboard overlaps exactly half of it. Seems like some width calculation didn't take into account the scale factor or something.
Comment 1 Nate Graham 2022-02-26 22:37:16 UTC
Fixed by Arjen Hiemstra with https://invent.kde.org/plasma/kwin/-/commit/7e25e20097fe8d140f7408b76fbf374fe5f33690 in Plasma 5.24.3
Comment 2 Nate Graham 2022-09-13 18:47:29 UTC
Apparently right edge panels are still affected; see Bug 459000.
Comment 3 Nate Graham 2023-09-28 19:01:59 UTC
It's now broken again in Plasma 6 exactly as it was before this fix went in; re-opening.
Comment 4 João Sousa 2023-10-25 07:50:44 UTC
Hi Nate! For me it is broken on on Plasma 5. I'm using a vertical floating panel at the left of the screen and the maliit virtual keyboard doesn't overlap the panel but it gets its rightmost edge of the window off the screen partially blocking the keyboard keys as reported on https://bugs.kde.org/show_bug.cgi?id=474910. I guess it's related to the same issue origianlly reported.

OS: NixOS 23.11 (unstable)
KDE Plasma Version: 5.27.8
KDE Frameworks Version: 5.110.0
Qt Version: 5.15.10
Comment 5 Nate Graham 2023-10-25 21:15:41 UTC
This appears to affect new panels too; creating a new horizontal panel when there's already a vertical panel causes it to be mis-positioned in exactly the same way as Maliit is. Seems like the vertical panel struts are wrong.

I'm using the system at 200% scale, so I thought maybe the struts were in physical pixels and not logical pixels. However I tested at 100% scale, and the issue remained.
Comment 6 Nate Graham 2023-10-25 21:15:46 UTC
*** Bug 459000 has been marked as a duplicate of this bug. ***
Comment 7 Nate Graham 2023-10-25 21:15:53 UTC
*** Bug 474910 has been marked as a duplicate of this bug. ***
Comment 8 Nate Graham 2023-12-01 18:04:45 UTC
*** Bug 477824 has been marked as a duplicate of this bug. ***
Comment 9 Nate Graham 2023-12-01 18:05:58 UTC
Anyway, clear steps to reproduce:

1. Have a vertical panel on the left screen edge
2. Add a new blank horizontal panel or show the Maliit virtual keyboard somehow

Both the new panel and also the Maliit virtual keyboard are positioned too far to the right.
Comment 10 Bug Janitor Service 2023-12-21 10:37:41 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/3714
Comment 11 David Redondo 2023-12-22 09:33:51 UTC
Git commit 6feb67b9fd1148634c022a87062c20a7955c1ac9 by David Redondo.
Committed on 22/12/2023 at 08:55.
Pushed by davidre into branch 'master'.

Let the compositor size space filling panels

There were two issues preventing to let the compositor size such
panels:
- the window needs to be anchored on opposite edges, so LayerShellQt
  requests size 0 (meaning the compositor should deciude) in that dimension
- QtWayland currently will not size windows smaller than the requested
  minimum size. We can work around this by having a minimum size that's
  actually smaller than the screen dimension.
This fixes a horizontal and a vertical panel next to each other to no
longer overlap.

M  +9    -1    shell/panelview.cpp

https://invent.kde.org/plasma/plasma-workspace/-/commit/6feb67b9fd1148634c022a87062c20a7955c1ac9
Comment 12 Nate Graham 2024-01-09 22:41:03 UTC
Not fixed yet, in case anyone was wondering if that commit fixed it.
Comment 13 David Redondo 2024-01-12 09:26:40 UTC
This is because maliit is not using layershell and KWin only lays out layer surfaces with regards to other layer surfaces
Comment 14 David Redondo 2024-01-12 09:38:21 UTC
Disregard the above.

Actually I think rather the panel reserves size only for it's non-floating form and uses the window geometry of windows plasmashell knows about to defloat itself.

But plasma doesnt know about the input panel window.
Comment 15 David Redondo 2024-01-12 10:07:12 UTC
After more testing I think there are two issues

- with a floating horizontal panel part of the panel is covered because it only reserves space for its defloated height and relies on window geometries communicated with plasma-window-managment to defloat. Inputpanel (or layershell) windows are not reported.
- with a non-floating horizontal panel thinks work correctly

- a non-floating vertical panel does not have wrong struts. What maliit does is create a window as big as the screen (see also this comment here https://invent.kde.org/plasma/kwin/-/blob/master/src/inputpanelv1window.cpp#L90). This window's contents spans it fully horizontally but not vertically. So with a vertical panel there ends up being just not enough space.

The first one we can fix inside the panel.
The second requires maliit to use a different shell protocol than the current input_panel_surface as KWin can't resize maliit through that.
Comment 16 Niccolò Venerandi 2024-01-12 13:55:14 UTC
(In reply to David Redondo from comment #15)
> After more testing I think there are two issues
> 
> - with a floating horizontal panel part of the panel is covered because it
> only reserves space for its defloated height and relies on window geometries
> communicated with plasma-window-managment to defloat. Inputpanel (or
> layershell) windows are not reported.
> - with a non-floating horizontal panel thinks work correctly
> 
> - a non-floating vertical panel does not have wrong struts. What maliit does
> is create a window as big as the screen (see also this comment here
> https://invent.kde.org/plasma/kwin/-/blob/master/src/inputpanelv1window.
> cpp#L90). This window's contents spans it fully horizontally but not
> vertically. So with a vertical panel there ends up being just not enough
> space.
> 
> The first one we can fix inside the panel.

Can we, though? Because it's intentional :-/

The issue with reserving the "correct" amount of space is that when we maximize a window that's going to maximize according to the floating panel strut, but then the panel de-floats, so the maximized windows have to get bigger, and that causes a quite ugly result. Thus the usage of 
the panel thickness, not considering floating margin, as the reserved area: it makes sure that the windows directly fill the correct amount of space immediately.
Comment 17 David Redondo 2024-01-12 15:35:36 UTC
> Can we, though? Because it's intentional :-/

We can do everything :D


> The issue with reserving the "correct" amount of space is that when we maximize a window that's going to maximize according to the floating panel strut, but then the panel de-floats, so the maximized windows have to get bigger, and that causes a quite ugly result. Thus the usage of 
the panel thickness, not considering floating margin, as the reserved area: it makes sure that the windows directly fill the correct amount of space immediately.

Hmm I think I can see what you mean.  At first I though it all looks nice, the maximized windows are animated nicely to a new size. But I can sometimes see 1 pixel wide line flickering on the border. In my testing I would say it's 50/50 :/
Comment 18 Niccolò Venerandi 2024-01-13 19:15:31 UTC
*** Bug 479750 has been marked as a duplicate of this bug. ***