Skip to content

Commit

Permalink
The DPI based computation of the screen scale factor is producing wro…
Browse files Browse the repository at this point in the history
…ng results in OS X, so disable this computation.

Also add a convenience method for setting the world morph scale factor property.
  • Loading branch information
ronsaldo committed Nov 17, 2020
1 parent af41f85 commit d914fe8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Morphic-Core/WorldMorph.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,11 @@ WorldMorph >> runStepMethods [

]

{ #category : #accessing }
WorldMorph >> scaleFactor: newScaleFactor [
self setProperty: #scaleFactor toValue: newScaleFactor
]

{ #category : #stepping }
WorldMorph >> startStepping: aMorph at: scheduledTime selector: aSelector arguments: args stepTime: stepTime [
worldState startStepping: aMorph at: scheduledTime selector: aSelector arguments: args stepTime: stepTime.
Expand Down
10 changes: 10 additions & 0 deletions src/OSWindow-SDL2/OSSDL2BackendWindow.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,16 @@ OSSDL2BackendWindow >> extent: newExtent [
{ #category : #private }
OSSDL2BackendWindow >> fetchDPI [
| displayIndex ddpi hdpi vdpi newDiagonalDPI newScreenScaleFactor |
"In OS X disable the computation of a DPI based scale factor. These values
are completely wrong and we are getting scale factors that are very large
even in non-retina display. This workaround does not affect the support for
retina display because that is handled by fetching the size of the drawing surface."
Smalltalk os isMacOSX ifTrue: [
diagonalDPI := verticalDPI := horizontalDPI := self screenScaleFactorBaseDPI.
screenScaleFactor := 1.0.
^ false
].

displayIndex := sdl2Window getDisplayIndex.
displayIndex < 0 ifTrue: [ ^ false ].

Expand Down

0 comments on commit d914fe8

Please sign in to comment.