Bug 382219

Summary: Touch screen swipe gestures interferes with Latte dock's ability to show itself if hidden (even without a touch screen).
Product: [Plasma] kwin Reporter: libookami
Component: inputAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED NOT A BUG    
Severity: minor CC: mvourlakos
Priority: NOR    
Version: 5.10.3   
Target Milestone: ---   
Platform: Neon   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description libookami 2017-07-10 21:34:14 UTC
Hi, the following is just a minor detail and i don't know if it can even considered a bug but here we go:
Since i got the update to Plasma 5.10 on Neon Latte dock started to fail by not being able to show itself most of the time. I noticed a new KCM about touch swipe gestures on borders and one gesture is activated by default on the left border. So after fiddling a bit i noticed that Latte dock only fails to show itself on borders where there's a gesture activated, so i just disabled the gesture on the left border and after restarting my session i has been able to use Latte dock normally.

I filled a bug against Latte dock too, you can see the details here:
https://github.com/psifidotos/Latte-Dock/issues/512

To reproduce the problem:
1: Activate swipe gesture for an specific border.
2: Put Latte-Dock on the border where you activated the swipe gesture if it was not there already.
3: Activate an option to auto-hide or dodge windows for that dock.
4: Close and open your session again (only restarting plasmashell and kwin didn't work for me to trigger the problem).
5: Now It's very hard or practically impossible to make the dock show itself when you put the mouse on that border.

It's not a big deal and i know maybe it's something that cannot be fixed but i fill the bug just for the developers to be aware that this can happen, i'm not even sure if i'm filling the bug against the correct product. Just tried it again today and it still happens, i don't have a touch screen, it may be good to only enable touch gestures when a touch device is detected. Thanks for your attention.

Plasma: 5.10.3
Frameworks: 5.35.0
Qt: 5.9.1
OS: Fully updated KDE Neon User edition 64-bit
Comment 1 Martin Flöser 2017-07-11 04:13:37 UTC
Latte dock should use the functionality provided by KWin for auto hiding on screen edges.
Comment 2 libookami 2017-07-11 04:20:00 UTC
I see, thanks a lot for your answer.
Comment 3 Michail Vourlakos 2018-03-28 17:52:34 UTC
(In reply to Martin Flöser from comment #1)
> Latte dock should use the functionality provided by KWin for auto hiding on
> screen edges.

Ok, let's discuss this.

The thing is that I just tried to use the KWin+Plasma way for informing KWin (under wayland) and xcb(under X11) but I had the following issues...

1. Because Qt considers the window out-of-screen when it is hidden all the animations for tasks are played after the window is shown... So animations that are not needed any more create a confusion to the user. Latte to workaround that Qt behavior isnt hidding the dock when it is hidden (it just sets a very small mask)

2. The issue isnt solved even with plasma panels usage under X11. For plasma panels if at a specific edge a gesture has been set and the panel is auto-hidden then the slide-in animation is played twice.
By tracking this down there is a following bug: 
a. When the user is touching the edge of a hidden panel then a QEvent::Enter is received
b. but immediately afterwards it receives also a QEvent::Leave, this is because the gesture possibly creates a small window on top of everything even on top of panels of docks

[2] is happening only on X11, for Wayland everything works as expected...


So concerning Latte, I would consider to support this because it works just fine under Wayland and I could forward the users to disable the Gestures if they dont need them under X11 BUT because of [1] the Latte experience is broken and that prevents me from doing so.
Comment 4 Martin Flöser 2018-03-28 18:06:04 UTC
IIRC the auto hiding is done in a way that Qt doesn't notice it. Are you sure you implemented it correctly? It's important to not do QWindow::hide on the window
Comment 6 Michail Vourlakos 2018-03-28 18:44:38 UTC
(In reply to Martin Flöser from comment #5)
> See https://community.kde.org/KWin/Screen_Edges and
> https://cgit.kde.org/kwin.git/tree/tests/screenedgeshowtest.cpp

Martin I dont think the issue is with the screen edge window but rather with the gesture window, arent they different?
Comment 7 Michail Vourlakos 2018-03-28 18:58:40 UTC
Just to observe it yourself, under X11.

----
Plasma issue (left panel - auto hidden - gesture enabled for left edge): 
https://drive.google.com/file/d/1UTR5QLQLA3sxBNKkgmscm3QGo5Wjs4YT/view

What I am doing is forcing the mouse continuously to the left edge.

----
Latte issue (left dock - auto hidden - gesture enabled for left edge:
https://drive.google.com/file/d/1SI7NnIJ8biBZT6VAuTSAYWRW4QM3bMHW/view?usp=sharing

For Latte in order to show the dock the mouse must leave that 1px wide area at the left edge.

----
Probably this is happening because it gets QEvent::Leave after QEvent::Enter so containsMouse flag which is set through (QEvent::Enter and QEvent::Leave events) is faulty. There is something 1px wide in the left edge at all cases under X11.
Comment 8 Martin Flöser 2018-03-28 19:57:58 UTC
The screenedge is a toggle. If you constantly move your mouse there you show and hide the edge. I don't see a bug in the plasma case, but expected behavior.

In the latte case the problem is that you still do things wrong. There's the shaped window and it steals the events. Remove it.
Comment 9 Michail Vourlakos 2018-03-28 20:14:31 UTC
> The screenedge is a toggle. If you constantly move your mouse there you show and hide the edge. I don't see a bug in the plasma case, but expected behavior.

but if the mouse didnt leave the panel that is sliding in I cant understand why the edge should be activated. The panel is shown so the edge shouldnt be valid.
Comment 10 Michail Vourlakos 2018-03-28 20:22:02 UTC
reported also here for the plasma case: https://bugs.kde.org/show_bug.cgi?id=392464
Comment 11 Michail Vourlakos 2018-03-30 22:15:59 UTC
(In reply to Martin Flöser from comment #4)
> IIRC the auto hiding is done in a way that Qt doesn't notice it. Are you
> sure you implemented it correctly? It's important to not do QWindow::hide on
> the window

Just to conclude in this ;)

the good news is that I managed to activate kwin edges with Latte and overcome also the [1] issue (when the dock becomes hidden in an edge the animations arent played). To workaround this I created a ghostWindow per dock with 1px thickness that is responsible to make the communication with KWin concerning KWin edges activation/deactivation.

I will make this the default behavior for the upcoming v0.8 because it fixed issues and also it demonstrates fantastic possibilities:

a. in !compositing mode when the dock isHidden there is no more 1px appearance at the edge of the screen
b. kwin screen edges provide the beautiful indicator when the mouse approachs the edge
c. I managed to orchestrate it with upcoming multiple running layouts in different activities. The user changes activities and as such layouts and the corner edges are updated according to the current activity
d. works just fine with wayland
e. the user can de-activate this behaviour if prefers to use the old way of hiding and showing docks
Comment 12 Martin Flöser 2018-03-31 07:07:35 UTC
Sounds good