diff mbox series

[v11,4/6] ui/cocoa: Make window resizable

Message ID 20240217-cocoa-v11-4-0a17a7e534d4@daynix.com
State New
Headers show
Series ui/cocoa: Use NSWindow's ability to resize | expand

Commit Message

Akihiko Odaki Feb. 17, 2024, 11:18 a.m. UTC
The window will be resizable when zoom-to-fit is on.

Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
---
 ui/cocoa.m | 3 +++
 1 file changed, 3 insertions(+)

Comments

Peter Maydell Feb. 22, 2024, 4:50 p.m. UTC | #1
On Sat, 17 Feb 2024 at 11:19, Akihiko Odaki <akihiko.odaki@daynix.com> wrote:
>
> The window will be resizable when zoom-to-fit is on.
>
> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
> ---

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM
diff mbox series

Patch

diff --git a/ui/cocoa.m b/ui/cocoa.m
index 0ebe0f326373..17f290987563 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -1379,8 +1379,10 @@  - (void)zoomToFit:(id) sender
 {
     stretch_video = !stretch_video;
     if (stretch_video == true) {
+        [normalWindow setStyleMask:[normalWindow styleMask] | NSWindowStyleMaskResizable];
         [sender setState: NSControlStateValueOn];
     } else {
+        [normalWindow setStyleMask:[normalWindow styleMask] & ~NSWindowStyleMaskResizable];
         [cocoaView resizeWindow];
         [sender setState: NSControlStateValueOff];
     }
@@ -2033,6 +2035,7 @@  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];
     }
 
     create_initial_menus();