Received: from eggs.gnu.org ([2001:4830:134:3::10]:33749) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uo3p9-0003NR-3p for qemu-devel@nongnu.org; Sat, 15 Jun 2013 23:40:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uo3p8-0005LG-7Q for qemu-devel@nongnu.org; Sat, 15 Jun 2013 23:40:15 -0400 Received: from cantor2.suse.de ([195.135.220.15]:44032 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uo3p7-0005L3-UM for qemu-devel@nongnu.org; Sat, 15 Jun 2013 23:40:14 -0400 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Sun, 16 Jun 2013 05:39:59 +0200 Message-Id: <1371354005-26873-3-git-send-email-afaerber@suse.de> In-Reply-To: <1371354005-26873-1-git-send-email-afaerber@suse.de> References: <1371354005-26873-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH RFC 2/8] ui/input: Simplify kbd_mouse_event() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Anthony Liguori , Brad Hards , Luiz Capitulino , Gerd Hoffmann , Paolo Bonzini , Ludwig Nussel , =?UTF-8?q?Andreas=20F=C3=A4rber?= Now that the field names are bearable, there's no compelling reason to use local variables for the fields. Unify the four callback invokations through variables for the rotated coordinates instead. Signed-off-by: Andreas F=C3=A4rber --- ui/input.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/ui/input.c b/ui/input.c index badf6c3..28353b4 100644 --- a/ui/input.c +++ b/ui/input.c @@ -431,9 +431,8 @@ void kbd_put_ledstate(int ledstate) void kbd_mouse_event(int dx, int dy, int dz, int buttons_state) { QEMUPutMouseEntry *entry; - QEMUPutMouseEvent *mouse_event; - void *mouse_event_opaque; int width, height; + int rotated_dx, rotated_dy; =20 if (!runstate_is_running() && !runstate_check(RUN_STATE_SUSPENDED)) = { return; @@ -444,10 +443,7 @@ void kbd_mouse_event(int dx, int dy, int dz, int but= tons_state) =20 entry =3D QTAILQ_FIRST(&mouse_handlers); =20 - mouse_event =3D entry->put_event; - mouse_event_opaque =3D entry->opaque; - - if (mouse_event) { + if (entry->put_event) { if (entry->absolute) { width =3D 0x7fff; height =3D 0x7fff; @@ -458,22 +454,26 @@ void kbd_mouse_event(int dx, int dy, int dz, int bu= ttons_state) =20 switch (graphic_rotate) { case 0: - mouse_event(mouse_event_opaque, - dx, dy, dz, buttons_state); + rotated_dx =3D dx; + rotated_dy =3D dy; break; case 90: - mouse_event(mouse_event_opaque, - width - dy, dx, dz, buttons_state); + rotated_dx =3D width - dy; + rotated_dy =3D dx; break; case 180: - mouse_event(mouse_event_opaque, - width - dx, height - dy, dz, buttons_state); + rotated_dx =3D width - dx; + rotated_dy =3D height - dy; break; case 270: - mouse_event(mouse_event_opaque, - dy, height - dx, dz, buttons_state); + rotated_dx =3D dy; + rotated_dy =3D height - dx; break; + default: + return; } + entry->put_event(entry->opaque, + rotated_dx, rotated_dy, dz, buttons_state); } } =20 --=20 1.8.1.4