Bug 269737 - Powerdevil doesn't send SimulateUserActivity() signal to screensaver
Summary: Powerdevil doesn't send SimulateUserActivity() signal to screensaver
Status: RESOLVED FIXED
Alias: None
Product: solid
Classification: Frameworks and Libraries
Component: powermanagement (show other bugs)
Version: unspecified
Platform: Gentoo Packages Linux
: NOR minor
Target Milestone: ---
Assignee: Dario Freddi
URL:
Keywords:
: 89138 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-03-29 22:58 UTC by Martin Bednar
Modified: 2011-04-09 09:54 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.6.3


Attachments
Fix SimulateUserActivity not working. (1.88 KB, patch)
2011-03-30 03:32 UTC, Lamarque V. Souza
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Bednar 2011-03-29 22:58:50 UTC
Version:           unspecified (using KDE 4.6.1) 
OS:                Linux

When I resume my PC with screen locking enabled, I expect to be directly asked for a password. Right now I need to move the mouse/press a key to get to the password dialog.

Reproducible: Didn't try

Steps to Reproduce:
Suspend with screen locking enabled, resume

Actual Results:  
if no screen saver is set, black screen.

Expected Results:  
if no screen saver is set, black screen with password prompt.

The code is there (powerdevilcore.cpp:536) but apparently doesn't work...
I tried catching the resumingFromSuspend() signal, that worked fine.
Sending SimulateUserActivity() to the screensaver also works.
Comment 1 Martin Bednar 2011-03-29 23:00:05 UTC
forgot to select Reproducible: Every time
Comment 2 Lamarque V. Souza 2011-03-30 03:32:46 UTC
Created attachment 58449 [details]
Fix SimulateUserActivity not working.

It seems there is a race condition between the Lock and SimulateUserActivity calls. If the SimulateUserActivity starts before the Lock call has taken effect te SimulateUserActivity is ignored. You can see this using:

qdbus org.freedesktop.ScreenSaver /ScreenSaver Lock ; sleep 0.5; qdbus org.freedesktop.ScreenSaver /ScreenSaver SimulateUserActivity

with sleep < 1s SimulateUserActivity has not effect.

I think the same thing happens during the suspend -> resume cicle. The attached patch fix this. I just wanted someone else to look at it and see if we can improve it.
Comment 3 Oswald Buddenhagen 2011-03-30 08:22:59 UTC
this is a rather horrid hack. it shouldn't be too hard to queue up the activity request in the screenlocker itself (there is already a --showunlock command line option).
technically, it's also a bug that the sleep is started before the lock has fully kicked in, but that may be hard to fix - http://lists.kde.org/?l=kde-devel&m=127854133109321&w=2
Comment 4 Lamarque V. Souza 2011-03-30 18:52:01 UTC
I tried adding --showunlock as a parameter to kscreenlocker in kde-workspace/krunner/screensaver/saverengine.cpp but it did not work. It locks the screen but still does not show the unlock dialog.
Comment 5 Oswald Buddenhagen 2011-03-30 19:06:03 UTC
that would be wrong anyway, as the regular Lock() is not supposed to pop it up. you need to fix the race inside the locker, and the feature was just a hint that there is already some relevant code.
Comment 6 Lamarque V. Souza 2011-04-09 07:53:39 UTC
Git commit 5c47f16d67065e239c380cc369a1da854acef19a by Lamarque V. Souza.
Committed on 09/04/2011 at 07:44.
Pushed by lvsouza into branch 'KDE/4.6'.

Fix SimulateUserActivity not working for a second when resuming from
ram/disk.

The problem is in krunner/lock/lockprocess.cc, LockProcess::lock(...),
lines:

mBusy = true;
...
QTimer::singleShot(1000, this, SLOT(slotDeadTimePassed()));

The "dead-time" makes LockProcess ignores any SimulateUserActivity
requests during that one second-time.
I have added "mInitialLock = true" in LockProcess::signalPipeSignal() to
simulate the "--showunlock" parameter after the one second-time.

BUG: 269737
FIXED-IN: 4.6.3

M  +2    -0    krunner/lock/lockprocess.cc     

http://commits.kde.org/kde-workspace/5c47f16d67065e239c380cc369a1da854acef19a
Comment 7 Lamarque V. Souza 2011-04-09 07:53:39 UTC
Git commit 49ecb2b9e1d340c799faaff0ea50ed5424217729 by Lamarque V. Souza.
Committed on 09/04/2011 at 07:44.
Pushed by lvsouza into branch 'master'.

Fix SimulateUserActivity not working for a second when resuming from
ram/disk.

The problem is in krunner/lock/lockprocess.cc, LockProcess::lock(...),
lines:

mBusy = true;
...
QTimer::singleShot(1000, this, SLOT(slotDeadTimePassed()));

The "dead-time" makes LockProcess ignores any SimulateUserActivity
requests during that one second-time.
I have added "mInitialLock = true" in LockProcess::signalPipeSignal() to
simulate the "--showunlock" parameter after the one second-time.

BUG: 269737
FIXED-IN: 4.6.3

M  +2    -0    krunner/lock/lockprocess.cc     

http://commits.kde.org/kde-workspace/49ecb2b9e1d340c799faaff0ea50ed5424217729
Comment 8 Lamarque V. Souza 2011-04-09 09:54:19 UTC
*** Bug 89138 has been marked as a duplicate of this bug. ***