From nobody Tue Nov 26 06:28:34 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1709636904; cv=none; d=zohomail.com; s=zohoarc; b=QGYSgvZ5nKga66hYLiS2kIMPGn5M2Gjruh2QdAPaPZKiKwdy+vrsTSfo8uDDlLONPUnWUZbF+J0Xab1RgMQGA8QeToVTSChMFwKe8bzews/80DNZHO449zlE8mbRPcj0B5q6DNeRzwRU9Cw4QYQgFGy/7BNoBOP3fcy1jSB/qHM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1709636904; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=o6n73qW0ydBRSB1J+ZYz20Ufnelrw0ubO1rh+yoO1Cs=; b=UxIXTzax/Bj8rkCG1qW7n3RwWLy9qBgPYiBtoLi6DEClfknFGpBOE3EECHMVUFywM4MzewYpPjZhIf7ADV4C41dge6MOR29jreCrl7zu1TrQVCLIwKM3REiwBed3RBG97Ylh6uFgdaXJ9C9PzaflMc/PsY++s1HK1PZASc12xCI= 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 1709636904705755.5288303549929; Tue, 5 Mar 2024 03:08:24 -0800 (PST) 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) 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) 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-Google-Smtp-Source: AGHT+IGsJ0xA5gp5PVLE4hvnhzm2/1SP6fLDnyp7I+pjOUCbEbIKp7wGAHBFhCbuSynMdoYC466y4w== 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Akihiko Odaki , Rene Engel , Peter Maydell , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1709636905276100003 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=C3=A9 --- 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 =3D 1; static bool swap_opt_cmd; =20 -static bool stretch_video; static CGInterpolationQuality zoom_interpolation =3D kCGInterpolationNone; static NSTextField *pauseLabel; =20 @@ -522,7 +521,7 @@ - (void) resizeWindow { [[self window] setContentAspectRatio:NSMakeSize(screen.width, screen.h= eight)]; =20 - if (!stretch_video) { + if (!([[self window] styleMask] & NSWindowStyleMaskResizable)) { [[self window] setContentSize:NSMakeSize(screen.width, screen.heig= ht)]; [[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 =3D !stretch_video; - if (stretch_video =3D=3D true) { - [cocoaView window].styleMask |=3D NSWindowStyleMaskResizable; - [sender setState: NSControlStateValueOn]; - } else { - [cocoaView window].styleMask &=3D ~NSWindowStyleMaskResizable; - [cocoaView resizeWindow]; - [sender setState: NSControlStateValueOff]; - } + NSWindowStyleMask styleMask =3D [[cocoaView window] styleMask] ^ NSWin= dowStyleMaskResizable; + + [[cocoaView window] setStyleMask:styleMask]; + [sender setState:styleMask & NSWindowStyleMaskResizable ? NSControlSta= teValueOn : NSControlStateValueOff]; } =20 - (void)toggleZoomInterpolation:(id) sender @@ -1638,7 +1632,7 @@ static void create_initial_menus(void) menu =3D [[NSMenu alloc] initWithTitle:@"View"]; [menu addItem: [[[NSMenuItem alloc] initWithTitle:@"Enter Fullscreen" = action:@selector(doToggleFullScreen:) keyEquivalent:@"f"] autorelease]]; //= Fullscreen menuItem =3D [[[NSMenuItem alloc] initWithTitle:@"Zoom To Fit" action:= @selector(zoomToFit:) keyEquivalent:@""] autorelease]; - [menuItem setState: stretch_video ? NSControlStateValueOn : NSControlS= tateValueOff]; + [menuItem setState: [[cocoaView window] styleMask] & NSWindowStyleMask= Resizable ? NSControlStateValueOn : NSControlStateValueOff]; [menu addItem: menuItem]; menuItem =3D [[[NSMenuItem alloc] initWithTitle:@"Zoom Interpolation" = action:@selector(toggleZoomInterpolation:) keyEquivalent:@""] autorelease]; [menuItem setState: zoom_interpolation =3D=3D kCGInterpolationLow ? NS= ControlStateValueOn : NSControlStateValueOff]; @@ -2027,7 +2021,6 @@ static void cocoa_display_init(DisplayState *ds, Disp= layOptions *opts) } =20 if (opts->u.cocoa.has_zoom_to_fit && opts->u.cocoa.zoom_to_fit) { - stretch_video =3D true; [cocoaView window].styleMask |=3D NSWindowStyleMaskResizable; } =20 --=20 2.41.0