[Vm-dev] multiple monitors with different backingScaleFactors on MacOS X

Marcel Taeumel marcel.taeumel at hpi.de
Thu Apr 7 07:34:27 UTC 2022


Hi Eliot --

The contract is to rely on the image side to poll both scale factor and screen size and react to changes. Everything is in place. Squeak can even detect for a changed platform scale factor whether the OS already did resize the window.

We just need to merge krono/highdpi-v2 which we are about to do. :-) Then, #actualScreenScaleFactor will be accessible from the image.

Until then, just change the scale factor manually in Squeak via Extras > Scale Factor.

Best,
Marcel

P.S.: As always, a purely event-driven system would be the way to go. However, we rely on polling for a changed screen size so we do as well for a changed platform scale factor (here on macOS: backing scale factor).

Am 07.04.2022 06:31:40 schrieb Eliot Miranda <eliot.miranda at gmail.com>:
On Wed, Apr 6, 2022 at 9:21 PM Eliot Miranda
wrote:

> Hi Marcel, Tobias, Ronie,
>
> I'm using an M1 laptop with a retina display (RD), which has a pixel
> extent of 3456 at 2234 and a scale factor of 2, hence giving an effective
> extent of 1728 at 1117. I have a now old Cinema DIsplay (CD) attached,
> which has a pixel extent of 2560 at 1440 and a scale factor of 1. When
> either the image opens on the CD, or is dragged from the RD to the CD, it
> ends up half the desired Smalltalk extent (the one saved in the image
> header, used to set the screen size form within Squeak etc).
>
> If I comment out the line sending convertRectFromBacking:
> in platforms/iOS/vm/OSX/SqueakOSXAppDelegate.m::setupWindow it no longer
> does this:
>
> NSRect resetFrame;
> resetFrame.origin.x = 0.0f;
> resetFrame.origin.y = 0.0f;
> resetFrame.size.width = width;
> resetFrame.size.height = height;
> #if 0 // Doing this results in a half sized window on a retina display with
> // a backingScalefactor of two
> resetFrame = [[self mainView] convertRectFromBacking: resetFrame];
> #endif
>
> NSSize sizeOfWindowContent = resetFrame.size;
> [gDelegateApp.window setContentSize: sizeOfWindowContent];
>
> Clearly this is the wrong thing to do. But something similar needs to
> happen when dragging a window from on display to another that
> have different scale factors.
>
> My question is where does this happen, or perhaps where should this
> happen? Presumably it's somewhere in the event handling code that allows
> the window to be moved.
>

I've found this. The iOS code doesn't listen for
thewindowDidChangeBackingProperties: notification. Where do we plum this
in?

https://developer.apple.com/documentation/appkit/nswindowdelegate/1419517-windowdidchangebackingproperties?language=objc

> _,,,^..^,,,_
> best, Eliot
>


--
_,,,^..^,,,_
best, Eliot



On Wed, Apr 6, 2022 at 9:21 PM Eliot Miranda <eliot.miranda at gmail.com [mailto:eliot.miranda at gmail.com]> wrote:

Hi Marcel, Tobias, Ronie,

    I'm using an M1 laptop with a retina display (RD), which has a pixel extent of 3456 at 2234 and a scale factor of 2, hence giving an effective extent of 1728 at 1117.  I have a now old Cinema DIsplay (CD) attached, which has a pixel extent of 2560 at 1440 and a scale factor of 1.  When either the image opens on the CD, or is dragged from the RD to the CD, it ends up half the desired Smalltalk extent (the one saved in the image header, used to set the screen size form within Squeak etc).

If I comment out the line sending convertRectFromBacking: in platforms/iOS/vm/OSX/SqueakOSXAppDelegate.m::setupWindow it no longer does this:

    NSRect resetFrame;
    resetFrame.origin.x = 0.0f;
    resetFrame.origin.y = 0.0f;
    resetFrame.size.width = width;
    resetFrame.size.height = height;
#if 0 // Doing this results in a half sized window on a retina display with
    // a backingScalefactor of two
    resetFrame = [[self mainView] convertRectFromBacking: resetFrame];
#endif

    NSSize sizeOfWindowContent = resetFrame.size;
    [gDelegateApp.window setContentSize: sizeOfWindowContent];


Clearly this is the wrong thing to do.  But something similar needs to happen when dragging a window from on display to another that have different scale factors.

My question is where does this happen, or perhaps where should this happen?  Presumably it's somewhere in the event handling code that allows the window to be moved.

I've found this.  The iOS code doesn't listen for thewindowDidChangeBackingProperties: notification.  Where do we plum this in?

https://developer.apple.com/documentation/appkit/nswindowdelegate/1419517-windowdidchangebackingproperties?language=objc [https://developer.apple.com/documentation/appkit/nswindowdelegate/1419517-windowdidchangebackingproperties?language=objc]
_,,,^..^,,,_

best, Eliot



--

_,,,^..^,,,_

best, Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20220407/470bb42e/attachment.html>


More information about the Vm-dev mailing list