From nobody Wed Nov 27 12:32:16 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1698242716; cv=none; d=zohomail.com; s=zohoarc; b=OoeMINE7OzRGSe8FAfdcDLKGAWlxMjHguuD+P0rArC2xp0CTj0EbiqlefaNeSGJAih7BokNsLatTX1pqtajA03NWFEPSVcXk65pN9rTs5Ben7/vQWdhAx0IfYakEpUpbYemugLLCHY8to56sVt7dNjYvlTKRhEySSTwlulp0Koc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1698242716; h=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=/SXdcp1LT8ZlY84+M35TdkDbvAz1Zap45bhOkLjSmgc=; b=ikB4ThtKaGR6OaMcKM//XeKsc5T+kmZN1p8kjlL8sZB/Oa29FditpWadHsN1XB4EX+C6vQIoIR0XAMmD8+Rc5l0I5foCEUwUXmgoqhnf0xZAe8u7RD7wfE9mx5S70+dNiwdD6CkPt9AR0ch09XHPHYdoGQpD6ZQtXLA7Wp/+bl0= 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 1698242716706154.56447431551726; Wed, 25 Oct 2023 07:05:16 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qveVU-0000Di-76; Wed, 25 Oct 2023 10:05: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 1qveVO-0000CG-Pl; Wed, 25 Oct 2023 10:05:06 -0400 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qveVH-0006Rr-1h; Wed, 25 Oct 2023 10:05:05 -0400 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-32d8c2c6dfdso3644932f8f.1; Wed, 25 Oct 2023 07:04:57 -0700 (PDT) Received: from localhost.localdomain (host86-185-6-213.range86-185.btcentralplus.com. [86.185.6.213]) by smtp.googlemail.com with ESMTPSA id d17-20020a5d6451000000b0032da022855fsm12103044wrw.111.2023.10.25.07.04.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 07:04:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698242696; x=1698847496; darn=nongnu.org; h=content-transfer-encoding:signed-off-by:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=/SXdcp1LT8ZlY84+M35TdkDbvAz1Zap45bhOkLjSmgc=; b=c0iNEHxFAuhYg93zeXipcEQglxyAwT49+FzICBqfqfTtWBoc5YCUv6bjz3W9yaeeeg JISp0wTT6+VN4/m5qLmPZVPPOH3JSuVt2pu7gVFMu8CkAK8u3p13DvtuGyx00yR5OgTp FDnT0p/tn3GQws5lrdzVc1Td12UTfi7/7cpkJ8QeBoSlKmen2WQ7p/PsQDgniEFfnjj5 9O+EwmdjCw5vx/hsfpU+H1HH1JHbDol35/OoS2x1dV91Qz4v+K0SuHAYIhuKoicVBFZi +cWozBkpKOw9Q7bCmSktYwHLg5wQ5eoh/DSqUCrpWQV1etrNf2JMXocNA8uVfI5Av0L9 SiWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698242696; x=1698847496; h=content-transfer-encoding:signed-off-by: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=/SXdcp1LT8ZlY84+M35TdkDbvAz1Zap45bhOkLjSmgc=; b=N0gHOb8JWJizDQwleIUJiE9xNtLkYNOMpftvA2loqy3IUs1jiRh4l58ZcGH8zshD9u wcGw6P2yTFBGXDztTQ09HjJUXsGOTgS47Vc82A2a25GntJMtjRXxFSrZTMYm1EbXvT4A ZsxNBsPtb8U0UFPpchy3fmdHB0AxOt3gtGfaNMkLsHM7Il4Wp0V11c7v5KdOXOstgkkt 1VcDFXbJAbcC1K5yFGRYNj6E36p1LEUcSQJ1PY197nryanTAU8wc5nVJ3FqgrE5gUL7x g9Hk4UmDAGvu+iKVLFiyMmMKdC0xXKOXASSb4M0cSicgYq/sBdtnM6H+aqkThbmFHY+f qvGQ== X-Gm-Message-State: AOJu0Yw6aEpARwlTrqK1PvaLQ1F4EsPF/V7y+YLim/IxLRvoAs7k/NWi FS9e51MST27j1sib4UuBhE7cOwV0/vo= X-Google-Smtp-Source: AGHT+IGvTEdsBwFHKcT2R8yRPYljR11LGrzIDY7l1xxL3cn8vGSqflO6EbPtBSARD3bypOX6SPZQBA== X-Received: by 2002:adf:db44:0:b0:32d:a7c8:eaf7 with SMTP id f4-20020adfdb44000000b0032da7c8eaf7mr11450764wrj.20.1698242696120; Wed, 25 Oct 2023 07:04:56 -0700 (PDT) From: carwynellis@gmail.com To: qemu-devel@nongnu.org Cc: qemu-trivial@nongnu.org, peter.maydell@linaro.org, philmd@linaro.org, akihiko.odaki@daynix.com, Carwyn Ellis Subject: [PATCH 1/1] ui/cocoa: add full-screen-scaling display option Date: Wed, 25 Oct 2023 15:04:43 +0100 Message-ID: <20231025140443.68520-2-carwynellis@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231025140443.68520-1-carwynellis@gmail.com> References: <20231025140443.68520-1-carwynellis@gmail.com> MIME-Version: 1.0 Signed-off-by: Carwyn Ellis 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::430; envelope-from=carwynellis@gmail.com; helo=mail-wr1-x430.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 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 @gmail.com) X-ZM-MESSAGEID: 1698242717352100001 Content-Type: text/plain; charset="utf-8" From: Carwyn Ellis Provides a display option, full-screen-scaling, that enables scaling of the display when full-screen mode is enabled. Also ensures that the corresponding menu item is marked as enabled when the option is set to on. --- qapi/ui.json | 6 +++++- ui/cocoa.m | 33 ++++++++++++++++++++------------- 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/qapi/ui.json b/qapi/ui.json index 006616aa77..9035b230ce 100644 --- a/qapi/ui.json +++ b/qapi/ui.json @@ -1409,13 +1409,17 @@ # codes match their position on non-Mac keyboards and you can use # Meta/Super and Alt where you expect them. (default: off) # +# @full-screen-scaling: Scale display to fit when full-screen enabled. +# Defaults to "off". +# # Since: 7.0 ## { 'struct': 'DisplayCocoa', 'data': { '*left-command-key': 'bool', '*full-grab': 'bool', - '*swap-opt-cmd': 'bool' + '*swap-opt-cmd': 'bool', + '*full-screen-scaling': 'bool' } } =20 ## diff --git a/ui/cocoa.m b/ui/cocoa.m index d95276013c..7ddc4de174 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -1671,7 +1671,9 @@ static void create_initial_menus(void) // View menu menu =3D [[NSMenu alloc] initWithTitle:@"View"]; [menu addItem: [[[NSMenuItem alloc] initWithTitle:@"Enter Fullscreen" = action:@selector(doToggleFullScreen:) keyEquivalent:@"f"] autorelease]]; //= Fullscreen - [menu addItem: [[[NSMenuItem alloc] initWithTitle:@"Zoom To Fit" actio= n:@selector(zoomToFit:) keyEquivalent:@""] autorelease]]; + menuItem =3D [[[NSMenuItem alloc] initWithTitle:@"Zoom To Fit" action:= @selector(zoomToFit:) keyEquivalent:@""] autorelease]; + [menuItem setState: (stretch_video) ? NSControlStateValueOn : NSContro= lStateValueOff]; + [menu addItem: menuItem]; menuItem =3D [[[NSMenuItem alloc] initWithTitle:@"View" action:nil key= Equivalent:@""] autorelease]; [menuItem setSubmenu:menu]; [[NSApp mainMenu] addItem:menuItem]; @@ -2041,18 +2043,6 @@ static void cocoa_display_init(DisplayState *ds, Dis= playOptions *opts) =20 [QemuApplication sharedApplication]; =20 - create_initial_menus(); - - /* - * Create the menu entries which depend on QEMU state (for consoles - * and removable devices). These make calls back into QEMU functions, - * which is OK because at this point we know that the second thread - * holds the iothread lock and is synchronously waiting for us to - * finish. - */ - add_console_menu_entries(); - addRemovableDevicesMenuItems(); - // Create an Application controller QemuCocoaAppController *controller =3D [[QemuCocoaAppController alloc]= init]; [NSApp setDelegate:controller]; @@ -2062,6 +2052,7 @@ static void cocoa_display_init(DisplayState *ds, Disp= layOptions *opts) [NSApp activateIgnoringOtherApps: YES]; [controller toggleFullScreen: nil]; } + if (opts->u.cocoa.has_full_grab && opts->u.cocoa.full_grab) { [controller setFullGrab: nil]; } @@ -2077,6 +2068,22 @@ static void cocoa_display_init(DisplayState *ds, Dis= playOptions *opts) left_command_key_enabled =3D 0; } =20 + if (opts->u.cocoa.has_full_screen_scaling && opts->u.cocoa.full_screen= _scaling) { + stretch_video =3D true; + } + + create_initial_menus(); + /* + * Create the menu entries which depend on QEMU state (for consoles + * and removable devices). These make calls back into QEMU functions, + * which is OK because at this point we know that the second thread + * holds the iothread lock and is synchronously waiting for us to + * finish. + */ + add_console_menu_entries(); + addRemovableDevicesMenuItems(); + + // register vga output callbacks register_displaychangelistener(&dcl); =20 --=20 2.42.0