Bug 45595

Summary: mouse wrapping doesn't work when the window is partially outside of the physical screen
Product: Spice Reporter: Alon Levy <alevy>
Component: spice-gtkAssignee: Spice Bug List <spice-bugs>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: widget: fix mouse wrapping failing when the window is outside

Description Alon Levy 2012-02-03 08:05:50 UTC
If the window of spice-gtk is partially outside of the physical screen, like so:

                                  .----------------------.
                                  |   physical screen    |
                            .-----------------.          |
                            |    spice-gtk    |          |
                            |     widget      |          |
                            |                 |          |
                            |                 |          |
                            |                 |          |
                            |                 |          |
                            '-----------------'          |
                                  |                      |
                                  '----------------------'

This doesn't work for linux and for windows.

For linux, the problem is that the grab area is wrongly set to:

                                  .----------------------.
                                  |                      |
                            .---------------.            |
                            |.-------------.|            |
                            ||  grab area  ||            |
                            ||             ||            |
                            ||             ||            |
                            |'-------------'|            |
                            '---------------'            |
                                  |                      |
                                  |                      |
                                  '----------------------'

and we actually want it to be the whole screen.

For windows we can use WH_MOUSE_LL for SetWindowsHookEx

But there is an even better implementation that we need to copy from spicec.
Comment 1 Marc-Andre Lureau 2012-02-07 06:43:14 UTC
Created attachment 56711 [details] [review]
widget: fix mouse wrapping failing when the window is outside

Use a anchor mouse position after every move, similar to spicec to
avoid reaching transparent border on the screen.

We try to move to the center of the screen, but
gdk_display_warp_pointer () will move the cursor within the grabbed
window (so it still receives mouse events even on Windows)

Tested with Linux and Windows clients.

Fixes bug:
Comment 2 Alon Levy 2012-02-13 07:53:28 UTC
ACK.
Comment 3 Marc-Andre Lureau 2012-02-13 08:13:57 UTC
pushed.

commit fdbd5c1b5eb8596b574ad651afb74a7c59a14484
Author: Marc-André Lureau <marcandre.lureau@redhat.com>
Date:   Tue Feb 7 14:36:14 2012 +0100

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.