From nobody Fri May 17 05:00:11 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=1681399293; cv=none; d=zohomail.com; s=zohoarc; b=CYkR9IUtKmwhK6PIslX3vt3Qrcd58a6JsKhX2OKOjQIFXCYFhbjGbqBelZhzKx0YmYUhoq+8edgQI744rOCwcb+2mMhTliV8RYST+RELkim+oX64sFRqzr5uLZuq/hmJVYgnsWeg5TGDu1+fWDJz0gDP/AvsP1TuC7ILl7CpK/I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681399293; 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=Z7CtTWK7gHded8SxJ4j2c4RCDm1hNNNJSUI9Emt1hVC+q1GpSmHEWbRPh9QXZzZcX5NLZkL/xrI/estQeSs04U6zf07FEIKbuTXuOCQIGv6lleTv+HHjO/NrEHXQZS9VGD979c4l/wpptFgskCFJwRR1tmDos/kVxqxfl2IG9i0= 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 1681399293228186.750935602303; Thu, 13 Apr 2023 08:21:33 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pmyk8-00063e-23; Thu, 13 Apr 2023 11:20:12 -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 1pmyk6-000638-AC for qemu-devel@nongnu.org; Thu, 13 Apr 2023 11:20:10 -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 1pmyk0-00080K-Gz for qemu-devel@nongnu.org; Thu, 13 Apr 2023 11:20:09 -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-298-2_bRWpo2P6G7eH2OrSY-cg-1; Thu, 13 Apr 2023 11:20:01 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6024F3822DEB; Thu, 13 Apr 2023 15:20:01 +0000 (UTC) Received: from toolbox.redhat.com (unknown [10.33.36.16]) by smtp.corp.redhat.com (Postfix) with ESMTP id DA5A4C16028; Thu, 13 Apr 2023 15:19:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681399203; 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=GvXlV2AY/X/ZSKesc33fGJ/H8ZgRsTd4XhsxPWzCYSoq+YOlBTEP8/Wt8VOfsXrCCE8228 sO4s20n9cqQSvEOdFHsIMv6UDXSzv/N0Tv99nyRZCUEI1BvX38om7NGFRGMBUqZjVVE3Vh Wkqm7A9psdN83WPz+tDNxBoDBuIpdJs= X-MC-Unique: 2_bRWpo2P6G7eH2OrSY-cg-1 From: Sergio Lopez To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Markus Armbruster , Pavel Dovgalyuk , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , "Michael S. Tsirkin" , Eric Blake , Sergio Lopez Subject: [PATCH v3 1/6] virtio-input: generalize virtio_input_key_config() Date: Thu, 13 Apr 2023 17:21:15 +0200 Message-Id: <20230413152120.53967-2-slp@redhat.com> In-Reply-To: <20230413152120.53967-1-slp@redhat.com> References: <20230413152120.53967-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.8 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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001, T_SPF_HELO_TEMPERROR=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: 1681399294866100001 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 Fri May 17 05:00:11 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=1681399250; cv=none; d=zohomail.com; s=zohoarc; b=eDsOvHhkSraBtfdzRMe19re1FWPtIHfAGCr6hYXuJ+O+vqwN41TWOhWBZ0sYSYFjtzOnTDJUZhR5k8Rlv26BK36q87GQeel+tsgRmjlg1ikmkhSwySuFewkwUaccep5H5mBKLyVxY2BA8zDgigsmxGG4HSOr0QCh4i0bHhGWH0E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681399250; 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=1zlIfQRx58l8T8/c888LXxjetDFJKP+gEEbcioWkgX8=; b=OcGNOaPcSLqVBDBbKdQ5J5UZ9oT+R71xFaXJNkeLvMFkAyotOds/3FgbIzkuvcfsUri54qxLkwtxAe7PQ9Kk/+NgDiInQYp2L6R6y7Qy4CSPSqZd2oyuF0kazqcQolh6YWBRNZVyx5QSqSP0VdQp0nTeSdJ1V+dY2wjssBrDqQM= 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 1681399250783964.1482697194974; Thu, 13 Apr 2023 08:20:50 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pmyk6-000636-6S; Thu, 13 Apr 2023 11:20:10 -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 1pmyk4-00062Q-IT for qemu-devel@nongnu.org; Thu, 13 Apr 2023 11:20:08 -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 1pmyk2-0008A7-Nl for qemu-devel@nongnu.org; Thu, 13 Apr 2023 11:20:08 -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-618-wD_m2y-EMJ2D1QsXsVx4sg-1; Thu, 13 Apr 2023 11:20:03 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 236FC185A7A4; Thu, 13 Apr 2023 15:20:03 +0000 (UTC) Received: from toolbox.redhat.com (unknown [10.33.36.16]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9D03AC16028; Thu, 13 Apr 2023 15:20:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681399205; 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=1zlIfQRx58l8T8/c888LXxjetDFJKP+gEEbcioWkgX8=; b=JgNMZ8WyuJBbNdHmhicBtn1d6/f44oQTMpfsVyNGQxuTsafT8VntvZFf3rewvGeb2caZ9K MHYVGkWh4oyR/ydrbry6g/bI+6idmuEQMj6QgeGfTJ7TsqXFYRWC99/Gg0Md9WW2b6Ffx7 Cl7f7QBOO7a7IT3OpDvES12uIuN9exg= X-MC-Unique: wD_m2y-EMJ2D1QsXsVx4sg-1 From: Sergio Lopez To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Markus Armbruster , Pavel Dovgalyuk , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , "Michael S. Tsirkin" , Eric Blake , Sergio Lopez Subject: [PATCH v3 2/6] ui: add the infrastructure to support MT events Date: Thu, 13 Apr 2023 17:21:16 +0200 Message-Id: <20230413152120.53967-3-slp@redhat.com> In-Reply-To: <20230413152120.53967-1-slp@redhat.com> References: <20230413152120.53967-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.8 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, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: 1681399252411100006 Add the required infrastructure to support generating multitouch events. Signed-off-by: Sergio Lopez Reviewed-by: Marc-Andr=C3=A9 Lureau --- include/ui/input.h | 3 +++ qapi/ui.json | 46 ++++++++++++++++++++++++++++++++++++++++--- replay/replay-input.c | 18 +++++++++++++++++ ui/input.c | 6 ++++++ ui/trace-events | 1 + 5 files changed, 71 insertions(+), 3 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..f788db20f7 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 Fri May 17 05:00:11 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=1681399250; cv=none; d=zohomail.com; s=zohoarc; b=SlvUF/o74kDIGf+N6Xf9ruge9EIlAQSqNSftt25XtalooA5VolU/Bv0ciZ8T0Y022CZuwbWLE1rAXjorUh3gEqGXlaxTGXenunB2WN7tVizhGGVkJJUDhlSA4/7f3+PezjBpoKqDpOxEcpbC7jpvghPCYS0H6X0PukIoDialitU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681399250; 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=iQoi4FAGMNJM/MYSx3/7Wc1oKvPf/n3uwnKpfGjVMYs=; b=essEx+tbbEa3GnoD4CLpU67BFUCdtH52reoWNbio78cglU6qhxucS+Wxf7945boLjfusug0uN452JMFlqfFXNELIUZy0jbc8O+3LCeDdbA8Gx1lsdyYREZ2ya9SdZOpvQmjyBYEGHUSRR1hCIJm/8XZcMMAzfrVbfZlXGGmj4p8= 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 16813992507801007.9730488603242; Thu, 13 Apr 2023 08:20:50 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pmyk9-00064T-Qu; Thu, 13 Apr 2023 11:20:13 -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 1pmyk7-00063c-TG for qemu-devel@nongnu.org; Thu, 13 Apr 2023 11:20: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 1pmyk5-0008BY-KB for qemu-devel@nongnu.org; Thu, 13 Apr 2023 11:20:11 -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-558-UQDB4cHvPa6gqBOGr0vzZg-1; Thu, 13 Apr 2023 11:20:05 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DC3472A5954D; Thu, 13 Apr 2023 15:20:04 +0000 (UTC) Received: from toolbox.redhat.com (unknown [10.33.36.16]) by smtp.corp.redhat.com (Postfix) with ESMTP id 60D87C16028; Thu, 13 Apr 2023 15:20:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681399208; 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=iQoi4FAGMNJM/MYSx3/7Wc1oKvPf/n3uwnKpfGjVMYs=; b=SfAhmjJHxuFBz/jiM58eR12/Hf5b0Krt16gcF3Zrs9EOJe6TarUfw8fZC8CazCZbtVL34g dyEzgAvuPrdOT2kGRR5V+93SeFCMhyZOGst1hkwdcwHzYYzcab3cuDhee+dQkt07nqngfS BlUbj5Cn1VtSMM44BbJsYCndI3GuwDE= X-MC-Unique: UQDB4cHvPa6gqBOGr0vzZg-1 From: Sergio Lopez To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Markus Armbruster , Pavel Dovgalyuk , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , "Michael S. Tsirkin" , Eric Blake , Sergio Lopez Subject: [PATCH v3 3/6] virtio-input: add a virtio-mulitouch device Date: Thu, 13 Apr 2023 17:21:17 +0200 Message-Id: <20230413152120.53967-4-slp@redhat.com> In-Reply-To: <20230413152120.53967-1-slp@redhat.com> References: <20230413152120.53967-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.8 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, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: 1681399252371100005 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..742235d3fa 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_MULTITOUCH_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 Fri May 17 05:00:11 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=1681399332; cv=none; d=zohomail.com; s=zohoarc; b=aJGorCTPbMnK1grKCBocttN4YzgP2DRa7K1wCeDHMKUWfyeg/j8aVf/aIvmj74YAhSjaU2SDhoDpnXKQ+CL5IDEGhQmmk3kCQWp9e5OHSn91My1k9iyE7RM+rDbqs26ypNFOCVZrYkcuKmOlGoZQQ8FYa+5H3MHl6j17X5RJ3tk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681399332; 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=Y2olCQc+unIFJtQeqJQJ+QJyCXIRm9TI6Hd49FdB4T6steMCvIRzlgPv9SrPkanyGp5l6P/42u2x1DovOrqecvnbJkMjrZBWK1+Otq+BtaQoKMzT4UqjlykUupmxeS1ZorXidXxko3x30Xa3KehOm6kmqou4TH4LODRVaKCcr7U= 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 1681399332496268.14540923172524; Thu, 13 Apr 2023 08:22:12 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pmykA-00064d-OV; Thu, 13 Apr 2023 11:20: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 1pmyk8-000641-NC for qemu-devel@nongnu.org; Thu, 13 Apr 2023 11:20:12 -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 1pmyk7-0008C7-5N for qemu-devel@nongnu.org; Thu, 13 Apr 2023 11:20:12 -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-182-fV14sljPNxye4HapCIRcww-1; Thu, 13 Apr 2023 11:20:07 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A1E0F857F81; Thu, 13 Apr 2023 15:20:06 +0000 (UTC) Received: from toolbox.redhat.com (unknown [10.33.36.16]) by smtp.corp.redhat.com (Postfix) with ESMTP id 27AC3C16028; Thu, 13 Apr 2023 15:20:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681399210; 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=CxQ/cw6nPWG4E+VNr7JWjy5PrI43ZLP8IM4K7NglsPFRoiIGdcRBT5+ZftxmBUnVRbEfqV UflDqjK4nqFLIQUZPEYMy9v3Lwxj9YuK+NvUSqY0OsU383H3VmkrT/uWz6z4BpI3LiUUtg Ra9h402z6wgT7Ln0la+Jgu5c46I7v6A= X-MC-Unique: fV14sljPNxye4HapCIRcww-1 From: Sergio Lopez To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Markus Armbruster , Pavel Dovgalyuk , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , "Michael S. Tsirkin" , Eric Blake , Sergio Lopez Subject: [PATCH v3 4/6] virtio-input-pci: add virtio-multitouch-pci Date: Thu, 13 Apr 2023 17:21:18 +0200 Message-Id: <20230413152120.53967-5-slp@redhat.com> In-Reply-To: <20230413152120.53967-1-slp@redhat.com> References: <20230413152120.53967-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.8 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, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: 1681399334523100001 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 Fri May 17 05:00:11 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=1681399285; cv=none; d=zohomail.com; s=zohoarc; b=H7fn0DXKnSf74YqllRjsV34GKdCMgCutnie5aSR5RTIVXKqpKzzZzM9ni5L8YyTov7sDHIJ671n8V2t+Njyo/BURFY8PrOj5DznSX/yKrSNUvVVn9WgBytsbUjrMMZzBVFYZEziM4V9mDOTEVziVBgBd5ciemi1ci6UY0deoJms= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681399285; 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=ZTRCSFCROj1GSLym6gTBjuTBu7m41D87hqy/XMN02+c=; b=k1qOpUXit0JRnJrhpuGjEvQXtOfu5xLFV5aha8MFXCie6kf8oyeDEbjTrd/mjS3hERimnyQdFIQk6jSnz0ILFDuy6BKMYMovPVN7TnUSWxr4LmQ4JCxYSJ5/4o8vUzoZDdndXvD+e9Y7/6MHVM+K8ZarKrr4C4KIZt2K6u+xhQM= 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 1681399285510661.2655635336331; Thu, 13 Apr 2023 08:21:25 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pmykC-00065H-Tl; Thu, 13 Apr 2023 11:20:16 -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 1pmykB-00064t-H6 for qemu-devel@nongnu.org; Thu, 13 Apr 2023 11:20:15 -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 1pmyk8-0008CS-Uk for qemu-devel@nongnu.org; Thu, 13 Apr 2023 11:20:15 -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-374-a6P0oQsfPlGH38J22qzdew-1; Thu, 13 Apr 2023 11:20:08 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 684C61C0432C; Thu, 13 Apr 2023 15:20:08 +0000 (UTC) Received: from toolbox.redhat.com (unknown [10.33.36.16]) by smtp.corp.redhat.com (Postfix) with ESMTP id E0CDBC16028; Thu, 13 Apr 2023 15:20:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681399212; 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=ZTRCSFCROj1GSLym6gTBjuTBu7m41D87hqy/XMN02+c=; b=bs+iHDJ4NQsBntnydwG/zMbKYb/rc52DwB0uFFw7Jjo8LfyD/wXEJcJfaacLkkbwIhz59b YcQs6fynz3giZ09PvJNdcMR0CBF9JU4EoInAqs73DMcjMdMSrjxv5RqOp08tC7FIlCxa2T ua9OrI68A0HcKIIElLo0APK6HVXdl+M= X-MC-Unique: a6P0oQsfPlGH38J22qzdew-1 From: Sergio Lopez To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Markus Armbruster , Pavel Dovgalyuk , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , "Michael S. Tsirkin" , Eric Blake , Sergio Lopez Subject: [PATCH v3 5/6] ui: add helpers for virtio-multitouch events Date: Thu, 13 Apr 2023 17:21:19 +0200 Message-Id: <20230413152120.53967-6-slp@redhat.com> In-Reply-To: <20230413152120.53967-1-slp@redhat.com> References: <20230413152120.53967-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.8 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, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: 1681399286309100001 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..c37251e1e9 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 f788db20f7..34331b7b0b 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_MULTITOUCH_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 Fri May 17 05:00:11 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=1681399253; cv=none; d=zohomail.com; s=zohoarc; b=Hu+1qgTLVxPNwF351LJfwdTazm09DSijiMEWHzp9VkH2wpt2weqfBKb/lY+sTGN9Kd1nccxMLD2GPKOR5XiZS2FCffyFj2t64WJ/+hExJwUJWTETztVnog+MSp/XGjU7kG+Ey/54l/PzfeORO4DRhI4WadDWTsutLPr2Jhbh7Iw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681399253; 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=MA/BQcbbAclo0q+YU9wdPYIrpdqh4HNJRJmcJur6uBM=; b=ivOj+xMM9pui/HfrFT4lK8Y6ICOJ4KGf4kHVJJ2zEhbY/LBAAyj9YWo4RT0bcIbK1sp3hqlnrOubidbAueuaOTggX4+HUTNWXs/FOEtbs/NL4lRy6dXpousjKs9fYtD0G6geEbVBeRWYyGihcbpC/HxrM63YftQ+hrYhEzVwPos= 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 1681399253265788.7192250424772; Thu, 13 Apr 2023 08:20:53 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pmykF-00065m-Ls; Thu, 13 Apr 2023 11:20:19 -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 1pmykD-00065M-OF for qemu-devel@nongnu.org; Thu, 13 Apr 2023 11:20:17 -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 1pmykB-0008Cl-6f for qemu-devel@nongnu.org; Thu, 13 Apr 2023 11:20: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-217-4BUI374GPRS8luhtzfXlAA-1; Thu, 13 Apr 2023 11:20:11 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BF5623822DF3; Thu, 13 Apr 2023 15:20:10 +0000 (UTC) Received: from toolbox.redhat.com (unknown [10.33.36.16]) by smtp.corp.redhat.com (Postfix) with ESMTP id A5F51C16028; Thu, 13 Apr 2023 15:20:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681399214; 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=MA/BQcbbAclo0q+YU9wdPYIrpdqh4HNJRJmcJur6uBM=; b=Amuk+TJeYnodyNGLPgxF0DAybFSwxXN7Vgoaf7Jjg3i8AiH5axwhtm8OPQVL0PNcq2X+qI 7BKX5/Yb+95bXrMtvRgkv9rxw8j2mhqA2gDW4rIw4tAHSC4Wj9aY2CeM1PzuZ/M9R3q+fj gjopumaEVnwjqtjOhUe68Olj+OCAOvc= X-MC-Unique: 4BUI374GPRS8luhtzfXlAA-1 From: Sergio Lopez To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Markus Armbruster , Pavel Dovgalyuk , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , "Michael S. Tsirkin" , Eric Blake , Sergio Lopez Subject: [PATCH v3 6/6] ui/gtk: enable backend to send multi-touch events Date: Thu, 13 Apr 2023 17:21:20 +0200 Message-Id: <20230413152120.53967-7-slp@redhat.com> In-Reply-To: <20230413152120.53967-1-slp@redhat.com> References: <20230413152120.53967-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.8 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, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: 1681399254357100012 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..b3e6443943 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_MULTITOUCH_TYPE_BEGIN; + slot->tracking_id =3D num_slot; + break; + case GDK_TOUCH_UPDATE: + type =3D INPUT_MULTITOUCH_TYPE_UPDATE; + break; + case GDK_TOUCH_END: + case GDK_TOUCH_CANCEL: + type =3D INPUT_MULTITOUCH_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_MULTITOUCH_TYPE_UPDATE; + } + + slot =3D &touch_slots[i]; + + if (slot->tracking_id =3D=3D -1) { + continue; + } + + if (update =3D=3D INPUT_MULTITOUCH_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