Over the last few days I've been adjusting BottomFeeder (and related code) to deal with the performance issues associated with using DoubleBufferingWindowDisplayPolicy on OS X. First, I just got rid of all the usage in my code, period - which fixed the problems on OS X, but led to problems in X11. Then I looked at #damageRepairPoliicy: in ScheduledWindow, and thought about hacking that.
The trouble is, that's invasive, and affects the whole system. Interestingly, after trying that, I noticed a lot of flashing in the little publishing animation that's used. So instead, I hit on this: I created a new package, a WindowRepairPolicy namespace, and my own DoubleBufferingWindowDisplayPolicy class. Here's how buffering is normally turned on, in #postOpenWith:
builder window damageRepairPolicy: DoubleBufferingWindowDisplayPolicy new.
To change my own apps without changing system code, I made #new in the new class look like this:
new
"answer the right policy"
| cls |
cls := ('*MacOSX' match: ExternalInterface currentPlatform last)
ifTrue: [UI.WindowDisplayPolicy]
ifFalse: [UI.DoubleBufferingWindowDisplayPolicy].
^cls new
And then changed my apps to use code like this:
builder window damageRepairPolicy:
WindowRepairPolicy.DoubleBufferingWindowDisplayPolicy new.
No system level hacks, and all of my code works the way I want it to, on all platforms.
Technorati Tags:
visualworks, osx, mac