From patchwork Wed Mar 9 09:04:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 8544181 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 1A2F29F46A for ; Wed, 9 Mar 2016 09:04:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 78C1A20251 for ; Wed, 9 Mar 2016 09:04:56 +0000 (UTC) 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.kernel.org (Postfix) with ESMTPS id C0DA52021A for ; Wed, 9 Mar 2016 09:04:55 +0000 (UTC) Received: from localhost ([::1]:40025 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ada35-0007hO-5Z for patchwork-qemu-devel@patchwork.kernel.org; Wed, 09 Mar 2016 04:04:55 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43099) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ada2u-0007h6-I6 for qemu-devel@nongnu.org; Wed, 09 Mar 2016 04:04:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ada2r-000761-8U for qemu-devel@nongnu.org; Wed, 09 Mar 2016 04:04:44 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44773) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ada2r-00075h-3c for qemu-devel@nongnu.org; Wed, 09 Mar 2016 04:04:41 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id 6BC9D486AC for ; Wed, 9 Mar 2016 09:04:40 +0000 (UTC) Received: from nilsson.home.kraxel.org (ovpn-116-31.ams2.redhat.com [10.36.116.31]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u2994dXW027961; Wed, 9 Mar 2016 04:04:40 -0500 Received: by nilsson.home.kraxel.org (Postfix, from userid 500) id 1DAEF8275E; Wed, 9 Mar 2016 10:04:39 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Wed, 9 Mar 2016 10:04:36 +0100 Message-Id: <1457514277-32408-5-git-send-email-kraxel@redhat.com> In-Reply-To: <1457514277-32408-1-git-send-email-kraxel@redhat.com> References: <1457514277-32408-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Gerd Hoffmann Subject: [Qemu-devel] [PULL 4/5] input-linux: add switch to enable auto-repeat events X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Enable with "-input-linux /dev/input/${device},repeat=on". Signed-off-by: Gerd Hoffmann Message-id: 1457087116-4379-4-git-send-email-kraxel@redhat.com --- ui/input-linux.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ui/input-linux.c b/ui/input-linux.c index ad43963..0bc0405 100644 --- a/ui/input-linux.c +++ b/ui/input-linux.c @@ -132,6 +132,7 @@ typedef struct InputLinux InputLinux; struct InputLinux { const char *evdev; int fd; + bool repeat; bool grab_request; bool grab_active; bool grab_all; @@ -188,7 +189,7 @@ static void input_linux_event_keyboard(void *opaque) switch (event.type) { case EV_KEY: - if (event.value > 1) { + if (event.value > 2 || (event.value > 1 && !il->repeat)) { /* * ignore autorepeat + unknown key events * 0 == up, 1 == down, 2 == autorepeat, other == undefined @@ -316,6 +317,7 @@ int input_linux_init(void *opaque, QemuOpts *opts, Error **errp) il->evdev = qemu_opt_get(opts, "evdev"); il->grab_all = qemu_opt_get_bool(opts, "grab-all", false); + il->repeat = qemu_opt_get_bool(opts, "repeat", false); if (!il->evdev) { error_setg(errp, "no input device specified"); @@ -374,6 +376,9 @@ static QemuOptsList qemu_input_linux_opts = { },{ .name = "grab-all", .type = QEMU_OPT_BOOL, + },{ + .name = "repeat", + .type = QEMU_OPT_BOOL, }, { /* end of list */ } },