From patchwork Sat May 5 07:25:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: dantmnf2@gmail.com X-Patchwork-Id: 10381997 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3454760159 for ; Sat, 5 May 2018 07:25:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0B98F2954E for ; Sat, 5 May 2018 07:25:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F0B9729593; Sat, 5 May 2018 07:25:13 +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 vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 85CE92954E for ; Sat, 5 May 2018 07:25:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750821AbeEEHZM (ORCPT ); Sat, 5 May 2018 03:25:12 -0400 Received: from mail-pg0-f66.google.com ([74.125.83.66]:35722 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750765AbeEEHZM (ORCPT ); Sat, 5 May 2018 03:25:12 -0400 Received: by mail-pg0-f66.google.com with SMTP id j11-v6so16892670pgf.2 for ; Sat, 05 May 2018 00:25:11 -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:mime-version :content-transfer-encoding:thread-index:content-language; bh=zM9ni/45RWK6iEGRs1R1KYpVUna72iwFKz8lCrJiAtg=; b=mVxl3iN6bsMn2OEJHNJtOsDotWf/fHM5+83TzfjImo6U8X1/ltsovD5BmMS56x7lJ+ mGYw2zJcqHiTOJKpCSS5axmYHwIajjI8jQGPC5/pbUwTVvUtIAmByC48IKPySh8+quGz il8RBh9KuxsACJTEYwi+3ElD8YoCpADL9gnuUh5dGn5FQSbu8uL+BTdQaArVjT2GSDd4 7ncW8LJy+iik7kHLVswukVlN3v+QxDI1UzuizS/KqMlzd6vF0we5PS9E+nXKOD6Z+bXf zbZ6Owvli+6bKy9obYoju6+0g9Nsfh2gj2aYXRXsLeefC7aG2y/RkDBJA+F96WLt1YiU m3Wg== 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:mime-version :content-transfer-encoding:thread-index:content-language; bh=zM9ni/45RWK6iEGRs1R1KYpVUna72iwFKz8lCrJiAtg=; b=c+2Kg8L79y29neCWSmmiRVHWbPONfxg+5GAVclUxdbOY0QhTMTucJ4IaqqC5gLq0fo MOOjYKe/sVoY5pVoBbSZaeI3z9MvnHy+9GxYp5KffJ2bn3kKsZ8SAIxtv1cZswzV5O12 wBy1dJQ85P8u+TryZWim01bqiW2TQHylkmWoLpKWEVOml+pubfLJBgzTKXol2Lpo8xpV 7FBho5rvg2nxlvfl2XlNFpD5Q43M1AfQOp3mngak/nNWp8lGk3Eg05SLg4hHmlPeuRrO TZYbo6yYslH0pP5nX1s0rQGR/Wg6as+44Uu2rB7tYI1dmazBckOTZ0YUIJm2TvxfHnfJ 8LQw== X-Gm-Message-State: ALQs6tBu9qYeXF7rVxmwZLATqyttbNeYDIJ1GP+WZjArD+4jhWvWqQae CHLkc29Kax6YFNi9UuSyVdY= X-Google-Smtp-Source: AB8JxZq5YlUhUYPyasNM98XecnUAC19klT6xuD+g00+w9wdxWODQIpXY/JBObxlljtbJ8h3BBadSQg== X-Received: by 2002:a17:902:31a4:: with SMTP id x33-v6mr30843911plb.355.1525505111544; Sat, 05 May 2018 00:25:11 -0700 (PDT) Received: from DANTPC2 (p-us-01.hjc.cloud. [97.64.30.123]) by smtp.gmail.com with ESMTPSA id a23sm31518676pfi.176.2018.05.05.00.25.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 05 May 2018 00:25:10 -0700 (PDT) From: To: Cc: "'Wu Bangming'" , "'VMware Graphics'" , "'VMware, Inc.'" , "'Dmitry Torokhov'" Subject: [PATCH] Input: vmmouse - report wheel events to device used by movement events Date: Sat, 5 May 2018 15:25:05 +0800 Message-ID: <2cea01d3e442$336dba80$9a492f80$@gmail.com> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: AdPkQckqKmAW+ZwuTAO+ePGx4cw6vQ== Content-Language: zh-cn Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The vmmouse driver prefers to "report button events on the same device where we report motion events", but it says "Xorg seems to ignore wheel events on absolute devices" so it always report wheel event to the relative device. Seems it is caused by a missing REL_WHEEL capability bit and has been fixed. Reporting wheel events to a device different from movement events is causing problems in applications using XInput2 (for example: GTK+ 3 and Qt 5 apps): application doesn't respond to wheel while you are moving mouse. Tested with some GTK+ 3 and Qt 5 applications. Signed-off-by: Wu Bangming --- drivers/input/mouse/vmmouse.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) pref_dev = rel_dev; @@ -194,8 +191,7 @@ static psmouse_ret_t vmmouse_report_events(struct psmouse *psmouse) input_report_abs(abs_dev, ABS_Y, y); } - /* Xorg seems to ignore wheel events on absolute devices */ - input_report_rel(rel_dev, REL_WHEEL, -(s8)((u8) z)); + input_report_rel(pref_dev, REL_WHEEL, -(s8)((u8) z)); vmmouse_report_button(psmouse, abs_dev, rel_dev, pref_dev, BTN_LEFT, @@ -462,6 +458,7 @@ int vmmouse_init(struct psmouse *psmouse) input_set_capability(abs_dev, EV_KEY, BTN_MIDDLE); input_set_capability(abs_dev, EV_ABS, ABS_X); input_set_capability(abs_dev, EV_ABS, ABS_Y); + input_set_capability(abs_dev, EV_REL, REL_WHEEL); input_set_abs_params(abs_dev, ABS_X, 0, VMMOUSE_MAX_X, 0, 0); input_set_abs_params(abs_dev, ABS_Y, 0, VMMOUSE_MAX_Y, 0, 0); diff --git a/drivers/input/mouse/vmmouse.c b/drivers/input/mouse/vmmouse.c index 1ae5c1ef..a4252447 100644 --- a/drivers/input/mouse/vmmouse.c +++ b/drivers/input/mouse/vmmouse.c @@ -180,9 +180,6 @@ static psmouse_ret_t vmmouse_report_events(struct psmouse *psmouse) /* * And report what we've got. Prefer to report button * events on the same device where we report motion events. - * This doesn't work well with the mouse wheel, though. See - * below. Ideally we would want to report that on the - * preferred device as well. */ if (status & VMMOUSE_RELATIVE_PACKET) {