Panel with auto hide and gap between screen edge won't stay visible
https://github.com/user-attachments/assets/587693dd-bc7a-4f5b-980a-27ecff37e96b
If a panel is set to auto hide and to leave a gap between itself and the screen edge, then moving the cursor to the screen edge will cause the panel to appear and immediately disappear unless the cursor is moved up during the panel appearance animation.
I came here to post the same thing. And it's not the same issue, but I think it makes sense to extend the button click area as well as the panel hover area to the screen edge, regardless of the gap size: https://github.com/pop-os/cosmic-panel/issues/233.
This is the same issue as #149. It's likely not a panel issue but an issue with cosmic-comp, where there are 1 pixel lines along the bottom and right screen edges that block input. It works properly if a panel is on the top or left screen edges.
I'm having a similar problem. With Dock settings autohide enabled and gap enabled; I move my mouse to the dock past 'the gap' (i.e. the very bottom of the screen), it pops up then auto-hides immediately.
One thing I found while messing around: Manually changing the value in ~/.config/cosmic/com.system76.Cosmic.Panel.Dock/v1/margin below 4 "hides" the problem.
And to make this more frustrating, sometimes, but not always, when I re-save Margin as 4 (the default), the problem won't comeback until I restart or log out of my current session.
Just a few observations around this issue as I add some debug info to cosmic-comp:
- When checking the extent of the mouse cursor position in cosmic-comp, it correctly outputs the f64 value as "one f64 lower" than the width of my screen. Example: my screen is 2256 pixels wide, but I am using 150% scaling, so 2256/1.5 is 1504. The value of the mouse cursor x position when I move it to the far right edge of the screen is 1503.999999999998, confirming that at least cosmic-comp is doing the correct thing here. I was unable to detect it clamping or otherwise changing the value to 1503.0 or 1502.0 or 32bit integers (which might account for right-edge and bottom-edge issues).
- My
~/.config/cosmic/com.system76.Cosmic.Panel.Dock/v1/marginconfig is set at 0, but the bug still happens for me as described in the original post.
A little more progress to report: I've been tracing the Visibility::TransitionToVisible and Visibility::TransitionToHidden states in cosmic-panel to see how the left- and right-hand panels behave differently. I've narrowed it down to the wrapper_space's pointer_leave event firing incorrectly (several times, and not when the mouse cursor has left the region) on the right-hand panel.
As a result, the c_hovered_surface FocusStatus state changes to LastFocused(now), and this cascades to the result that this issue describes.
Edit: Traced it as far as https://github.com/pop-os/client-toolkit and the wayland_client::protocol::wl_data_device::Event::Leave event.
Edit: Traced it as far as https://github.com/pop-os/client-toolkit and the wayland_client::protocol::wl_data_device::Event::Leave event.
Do you mean a pointer Leave event? If the panel receives a leave event, it starts the countdown to hide, and it really shouldn't be receiving a leave event if the mouse is on the surface. Assuming the panel has a zero margin on the edge that it is anchored to, and the input region is the correct size, it shouldn't be receiving any leave events from the compositor when the pointer is pushed to the edge of the screen.
https://github.com/pop-os/cosmic-panel/commit/d0d79726307405cdf2d879d3fb6162a8b2f5996a should fix this
Just wanted to come back and confirm that your patch fixes the issue, @wash2 . Thanks!