From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Akihiko Odaki" <akihiko.odaki@daynix.com>,
"Rene Engel" <ReneEngel80@emailn.de>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Gerd Hoffmann" <kraxel@redhat.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>
Subject: [PULL 09/12] ui/cocoa: Remove normalWindow
Date: Tue, 5 Mar 2024 12:06:04 +0100 [thread overview]
Message-ID: <20240305110608.21618-10-philmd@linaro.org> (raw)
In-Reply-To: <20240305110608.21618-1-philmd@linaro.org>
From: Akihiko Odaki <akihiko.odaki@daynix.com>
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 <akihiko.odaki@daynix.com>
Tested-by: Rene Engel <ReneEngel80@emailn.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-ID: <20240224-cocoa-v12-7-e89f70bdda71@daynix.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
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];
--
2.41.0
next prev parent reply other threads:[~2024-03-05 11:09 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-05 11:05 [PULL 00/12] Cocoa patches for 2024-03-05 Philippe Mathieu-Daudé
2024-03-05 11:05 ` [PULL 01/12] ui/cocoa: add zoom-interpolation display option Philippe Mathieu-Daudé
2024-03-05 11:05 ` [PULL 02/12] ui/cocoa: Fix window clipping on macOS 14 Philippe Mathieu-Daudé
2024-03-05 11:05 ` [PULL 03/12] ui/cocoa: Split [-QemuCocoaView handleEventLocked:] Philippe Mathieu-Daudé
2024-03-05 11:05 ` [PULL 04/12] ui/cocoa: Immediately call [-QemuCocoaView handleMouseEvent:buttons:] Philippe Mathieu-Daudé
2024-03-05 11:06 ` [PULL 05/12] ui/cocoa: Release specific mouse buttons Philippe Mathieu-Daudé
2024-03-05 11:06 ` [PULL 06/12] ui/cocoa: Scale with NSView instead of Core Graphics Philippe Mathieu-Daudé
2024-03-05 11:06 ` [PULL 07/12] ui/cocoa: Fix pause label coordinates Philippe Mathieu-Daudé
2024-03-05 11:06 ` [PULL 08/12] ui/cocoa: Let the platform toggle fullscreen Philippe Mathieu-Daudé
2024-03-05 11:06 ` Philippe Mathieu-Daudé [this message]
2024-03-05 11:06 ` [PULL 10/12] ui/cocoa: Make window resizable Philippe Mathieu-Daudé
2024-03-05 11:06 ` [PULL 11/12] ui/cocoa: Call console_select() with the BQL Philippe Mathieu-Daudé
2024-03-05 11:06 ` [PULL 12/12] ui/cocoa: Remove stretch_video flag Philippe Mathieu-Daudé
2024-03-05 15:27 ` [PULL 00/12] Cocoa patches for 2024-03-05 Peter Maydell
2024-03-09 14:58 ` Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240305110608.21618-10-philmd@linaro.org \
--to=philmd@linaro.org \
--cc=ReneEngel80@emailn.de \
--cc=akihiko.odaki@daynix.com \
--cc=kraxel@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).