Bug 1121446

Summary: screensaver cannot start when the input is grabbed by spice guest
Product: Red Hat Enterprise Linux 6 Reporter: CongDong <codong>
Component: spice-gtkAssignee: Default Assignee for SPICE Bugs <rh-spice-bugs>
Status: CLOSED WONTFIX QA Contact: SPICE QE bug list <spice-qe-bugs>
Severity: low Docs Contact:
Priority: low    
Version: 6.6CC: cfergeau, dblechte, fidencio, juzhou, marcandre.lureau, mzhan, pgrunt, rbalakri, sgraf, tpelka, tzheng
Target Milestone: rc   
Target Release: 6.8   
Hardware: Unspecified   
OS: Unspecified   
URL: https://bugs.freedesktop.org/show_bug.cgi?id=34793
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-10-17 16:57:43 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description CongDong 2014-07-21 02:06:58 UTC
Description of problem:
When mouse is grabed by spice guest, the screensaver of host won't start.

Version-Release number of selected component (if applicable):
libvirt-0.10.2-41.el6.x86_64
virt-manager-0.9.0-26.el6.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Prepare a spice guest with qxl:
...
    <input type='tablet' bus='usb'/>
...
    <graphics type='spice' port='5900' autoport='yes' listen='127.0.0.1'>
      <listen type='address' address='127.0.0.1'/>
    </graphics>
...
    <video>
      <model type='qxl' ram='65536' vram='65536' heads='1'/>
      <alias name='video0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
...

2. Set the host screensaver start as the machine idle after "1 minute"
System -> Preferences -> Screensaver -> "Regard the computer as idle after: 1 mintue"
Screensaver theme: Blank screen

3. start the guest and click mouse on the guest's desktop, then wait 1 minute.
#virsh start $vm
#virt-manager
double click the name of #vm, then click the desktop of guest, so the guest window is foucsed(the guest window has a black title bar).

Actual results:
After 1 minute, notice that the guest window is not foucsed(the guest window title bar changed to white), but the screensaver is not start.

Expected results:
The screensaver should start after 1 minute.

Additional info:
use virt-viewer get the same problem.
guest with vnc doesn't have the problem.

Comment 2 Martin Kletzander 2014-07-21 05:22:25 UTC
I'm sorry to say that, but if your mouse pointer gets grabbed, you have the guest configured badly.  It should not grab the pointer at all (maybe first few seconds before the kernel is fully loaded or something).  Is the guest installed?

Comment 3 CongDong 2014-07-21 05:35:33 UTC
(In reply to Martin Kletzander from comment #2)
> I'm sorry to say that, but if your mouse pointer gets grabbed, you have the
> guest configured badly.  It should not grab the pointer at all (maybe first
> few seconds before the kernel is fully loaded or something).  Is the guest
> installed?

The guest is already installed.

In step3, after 1 minute, the window is not fcoused any more(the window title bar changed to white background), is that mean the mouse pointer is ungrabed?

Comment 4 Martin Kletzander 2014-07-21 08:46:22 UTC
pointer is grabbed when the titlebar has information about how to ungrab it. After the guest boots the screensaver should work. Because is doesn't with spice, but does with VNC, I'm moving it to spice-gtk (that is used by virt-manager).

Comment 5 Marc-Andre Lureau 2014-07-21 10:06:09 UTC
In client mode, only the keyboard is grabbed (to be able to receive win keys, alt-tab etc) The grab prevent the screenscaver from starting

When the screensaver is activated, spice-gtk continuously process those events:  

(remote-viewer:4369): GSpice-DEBUG: spice-widget.c:1436 leave_event
(remote-viewer:4369): GSpice-DEBUG: spice-widget.c:771 ungrab keyboard
(remote-viewer:4369): GSpice-DEBUG: spice-widget.c:1475 focus_out_event
(remote-viewer:4369): GSpice-DEBUG: spice-widget.c:1252 release_keys
(remote-viewer:4369): GSpice-DEBUG: spice-widget.c:1422 enter_event
(remote-viewer:4369): GSpice-DEBUG: spice-widget.c:1452 focus_in_event
(remote-viewer:4369): GSpice-DEBUG: spice-widget.c:1252 release_keys
(remote-viewer:4369): GSpice-DEBUG: spice-widget.c:743 grab keyboard

If spice-gtk wouldn't receive the enter event and focus-in, the screensaver would probably start, since the keyboard and pointer would not be grabbed.

Note that this "bug" has always happened in spice-gtk, and that leaving the pointer from spice-gtk will start the screensaver, so it is considered a minor bug.

Comment 6 Marc-Andre Lureau 2014-07-21 10:19:54 UTC
tbh, I think it is equally a interesting to prevent the client from logging out / screensaver automatically. In general the guest is also configured to log out / screensaver on idle, and it is annoying if you need to log back 2 times.

Comment 8 Pavel Grunt 2015-03-03 05:56:37 UTC
According to the upstream https://bugs.freedesktop.org/show_bug.cgi?id=34793 it requires changes in spice-gtk and spice-vdagent - I don't think it will be solved in rhel-6.7

Comment 9 Fabiano FidĂȘncio 2015-03-17 23:51:21 UTC
As far I understand it is not going to happen on RHEL-6 cycle.
Can we close it here and open the same bug for RHEL-7 cycle?

Comment 10 Marc-Andre Lureau 2015-03-19 11:08:12 UTC
(In reply to Fabiano FidĂȘncio from comment #9)
> As far I understand it is not going to happen on RHEL-6 cycle.
> Can we close it here and open the same bug for RHEL-7 cycle?

I would even move the bug upstream.  I am not even sure spice-gtk will be able to solve it properly. Fundamentally, it's Xorg grab and screensaver design that is broken, it's not just a spice client issue.

Comment 11 fwu 2015-04-10 09:04:19 UTC
The problem can be reproduced in newer version of virt-manager

package version:
libvirt-0.10.2-51.el6.x86_64
virt-manager-0.9.0-29.el6.x86_64

Operating System:
RHEL 6.7


Steps:
1. Prepare a spice guest with qxl:
...
    <input type='tablet' bus='usb'/>
...
    <graphics type='spice' port='5900' autoport='yes' listen='127.0.0.1'>
      <listen type='address' address='127.0.0.1'/>
    </graphics>
...
    <video>
      <model type='qxl' ram='65536' vram='65536' heads='1'/>
      <alias name='video0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
...

2. Set the host screensaver start as the machine idle after "1 minute"
System -> Preferences -> Screensaver -> "Regard the computer as idle after: 1 mintue"
Screensaver theme: Blank screen

3. start the guest and click mouse on the guest's desktop, then wait 1 minute.
#virsh start $vm
#virt-manager
Double click the name of #vm, then click the desktop of guest, ensure that the guest window is focused.

results:
1. After step3, the guest window is not focused after 1 minute(the guest window title bar turned white) and the screensaver will not be started unless the mouse was moved.

2. Guest with VNC have the same problem as well.

Comment 13 David Blechter 2015-06-18 13:43:10 UTC
moving to 6.8 for now, and we'll  evaluate the next step later

Comment 15 David Blechter 2015-10-17 16:57:43 UTC
it is too low severity in order to address in rhel 6.x