[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] ui/cocoa: Do not automatically zoom for HiDPI
From: |
Peter Maydell |
Subject: |
Re: [PATCH] ui/cocoa: Do not automatically zoom for HiDPI |
Date: |
Fri, 22 Mar 2024 13:06:50 +0000 |
On Mon, 18 Mar 2024 at 09:02, Akihiko Odaki <akihiko.odaki@daynix.com> wrote:
>
> Cocoa automatically zooms for a HiDPI display like Retina and makes
> the display blurry. Revert the automatic zooming.
>
> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
> ---
> ui/cocoa.m | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/ui/cocoa.m b/ui/cocoa.m
> index fa879d7dcd4b..c5b3c28000ff 100644
> --- a/ui/cocoa.m
> +++ b/ui/cocoa.m
> @@ -522,7 +522,10 @@ - (void) resizeWindow
> [[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 screenSafeAreaSize]];
> @@ -575,8 +578,8 @@ - (void) updateUIInfoLocked
>
> 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);
> }
Could we / should we use convertRectToBacking and convertRectFromBacking
rather than doing the multiply/divide ourselves? The docs seem to
recommend against directly using backingScaleFactor when possible.
thanks
-- PMM