From patchwork Mon Apr 17 19:21:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 13214472 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A2F82C77B76 for ; Mon, 17 Apr 2023 19:22:13 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1poUQJ-0000Fl-S0; Mon, 17 Apr 2023 15:22:01 -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 1poUQC-0000Fb-Qx for qemu-devel@nongnu.org; Mon, 17 Apr 2023 15:21:52 -0400 Received: from mail-ej1-x635.google.com ([2a00:1450:4864:20::635]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1poUQB-0007vD-80 for qemu-devel@nongnu.org; Mon, 17 Apr 2023 15:21:52 -0400 Received: by mail-ej1-x635.google.com with SMTP id ud9so66882334ejc.7 for ; Mon, 17 Apr 2023 12:21:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681759309; x=1684351309; 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=THKXDGcAzs96r2S6UQiFVZFfNh0FZnvDmU09b9bBVHo=; b=MXS8hN1LfvLJHmy+MpBF2gj4ec4bt9ByJA7FmBh696hff8E4rzPRpq93rN3gt0l9Bz Rcx/ptA6pkrLM+ZChQ8xFmL5vZtheOBvu1DYWjDhelkTDu1iWsGNv+7QwRVvERYlaJze SqL1VHbsWlPWDORai2VP5mdLVtQ3Iakgu3Oy710rQKaDdk8fI4XVudMlzOfuY2lGgtsa tzwnnZXBJkLKQXgCyXWpwXRJyyUDVCAq8E2anc3nieNT+IfXoQ7btkoHbmqbeB1uRCCG hYwYy9hubUH8upgl25lWA4zGSPKH1RjwSIbMwut9UqExNidNqZX4CczviLRGdvdT9gt1 kOlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681759309; x=1684351309; 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=THKXDGcAzs96r2S6UQiFVZFfNh0FZnvDmU09b9bBVHo=; b=WVIbSW5sFUo8R0rRVohvyHB0VlqTNJRDHIzcd913BFyu25WJOuWBys9pGmQs2m5sc+ ukr07AZpAQyESMjD91oRtVBcCtd40JZpsecDtTU17vr85NS1WHgOx4og6t1znU49/XY6 4sxk1rtE6u6H+Vhv37kdlQqzU6/6juiZlp0LSykM0EWoFRLhEiMpOBp/9PuprtAEwKx6 tj3ZvzbyIFkOrwdk51VUje1WOkgjUfHFDdHWMbG6akB+EmjoKbK7ElCMsOZ0TeRIaasV pA0GZUgfux+Q/UZGJOOdf7QYnxK+OjxVrQljjqR80t4FgTYl+8Gdw06RdyE7GsEX0oTo C8zg== X-Gm-Message-State: AAQBX9dH1Af6A2Z/Mr6O2m3cNdIo50S8m30TqKi3PvyyALwUvo/8+9x1 AoQXSw0hI2vMlZnVcrEsFqatZX5N+z1Z4Q== X-Google-Smtp-Source: AKy350YcO9eLJJuTBH3gpXUqBGnPMI0RRvYQOYBsW8TeqyZEHSFozrDkg+VbkbCGTcAqy09aGsq+kw== X-Received: by 2002:a17:906:1b07:b0:94e:d951:d4e7 with SMTP id o7-20020a1709061b0700b0094ed951d4e7mr8779878ejg.59.1681759309020; Mon, 17 Apr 2023 12:21:49 -0700 (PDT) Received: from Provence.localdomain (dynamic-089-012-025-091.89.12.pool.telefonica.de. [89.12.25.91]) by smtp.gmail.com with ESMTPSA id l19-20020a1709066b9300b0094a65f209d7sm6940134ejr.119.2023.04.17.12.21.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Apr 2023 12:21:48 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Stefan Weil , =?utf-8?q?Volker_R=C3=BCmelin?= , Gerd Hoffmann , Bernhard Beschow Subject: [PATCH v2 1/2] ui/sdl2: Grab Alt+Tab also in fullscreen mode Date: Mon, 17 Apr 2023 21:21:38 +0200 Message-Id: <20230417192139.43263-2-shentey@gmail.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230417192139.43263-1-shentey@gmail.com> References: <20230417192139.43263-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::635; envelope-from=shentey@gmail.com; helo=mail-ej1-x635.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, FREEMAIL_FROM=0.001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org By default, SDL grabs Alt+Tab only in non-fullscreen mode. This causes Alt+Tab to switch tasks on the host rather than in the VM in fullscreen mode while it switches tasks in non-fullscreen mode in the VM. Fix this confusing behavior by grabbing Alt+Tab in fullscreen mode, always causing tasks to be switched in the VM. Signed-off-by: Bernhard Beschow Reviewed-by: Volker RĂ¼melin --- ui/sdl2.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ui/sdl2.c b/ui/sdl2.c index b12dec4caf..8af8b89f1d 100644 --- a/ui/sdl2.c +++ b/ui/sdl2.c @@ -856,6 +856,9 @@ static void sdl2_display_init(DisplayState *ds, DisplayOptions *o) SDL_SetHint(SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR, "0"); #endif SDL_SetHint(SDL_HINT_GRAB_KEYBOARD, "1"); +#ifdef SDL_HINT_ALLOW_ALT_TAB_WHILE_GRABBED + SDL_SetHint(SDL_HINT_ALLOW_ALT_TAB_WHILE_GRABBED, "0"); +#endif memset(&info, 0, sizeof(info)); SDL_VERSION(&info.version); From patchwork Mon Apr 17 19:21:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 13214474 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AFC34C77B72 for ; Mon, 17 Apr 2023 19:22:46 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1poUQV-0000Zp-TJ; Mon, 17 Apr 2023 15:22:11 -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 1poUQE-0000Fr-Bo for qemu-devel@nongnu.org; Mon, 17 Apr 2023 15:21:59 -0400 Received: from mail-ej1-x62a.google.com ([2a00:1450:4864:20::62a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1poUQC-0007vO-GK for qemu-devel@nongnu.org; Mon, 17 Apr 2023 15:21:53 -0400 Received: by mail-ej1-x62a.google.com with SMTP id u3so15081720ejj.12 for ; Mon, 17 Apr 2023 12:21:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681759310; x=1684351310; 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=vDjuNP5wxVhovFPvM7m4qpDAg3jpnIG9FC53GI3D19c=; b=QiWhkZLkLtLeh6BEJ4+8WbQ+3J9/Z/Mr5qmx5QlP+fio4FFJ2P4EGmmMrZoFYdV4wD uT79YbuH8jICINymwhs6D/9+4v/6KppOYFLCuynuyMOJyURQBSJ1h4U74TVuYxzpGhXH MyuxVkc/emdCmi9PCp7Ts0Ujh/9hUWiCrpNy/yi6OJb3lEz65fGXS3FPSfL0qRaCBjtw fGvD5Qb6wR8/o+tF/oPxylzUMT1QsDCWrsJCTyQYd8E4k3R2TnCCRGJjN6KV+MvUzkq6 TxQtvboFkyj26c9pSUWGlhFeNJqAbN51TVQ/2R/wU2YmHu8Hn1kSygZNJv8vBuvn1n1c LCAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681759310; x=1684351310; 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=vDjuNP5wxVhovFPvM7m4qpDAg3jpnIG9FC53GI3D19c=; b=KHPC/UoHBFubYExy5YNv80m7mmbRpmSJVbHjnkjPLsGq1RHlMbUDiPKkxY4hYxtn72 MQSfszteqWS2aILVxyThBuKvN5x+mc13NsNJEKAf5BzwQMHCIPpme8g8DZzxUBjQ37Ex ZtBsyLBV+ewa7KF4acc1NfZmKw8ydRgKJQCbVHnrg2mv5nbrYWceQehFs38GWIqanMSB hCgEo3NiW2gLgwy6rIFiqDjGgKj5EmVGL3wlBSGO06sTwZvB4n+VQvV2LhHDnaSnPRt3 c4/EJLt9ZLI+BOonrGa+WXVN27MRNK3EF/c3rMnAcIhU6VhemExvJAyxhmVUge375GHd X/vw== X-Gm-Message-State: AAQBX9fyAXRtH9KVGAQp/B4YjJ9wQIllV0XCBOKbk+bw8RP60A6vCFLt Mp0q2gQ/0S3qX65HQi1Dnvt/F6SIAtIRfQ== X-Google-Smtp-Source: AKy350YdDVM3bg1pvjLEyF2wtIX/DkueJ95qqI4O7pVXhMFTDcRT5X7TnI2k7LWMXXjBjvkZogg3Ow== X-Received: by 2002:a17:906:4a0f:b0:930:2e3c:c6aa with SMTP id w15-20020a1709064a0f00b009302e3cc6aamr8423651eju.49.1681759309953; Mon, 17 Apr 2023 12:21:49 -0700 (PDT) Received: from Provence.localdomain (dynamic-089-012-025-091.89.12.pool.telefonica.de. [89.12.25.91]) by smtp.gmail.com with ESMTPSA id l19-20020a1709066b9300b0094a65f209d7sm6940134ejr.119.2023.04.17.12.21.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Apr 2023 12:21:49 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Stefan Weil , =?utf-8?q?Volker_R=C3=BCmelin?= , Gerd Hoffmann , Bernhard Beschow Subject: [PATCH v2 2/2] ui/sdl2: Grab Alt+F4 also under Windows Date: Mon, 17 Apr 2023 21:21:39 +0200 Message-Id: <20230417192139.43263-3-shentey@gmail.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230417192139.43263-1-shentey@gmail.com> References: <20230417192139.43263-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::62a; envelope-from=shentey@gmail.com; helo=mail-ej1-x62a.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, FREEMAIL_FROM=0.001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org SDL doesn't grab Alt+F4 under Windows by default. Pressing Alt+F4 thus closes the VM immediately without confirmation, possibly leading to data loss. Fix this by always grabbing Alt+F4 on Windows hosts, too. Signed-off-by: Bernhard Beschow Reviewed-by: Volker RĂ¼melin --- ui/sdl2.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ui/sdl2.c b/ui/sdl2.c index 8af8b89f1d..00aadfae37 100644 --- a/ui/sdl2.c +++ b/ui/sdl2.c @@ -859,6 +859,7 @@ static void sdl2_display_init(DisplayState *ds, DisplayOptions *o) #ifdef SDL_HINT_ALLOW_ALT_TAB_WHILE_GRABBED SDL_SetHint(SDL_HINT_ALLOW_ALT_TAB_WHILE_GRABBED, "0"); #endif + SDL_SetHint(SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4, "1"); memset(&info, 0, sizeof(info)); SDL_VERSION(&info.version);