[Spice-commits] gtk/spice-widget.c

Hans de Goede jwrdegoede at kemper.freedesktop.org
Wed Feb 6 06:05:37 PST 2013


 gtk/spice-widget.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

New commits:
commit fe4540d7d353b824601330d3df68f2e36847d75b
Author: Hans de Goede <hdegoede at redhat.com>
Date:   Sat Feb 2 16:30:10 2013 +0100

    widget: Fix mouse position reporting for multiple monitors on 1 display channel
    
    VDAgentMouseState contains a display_id and expects coordinates in multi-mon
    mode to be relative to the origin of the monitor specified by the display_id.
    
    The agent will then adjust the mouse coordinates for the position of the
    monitor as configured in the guest.
    
    In multiple monitors on 1 display channel spice-gtk is wrongly setting
    display_id to the channel_id (which is 0 for all monitors), and is working
    around the problems this causes by doing the adjustment of the mouse position
    itself.
    
    But the agent is still applying the correction for the monitor position to
    all VDAgentMouseState messages it gets, and since for all monitors a display_id
    of 0 is reported it always uses the position of display 0 for the correction.
    
    Since the position of display 0 is usally +0+0 this usually works, but as soon
    as the position of display 0 is not +0+0, the correction will get done twice
    for display 0, and the display 0 position will wrongly get added the mouse
    position for other displays.
    
    This patch fixes this by properly setting display_id, and removing the
    modification of the mouse coordinates as that is already done in the agent.
    
    Signed-off-by: Hans de Goede <hdegoede at redhat.com>

diff --git a/gtk/spice-widget.c b/gtk/spice-widget.c
index 81670c3..fcb3e87 100644
--- a/gtk/spice-widget.c
+++ b/gtk/spice-widget.c
@@ -1526,9 +1526,7 @@ static gboolean motion_event(GtkWidget *widget, GdkEventMotion *motion)
     case SPICE_MOUSE_MODE_CLIENT:
         if (x >= 0 && x < d->area.width &&
             y >= 0 && y < d->area.height) {
-            spice_inputs_position(d->inputs,
-                                  x + d->area.x, y + d->area.y,
-                                  d->channel_id,
+            spice_inputs_position(d->inputs, x, y, get_display_id(display),
                                   button_mask_gdk_to_spice(motion->state));
         }
         break;


More information about the Spice-commits mailing list