From patchwork Tue Mar 5 11:06:07 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: 777973 Delivered-To: patch@linaro.org Received: by 2002:a5d:48c8:0:b0:33e:474f:8c56 with SMTP id p8csp372380wrs; Tue, 5 Mar 2024 03:08:24 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCX3OdXAFdgG77YLN1UHJoNc6noDITEAKmpDsclrYAbgKFELOYwS+PJkvIeEnHm/JY6NprD9fLStFPqDfGw0QDmD X-Google-Smtp-Source: AGHT+IEMwpO1G/OIt7zGIwxhlweu8+aK4rDj4JnfuEBMnybJ759RI47PUH3A+rWfjUX97DlZbsJb X-Received: by 2002:ac8:5e08:0:b0:42e:f1f8:6957 with SMTP id h8-20020ac85e08000000b0042ef1f86957mr1713584qtx.65.1709636904400; Tue, 05 Mar 2024 03:08:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709636904; cv=none; d=google.com; s=arc-20160816; b=07iD9Z2hzBgyOoAp7z/xQWGV+1fWs+gMikqkRi5GQ8n8lGgouUNrr3WQhAeusk0D3q jb0pKQRFjWBjtT/nG3J571aMtSP3SdnTCj1NqaBpQvz1k7P34qP72azlZV27U0XMdvSV AeoTml7jWwWJkeo0vnCsXrk4o76bgTwlDs1dhHxrRjm3LHa40QdBrFAAkej+8miRN9rt IwNJ5R/g3tXXmzYOL/821F7Y58hixRIplknz2jMD9iakCH4dvd0nT7kpdhIKeet3t2Ci 6A2h2z+5rh/9sc3or4cZ49iQIph5WgGXBemNn97qKCfAuH8iMU9qvV91kU4KDD6Ldena O2vQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=o6n73qW0ydBRSB1J+ZYz20Ufnelrw0ubO1rh+yoO1Cs=; fh=lnLpXpuHHACtmFCFYDz84qQIx2RASFfAeprBY3P3HzE=; b=hj6rN7VyZuIxXefJfpD4K3rEPxLtbUbDiGWovadPRSjbHUp7T+I9rAgt9WdyYE+R8M AETR/GArKw7x/fF6mSMZCnTU2k+nmI/C49KMEvrGe0uVPxjvJeg8+BeE7hIefh7rg4X0 f+yuNykyLFldkuJpTuQfLr9zPN8N8r/bw9mSFRdvG133HcjQeVzBE3KHRwHpx/ne0ah2 +cv4BhZ6WAeVReY8P8W5kqQGRWHl1JIIfKcqQLuTNI4h3vW8RBgwRYVDyY9NkEovvu4e IP7prx3f9w5CXVPhNlmmP5W9JY759zgE8iGDIW/LOMAgm59o8bOLd1j2tQ0vWsyDs53Y 3yNA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=G5CZUp5J; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id o1-20020ac84281000000b0042e646b6d41si10770343qtl.509.2024.03.05.03.08.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Mar 2024 03:08:24 -0800 (PST) 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=G5CZUp5J; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rhSdy-0001iY-6k; Tue, 05 Mar 2024 06:07:34 -0500 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 1rhSds-00014l-7m for qemu-devel@nongnu.org; Tue, 05 Mar 2024 06:07:28 -0500 Received: from mail-ej1-x62c.google.com ([2a00:1450:4864:20::62c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rhSdp-0002yE-8h for qemu-devel@nongnu.org; Tue, 05 Mar 2024 06:07:27 -0500 Received: by mail-ej1-x62c.google.com with SMTP id a640c23a62f3a-a458eb7db13so121856566b.2 for ; Tue, 05 Mar 2024 03:07:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709636843; x=1710241643; 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=o6n73qW0ydBRSB1J+ZYz20Ufnelrw0ubO1rh+yoO1Cs=; b=G5CZUp5J6nmQqFFIniPu2h8MCQXloNt2FG34aqq+VZP2dh3ofeCfS/SyEM40I/3Wen J1lC2KkuX5x3anyHQ6DJ6HwWK0MJLa7Fdww34jpKltVDC+zSWWERJdC8TeTSSIylhoYQ w6jn3i7lDmi07OiXEVvxBl5V3YGU/Jtz6cC1Zw7HDPfY7eU8JGoQO8gymp+aO1xDZTSR CtAdTJzohV/84EQ5CWrTNMMKwXja9fmZLWvzZExA1vr7koOqpRsAo0awIbZvk7ZrH46o tqzJXsG6rg3p7mxn3kkv65NPcpM8S22R8khNgEZPRdhZfFRYs2vdQ2pQvXJzgqJb85yL VZlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709636843; x=1710241643; 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=o6n73qW0ydBRSB1J+ZYz20Ufnelrw0ubO1rh+yoO1Cs=; b=agNGzkmy6a3Bd/31Dv56KAfFnrRSIL384Dwvv4McCHkXrPS/5g7KJL9p0vZAjvw2Zf hVxVhwx1kbTQwJ/JdTw1dvzNFTeanMOFMyqV/a1L7FJ8A1T6cjBac4ZUduIV9pcmLU6+ NOEFJTBKvPnUttbShQtOeb6i5NTTufYBvQrXZuxKLW6UTFXtk/+BhzuOce36giUo50pO nB+fcr+Fd5eWWShPKeVbkqYaGdIQNBs+LcAZWWQG2LBzOMPqC6tBSj5rimdy32ZgtZ8w zQfJWSviGt/gTF7BWQifhPHbVlNLcqX//syCNkzThJednAChNmyz3+atoho3hCK9T7LA dN6g== X-Gm-Message-State: AOJu0YyptAp/XWfQlG+KQXuTOVnCWpKzW9EgtxNMgxZ5ejisFh2nY3Zp 9XXJSJlNpK1SlZPfR2OIhazfNiCSlXuztzT9gUyZUJh8lncdOCvkKvWk0ZX9McEQB9w4v1Db7F3 V X-Received: by 2002:a17:906:bc54:b0:a43:f182:66c4 with SMTP id s20-20020a170906bc5400b00a43f18266c4mr8561650ejv.17.1709636843351; Tue, 05 Mar 2024 03:07:23 -0800 (PST) Received: from m1x-phil.lan ([176.176.177.70]) by smtp.gmail.com with ESMTPSA id lm7-20020a170906980700b00a449fdfe27bsm4588465ejb.170.2024.03.05.03.07.21 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 05 Mar 2024 03:07:22 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Akihiko Odaki , Rene Engel , Peter Maydell , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Gerd Hoffmann , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Subject: [PULL 12/12] ui/cocoa: Remove stretch_video flag Date: Tue, 5 Mar 2024 12:06:07 +0100 Message-ID: <20240305110608.21618-13-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240305110608.21618-1-philmd@linaro.org> References: <20240305110608.21618-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::62c; envelope-from=philmd@linaro.org; helo=mail-ej1-x62c.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, 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Akihiko Odaki Evaluate [normalWindow styleMask] & NSWindowStyleMaskResizable instead. Signed-off-by: Akihiko Odaki Tested-by: Rene Engel Reviewed-by: Peter Maydell Message-ID: <20240224-cocoa-v12-10-e89f70bdda71@daynix.com> Signed-off-by: Philippe Mathieu-Daudé --- ui/cocoa.m | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/ui/cocoa.m b/ui/cocoa.m index bc63043158..fa879d7dcd 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -106,7 +106,6 @@ static void cocoa_switch(DisplayChangeListener *dcl, static int left_command_key_enabled = 1; static bool swap_opt_cmd; -static bool stretch_video; static CGInterpolationQuality zoom_interpolation = kCGInterpolationNone; static NSTextField *pauseLabel; @@ -522,7 +521,7 @@ - (void) resizeWindow { [[self window] setContentAspectRatio:NSMakeSize(screen.width, screen.height)]; - if (!stretch_video) { + if (!([[self window] styleMask] & NSWindowStyleMaskResizable)) { [[self window] setContentSize:NSMakeSize(screen.width, screen.height)]; [[self window] center]; } else if ([[self window] styleMask] & NSWindowStyleMaskFullScreen) { @@ -1354,15 +1353,10 @@ - (void)showQEMUDoc:(id)sender /* Stretches video to fit host monitor size */ - (void)zoomToFit:(id) sender { - stretch_video = !stretch_video; - if (stretch_video == true) { - [cocoaView window].styleMask |= NSWindowStyleMaskResizable; - [sender setState: NSControlStateValueOn]; - } else { - [cocoaView window].styleMask &= ~NSWindowStyleMaskResizable; - [cocoaView resizeWindow]; - [sender setState: NSControlStateValueOff]; - } + NSWindowStyleMask styleMask = [[cocoaView window] styleMask] ^ NSWindowStyleMaskResizable; + + [[cocoaView window] setStyleMask:styleMask]; + [sender setState:styleMask & NSWindowStyleMaskResizable ? NSControlStateValueOn : NSControlStateValueOff]; } - (void)toggleZoomInterpolation:(id) sender @@ -1638,7 +1632,7 @@ static void create_initial_menus(void) menu = [[NSMenu alloc] initWithTitle:@"View"]; [menu addItem: [[[NSMenuItem alloc] initWithTitle:@"Enter Fullscreen" action:@selector(doToggleFullScreen:) keyEquivalent:@"f"] autorelease]]; // Fullscreen menuItem = [[[NSMenuItem alloc] initWithTitle:@"Zoom To Fit" action:@selector(zoomToFit:) keyEquivalent:@""] autorelease]; - [menuItem setState: stretch_video ? NSControlStateValueOn : NSControlStateValueOff]; + [menuItem setState: [[cocoaView window] styleMask] & NSWindowStyleMaskResizable ? NSControlStateValueOn : NSControlStateValueOff]; [menu addItem: menuItem]; menuItem = [[[NSMenuItem alloc] initWithTitle:@"Zoom Interpolation" action:@selector(toggleZoomInterpolation:) keyEquivalent:@""] autorelease]; [menuItem setState: zoom_interpolation == kCGInterpolationLow ? NSControlStateValueOn : NSControlStateValueOff]; @@ -2027,7 +2021,6 @@ static void cocoa_display_init(DisplayState *ds, DisplayOptions *opts) } if (opts->u.cocoa.has_zoom_to_fit && opts->u.cocoa.zoom_to_fit) { - stretch_video = true; [cocoaView window].styleMask |= NSWindowStyleMaskResizable; }