Bug 467388

Summary: Side- and top-tiled Breeze-decorated windows can inappropriately be resized from top window edge, which interferes with Fitts' Law for UI elements at that edge
Product: [Plasma] Breeze Reporter: deadmeu <deadmeu>
Component: window decorationAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: kwin-bugs-null, nate, uhhadd
Priority: NOR Keywords: usability
Version: 5.27.3   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In: 6.2.0
Sentry Crash Report:

Description deadmeu 2023-03-15 09:15:32 UTC
SUMMARY
When a window (such as Firefox using its custom decorations) is snapped to the side of the screen, moving the cursor to the top tabs, touching the edge of the window, causes the cursor to enter into a resize window state.

This is incredibly annoying to deal with as the tabs are quite small and whipping the cursor to the top of the display, touching the tab and window edge, is typically a convenient way to select the tab.

I think this was introduced with the Plasma 5.27.3 update as I did not notice this prior to updating. It could potentially be an issue with Firefox but I get the same behaviour with VSCode when trying to access its top bar menus. Additionally, the scrollbar edge in VSCode also forces the cursor to enter the resize state, but this does not occur in Firefox (I'm not sure whether this was an issue with VSCode prior to updating Plasma).

This issue does not occur when the window is full-screen.

Note: I'm unsure which product/component would be responsible for this issue.

STEPS TO REPRODUCE
1. Configure Firefox to use its own custom title bar.
2. Snap the Firefox window to either the left or right edge of the screen.
3. Open a few tabs and try to swap between them by sitting the cursor right at the top edge of the tab.

OBSERVED RESULT
The mouse cursor enters the resize window state.

EXPECTED RESULT
The mouse cursor acts like a regular cursor and allows the tab to be clicked normally.

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 5.27.3
KDE Frameworks Version: 5.104.0
Qt Version: 5.15.8
Kernel Version: 6.2.6-arch1-1 (64-bit)
Graphics Platform: Wayland
Processors: 24 × AMD Ryzen 9 3900X 12-Core Processor
Memory: 31.3 GiB of RAM
Graphics Processor: AMD Radeon RX 7900 XT
Manufacturer: ASUS
Comment 1 Nate Graham 2023-03-15 20:14:18 UTC
A few questions:
1. When you say "full-screen" do you mean actually full screen, or mazimized? They're separate states.
2. Does the issue go away if you force the affected XWayland-using apps into their native Wayland modes?  You can do this for Firefox by adding MOZ_ENABLE_WAYLAND=1 to /etc/environment, rebooting, and then starting Firefox
3. Are you using any screen scale factors on your system that aren't either 100% or 200%? If so, does the issue go away for XWayland-using apps when you do change the scale factor to 100% or 200%?

All of these questions are to help me understand if the issue is Bug 459373, or something else.
Comment 2 deadmeu 2023-03-16 04:11:59 UTC
(In reply to Nate Graham from comment #1)
> 1. When you say "full-screen" do you mean actually full screen, or
> mazimized? They're separate states.
Sorry, I mean maximised. I've just tested proper full-screen (by pressing F11) and maximised in Firefox and VSCode and found that in Firefox, full-screen and maximised have the same good expected behaviour, but in VSCode going full-screen causes the scrollbar edge to have the issue. When Maximised, VSCode exhibits the good expected behaviour I described earlier.
> 2. Does the issue go away if you force the affected XWayland-using apps into
> their native Wayland modes?  You can do this for Firefox by adding
> MOZ_ENABLE_WAYLAND=1 to /etc/environment, rebooting, and then starting
> Firefox
I have already enabled Wayland in Firefox (confirmed by checking in about:support that Window Protocol = wayland). VSCode's behaviour seems to be identical regardless of whether it's running under XWayland or Wayland natively.
> 3. Are you using any screen scale factors on your system that aren't either
> 100% or 200%? If so, does the issue go away for XWayland-using apps when you
> do change the scale factor to 100% or 200%?
No, I use 100% scale.
> All of these questions are to help me understand if the issue is Bug 459373,
> or something else.
I don't think this is the same as Bug 459373 and I really don't think this was an issue prior to me doing a system update a couple of days ago.

It might be worth noting that I have installed Firefox as a Flatpak, but VSCode was obtained from the Arch repo. Both of these were recently updated alongside me picking up the Plasma 5.27.3 update but I don't think they would be responsible for this issue as it appears in multiple programs using custom decorations.
Comment 3 deadmeu 2023-03-16 04:22:01 UTC
Here's a video of the issue: https://streamable.com/fy6acq
In the video, I start by showing the expected tab switching behaviour when Firefox is maximised, then full-screen. Then I snap Firefox to the edge of my screen and try to switch tabs as before but am unable to do so.
Comment 4 Nate Graham 2023-03-27 19:00:21 UTC
Can reproduce the issue of being able to resize tiled windows from the top window edge.

The thing with VSCode and the scrollbar is probably something else, maybe an issue in VSCode itself.
Comment 5 deadmeu 2023-12-01 13:43:50 UTC
This one has been quite annoying for me over the months and I wish there was something I could do to mitigate it...

Is it possible to disable the ability to resize windows from the top/all edges? If anyone has any ideas please leave a comment as this has been driving me nuts 😬.
Comment 6 Vlad Zahorodnii 2024-07-30 08:35:14 UTC
kwin seems to set correct tiled states and it also sends motion events with the coordinates that are within the bounds of the screen. It looks like a Firefox issue. Can you report this issue to Firefox developers please?

I've also tested with other csd applications, the issue is reproducible only in Firefox. In other GTK apps, the top edge behaves as expected when tiled.
Comment 7 Nate Graham 2024-07-30 13:18:48 UTC
I can reproduce the issue with more than just Firefox CSD windows. In fact I can reproduce it with all Breeze-decorated SSD windows. But not CSD windows of GNOME or Chromium.

So it seems like there are two different bugs here, caused by:
- Breeze window decorations
- Firefox specifically

We'll use this bug report to track #1.

Can someone open a bug report for Firefox?
Comment 8 Bug Janitor Service 2024-07-30 13:33:59 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/breeze/-/merge_requests/473
Comment 9 deadmeu 2024-07-30 13:39:30 UTC
I think I agree that my issue specifically is actually a Firefox bug. I did not previously realise the difference between CSD and SSD behaviour, so that is a good observation to point out. Because of this, I'm not so sure it actually needs to be addressed with SSD because you would not normally need click at the window's edge if it is being simply rendered as the default draggable bar. With Firefox, it's a problem because that's where the tabs are, but again, that is actually a CSD bug with Firefox and not KDE related.

I think the current behaviour actually matches what Windows does, so maybe it should be left alone?
Comment 10 deadmeu 2024-07-30 13:54:06 UTC
I should point out that there's actually a secondary issue that ties in with this, and I think that maybe the secondary issue is Kwin related: In some applications (Firefox included), if you snap the window to the edge and then begin resizing it, it momentarily reverts the window's size and position to the state it was in before it was snapped to the edge. This issue is actually more annoying than the resizing one, because in Firefox, simply clicking at the edge will cause the window to immediately revert to this previous window state. I have to work around this issue by snapping my window to the edge and then resizing the window down a bit and then back up in order to prevent the window from moving away from underneath my cursor if I happen to click at the edge at some point later.

Is this something that either of you, Nate and Vlad, can replicate? I can open this as a new issue if you would like.
Comment 11 Vlad Zahorodnii 2024-07-30 14:39:43 UTC
Git commit 6d7ee3947429e15ce7cfb043c3bac8d6cb1d68c2 by Vlad Zahorodnii.
Committed on 30/07/2024 at 13:30.
Pushed by ngraham into branch 'master'.

Disable top resize border if the window is tiled

Do this in order to avoid interfering with the Fitts' law.

M  +3    -2    kdecoration/breezedecoration.cpp

https://invent.kde.org/plasma/breeze/-/commit/6d7ee3947429e15ce7cfb043c3bac8d6cb1d68c2