Re: RSIBreak / KIdleTime on Wayland

2020-11-16 Thread Dominik Waurenschk
> > 2.  It works with XWayland, but only detects user activity if the user 
> > makes an input to an XWayland window.
> Yeah, that's expected. We only send things to X when an X app has focus.
> Changing this behaviour is not an option. I don't think this is a viable 
> setup option to support.
> > RSIBreak is started as an XWayland application by default.
> That shouldn't be the case. Are you on OpenSuse by any chance?

Alright, just checking if that is intended behaviour.
Yes, I am indeed on OpenSuse, so I guess that's some kind of config error on my 
end. 

No need to worry about this case then.

> > 3.  It works okay if RSIBreak is started as a native Wayland application 
> > (QT_QPA_PLATFORM=wayland).
> > All input is detected, on native and XWayland windows.
> > But: It takes about 5-10 seconds of me not doing any inputs for the 
> > idle timeout to be called, instead of the 1 second timeout I requested.
> > (the resume event is emitted immediately though, it is just the idle 
> > timout that is slow)
> Indeed:
> // less than 5 sec is not idle by definition
> timer->setInterval(qMax(timeout, 5000u));
>
> In kwayland-server/src/server/idle_interface.cpp
> I have no objections to changing this.
> 

> David

Thanks for the information, and the merge request :)

Dominik

signature.asc
Description: OpenPGP digital signature


Re: RSIBreak / KIdleTime on Wayland

2020-11-16 Thread Dominik Waurenschk
> > Yes, I meant that progress bar.
> > I've had that 1s idle timer idea as well, unfortunately after writing this, 
> > but thank you for confirming that this would indeed work.
> > I will give that a try and if I can get RSIBreak to a working state on 
> > wayland submit a PR for it.
>
> Excellent, thank you very much.
> Please do please reach out if there are any questions with regards to the 
> wayland side.
>
> David

So, I implemented it this way (least invasive to RSIBreak):
If the user was idle for a second (using a KIdleTime timeout), I start my own 
idle time counter (counter++ every second).
Then I catch the next resume event (next user input) and reset my counter to 0.

Now here's some things I found:
1) It works just fine in X.

2) It works with XWayland, but only detects user activity if the user makes an 
input to an XWayland window.
   This means RSIBreak will think the user is idle if using a native wayland 
application.
   On a KDE Plasma Wayland session, RSIBreak is started as an XWayland 
application by default.

3) It works okay if RSIBreak is started as a native Wayland application 
(QT_QPA_PLATFORM=wayland).
   All input is detected, on native and XWayland windows.
   But: It takes about 5-10 seconds of me not doing any inputs for the idle 
timeout to be called, instead of the 1 second timeout I requested.
   (the resume event is emitted immediately though, it is just the idle timout 
that is slow)

So I wonder if this can be fixed in KIdleTime, or if that's just how Wayland 
works.
Thank you,
Dominik

signature.asc
Description: OpenPGP digital signature


Re: RSIBreak / KIdleTime on Wayland

2020-11-16 Thread David Edmundson
change made:
https://invent.kde.org/plasma/kwayland-server/-/merge_requests/133


Re: RSIBreak / KIdleTime on Wayland

2020-11-16 Thread David Edmundson
>If the user was idle for a second (using a KIdleTime timeout), I start my own 
>idle time counter (counter++ every second).
>Then I catch the next resume event (next user input) and reset my counter to 0.

That sounds like what I had in mind.

> 2) It works with XWayland, but only detects user activity if the user makes 
> an input to an XWayland window.

Yeah, that's expected. We only send things to X when an X app has focus.
Changing this behaviour is not an option. I don't think this is a
viable setup option to support.

>RSIBreak is started as an XWayland application by default.
That shouldn't be the case. Are you on OpenSuse by any chance?

>
> 3) It works okay if RSIBreak is started as a native Wayland application 
> (QT_QPA_PLATFORM=wayland).
>All input is detected, on native and XWayland windows.
>But: It takes about 5-10 seconds of me not doing any inputs for the idle 
> timeout to be called, instead of the 1 second timeout I requested.
>(the resume event is emitted immediately though, it is just the idle 
> timout that is slow)

Indeed:

// less than 5 sec is not idle by definition
timer->setInterval(qMax(timeout, 5000u));

In kwayland-server/src/server/idle_interface.cpp
I have no objections to changing this.

David

>
> So I wonder if this can be fixed in KIdleTime, or if that's just how Wayland 
> works.
> Thank you,
> Dominik