From a3b23b946c85062ff6fbdcc3d1f10557715516e4 Mon Sep 17 00:00:00 2001 From: Akihiko Odaki Date: Wed, 4 Mar 2026 15:39:53 +0900 Subject: [PATCH] ui/cocoa: Do not automatically zoom for HiDPI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cocoa automatically zooms for a HiDPI display like Retina and makes the display blurry. Revert the automatic zooming. Signed-off-by: Akihiko Odaki Acked-by: Marc-André Lureau Message-ID: <20260304-zoom-v2-1-2eebf2b51106@rsg.ci.i.u-tokyo.ac.jp> Signed-off-by: Philippe Mathieu-Daudé --- ui/cocoa.m | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ui/cocoa.m b/ui/cocoa.m index 5b21fe3aea..9093d1e408 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -627,7 +627,10 @@ static CGEventRef handleTapEvent(CGEventTapProxy proxy, CGEventType type, CGEven [[self window] setContentAspectRatio:NSMakeSize(screen.width, screen.height)]; if (!([[self window] styleMask] & NSWindowStyleMaskResizable)) { - [[self window] setContentSize:NSMakeSize(screen.width, screen.height)]; + CGFloat width = screen.width / [[self window] backingScaleFactor]; + CGFloat height = screen.height / [[self window] backingScaleFactor]; + + [[self window] setContentSize:NSMakeSize(width, height)]; [[self window] center]; } else if ([[self window] styleMask] & NSWindowStyleMaskFullScreen) { [[self window] setContentSize:[self fixAspectRatio:[self screenSafeAreaSize]]]; @@ -685,8 +688,8 @@ static CGEventRef handleTapEvent(CGEventTapProxy proxy, CGEventType type, CGEven info.xoff = 0; info.yoff = 0; - info.width = frameSize.width; - info.height = frameSize.height; + info.width = frameSize.width * [[self window] backingScaleFactor]; + info.height = frameSize.height * [[self window] backingScaleFactor]; dpy_set_ui_info(dcl.con, &info, TRUE); }