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

Tobias Pape Das.Linux at gmx.de
Thu Apr 7 07:38:25 UTC 2022

Hi Eliot

> On 7. Apr 2022, at 06:31, Eliot Miranda <eliot.miranda at gmail.com> wrote:
> On Wed, Apr 6, 2022 at 9:21 PM Eliot Miranda <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

Im on it

More information about the Vm-dev mailing list