Evaluate [normalWindow styleMask] & NSWindowStyleMaskResizable instead.
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
---
ui/cocoa.m | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/ui/cocoa.m b/ui/cocoa.m
index 1357690e50ca..05f7854f9819 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -103,7 +103,6 @@ static void cocoa_switch(DisplayChangeListener *dcl,
static int left_command_key_enabled = 1;
static bool swap_opt_cmd;
-static bool stretch_video;
static NSTextField *pauseLabel;
static bool allow_events;
@@ -1374,8 +1373,7 @@ - (void)showQEMUDoc:(id)sender
/* Stretches video to fit host monitor size */
- (void)zoomToFit:(id) sender
{
- stretch_video = !stretch_video;
- if (stretch_video == true) {
+ if (([normalWindow styleMask] & NSWindowStyleMaskResizable) == 0) {
[normalWindow setStyleMask:[normalWindow styleMask] | NSWindowStyleMaskResizable];
[sender setState: NSControlStateValueOn];
} else {
@@ -1647,7 +1645,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: [normalWindow styleMask] & NSWindowStyleMaskResizable ? NSControlStateValueOn : NSControlStateValueOff];
[menu addItem: menuItem];
menuItem = [[[NSMenuItem alloc] initWithTitle:@"View" action:nil keyEquivalent:@""] autorelease];
[menuItem setSubmenu:menu];
@@ -2040,7 +2038,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;
[normalWindow setStyleMask:[normalWindow styleMask] | NSWindowStyleMaskResizable];
}
--
2.43.0