From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NIKPB-0005rK-Kb for qemu-devel@nongnu.org; Wed, 09 Dec 2009 06:08:25 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NIKP9-0005pp-VD for qemu-devel@nongnu.org; Wed, 09 Dec 2009 06:08:24 -0500 Received: from [199.232.76.173] (port=37141 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NIKP9-0005pd-S4 for qemu-devel@nongnu.org; Wed, 09 Dec 2009 06:08:23 -0500 Received: from atlas.linux2go.dk ([88.198.22.52]:57284) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NIKP9-0002ff-9k for qemu-devel@nongnu.org; Wed, 09 Dec 2009 06:08:23 -0500 Received: from linux2go.dk (unknown [95.166.159.124]) by atlas.linux2go.dk (Postfix) with ESMTP id 7A5A940A2D9 for ; Wed, 9 Dec 2009 12:07:56 +0100 (CET) Date: Wed, 9 Dec 2009 12:07:50 +0100 From: Soren Hansen Message-ID: <20091209110750.GA12885@linux2go.dk> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="x+6KMIRAuhnl3hBn" Content-Disposition: inline Subject: [Qemu-devel] [PATCH] Let mouse_button monitor command accept coordinates List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org --x+6KMIRAuhnl3hBn Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable The mouse_button monitor command currently results in a call like this: kbd_mouse_event(0, 0, 0, mouse_button_status); For a pointer in relative mode, this means a button gets pressed (or or released) and nothing else. However, if the pointer currently being controlled is in absolute mode (such as -usbtablet), it means that the pointer will warp to (0, 0), effectively limiting clicking to the top left corner of the desktop in the guest. To work around this, I propose (thanks to Daniel Berrange for the suggestion) to let the mouse_button monitor command optionally accept coordinates. Signed-off-by: Soren Hansen --- monitor.c | 16 +++++++++++++++- qemu-monitor.hx | 6 +++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/monitor.c b/monitor.c index e161f7d..8b879cc 100644 --- a/monitor.c +++ b/monitor.c @@ -1336,8 +1336,22 @@ static void do_mouse_move(Monitor *mon, const QDict = *qdict) static void do_mouse_button(Monitor *mon, const QDict *qdict) { int button_state =3D qdict_get_int(qdict, "button_state"); + int dx, dy, dz; + const char *dx_str =3D qdict_get_try_str(qdict, "dx_str"); + const char *dy_str =3D qdict_get_try_str(qdict, "dy_str"); + const char *dz_str =3D qdict_get_try_str(qdict, "dz_str"); + + dx =3D dy =3D dz =3D 0; + + if (dx_str && dy_str) { + dx =3D strtol(dx_str, NULL, 0); + dy =3D strtol(dy_str, NULL, 0); + if (dz_str) + dz =3D strtol(dz_str, NULL, 0); + } + mouse_button_state =3D button_state; - kbd_mouse_event(0, 0, 0, mouse_button_state); + kbd_mouse_event(dx, dy, dz, mouse_button_state); } =20 static void do_ioport_read(Monitor *mon, const QDict *qdict) diff --git a/qemu-monitor.hx b/qemu-monitor.hx index 2b14802..b42b461 100644 --- a/qemu-monitor.hx +++ b/qemu-monitor.hx @@ -595,9 +595,9 @@ ETEXI =20 { .name =3D "mouse_button", - .args_type =3D "button_state:i", - .params =3D "state", - .help =3D "change mouse button state (1=3DL, 2=3DM, 4=3DR)", + .args_type =3D "button_state:i,dx_str:s?,dy_str:s?,dz_str:s?", + .params =3D "state [dx dy [dz]]", + .help =3D "change mouse button state (1=3DL, 2=3DM, 4=3DR), = optionally specifying coordinates as well (useful for pointers in absolute = mode)", .mhandler.cmd =3D do_mouse_button, }, =20 --=20 1.6.5 --=20 Soren Hansen |=20 Lead virtualisation engineer | Ubuntu Server Team Canonical Ltd. | http://www.ubuntu.com/ --x+6KMIRAuhnl3hBn Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAksfhQMACgkQonjfXui9pOOTegCgrRwD1ZESaumiMZvc8OIjYa1d Br0AniCLyEdukNyBenqygZKrDNYrC/px =sRco -----END PGP SIGNATURE----- --x+6KMIRAuhnl3hBn--