From nobody Wed Apr 24 19:39:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1685100510; cv=none; d=zohomail.com; s=zohoarc; b=OeRx8rpADUFm2gCO7o3+7x61GQh/6X+IJkbWTDwQvZAlKenI/JDc1o7RNuI6+drfRO2WmUfWVrWC1JmiiXxJG+/80HcLDWf6XRlRo30NS4N6KyExCHsZZwvXXLzdrKNtRmcWnQXas1MKa/iiX/CduIGW5r0HNfKKIEg41/tmxOo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685100510; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=YmJGY41XqyCGRPeTDO3+MBEiUMQeBjAmMfYNNBfiDjs=; b=dLpzeYSxWrpASBXi4Lk+kSJ76AGcXE0Q4yP6R4bCIhke/VURuc+XV5j7L1cpADhOVeuI3EOiZzRyCwOXgIP+FUaxEWIyvW+4mJkU9KjoRg9mdsQyW+yZ4Jc7gj8ktRRvM/SozYdzIKfZQf+VCxThy1b/l3cUh4AiGBfqsJXy5WU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1685100510197759.6161773843226; Fri, 26 May 2023 04:28:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q2VcE-0004XJ-3k; Fri, 26 May 2023 07:28:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q2VcB-0004Qs-OM for qemu-devel@nongnu.org; Fri, 26 May 2023 07:28:11 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q2VcA-0003Su-5l for qemu-devel@nongnu.org; Fri, 26 May 2023 07:28:11 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-96-eOU4Hxu7NAyD80VmRcI4xA-1; Fri, 26 May 2023 07:28:07 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 77CA3800159; Fri, 26 May 2023 11:28:07 +0000 (UTC) Received: from toolbox.redhat.com (unknown [10.39.194.90]) by smtp.corp.redhat.com (Postfix) with ESMTP id C4EDB140E95D; Fri, 26 May 2023 11:28:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685100489; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YmJGY41XqyCGRPeTDO3+MBEiUMQeBjAmMfYNNBfiDjs=; b=SLGngGVmt+X0NEdr0HvQLk5oJQ79ybSgD5YQqxpn1UpMfRorEOG1ihW77S76hMJwQZd4K1 4IWzCION4Kg+ZL7lx6ygwa3g3FE7r7YAReM0YCZTeQ13IrGsEvYyEw4Q/COroF891zd0j/ E/Zoud/MBs8HxKhtVmkhJFj541tIcKg= X-MC-Unique: eOU4Hxu7NAyD80VmRcI4xA-1 From: Sergio Lopez To: qemu-devel@nongnu.org Cc: Eric Blake , Pavel Dovgalyuk , "Michael S. Tsirkin" , Markus Armbruster , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Gerd Hoffmann , Sergio Lopez Subject: [PATCH v5 1/6] virtio-input: generalize virtio_input_key_config() Date: Fri, 26 May 2023 13:29:20 +0200 Message-Id: <20230526112925.38794-2-slp@redhat.com> In-Reply-To: <20230526112925.38794-1-slp@redhat.com> References: <20230526112925.38794-1-slp@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=slp@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1685100511707100001 As there are other bitmap-based config properties that need to be dealt in a similar fashion as VIRTIO_INPUT_CFG_EV_BITS, generalize the function to receive select and subsel as arguments, and rename it to virtio_input_extend_config() Signed-off-by: Sergio Lopez Reviewed-by: Marc-Andr=C3=A9 Lureau --- hw/input/virtio-input-hid.c | 38 ++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/hw/input/virtio-input-hid.c b/hw/input/virtio-input-hid.c index a7a244a95d..d28dab69ba 100644 --- a/hw/input/virtio-input-hid.c +++ b/hw/input/virtio-input-hid.c @@ -44,30 +44,31 @@ static const unsigned short axismap_abs[INPUT_AXIS__MAX= ] =3D { =20 /* ----------------------------------------------------------------- */ =20 -static void virtio_input_key_config(VirtIOInput *vinput, - const unsigned short *keymap, - size_t mapsize) +static void virtio_input_extend_config(VirtIOInput *vinput, + const unsigned short *map, + size_t mapsize, + uint8_t select, uint8_t subsel) { - virtio_input_config keys; + virtio_input_config ext; int i, bit, byte, bmax =3D 0; =20 - memset(&keys, 0, sizeof(keys)); + memset(&ext, 0, sizeof(ext)); for (i =3D 0; i < mapsize; i++) { - bit =3D keymap[i]; + bit =3D map[i]; if (!bit) { continue; } byte =3D bit / 8; bit =3D bit % 8; - keys.u.bitmap[byte] |=3D (1 << bit); + ext.u.bitmap[byte] |=3D (1 << bit); if (bmax < byte+1) { bmax =3D byte+1; } } - keys.select =3D VIRTIO_INPUT_CFG_EV_BITS; - keys.subsel =3D EV_KEY; - keys.size =3D bmax; - virtio_input_add_config(vinput, &keys); + ext.select =3D select; + ext.subsel =3D subsel; + ext.size =3D bmax; + virtio_input_add_config(vinput, &ext); } =20 static void virtio_input_handle_event(DeviceState *dev, QemuConsole *src, @@ -281,8 +282,9 @@ static void virtio_keyboard_init(Object *obj) =20 vhid->handler =3D &virtio_keyboard_handler; virtio_input_init_config(vinput, virtio_keyboard_config); - virtio_input_key_config(vinput, qemu_input_map_qcode_to_linux, - qemu_input_map_qcode_to_linux_len); + virtio_input_extend_config(vinput, qemu_input_map_qcode_to_linux, + qemu_input_map_qcode_to_linux_len, + VIRTIO_INPUT_CFG_EV_BITS, EV_KEY); } =20 static const TypeInfo virtio_keyboard_info =3D { @@ -373,8 +375,9 @@ static void virtio_mouse_init(Object *obj) virtio_input_init_config(vinput, vhid->wheel_axis ? virtio_mouse_config_v2 : virtio_mouse_config_v1); - virtio_input_key_config(vinput, keymap_button, - ARRAY_SIZE(keymap_button)); + virtio_input_extend_config(vinput, keymap_button, + ARRAY_SIZE(keymap_button), + VIRTIO_INPUT_CFG_EV_BITS, EV_KEY); } =20 static const TypeInfo virtio_mouse_info =3D { @@ -497,8 +500,9 @@ static void virtio_tablet_init(Object *obj) virtio_input_init_config(vinput, vhid->wheel_axis ? virtio_tablet_config_v2 : virtio_tablet_config_v1); - virtio_input_key_config(vinput, keymap_button, - ARRAY_SIZE(keymap_button)); + virtio_input_extend_config(vinput, keymap_button, + ARRAY_SIZE(keymap_button), + VIRTIO_INPUT_CFG_EV_BITS, EV_KEY); } =20 static const TypeInfo virtio_tablet_info =3D { --=20 2.38.1 From nobody Wed Apr 24 19:39:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1685100598; cv=none; d=zohomail.com; s=zohoarc; b=M1Feeh2xjLEEndQfEzgGHoonT6xdKXmoSjEzQ2BHd6Aqh5uBA6Q/G2Vv+02bvCMhBIhLdb5sIhSDT1XLQXkqoQrAw2eGhdlJUXlWY158JnPQGgoktXkifgoPTo85dQ5mUbRve9jlrn63gIVFgyPo0qnhXcjFAnXcg/GRj/jbnig= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685100598; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=1JP/x2pPQ9XCBWOW3Ufbta0dmUENE7YjcjGS9K551pM=; b=nPoFMiZJljU+l3qeOWs1CGB8bimw1HTUahdq8xxUdwKxoZrowFTe+T2o+yHzszoOydlii3PhlRV1DIInnUUPjnbMt1oIw/2qI9fNfI/Z/aZYKusflbnqtDc/LaY3iS+zl7kHubtDguAfsb+REYorQWQ1O281goxB029SHASOS4U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16851005980608.999377583853061; Fri, 26 May 2023 04:29:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q2VcK-0004bD-90; Fri, 26 May 2023 07:28:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q2VcF-0004ZP-QV for qemu-devel@nongnu.org; Fri, 26 May 2023 07:28:15 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q2VcD-0003Ut-SS for qemu-devel@nongnu.org; Fri, 26 May 2023 07:28:15 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-619-WQrbt7WmNxCx4Y3JPQyGHg-1; Fri, 26 May 2023 07:28:09 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 723B1811E7F; Fri, 26 May 2023 11:28:09 +0000 (UTC) Received: from toolbox.redhat.com (unknown [10.39.194.90]) by smtp.corp.redhat.com (Postfix) with ESMTP id BF3B6140E95D; Fri, 26 May 2023 11:28:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685100493; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1JP/x2pPQ9XCBWOW3Ufbta0dmUENE7YjcjGS9K551pM=; b=YLCb8LhEfc3fiJy5caUmp8gZ80d+Bv00v6geKXieDDZOgQwxvNFwENRx5ebGUAu5XPyAdv 7ohB1BAiJLS2RzS3wA1XVn4t7oWWEmzU229kbMXJAZ+zo4xQABTq/sTvFHc7CHp7pTt79F bx22L0VRZI8kj7+Fkab0lo3qaduHE10= X-MC-Unique: WQrbt7WmNxCx4Y3JPQyGHg-1 From: Sergio Lopez To: qemu-devel@nongnu.org Cc: Eric Blake , Pavel Dovgalyuk , "Michael S. Tsirkin" , Markus Armbruster , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Gerd Hoffmann , Sergio Lopez Subject: [PATCH v5 2/6] ui: add the infrastructure to support MT events Date: Fri, 26 May 2023 13:29:21 +0200 Message-Id: <20230526112925.38794-3-slp@redhat.com> In-Reply-To: <20230526112925.38794-1-slp@redhat.com> References: <20230526112925.38794-1-slp@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=slp@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1685100599401100007 Add the required infrastructure to support generating multitouch events. Signed-off-by: Sergio Lopez Reviewed-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Markus Armbruster --- include/ui/input.h | 3 ++ qapi/ui.json | 68 +++++++++++++++++++++++++++++++++++++------ replay/replay-input.c | 18 ++++++++++++ ui/input.c | 6 ++++ ui/trace-events | 1 + 5 files changed, 87 insertions(+), 9 deletions(-) diff --git a/include/ui/input.h b/include/ui/input.h index c86219a1c1..2a3dffd417 100644 --- a/include/ui/input.h +++ b/include/ui/input.h @@ -8,9 +8,12 @@ #define INPUT_EVENT_MASK_BTN (1<type); =20 switch (evt->type) { @@ -58,6 +59,14 @@ void replay_save_input_event(InputEvent *evt) replay_put_dword(move->axis); replay_put_qword(move->value); break; + case INPUT_EVENT_KIND_MTT: + mtt =3D evt->u.mtt.data; + replay_put_dword(mtt->type); + replay_put_qword(mtt->slot); + replay_put_qword(mtt->tracking_id); + replay_put_dword(mtt->axis); + replay_put_qword(mtt->value); + break; case INPUT_EVENT_KIND__MAX: /* keep gcc happy */ break; @@ -73,6 +82,7 @@ InputEvent *replay_read_input_event(void) InputBtnEvent btn; InputMoveEvent rel; InputMoveEvent abs; + InputMultiTouchEvent mtt; =20 evt.type =3D replay_get_dword(); switch (evt.type) { @@ -109,6 +119,14 @@ InputEvent *replay_read_input_event(void) evt.u.abs.data->axis =3D (InputAxis)replay_get_dword(); evt.u.abs.data->value =3D replay_get_qword(); break; + case INPUT_EVENT_KIND_MTT: + evt.u.mtt.data =3D &mtt; + evt.u.mtt.data->type =3D (InputMultiTouchType)replay_get_dword(); + evt.u.mtt.data->slot =3D replay_get_qword(); + evt.u.mtt.data->tracking_id =3D replay_get_qword(); + evt.u.mtt.data->axis =3D (InputAxis)replay_get_dword(); + evt.u.mtt.data->value =3D replay_get_qword(); + break; case INPUT_EVENT_KIND__MAX: /* keep gcc happy */ break; diff --git a/ui/input.c b/ui/input.c index f2d1e7a3a7..fc75f1353c 100644 --- a/ui/input.c +++ b/ui/input.c @@ -212,6 +212,7 @@ static void qemu_input_event_trace(QemuConsole *src, In= putEvent *evt) InputKeyEvent *key; InputBtnEvent *btn; InputMoveEvent *move; + InputMultiTouchEvent *mtt; =20 if (src) { idx =3D qemu_console_get_index(src); @@ -250,6 +251,11 @@ static void qemu_input_event_trace(QemuConsole *src, I= nputEvent *evt) name =3D InputAxis_str(move->axis); trace_input_event_abs(idx, name, move->value); break; + case INPUT_EVENT_KIND_MTT: + mtt =3D evt->u.mtt.data; + name =3D InputAxis_str(mtt->axis); + trace_input_event_mtt(idx, name, mtt->value); + break; case INPUT_EVENT_KIND__MAX: /* keep gcc happy */ break; diff --git a/ui/trace-events b/ui/trace-events index 977577fbba..6747361745 100644 --- a/ui/trace-events +++ b/ui/trace-events @@ -90,6 +90,7 @@ input_event_key_qcode(int conidx, const char *qcode, bool= down) "con %d, key qco input_event_btn(int conidx, const char *btn, bool down) "con %d, button %s= , down %d" input_event_rel(int conidx, const char *axis, int value) "con %d, axis %s,= value %d" input_event_abs(int conidx, const char *axis, int value) "con %d, axis %s,= value 0x%x" +input_event_mtt(int conidx, const char *axis, int value) "con %d, axis %s,= value 0x%x" input_event_sync(void) "" input_mouse_mode(int absolute) "absolute %d" =20 --=20 2.38.1 From nobody Wed Apr 24 19:39:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1685100533; cv=none; d=zohomail.com; s=zohoarc; b=gWFupUbpMArYgXv22r27F79QCIolKf4pYDzS33LQmqSLTYetlIOgDLBbfx/Df+Ci/sXat5sS6CvX9lsHnWnt2FQW3tNDtQ/arLbQf/FGganvoMAXKotcibt9Txh9K+8WyNvJiLxCGgZiNcUJnM0RxXjnitd5u7dkX3fWVxI+B3E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685100533; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=QDsNHlioR2H4jjrLp3qswH/BlBa76rIX84DZvBPUH6Y=; b=IKqxE6wF0/EWJnAbdqSx5pNuVIyKVnCKRvclgJQHXzC6fNS1cqtU+HIzW8VH0xXDcD6+NIKhoPDlpzPEvNI5TdI4D5HZ1NtPWy91Qr1axUB5xSGwecJLt/FBebzbZao4pQ4xMlk1jsymG3HWFq/3OWwLwSlDwaPrHIKRhlQSW2w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1685100533840594.1677166746532; Fri, 26 May 2023 04:28:53 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q2VcM-0004gK-KQ; Fri, 26 May 2023 07:28:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q2VcK-0004eM-EZ for qemu-devel@nongnu.org; Fri, 26 May 2023 07:28:20 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q2VcF-0003V9-Jy for qemu-devel@nongnu.org; Fri, 26 May 2023 07:28:17 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-561-QocyjRs6NfC4yU0NBZLMSQ-1; Fri, 26 May 2023 07:28:11 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 681CF1C060C3; Fri, 26 May 2023 11:28:11 +0000 (UTC) Received: from toolbox.redhat.com (unknown [10.39.194.90]) by smtp.corp.redhat.com (Postfix) with ESMTP id B6F04140E95D; Fri, 26 May 2023 11:28:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685100495; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QDsNHlioR2H4jjrLp3qswH/BlBa76rIX84DZvBPUH6Y=; b=FP6n1iGKXnB7MJAouLbJrAGvTbhO5YwlK1PwH6NVrU3gcucFmdWGFvSZn9u5r4zdZtF7k6 nPfSotkS9679ZGSFcreY0GMY/Awn2UrJpm0CFUFgrwihgMYyiW6/Yrqwpy6xd7jmBEv54f baK2IGQwe396iaHzDWvp982nFbT/4WQ= X-MC-Unique: QocyjRs6NfC4yU0NBZLMSQ-1 From: Sergio Lopez To: qemu-devel@nongnu.org Cc: Eric Blake , Pavel Dovgalyuk , "Michael S. Tsirkin" , Markus Armbruster , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Gerd Hoffmann , Sergio Lopez Subject: [PATCH v5 3/6] virtio-input: add a virtio-mulitouch device Date: Fri, 26 May 2023 13:29:22 +0200 Message-Id: <20230526112925.38794-4-slp@redhat.com> In-Reply-To: <20230526112925.38794-1-slp@redhat.com> References: <20230526112925.38794-1-slp@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=slp@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1685100535090100007 Add a virtio-multitouch device to the family of devices emulated by virtio-input implementing the Multi-touch protocol as descripted here: https://www.kernel.org/doc/html/latest/input/multi-touch-protocol.html?high= light=3Dmulti+touch This patch just add the device itself, without connecting it to any backends. The following patches will add a PCI-based multitouch device, some helpers in "ui" and will enable the GTK3 backend to transpose multi-touch events from the host to the guest. Signed-off-by: Sergio Lopez Reviewed-by: Marc-Andr=C3=A9 Lureau --- hw/input/virtio-input-hid.c | 118 ++++++++++++++++++++++++++++++- include/hw/virtio/virtio-input.h | 9 +-- 2 files changed, 120 insertions(+), 7 deletions(-) diff --git a/hw/input/virtio-input-hid.c b/hw/input/virtio-input-hid.c index d28dab69ba..7053ad72d4 100644 --- a/hw/input/virtio-input-hid.c +++ b/hw/input/virtio-input-hid.c @@ -16,9 +16,10 @@ =20 #include "standard-headers/linux/input.h" =20 -#define VIRTIO_ID_NAME_KEYBOARD "QEMU Virtio Keyboard" -#define VIRTIO_ID_NAME_MOUSE "QEMU Virtio Mouse" -#define VIRTIO_ID_NAME_TABLET "QEMU Virtio Tablet" +#define VIRTIO_ID_NAME_KEYBOARD "QEMU Virtio Keyboard" +#define VIRTIO_ID_NAME_MOUSE "QEMU Virtio Mouse" +#define VIRTIO_ID_NAME_TABLET "QEMU Virtio Tablet" +#define VIRTIO_ID_NAME_MULTITOUCH "QEMU Virtio MultiTouch" =20 /* ----------------------------------------------------------------- */ =20 @@ -30,6 +31,7 @@ static const unsigned short keymap_button[INPUT_BUTTON__M= AX] =3D { [INPUT_BUTTON_WHEEL_DOWN] =3D BTN_GEAR_DOWN, [INPUT_BUTTON_SIDE] =3D BTN_SIDE, [INPUT_BUTTON_EXTRA] =3D BTN_EXTRA, + [INPUT_BUTTON_TOUCH] =3D BTN_TOUCH, }; =20 static const unsigned short axismap_rel[INPUT_AXIS__MAX] =3D { @@ -42,6 +44,11 @@ static const unsigned short axismap_abs[INPUT_AXIS__MAX]= =3D { [INPUT_AXIS_Y] =3D ABS_Y, }; =20 +static const unsigned short axismap_tch[INPUT_AXIS__MAX] =3D { + [INPUT_AXIS_X] =3D ABS_MT_POSITION_X, + [INPUT_AXIS_Y] =3D ABS_MT_POSITION_Y, +}; + /* ----------------------------------------------------------------- */ =20 static void virtio_input_extend_config(VirtIOInput *vinput, @@ -81,6 +88,7 @@ static void virtio_input_handle_event(DeviceState *dev, Q= emuConsole *src, InputKeyEvent *key; InputMoveEvent *move; InputBtnEvent *btn; + InputMultiTouchEvent *mtt; =20 switch (evt->type) { case INPUT_EVENT_KIND_KEY: @@ -137,6 +145,24 @@ static void virtio_input_handle_event(DeviceState *dev= , QemuConsole *src, event.value =3D cpu_to_le32(move->value); virtio_input_send(vinput, &event); break; + case INPUT_EVENT_KIND_MTT: + mtt =3D evt->u.mtt.data; + if (mtt->type =3D=3D INPUT_MULTI_TOUCH_TYPE_DATA) { + event.type =3D cpu_to_le16(EV_ABS); + event.code =3D cpu_to_le16(axismap_tch[mtt->axis]); + event.value =3D cpu_to_le32(mtt->value); + virtio_input_send(vinput, &event); + } else { + event.type =3D cpu_to_le16(EV_ABS); + event.code =3D cpu_to_le16(ABS_MT_SLOT); + event.value =3D cpu_to_le32(mtt->slot); + virtio_input_send(vinput, &event); + event.type =3D cpu_to_le16(EV_ABS); + event.code =3D cpu_to_le16(ABS_MT_TRACKING_ID); + event.value =3D cpu_to_le32(mtt->tracking_id); + virtio_input_send(vinput, &event); + } + break; default: /* keep gcc happy */ break; @@ -515,12 +541,98 @@ static const TypeInfo virtio_tablet_info =3D { =20 /* ----------------------------------------------------------------- */ =20 +static QemuInputHandler virtio_multitouch_handler =3D { + .name =3D VIRTIO_ID_NAME_MULTITOUCH, + .mask =3D INPUT_EVENT_MASK_BTN | INPUT_EVENT_MASK_MTT, + .event =3D virtio_input_handle_event, + .sync =3D virtio_input_handle_sync, +}; + +static struct virtio_input_config virtio_multitouch_config[] =3D { + { + .select =3D VIRTIO_INPUT_CFG_ID_NAME, + .size =3D sizeof(VIRTIO_ID_NAME_MULTITOUCH), + .u.string =3D VIRTIO_ID_NAME_MULTITOUCH, + },{ + .select =3D VIRTIO_INPUT_CFG_ID_DEVIDS, + .size =3D sizeof(struct virtio_input_devids), + .u.ids =3D { + .bustype =3D const_le16(BUS_VIRTUAL), + .vendor =3D const_le16(0x0627), /* same we use for usb hid de= vices */ + .product =3D const_le16(0x0003), + .version =3D const_le16(0x0001), + }, + },{ + .select =3D VIRTIO_INPUT_CFG_ABS_INFO, + .subsel =3D ABS_MT_SLOT, + .size =3D sizeof(virtio_input_absinfo), + .u.abs.min =3D const_le32(INPUT_EVENT_SLOTS_MIN), + .u.abs.max =3D const_le32(INPUT_EVENT_SLOTS_MAX), + },{ + .select =3D VIRTIO_INPUT_CFG_ABS_INFO, + .subsel =3D ABS_MT_TRACKING_ID, + .size =3D sizeof(virtio_input_absinfo), + .u.abs.min =3D const_le32(INPUT_EVENT_SLOTS_MIN), + .u.abs.max =3D const_le32(INPUT_EVENT_SLOTS_MAX), + },{ + .select =3D VIRTIO_INPUT_CFG_ABS_INFO, + .subsel =3D ABS_MT_POSITION_X, + .size =3D sizeof(virtio_input_absinfo), + .u.abs.min =3D const_le32(INPUT_EVENT_ABS_MIN), + .u.abs.max =3D const_le32(INPUT_EVENT_ABS_MAX), + },{ + .select =3D VIRTIO_INPUT_CFG_ABS_INFO, + .subsel =3D ABS_MT_POSITION_Y, + .size =3D sizeof(virtio_input_absinfo), + .u.abs.min =3D const_le32(INPUT_EVENT_ABS_MIN), + .u.abs.max =3D const_le32(INPUT_EVENT_ABS_MAX), + }, + { /* end of list */ }, +}; + +static void virtio_multitouch_init(Object *obj) +{ + VirtIOInputHID *vhid =3D VIRTIO_INPUT_HID(obj); + VirtIOInput *vinput =3D VIRTIO_INPUT(obj); + unsigned short abs_props[] =3D { + INPUT_PROP_DIRECT, + }; + unsigned short abs_bits[] =3D { + ABS_MT_SLOT, + ABS_MT_TRACKING_ID, + ABS_MT_POSITION_X, + ABS_MT_POSITION_Y, + }; + + vhid->handler =3D &virtio_multitouch_handler; + virtio_input_init_config(vinput, virtio_multitouch_config); + virtio_input_extend_config(vinput, keymap_button, + ARRAY_SIZE(keymap_button), + VIRTIO_INPUT_CFG_EV_BITS, EV_KEY); + virtio_input_extend_config(vinput, abs_props, + ARRAY_SIZE(abs_props), + VIRTIO_INPUT_CFG_PROP_BITS, 0); + virtio_input_extend_config(vinput, abs_bits, + ARRAY_SIZE(abs_bits), + VIRTIO_INPUT_CFG_EV_BITS, EV_ABS); +} + +static const TypeInfo virtio_multitouch_info =3D { + .name =3D TYPE_VIRTIO_MULTITOUCH, + .parent =3D TYPE_VIRTIO_INPUT_HID, + .instance_size =3D sizeof(VirtIOInputHID), + .instance_init =3D virtio_multitouch_init, +}; + +/* ----------------------------------------------------------------- */ + static void virtio_register_types(void) { type_register_static(&virtio_input_hid_info); type_register_static(&virtio_keyboard_info); type_register_static(&virtio_mouse_info); type_register_static(&virtio_tablet_info); + type_register_static(&virtio_multitouch_info); } =20 type_init(virtio_register_types) diff --git a/include/hw/virtio/virtio-input.h b/include/hw/virtio/virtio-in= put.h index f2da63d309..08f1591424 100644 --- a/include/hw/virtio/virtio-input.h +++ b/include/hw/virtio/virtio-input.h @@ -24,10 +24,11 @@ OBJECT_DECLARE_TYPE(VirtIOInput, VirtIOInputClass, #define VIRTIO_INPUT_GET_PARENT_CLASS(obj) \ OBJECT_GET_PARENT_CLASS(obj, TYPE_VIRTIO_INPUT) =20 -#define TYPE_VIRTIO_INPUT_HID "virtio-input-hid-device" -#define TYPE_VIRTIO_KEYBOARD "virtio-keyboard-device" -#define TYPE_VIRTIO_MOUSE "virtio-mouse-device" -#define TYPE_VIRTIO_TABLET "virtio-tablet-device" +#define TYPE_VIRTIO_INPUT_HID "virtio-input-hid-device" +#define TYPE_VIRTIO_KEYBOARD "virtio-keyboard-device" +#define TYPE_VIRTIO_MOUSE "virtio-mouse-device" +#define TYPE_VIRTIO_TABLET "virtio-tablet-device" +#define TYPE_VIRTIO_MULTITOUCH "virtio-multitouch-device" =20 OBJECT_DECLARE_SIMPLE_TYPE(VirtIOInputHID, VIRTIO_INPUT_HID) #define VIRTIO_INPUT_HID_GET_PARENT_CLASS(obj) \ --=20 2.38.1 From nobody Wed Apr 24 19:39:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1685100541; cv=none; d=zohomail.com; s=zohoarc; b=W21yLBV8pE1x6C4b/2tcp+wnDpKf9OtVdgDWjgqhFCeEy3ZnA+e9lTfl41KOkhyNBAA8/LDF1ZLyIShnGd41qtp4C8CrW5nM/3MH608Wf87JTZtx2AViKqWYHDrpkUdryLO4Nw5+2QtsDiJ88YxM+30DScSoYR1mJ8xePhbgtSY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685100541; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=l1ceSGMmVTCFXDalws1nD4Q50MJp08HLNddO0ApxUlc=; b=R0WVarUPRZYo+HdeM+ajl6v9EsogAAVq530ssXN51btW0SB5Z1EBU3TS19pKXu0wGFOume8XFRMg1INdtQOIWi62z3CsvgX37gw7sEox3ynDw4M8XPOSzdzjz+y3nnUXE51vyZo6Ddes9yrwlZC5bAskC8t/WeUmqC1u4MnsFjk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1685100541680229.0202809074642; Fri, 26 May 2023 04:29:01 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q2VcS-0004oL-8K; Fri, 26 May 2023 07:28:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q2VcL-0004g4-WE for qemu-devel@nongnu.org; Fri, 26 May 2023 07:28:22 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q2VcK-0003Vs-7y for qemu-devel@nongnu.org; Fri, 26 May 2023 07:28:21 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-78-SjSeN5duPQa9Pw5pIQfoxg-1; Fri, 26 May 2023 07:28:13 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5FBF985A5BB; Fri, 26 May 2023 11:28:13 +0000 (UTC) Received: from toolbox.redhat.com (unknown [10.39.194.90]) by smtp.corp.redhat.com (Postfix) with ESMTP id ACAF3140E95D; Fri, 26 May 2023 11:28:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685100496; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=l1ceSGMmVTCFXDalws1nD4Q50MJp08HLNddO0ApxUlc=; b=L1DvkZ7RWvzh1ylWVo0oXhuN2hqP1myLDCyjTnw3JcBiBvR/dbtsTkscsxGj+bK3GM8uRb WYIRKP4fOgqoNxs9hro4YeXEXRe99TsgMszYTp80sSVKlyaENRxOl30OFNm2oynlSA/uRI LdD6HFPXaLzZ8/HjOIYPhL4piducRB8= X-MC-Unique: SjSeN5duPQa9Pw5pIQfoxg-1 From: Sergio Lopez To: qemu-devel@nongnu.org Cc: Eric Blake , Pavel Dovgalyuk , "Michael S. Tsirkin" , Markus Armbruster , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Gerd Hoffmann , Sergio Lopez Subject: [PATCH v5 4/6] virtio-input-pci: add virtio-multitouch-pci Date: Fri, 26 May 2023 13:29:23 +0200 Message-Id: <20230526112925.38794-5-slp@redhat.com> In-Reply-To: <20230526112925.38794-1-slp@redhat.com> References: <20230526112925.38794-1-slp@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=slp@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1685100543106100001 Add virtio-multitouch-pci, a Multitouch-capable input device, to the list of devices that can be provided by virtio-input-pci. Signed-off-by: Sergio Lopez Reviewed-by: Marc-Andr=C3=A9 Lureau --- hw/virtio/virtio-input-pci.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/hw/virtio/virtio-input-pci.c b/hw/virtio/virtio-input-pci.c index a9d0992389..a53edf46c4 100644 --- a/hw/virtio/virtio-input-pci.c +++ b/hw/virtio/virtio-input-pci.c @@ -25,10 +25,11 @@ struct VirtIOInputPCI { VirtIOInput vdev; }; =20 -#define TYPE_VIRTIO_INPUT_HID_PCI "virtio-input-hid-pci" -#define TYPE_VIRTIO_KEYBOARD_PCI "virtio-keyboard-pci" -#define TYPE_VIRTIO_MOUSE_PCI "virtio-mouse-pci" -#define TYPE_VIRTIO_TABLET_PCI "virtio-tablet-pci" +#define TYPE_VIRTIO_INPUT_HID_PCI "virtio-input-hid-pci" +#define TYPE_VIRTIO_KEYBOARD_PCI "virtio-keyboard-pci" +#define TYPE_VIRTIO_MOUSE_PCI "virtio-mouse-pci" +#define TYPE_VIRTIO_TABLET_PCI "virtio-tablet-pci" +#define TYPE_VIRTIO_MULTITOUCH_PCI "virtio-multitouch-pci" OBJECT_DECLARE_SIMPLE_TYPE(VirtIOInputHIDPCI, VIRTIO_INPUT_HID_PCI) =20 struct VirtIOInputHIDPCI { @@ -102,6 +103,14 @@ static void virtio_tablet_initfn(Object *obj) TYPE_VIRTIO_TABLET); } =20 +static void virtio_multitouch_initfn(Object *obj) +{ + VirtIOInputHIDPCI *dev =3D VIRTIO_INPUT_HID_PCI(obj); + + virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), + TYPE_VIRTIO_MULTITOUCH); +} + static const TypeInfo virtio_input_pci_info =3D { .name =3D TYPE_VIRTIO_INPUT_PCI, .parent =3D TYPE_VIRTIO_PCI, @@ -140,6 +149,13 @@ static const VirtioPCIDeviceTypeInfo virtio_tablet_pci= _info =3D { .instance_init =3D virtio_tablet_initfn, }; =20 +static const VirtioPCIDeviceTypeInfo virtio_multitouch_pci_info =3D { + .generic_name =3D TYPE_VIRTIO_MULTITOUCH_PCI, + .parent =3D TYPE_VIRTIO_INPUT_HID_PCI, + .instance_size =3D sizeof(VirtIOInputHIDPCI), + .instance_init =3D virtio_multitouch_initfn, +}; + static void virtio_pci_input_register(void) { /* Base types: */ @@ -150,6 +166,7 @@ static void virtio_pci_input_register(void) virtio_pci_types_register(&virtio_keyboard_pci_info); virtio_pci_types_register(&virtio_mouse_pci_info); virtio_pci_types_register(&virtio_tablet_pci_info); + virtio_pci_types_register(&virtio_multitouch_pci_info); } =20 type_init(virtio_pci_input_register) --=20 2.38.1 From nobody Wed Apr 24 19:39:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1685100595; cv=none; d=zohomail.com; s=zohoarc; b=FaJ5p9IXZyekSvyTc8/5aM/ImMo+xH/30QEX4IkNSJk9UR5Hhpjd212cKVzzFUWsPMOOppBF3De3kOG/oQqNp3IyMLS/tUId399A8Xh5CT71+B2TMOFHoiABA52NZ+++a6sozXhhcaO7UQZOsqMBW/D8cv4Pct6Dz1AlYIZD4d4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685100595; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=1CkmwlFbjP+S/fRpHno0l/DfR8/XqWdyN+IJPUI5O/s=; b=k3mCWe5eoI3cRSc8YLoI0OzFbKy90oS6sDidFuuYEbQ0KpGB+h8aobXs7dcnvdMHsuirDHKYb5gNJsJara6srjC5jraJzdf32vZu2rujEjAn+elSZ+oCNUcVLRs01Y8dD1cbVfMNZOZ11pG/iNH0b8DBRI46qV8/Pb4skgCts88= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1685100595622787.5746310641334; Fri, 26 May 2023 04:29:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q2VcT-0004rT-1o; Fri, 26 May 2023 07:28:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q2VcO-0004gw-6y for qemu-devel@nongnu.org; Fri, 26 May 2023 07:28:25 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q2VcK-0003WK-8k for qemu-devel@nongnu.org; Fri, 26 May 2023 07:28:23 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-21-8wDR2Ma9Na-MavqniBPfqQ-1; Fri, 26 May 2023 07:28:15 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 56D54185A78E; Fri, 26 May 2023 11:28:15 +0000 (UTC) Received: from toolbox.redhat.com (unknown [10.39.194.90]) by smtp.corp.redhat.com (Postfix) with ESMTP id A3B39140E95D; Fri, 26 May 2023 11:28:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685100498; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1CkmwlFbjP+S/fRpHno0l/DfR8/XqWdyN+IJPUI5O/s=; b=OVW0FSa/OCvEJL6YJXXZCHQ6snWTmOgMOTTAp6dkAvZaFjECjpwUqaxEXW8LJfbOuEhB9O BplQHOcY3qbNaa3iT7weHfDhLd89C0a/uKY8AcHBqBk+5hrhE3Nhgw4+YrjuDLhmn1zsHe CXEmLsSIcNyBRAvC10ag383Xx1U6d5Y= X-MC-Unique: 8wDR2Ma9Na-MavqniBPfqQ-1 From: Sergio Lopez To: qemu-devel@nongnu.org Cc: Eric Blake , Pavel Dovgalyuk , "Michael S. Tsirkin" , Markus Armbruster , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Gerd Hoffmann , Sergio Lopez Subject: [PATCH v5 5/6] ui: add helpers for virtio-multitouch events Date: Fri, 26 May 2023 13:29:24 +0200 Message-Id: <20230526112925.38794-6-slp@redhat.com> In-Reply-To: <20230526112925.38794-1-slp@redhat.com> References: <20230526112925.38794-1-slp@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=slp@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1685100597317100001 Add helpers for generating Multi-touch events from the UI backends that can be sent to the guest through a virtio-multitouch device. Signed-off-by: Sergio Lopez Reviewed-by: Marc-Andr=C3=A9 Lureau --- include/ui/input.h | 5 +++++ ui/input.c | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/include/ui/input.h b/include/ui/input.h index 2a3dffd417..c29a730a71 100644 --- a/include/ui/input.h +++ b/include/ui/input.h @@ -64,6 +64,11 @@ int qemu_input_scale_axis(int value, void qemu_input_queue_rel(QemuConsole *src, InputAxis axis, int value); void qemu_input_queue_abs(QemuConsole *src, InputAxis axis, int value, int min_in, int max_in); +void qemu_input_queue_mtt(QemuConsole *src, InputMultiTouchType type, int = slot, + int tracking_id); +void qemu_input_queue_mtt_abs(QemuConsole *src, InputAxis axis, int value, + int min_in, int max_in, + int slot, int tracking_id); =20 void qemu_input_check_mode_change(void); void qemu_add_mouse_mode_change_notifier(Notifier *notify); diff --git a/ui/input.c b/ui/input.c index fc75f1353c..1aad64b07c 100644 --- a/ui/input.c +++ b/ui/input.c @@ -547,6 +547,42 @@ void qemu_input_queue_abs(QemuConsole *src, InputAxis = axis, int value, qemu_input_event_send(src, &evt); } =20 +void qemu_input_queue_mtt(QemuConsole *src, InputMultiTouchType type, + int slot, int tracking_id) +{ + InputMultiTouchEvent mtt =3D { + .type =3D type, + .slot =3D slot, + .tracking_id =3D tracking_id, + }; + InputEvent evt =3D { + .type =3D INPUT_EVENT_KIND_MTT, + .u.mtt.data =3D &mtt, + }; + + qemu_input_event_send(src, &evt); +} + +void qemu_input_queue_mtt_abs(QemuConsole *src, InputAxis axis, int value, + int min_in, int max_in, int slot, int tracki= ng_id) +{ + InputMultiTouchEvent mtt =3D { + .type =3D INPUT_MULTI_TOUCH_TYPE_DATA, + .slot =3D slot, + .tracking_id =3D tracking_id, + .axis =3D axis, + .value =3D qemu_input_scale_axis(value, min_in, max_in, + INPUT_EVENT_ABS_MIN, + INPUT_EVENT_ABS_MAX), + }; + InputEvent evt =3D { + .type =3D INPUT_EVENT_KIND_MTT, + .u.mtt.data =3D &mtt, + }; + + qemu_input_event_send(src, &evt); +} + void qemu_input_check_mode_change(void) { static int current_is_absolute; --=20 2.38.1 From nobody Wed Apr 24 19:39:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1685100532; cv=none; d=zohomail.com; s=zohoarc; b=N18ttPPnlfWkH8awHXKPpn4hmZv+RD+9nfJJnd3NBVIHrEb2PaA5+zv/ErV7iuaKonXPCNUh5rMA6iVPlm4d/Ne7eyVuDVC+KMKA+3fVKyXjedKkGEo9la204pDYYXc6xdJDOOBRblc1yn9LCMolHp7tBjWZhFKUU48PlrVPA+o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685100532; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Y/8VlI+EXo+MKALZB7JN0qnitzXR8PRXZ4zSc3D13ng=; b=MVf4JWFYWwoAVJ65ltPTWTevbuJCD9vOzBpUX3OYPjbjk8385TnBMCQILvJoRgF4lEZWB1rjw7NQF8lH3QjOpCJfP4dDoqsOZRGjprvaTHjINLkgYTxoGGk8oSe+G/9oWQTTbpjvRYXRyLRiw6pTjXC6NSxnsJcWy+1/T7J5F1s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1685100532090526.9758113567082; Fri, 26 May 2023 04:28:52 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q2VcR-0004lz-IJ; Fri, 26 May 2023 07:28:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q2VcM-0004gf-Oz for qemu-devel@nongnu.org; Fri, 26 May 2023 07:28:25 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q2VcK-0003WH-7C for qemu-devel@nongnu.org; Fri, 26 May 2023 07:28:21 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-623-_VY2K_hhPa-A7yD67K0asg-1; Fri, 26 May 2023 07:28:17 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4D1D2185A78B; Fri, 26 May 2023 11:28:17 +0000 (UTC) Received: from toolbox.redhat.com (unknown [10.39.194.90]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9B819140E961; Fri, 26 May 2023 11:28:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685100498; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Y/8VlI+EXo+MKALZB7JN0qnitzXR8PRXZ4zSc3D13ng=; b=AvPgCU+YJauUYqAj2Yqdu4TsF1QKjq5Ca8YutBnpjk9yplbwk0OIC0i6SraOjVTykEvEYQ xT8Z0S53zPdANW+lyRjxZfFjB614itpmOBOaFtvDW3IImtGJM0bdRgghrRDJjpJhqvJ9W0 2UIJtYy0G0zXH7c5F2fhvxcryhSJVc8= X-MC-Unique: _VY2K_hhPa-A7yD67K0asg-1 From: Sergio Lopez To: qemu-devel@nongnu.org Cc: Eric Blake , Pavel Dovgalyuk , "Michael S. Tsirkin" , Markus Armbruster , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Gerd Hoffmann , Sergio Lopez Subject: [PATCH v5 6/6] ui/gtk: enable backend to send multi-touch events Date: Fri, 26 May 2023 13:29:25 +0200 Message-Id: <20230526112925.38794-7-slp@redhat.com> In-Reply-To: <20230526112925.38794-1-slp@redhat.com> References: <20230526112925.38794-1-slp@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=slp@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1685100533428100002 GTK3 provides the infrastructure to receive and process multi-touch events through the "touch-event" signal and the GdkEventTouch type. Make use of it to transpose events from the host to the guest. This allows users of machines with hardware capable of receiving multi-touch events to run guests that can also receive those events and interpret them as gestures, when appropriate. An example of this in action can be seen here: https://fosstodon.org/@slp/109545849296546767 Signed-off-by: Sergio Lopez Reviewed-by: Marc-Andr=C3=A9 Lureau --- ui/gtk.c | 92 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) diff --git a/ui/gtk.c b/ui/gtk.c index f16e0f8dee..b180bdf34e 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -130,6 +130,13 @@ typedef struct VCChardev VCChardev; DECLARE_INSTANCE_CHECKER(VCChardev, VC_CHARDEV, TYPE_CHARDEV_VC) =20 +struct touch_slot { + int x; + int y; + int tracking_id; +}; +static struct touch_slot touch_slots[INPUT_EVENT_SLOTS_MAX]; + bool gtk_use_gl_area; =20 static void gd_grab_pointer(VirtualConsole *vc, const char *reason); @@ -1059,6 +1066,82 @@ static gboolean gd_scroll_event(GtkWidget *widget, G= dkEventScroll *scroll, } =20 =20 +static gboolean gd_touch_event(GtkWidget *widget, GdkEventTouch *touch, + void *opaque) +{ + VirtualConsole *vc =3D opaque; + struct touch_slot *slot; + uint64_t num_slot =3D GPOINTER_TO_UINT(touch->sequence); + bool needs_sync =3D false; + int update; + int type =3D -1; + int i; + + if (num_slot >=3D INPUT_EVENT_SLOTS_MAX) { + warn_report("gtk: unexpected touch slot number: %ld >=3D %d\n", + num_slot, INPUT_EVENT_SLOTS_MAX); + return FALSE; + } + + slot =3D &touch_slots[num_slot]; + slot->x =3D touch->x; + slot->y =3D touch->y; + + switch (touch->type) { + case GDK_TOUCH_BEGIN: + type =3D INPUT_MULTI_TOUCH_TYPE_BEGIN; + slot->tracking_id =3D num_slot; + break; + case GDK_TOUCH_UPDATE: + type =3D INPUT_MULTI_TOUCH_TYPE_UPDATE; + break; + case GDK_TOUCH_END: + case GDK_TOUCH_CANCEL: + type =3D INPUT_MULTI_TOUCH_TYPE_END; + break; + default: + warn_report("gtk: unexpected touch event type\n"); + } + + for (i =3D 0; i < INPUT_EVENT_SLOTS_MAX; ++i) { + if (i =3D=3D num_slot) { + update =3D type; + } else { + update =3D INPUT_MULTI_TOUCH_TYPE_UPDATE; + } + + slot =3D &touch_slots[i]; + + if (slot->tracking_id =3D=3D -1) { + continue; + } + + if (update =3D=3D INPUT_MULTI_TOUCH_TYPE_END) { + slot->tracking_id =3D -1; + qemu_input_queue_mtt(vc->gfx.dcl.con, update, i, slot->trackin= g_id); + needs_sync =3D true; + } else { + qemu_input_queue_mtt(vc->gfx.dcl.con, update, i, slot->trackin= g_id); + qemu_input_queue_btn(vc->gfx.dcl.con, INPUT_BUTTON_TOUCH, true= ); + qemu_input_queue_mtt_abs(vc->gfx.dcl.con, + INPUT_AXIS_X, (int) slot->x, + 0, surface_width(vc->gfx.ds), + i, slot->tracking_id); + qemu_input_queue_mtt_abs(vc->gfx.dcl.con, + INPUT_AXIS_Y, (int) slot->y, + 0, surface_height(vc->gfx.ds), + i, slot->tracking_id); + needs_sync =3D true; + } + } + + if (needs_sync) { + qemu_input_event_sync(); + } + + return TRUE; +} + static const guint16 *gd_get_keymap(size_t *maplen) { GdkDisplay *dpy =3D gdk_display_get_default(); @@ -1980,6 +2063,8 @@ static void gd_connect_vc_gfx_signals(VirtualConsole = *vc) G_CALLBACK(gd_key_event), vc); g_signal_connect(vc->gfx.drawing_area, "key-release-event", G_CALLBACK(gd_key_event), vc); + g_signal_connect(vc->gfx.drawing_area, "touch-event", + G_CALLBACK(gd_touch_event), vc); =20 g_signal_connect(vc->gfx.drawing_area, "enter-notify-event", G_CALLBACK(gd_enter_event), vc); @@ -2089,6 +2174,7 @@ static GSList *gd_vc_gfx_init(GtkDisplayState *s, Vir= tualConsole *vc, GSList *group, GtkWidget *view_menu) { bool zoom_to_fit =3D false; + int i; =20 vc->label =3D qemu_console_get_label(con); vc->s =3D s; @@ -2136,6 +2222,7 @@ static GSList *gd_vc_gfx_init(GtkDisplayState *s, Vir= tualConsole *vc, GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_BUTTON_MOTION_MASK | + GDK_TOUCH_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_SCROLL_MASK | @@ -2171,6 +2258,11 @@ static GSList *gd_vc_gfx_init(GtkDisplayState *s, Vi= rtualConsole *vc, s->free_scale =3D true; } =20 + for (i =3D 0; i < INPUT_EVENT_SLOTS_MAX; i++) { + struct touch_slot *slot =3D &touch_slots[i]; + slot->tracking_id =3D -1; + } + return group; } =20 --=20 2.38.1