[squeak-dev] Screen background odd changes (was: Re: Setting default font breaks DefaultTextStyle font list)
tim Rowledge
tim at rowledge.org
Sun Apr 23 17:03:34 UTC 2017
> On 23-04-2017, at 3:31 AM, Bob Arning <arning315 at comcast.net> wrote:
>
> You might want to look at something like:
>
> setSystemFontTo: aFont
> "Establish the default text font and style"
>
> | aStyle newDefaultStyle |
> aFont ifNil: [^ self].
> aStyle := aFont textStyle ifNil: [^ self].
> newDefaultStyle := aStyle copy.
> newDefaultStyle defaultFontIndex: (aStyle fontIndexOf: aFont).
>
> UserInterfaceTheme current
> set: #standardSystemFont to: aFont;
> apply.
>
> TextStyle setDefault: newDefaultStyle.
> Flaps replaceToolsFlap.
> ScriptingSystem resetStandardPartsBin.
>
> which when you change the system font does an #apply of the current theme.
Yeah, I looked at that and simply assumed the #apply meant ‘apply the font change’ rather than ‘do approximately half a billion loops through all the objects in the image’. Really - applying a theme change finds all the plausible theme clients (656 in my image) and then for each one scans every object in the image to see if it needs altering. Thats ~750,000 objects and touching every one of them 650 times. I suspect we can improve that a bit. Admittedly this isn’t something done terribly often so it’s hardly a major performance bottleneck in daily life but imagine trying it in a *big* image that results in page thrashing.
At least we should consider using something like
self classesThatWantToPratAroundWithThemesDo: [cl|
cl allInstancesDo:[:inst|
inst applyUserInterfaceTheme]]
So the background thing becomes a little clearer; MorphicProject>applyUserInterfaceTheme checks to see if the world hasProperty: #hasCustomBackground - which in the ‘problem’ image it does not. Thus the #setWorldBackground: method goes through its somewhat convoluted checks and sets the background to the theme default. Since the #hasCustomBackground property is newly introduced as part of the theme stuff it is not too surprising that it wasn’t already set in an older image that got updated. I wouldn’t be too surprised if a similar change made for you r window size alterations.
tim
--
tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
...now touch these wires to your tongue!
More information about the Squeak-dev
mailing list
|