Bug 370526

Summary: Screen doesn't get locked when virtual box with MS windows guest has the focus
Product: [Plasma] kscreenlocker Reporter: adarmalik
Component: generalAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED INTENTIONAL    
Severity: minor CC: bhush94, mgraesslin
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In:

Description adarmalik 2016-10-12 08:04:38 UTC
I am using openSUSE Leap 42.1 (x86_64) and the KDE5 repositories. I run virtualbox (5.1.6_110634_openSUSE132-1) with a MS Windows 8 guest.
If virtualbox has focus the screen is not locked.
Comment 1 Martin Flöser 2016-10-12 08:42:03 UTC
I assume it's a feature of virtualbox and it inhibits the lock screen
Comment 2 Martin Flöser 2016-10-12 08:42:51 UTC
you should see that in the "Battery and Brightness" applet whether there is an inhibition in place.
Comment 3 adarmalik 2016-10-12 10:52:28 UTC
Hi Martin,

I don't see any inhibition in the applet.

I have found something that might be related:

https://bugs.launchpad.net/ubuntu/+source/gnome-screensaver/+bug/1124282
https://bugs.launchpad.net/ubuntu/+source/gnome-screensaver/+bug/49579

So it might be that virtualbox grabs the keys and the screenlocker can't grab them so it doesn't start?
Comment 4 Martin Flöser 2016-10-12 13:23:42 UTC
(In reply to adarmalik from comment #3)
> So it might be that virtualbox grabs the keys and the screenlocker can't
> grab them so it doesn't start?

yes that makes sense. If an application grabs the keyboard (or pointer) the lock screen cannot grab them and thus doesn't run at all. You can verify with:
xdotool key "XF86LogGrabInfo"

That should add an entry to /var/log/Xorg.0.log about the application currently holding a grab.
Comment 5 adarmalik 2016-10-12 14:14:06 UTC
Yes, that's the reason ...

[ 23493.940] (II) Printing all currently active device grabs:
[ 23493.940] Active grab 0x4600000 (core) on device 'Virtual core keyboard' (3):
[ 23493.940]       client pid 2600 /usr/lib/virtualbox/VirtualBox --startvm win8
[ 23493.940]       at 23492835 (from active grab) (device thawed, state 1)
[ 23493.940]         core event mask 0x3
[ 23493.940]       owner-events false, kb 1 ptr 1, confine 0, cursor 0x0
[ 23493.940] (II) End list of active device grabs

I guess this can not be solved, right? I was able to remove the keyboard grabbing from vbox but than I can't ALT+TAB between the guest windows anymore :(
Comment 6 Martin Flöser 2016-10-12 14:28:46 UTC
> I guess this can not be solved, right?

Not on X11 - on Wayland it's not a problem. Setting to WONTFIX, though CANTFIX would be more matching.