squeak-smalltalk / squeak-object-memory

Issues and assets related to the Squeak object memory.
https://bugs.squeak.org
MIT License
11 stars 1 forks source link

Older trunk image incorrectly scaled up (Windows 10, 150% --> 225%) #27

Closed j4yk closed 2 years ago

j4yk commented 2 years ago

I just downloaded the new Squeak 6.0 beta all in one bundle (version 21772) and took the VM from it. When I use that VM to open a recent Trunk-based work image (at version 21736), a) it takes some time until the Squeak window actually appears, but that is not the main concern of this ticket; and b) the scale factor is changed automatically to 225%. This is incorrect because I already used the same image with scaling set to 150% on the same screen and operating environment.

Expectation: if the scaling is already set in the image to a value other than 100%, assume that this is what the user wants, and do not change the scaling automatically.

(For a fresh image, it is good if the scaling is set automatically from 100% to 150% in my case -- I did not even notice this contribution in the update stream, so I was a bit surprised.)

j4yk commented 2 years ago

Image

C:\Users\Jakob\HiDrive\Squot-trunk-64bit.1.image Squeak6.0alpha latest update: #21736 Current Change Set: Tonel change stamps Image format 68021 (64 bit) Preferred bytecode set: SistaV1

Virtual Machine

C:\Squeak\VMs\Squeak64\Squeak64.exe Open Smalltalk Cog[Spur] VM [CoInterpreterPrimitives VMMaker.oscog-mt.3184] Win32 built on May 11 2022 07:53:00 Compiler: Clang 14.0.0 platform sources revision VM: 202205110711 runneradmin@fv-az207-117:/d/a/opensmalltalk-vm/opensmalltalk-vm Date: Wed May 11 09:11:21 2022 CommitHash: 95dbe9d Plugins: 202205110711 runneradmin@fv-az207-117:/d/a/opensmalltalk-vm/opensmalltalk-vm CoInterpreter VMMaker.oscog-mt.3184 uuid: 57b61827-3f1a-ab45-966e-7c5caaef28d7 May 11 2022 StackToRegisterMappingCogit VMMaker.oscog-mt.3179 uuid: c6fbcb07-2a19-ed4f-8b40-9c119a70882a May 11 2022

j4yk commented 2 years ago

I can change the scale factor back to 150% manually, but then my windows seem to have been moved because of the different overall Squeak window size.

j4yk commented 2 years ago

When I open the image first in the older VM that I had previously, update to the latest Trunk version, and then open the image with the new VM, the same error appears (scale factor changed to 225%).

Depending on where the issue lies, this might be the only procedure to preserve one's window layout. If that turns out to be the case, please make it clear in the release notes of 6.0 that one has to do this.

j4yk commented 2 years ago

(When I scale back to 150%, save the image, then open the image again with the old VM, it automatically scales back to 100%...)

Old Virtual Machine

C:\Squeak\VMs\squeak.cog.spur_win64x64_202112022203\Squeak.exe Open Smalltalk Cog[Spur] VM [CoInterpreterPrimitives VMMaker.oscog-eem.3116] Win32 built on Dec 8 2021 18:12:56 Compiler: Clang 13.0.0 platform sources revision VM: 202112022203 runneradmin@fv-az82-636:/d/a/opensmalltalk-vm/opensmalltalk-vm Date: Thu Dec 2 14:03:25 2021 CommitHash: 6f2914e Plugins: 202112022203 runneradmin@fv-az82-636:/d/a/opensmalltalk-vm/opensmalltalk-vm CoInterpreter VMMaker.oscog-eem.3116 uuid: d757936e-c3f3-48be-9435-9a3a60b14615 Dec 8 2021 StackToRegisterMappingCogit VMMaker.oscog-eem.3114 uuid: 0522972d-531d-4f3a-9559-5c9bdbbf5427 Dec 8 2021

marceltaeumel commented 2 years ago

Expectation: if the scaling is already set in the image to a value other than 100%, assume that this is what the user wants, and do not change the scaling automatically.

That's exactly how it is implemented. The first time the primitiveScreenScaleFactor reports an actual value, the image will keep your current choice of scale factor. Well, we had this little timeframe in Trunk where that defaulted to 1.0 meaning that logic would break.

When I open the image first in the older VM that I had previously, update to the latest Trunk version, and then open the image with the new VM, the same error appears (scale factor changed to 225%).

Well, that is expected if the platform's scale factor changed between image start-ups. So, when you save your image on a platform scale 1.0 and an image scale 1.5 to then open it on a platform scale 2.0, the image scale will be 3.0.


We have no official support for running newer images on older VMs. Sorry.

j4yk commented 2 years ago

Well, I would like to not use the old VM anymore, but at the moment by opening the image in the new VM I lose my window geometry in the projects in that image! (And I have to adjust the scaling manually, but I could live with that.)

In the old VM, DisplayScreen actualScreenScaleFactor answers 1.0, in the new one it answers 1.5 (which correctly aligns with my Windows 10 settings) in the same image. So if I understand you correctly, from the image's point of view it looks like I switched to a different monitor and/or different OS scaling settings. Of course, I did no such thing, it is only the VM that is different.

Then a workaround should be that I open the image in the old VM, set the scale factor to 1.0, save, then open it in the new VM (and then run the Squeak update), right? But unfortunately even if I reduce the scale factor to 1.0, some windows are getting moved around... It looks like the Squeak window is shrunk before the positions and sizes are adjusted for the new scale factor. It should be the other way around (or happen atomically at the same time) to preserve the geometry on the display. Even when I maximize the Squeak window before the factor change, the window is forced out of the maximized state when the scale factor is changed, so this also does not help.

How to salvage my image and preserve the window geometry when migrating to the new VM and updating from Trunk? (Is there some intermediate VM version or Monticello version of a specific package via which I could try to go?)

j4yk commented 2 years ago

I think I have found a workaround:

  1. Open the image in the old VM
  2. Put Squeak in fullscreen mode
  3. Reset scaling to 100%. Because of fullscreen mode, the Squeak window will not be shrunk, so the window geometry stays.
  4. Save & quit
  5. Open the image in the new VM, it will automatically be scaled to 150%. Everything looks again like it did after step 1.
  6. Update Squeak...
marceltaeumel commented 2 years ago

You can also remove that automatic check in DisplayScreen class:

checkForNewScreenScaleFactor
   Display platformScaleFactor: DisplayScreen actualScreenScaleFactor.