From patchwork Wed Sep 11 12:14:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 827406 Delivered-To: patch@linaro.org Received: by 2002:adf:ab1c:0:b0:367:895a:4699 with SMTP id q28csp764574wrc; Wed, 11 Sep 2024 05:21:53 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVAF/w7A33w3wqRE/QgV2goVt2Daf7wrz6Gl704AvdLNklB5nf5Tk23IPjik7k5NZg8vZtrrA==@linaro.org X-Google-Smtp-Source: AGHT+IGq8W6dQYazbCrA/5KAOWXBET1O1FlVjx1O8l69jNjZ+IdK8Oo7+cLlyuK/0uExW73EUmbJ X-Received: by 2002:a05:6214:2b9d:b0:6c5:de4:3edb with SMTP id 6a1803df08f44-6c5284f61c9mr241128936d6.29.1726057313052; Wed, 11 Sep 2024 05:21:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726057313; cv=none; d=google.com; s=arc-20240605; b=cYNx1Q0LgydcYfg7MsL/SQFeLbDtuoRF3k6PDOjp5cdTovsxLZHWZsdCUzxZ29ICcf eZC7nTqgMUBRTEbddgBuMqfw3kMQ2euQyJw2WoYBYp+ls76imFzfcgm4f0FaCK/GlLXy GXa+pZUgJsppUGoLb/vgFjTepc1Emfumd7/MINun7MG7kTl3qO5LPDTxOA1VcARGPlG7 GM5zN0v5Nrmn/8tF3q3tOGS97dnToMcSwj0nuO3LxCgaeOjre6mdKKc+iZqBsmqKAOYF axHd1WQeQpKcBUjGtcDQN84MkSv8H7v1+DkxF0f++F9kmBfyIjqB5EhmJ3RrukiCsZK2 0zRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=r5FvC+/VM5CrNgO4HyY/9BZiUoLX3NqqSLut7K2D/c8=; fh=+aSvXDiqZ2W0q/7kXE8ttXnONuOwKPBBQR1BEfKH9WY=; b=HHcF/uNrtpWKQfHjo4EiNYIACc2ONmmXd38KlXmU2oOUoA98pjfXCBNBns8k/p0iqU WM8l0j9yg0UqsBWzsEwHbaaue+vAPyMrZgzl7md7NwUZROXwcTbXL7Q4pfY/EcKC3W3Q L+w4vaGvLkA38Q3pmLK+/cphfcXwUGPEDfDvMdR0VTqG5YCWJH7ruFTBlQIdCL2oi5gr plNyl8HalE7yMgwcjn80/i1+iCvCK8zun+IuSwa7XQmx6HOGwSpCbqWwvBnoNHrFWyA8 9uieDw9+/2Z/zA/TOuKuUj6GADKdqMkagJ3tFB3Xciaenj2wfCZgYBm12qZPUjljQAfV 2dQA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=O+I5HPTc; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6c534330ab4si102255516d6.92.2024.09.11.05.21.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 11 Sep 2024 05:21:53 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=O+I5HPTc; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1soMKh-0007Ol-De; Wed, 11 Sep 2024 08:20: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 1soMKe-0007FA-Ry for qemu-devel@nongnu.org; Wed, 11 Sep 2024 08:20:25 -0400 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1soMKd-0007xt-28 for qemu-devel@nongnu.org; Wed, 11 Sep 2024 08:20:24 -0400 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-42bb7298bdeso80581155e9.1 for ; Wed, 11 Sep 2024 05:20:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726057221; x=1726662021; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=r5FvC+/VM5CrNgO4HyY/9BZiUoLX3NqqSLut7K2D/c8=; b=O+I5HPTc+ntUDEuSpBIomojFZHMhpYL2u6JkHMfVTpT4pmgEzWCPJMzZdbpp7gZuy/ NBksv4OVyRrkbQsVd7fNkwp28AHEewObf2wuAPFnXQwlGju+OJHZZ52gdO1CnFj9h+5g UlxkkHO1rFTo9X7YNu056fCx9unPQZAGEP0SA8uV/LaIwEdQqmVELaFqXKRjEyvUPMZW 28V5zOwJHaD5DlkUvm9FJeq4G46cAuU1LpbyhbG0xq24qJoHZ8aNCm2gUTQhHldT9Rj6 rQBMthL7dDeSG1UZK1uou2BF4QW0eyRlUKV9jWaHxVvLOvirLMEZ2nZtCl4OnIgnRDDP SbNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726057221; x=1726662021; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=r5FvC+/VM5CrNgO4HyY/9BZiUoLX3NqqSLut7K2D/c8=; b=KmQ0rWyMVlgWqfNzOshAK5++0kcC+0nLpoBAYQFRHlHWRF3awR46+KmEEfN+W9b/ry HcAMhlRKQIjTj2QXUjA0RlflNtt++4bMItSnkslGqXBdL/SRkcM43ZL+xbYRximx3JBx WZoB81Ia+pBJTwTmvCIURPBMISuwPFfYkkrDEgQkAXCYnK5VC6qY7bglfeDhi5zPrI3o oBp+aQqHSOC0JNGbx+bWpHenLja6UnCvbdAyoEVmwVqs9M2W7EC5+clDEm/f5S3GKAMx iESOsAjxecmNRnN4xnB2ZKlrPwBaVFAdgrlsV9c/zJdFzMyQPVAHafisOsPmQLIzpzkF TlEw== X-Gm-Message-State: AOJu0Yw4eA7cwqCMVsN4+TZs0sKP1IQRRJFNyaHzdVsQWUPfX/fIgLv5 97UPANP/MLDMoUDar0xFLihMQIqiw8rG9HTQ4TL/s2j/PLCLuReB8e1pDPlNqeeRAMOyNUa3zP6 J X-Received: by 2002:a05:600c:524c:b0:42c:b555:43dd with SMTP id 5b1f17b1804b1-42cb55545fdmr110635715e9.3.1726057221052; Wed, 11 Sep 2024 05:20:21 -0700 (PDT) Received: from m1x-phil.lan ([176.187.196.107]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-378956d3941sm11477256f8f.84.2024.09.11.05.20.19 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 11 Sep 2024 05:20:20 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Volker_R=C3=BCmelin?= , Howard Spoelstra , Bernhard Beschow , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 53/56] ui/sdl2: release all modifiers Date: Wed, 11 Sep 2024 14:14:18 +0200 Message-ID: <20240911121422.52585-54-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240911121422.52585-1-philmd@linaro.org> References: <20240911121422.52585-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=philmd@linaro.org; helo=mail-wm1-x32d.google.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, 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Volker Rümelin Each virtual console in the SDL2 frontend has a key state map. When switching windows with GUI keys we have to release all pressed modifier keys in the currently active window, because after the switch the now inactive window no longer receives the key release events. To reproduce the issue open a text editor in the SDL UI and then press Ctrl-Alt-2 to open a Compat Monitor Console. Close the console with the mouse. Try to enter text in the text editor and notice that the modifier keys Ctrl and Alt are stuck and need to be pressed once to be released. Tested-by: Howard Spoelstra Signed-off-by: Volker Rümelin Tested-by: Bernhard Beschow Message-ID: <20240909061552.6122-2-vr_qemu@t-online.de> Signed-off-by: Philippe Mathieu-Daudé --- include/ui/sdl2.h | 1 + ui/sdl2-input.c | 5 +++++ ui/sdl2.c | 1 + 3 files changed, 7 insertions(+) diff --git a/include/ui/sdl2.h b/include/ui/sdl2.h index e3acc7c82a..6907115809 100644 --- a/include/ui/sdl2.h +++ b/include/ui/sdl2.h @@ -60,6 +60,7 @@ void sdl2_poll_events(struct sdl2_console *scon); void sdl2_process_key(struct sdl2_console *scon, SDL_KeyboardEvent *ev); +void sdl2_release_modifiers(struct sdl2_console *scon); void sdl2_2d_update(DisplayChangeListener *dcl, int x, int y, int w, int h); diff --git a/ui/sdl2-input.c b/ui/sdl2-input.c index b02a89ee7c..2286df4223 100644 --- a/ui/sdl2-input.c +++ b/ui/sdl2-input.c @@ -58,3 +58,8 @@ void sdl2_process_key(struct sdl2_console *scon, } } } + +void sdl2_release_modifiers(struct sdl2_console *scon) +{ + qkbd_state_lift_all_keys(scon->kbd); +} diff --git a/ui/sdl2.c b/ui/sdl2.c index 98ed974371..bf6868f204 100644 --- a/ui/sdl2.c +++ b/ui/sdl2.c @@ -418,6 +418,7 @@ static void handle_keydown(SDL_Event *ev) SDL_ShowWindow(sdl2_console[win].real_window); } } + sdl2_release_modifiers(scon); gui_keysym = 1; } break;