From patchwork Tue Mar 5 11:06:04 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: 777976 Delivered-To: patch@linaro.org Received: by 2002:a5d:48c8:0:b0:33e:474f:8c56 with SMTP id p8csp372685wrs; Tue, 5 Mar 2024 03:09:19 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVeEvwLWwE/714CSPQ3BECqtXBTUhffCMa8l5ZWpcJzNES8ur256Uouo26A4/pjridLj2teTda2QfOywmRssffG X-Google-Smtp-Source: AGHT+IGKAfXSDGCOVaXF1IPxsW4xM+UVMVVYzK7koAPml6gwJsOrJBiT7i33hBqBNH16eaQP7Kpj X-Received: by 2002:a81:5243:0:b0:609:89b7:689b with SMTP id g64-20020a815243000000b0060989b7689bmr10813815ywb.16.1709636959137; Tue, 05 Mar 2024 03:09:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709636959; cv=none; d=google.com; s=arc-20160816; b=nEgBIQre7tpqnKnXPtQIMTV5tsN27UByihwT700rrcrJIlwOXT/k3iptzKCaF0e6ri LAWEt7UwKwiG3rN1FvkTTOZ+Wt3pHRoz4OC/oNj8UHKxdZyeizdODD+MMS4UL0WXZkrd G0jPPR4jg6lSHyAitb59lHCJq5GD/CLe1XwRouYv+G0tJK+AB4Y5aUUY4cf2Ht7r+gOm UZPrxPwLCmRfswXkAsH7n0jy6WOikQP0fW4+xp2OgS75cHtQQqrYF5C35k4jMTbra46l jPFpyyNk9+gScegQo/STr+ui0ErnkuWCJFhA54lmXGCvxFZ3I5o4PTHfZR6oEXSdCt3S HGyQ== 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=u6bEtJuwfbnOuuvRh3OE+y+ZReFgvS5n0cBCvwV1aiQ=; fh=lnLpXpuHHACtmFCFYDz84qQIx2RASFfAeprBY3P3HzE=; b=TXpFynlxRIJ2TSZ8fk9LfIYyetgi9bTBWVNn44JRo44J3V+DLrpuPm0700S1VGb+SX 6+wagf7t1nAP8qTQFJ87rg6RYUrXR1qjgH27jeHx0vYHaaw/wTztESfZ4Kth5Cbom4g3 1QnXRLcyIdRKAzFGjuRXD7eOaWYZ0VxzdlJYm414reAfTjfiDNADf84UXqaADhHp0OBx ZA7ck0f+1VhV+sco5WnvJiJy3tceMhizSJkeUe01R9mIXu/0ABSjMUvFvyakK6ME1qeF IT+CG+CUiUZV7b1aE9eEOes1woPzxbeU7cvlZvR22ipn7b3OsdWaysr1tnIdmnDyehLi IuFw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ez8TNzMn; 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 d15-20020ac85d8f000000b0042ef8746f3esi2915447qtx.772.2024.03.05.03.09.18 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Mar 2024 03:09:19 -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=Ez8TNzMn; 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 1rhSde-0000GW-1V; Tue, 05 Mar 2024 06:07:14 -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 1rhSdb-00007J-7W for qemu-devel@nongnu.org; Tue, 05 Mar 2024 06:07:11 -0500 Received: from mail-lf1-x132.google.com ([2a00:1450:4864:20::132]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rhSdZ-0002rB-85 for qemu-devel@nongnu.org; Tue, 05 Mar 2024 06:07:10 -0500 Received: by mail-lf1-x132.google.com with SMTP id 2adb3069b0e04-51341a5aafbso2539902e87.0 for ; Tue, 05 Mar 2024 03:07:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709636825; x=1710241625; 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=u6bEtJuwfbnOuuvRh3OE+y+ZReFgvS5n0cBCvwV1aiQ=; b=Ez8TNzMn9+LJ8pBSXIsfZQKMvqyLKbD9jWduzNxc2IKvY+5m013LTnJchbGQvpex7E EUDBev3y71CZIDS7KvS8MpDWIzsm1opvWPfCT9EX2NAqoK2grCiuCknoc7kjuknnBbyY t3idbmJ9kyyFMAUpMxUAHnVbTWedoRsguflnG3kglcp/nlubPB41CgSU4roJ3OyepKGN X6odDpjMYBEYoW7xyhTADBbdxuRtzmV/g+Pjl4VYvR0xQJnDwXT4r2J3E0mJShB6Yqz8 vIb8hYcNlKWSOG++ds2K7l/6+c4Any59BJ3+aXTmMSyWL1mCkVzGBYWKBAGS/ryeUCTR V+vg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709636825; x=1710241625; 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=u6bEtJuwfbnOuuvRh3OE+y+ZReFgvS5n0cBCvwV1aiQ=; b=OCvok0wwUKgxpQHrPkts/BUfEUBXQ8SkMfMEZk7bgyHtWLRUZNJLphByHNlc4QkPNU zI0izWem7z2TZKp7a7YTUvGb8pL0TajX8CeWv5KDGzN/wfYHEwG1C2WR2vLa/VRaB1zp rfg1ITa34B+8fUyHQaUlazhxrFVSkVzTYJDAX/4wEIPhuPAb4vUQ/rTPqp8ZqazYSosd hNrTg9pD0xteSER8uH/GB5k8cUC4FQahCC3fYtJ/Cg4/nx28S+9DqjLM2a212mJ/b5Wv 65Bv/n89Q+m2nnvDuBHuesk3RZg297CfsMbN1EnXupZaXJaCJwaexwBLmKsXYMoj6TLz uqIw== X-Gm-Message-State: AOJu0YzUVk7lQLoLfvKgxJj2A1jQWZ3HvKrAqNYqqcq/MljOr6cCVx64 er0fEQFJnQNfGBEozcIOt4phKpKnJeQEy7L9UPDzRPorBjoryZWbdO/bLjuB5bZ7iyXSJQtBCMI 2 X-Received: by 2002:a05:6512:551:b0:511:6a0b:1035 with SMTP id h17-20020a056512055100b005116a0b1035mr1018904lfl.17.1709636825185; Tue, 05 Mar 2024 03:07:05 -0800 (PST) Received: from m1x-phil.lan ([176.176.177.70]) by smtp.gmail.com with ESMTPSA id v23-20020a1709067d9700b00a42ee62b634sm5861402ejo.106.2024.03.05.03.07.03 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 05 Mar 2024 03:07:04 -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 09/12] ui/cocoa: Remove normalWindow Date: Tue, 5 Mar 2024 12:06:04 +0100 Message-ID: <20240305110608.21618-10-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::132; envelope-from=philmd@linaro.org; helo=mail-lf1-x132.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 QemuCocoaView used to have fullScreenWindow but now it's gone, so we do no longer have to call the window specifically "normalWindow". Instead, refer to it with [-QemuCocoaView window]. Signed-off-by: Akihiko Odaki Tested-by: Rene Engel Reviewed-by: Peter Maydell Message-ID: <20240224-cocoa-v12-7-e89f70bdda71@daynix.com> Signed-off-by: Philippe Mathieu-Daudé --- ui/cocoa.m | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/ui/cocoa.m b/ui/cocoa.m index 20d73098e2..a891e76345 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -93,7 +93,6 @@ static void cocoa_switch(DisplayChangeListener *dcl, static void cocoa_refresh(DisplayChangeListener *dcl); -static NSWindow *normalWindow; static const DisplayChangeListenerOps dcl_ops = { .dpy_name = "cocoa", .dpy_gfx_update = cocoa_update, @@ -1071,9 +1070,9 @@ - (void) grabMouse COCOA_DEBUG("QemuCocoaView: grabMouse\n"); if (qemu_name) - [normalWindow setTitle:[NSString stringWithFormat:@"QEMU %s - (Press " UC_CTRL_KEY " " UC_ALT_KEY " G to release Mouse)", qemu_name]]; + [[self window] setTitle:[NSString stringWithFormat:@"QEMU %s - (Press " UC_CTRL_KEY " " UC_ALT_KEY " G to release Mouse)", qemu_name]]; else - [normalWindow setTitle:@"QEMU - (Press " UC_CTRL_KEY " " UC_ALT_KEY " G to release Mouse)"]; + [[self window] setTitle:@"QEMU - (Press " UC_CTRL_KEY " " UC_ALT_KEY " G to release Mouse)"]; [self hideCursor]; CGAssociateMouseAndMouseCursorPosition(isAbsoluteEnabled); isMouseGrabbed = TRUE; // while isMouseGrabbed = TRUE, QemuCocoaApp sends all events to [cocoaView handleEvent:] @@ -1084,9 +1083,9 @@ - (void) ungrabMouse COCOA_DEBUG("QemuCocoaView: ungrabMouse\n"); if (qemu_name) - [normalWindow setTitle:[NSString stringWithFormat:@"QEMU %s", qemu_name]]; + [[self window] setTitle:[NSString stringWithFormat:@"QEMU %s", qemu_name]]; else - [normalWindow setTitle:@"QEMU"]; + [[self window] setTitle:@"QEMU"]; [self unhideCursor]; CGAssociateMouseAndMouseCursorPosition(TRUE); isMouseGrabbed = FALSE; @@ -1157,6 +1156,8 @@ - (void)adjustSpeed:(id)sender; @implementation QemuCocoaAppController - (id) init { + NSWindow *window; + COCOA_DEBUG("QemuCocoaAppController: init\n"); self = [super init]; @@ -1170,20 +1171,20 @@ - (id) init } // create a window - normalWindow = [[NSWindow alloc] initWithContentRect:[cocoaView frame] + window = [[NSWindow alloc] initWithContentRect:[cocoaView frame] styleMask:NSWindowStyleMaskTitled|NSWindowStyleMaskMiniaturizable|NSWindowStyleMaskClosable backing:NSBackingStoreBuffered defer:NO]; - if(!normalWindow) { + if(!window) { error_report("(cocoa) can't create window"); exit(1); } - [normalWindow setAcceptsMouseMovedEvents:YES]; - [normalWindow setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary]; - [normalWindow setTitle:qemu_name ? [NSString stringWithFormat:@"QEMU %s", qemu_name] : @"QEMU"]; - [normalWindow setContentView:cocoaView]; - [normalWindow makeKeyAndOrderFront:self]; - [normalWindow center]; - [normalWindow setDelegate: self]; + [window setAcceptsMouseMovedEvents:YES]; + [window setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary]; + [window setTitle:qemu_name ? [NSString stringWithFormat:@"QEMU %s", qemu_name] : @"QEMU"]; + [window setContentView:cocoaView]; + [window makeKeyAndOrderFront:self]; + [window center]; + [window setDelegate: self]; /* Used for displaying pause on the screen */ pauseLabel = [NSTextField new]; @@ -1306,7 +1307,7 @@ - (void) windowDidResignKey: (NSNotification *)aNotification */ - (void) doToggleFullScreen:(id)sender { - [normalWindow toggleFullScreen:sender]; + [[cocoaView window] toggleFullScreen:sender]; } - (void) setFullGrab:(id)sender @@ -2004,7 +2005,7 @@ static void cocoa_display_init(DisplayState *ds, DisplayOptions *opts) /* if fullscreen mode is to be used */ if (opts->has_full_screen && opts->full_screen) { - [normalWindow toggleFullScreen: nil]; + [[cocoaView window] toggleFullScreen: nil]; } if (opts->u.cocoa.has_full_grab && opts->u.cocoa.full_grab) { [controller setFullGrab: nil];