[PATCH spice-gtk] widget: Fix mouse position reporting for multiple monitors on 1 display channel

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 gtk/spice-widget.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

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;
-- 
1.8.0.2

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]