From patchwork Sun Aug 19 04:35:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Programmingkid X-Patchwork-Id: 10569663 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CF520139B for ; Sun, 19 Aug 2018 04:36:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AA2F729675 for ; Sun, 19 Aug 2018 04:36:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9991929B79; Sun, 19 Aug 2018 04:36:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0CB5429675 for ; Sun, 19 Aug 2018 04:36:22 +0000 (UTC) Received: from localhost ([::1]:41556 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1frFRs-00056X-90 for patchwork-qemu-devel@patchwork.kernel.org; Sun, 19 Aug 2018 00:36:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48454) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1frFR5-0004lw-DT for qemu-devel@nongnu.org; Sun, 19 Aug 2018 00:35:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1frFR0-0005Tu-Da for qemu-devel@nongnu.org; Sun, 19 Aug 2018 00:35:31 -0400 Received: from mail-it0-x243.google.com ([2607:f8b0:4001:c0b::243]:35410) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1frFR0-0005Tf-8t for qemu-devel@nongnu.org; Sun, 19 Aug 2018 00:35:26 -0400 Received: by mail-it0-x243.google.com with SMTP id 139-v6so16588005itf.0 for ; Sat, 18 Aug 2018 21:35:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=S7/4KxVQYYZngBy5c0RcTHZZ2EPavyiN/54SRmZVDZ4=; b=YQT92QsGMGd9zc3qKUzxJmLyQdQgIDkJXYvXrQXyHCWR9du2/aZMJ5Tdw6unXZEgeQ GA1RsWgNRzCkriRwuSvco7Ia/EXVSZcw6GQ3C927L+D89koMZ2+nFwWgDkVHcSqxlfpQ AajKFaoSrB91+dhr09ZRo7YTGgcZ0pjyn6NFWh3yrlop5LnwM9ZQOnLrYdBOopsgoGm/ 0KXo9sETzMwL/Bc+M47oF4Ko4tLG4VCUiO6GV6hiii5UwFKI2CjghIQ6wHfKQ/sPQBbt hQt9wYIm3pN2W/pIxVNxx6knyFiSeyr2SrG6Gfid7nX59xiGCBR9T4OnaC/C7D/eYwHk rJ9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=S7/4KxVQYYZngBy5c0RcTHZZ2EPavyiN/54SRmZVDZ4=; b=tapNg+2eXxTZeL+hOxi0jlSUzxn/7KcLY/TFmx6Dy4KPioQyHVFZadOdy9y6yJB3DF qRaSquywEd2q9Y6vIrwUch410rW1aMlgFa+sAjzw/LETC48QALpGojU351lzNE9X3MMZ sL6/+3ENePP/WNo+IW7ftd0I76GRX104Kj7ePL3G89KJCqQDCXHlpTG0VquHBJ4Nhj4f mj6vPTaIp/gDVUGEZL34sd7KFbtz7gRG9ZPBgmYOGnEh63L73dB4cMND68G31CZcJERn NdGTTcjoA0b66oSjgiqO03foOa9bowLj+af96E2Jls03bj85z2fjNuLlmRXXBu3/Q2lu KSoQ== X-Gm-Message-State: AOUpUlG7PE1sZqNzWDA0Myns8NPmnslkAt/daAurq4nSODr935ldZXuS OUJbj2YazREY3PTfyHxmlL4= X-Google-Smtp-Source: AA+uWPzdFNFqQ8qdYWrHklfNwZWboav80lKhRMHCCXfCFByLvwu3KI65M2Pl2cyakh9FzardpptJtA== X-Received: by 2002:a24:f545:: with SMTP id k66-v6mr9084293ith.138.1534653325730; Sat, 18 Aug 2018 21:35:25 -0700 (PDT) Received: from localhost.localdomain ([69.14.184.20]) by smtp.gmail.com with ESMTPSA id r201-v6sm4166388itb.24.2018.08.18.21.35.24 (version=TLS1 cipher=AES128-SHA bits=128/128); Sat, 18 Aug 2018 21:35:24 -0700 (PDT) From: John Arbuckle To: pbonzini@redhat.com, rth@twiddle.net, ehabkost@redhat.com, kraxel@redhat.com, qemu-devel@nongnu.org Date: Sun, 19 Aug 2018 00:35:09 -0400 Message-Id: <20180819043509.12888-1-programmingkidx@gmail.com> X-Mailer: git-send-email 2.14.3 (Apple Git-98) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4001:c0b::243 Subject: [Qemu-devel] [PATCH] hw/input/ps2.c: fix erratic mouse behavior for Windows 3.1 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: John Arbuckle Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP When the user moves the mouse and moves the scroll wheel at the same time, the mouse cursor's movement becomes erratic in Windows 3.1. With this patch if the mouse is in ps/2 mode and the scroll wheel is used, the command queue is reset. This does not fix the erratic mouse problem in Windows NT 4.0. Signed-off-by: John Arbuckle --- hw/input/ps2.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/hw/input/ps2.c b/hw/input/ps2.c index fdfcadf9a1..bb9ebfa5a9 100644 --- a/hw/input/ps2.c +++ b/hw/input/ps2.c @@ -685,8 +685,17 @@ static int ps2_mouse_send_packet(PS2MouseState *s) /* update deltas */ s->mouse_dx -= dx1; s->mouse_dy -= dy1; - s->mouse_dz -= dz1; + /* + * This prevents the mouse from going crazy in Windows that doesn't support + * the Microsoft Intellimouse standard. + */ + if (s->mouse_type == 0 && s->mouse_dz != 0) { + s->mouse_dz = 0; + ps2_reset_queue(&s->common); + return 1; + } + s->mouse_dz -= dz1; return 1; }