On 10 Jan 2012, at 09:12, Fred Kiefer wrote: > On 10.01.2012 09:14, Richard Frith-Macdonald wrote: >> >> On 10 Jan 2012, at 04:54, Eric Wasylishen wrote: >> >>> I didn't like the current approach either… I just committed a >>> rewrite of how theme images are handled which gets rid of theme >>> proxies entirely, and eliminates the code in -[GSTheme activate] >>> and -[GSTheme deactivate] which were setting/restoring images. >>> >>> Now, when a name is set on an NSImage instance, it also subscribes >>> to the theme change notification. When an NSImage receives this >>> notification, it does the name-to-path lookup again that +[NSImage >>> imageNamed:] did, and reloads itself (discarding all reps) if the >>> path has changed. >>> >>> It's a fairly major change but I tested Gorm, GSTest, SimpleAgenda, >>> and tried switching between the GNUstep default theme, Neos, and >>> Etoile's Nesedah theme while the apps were running, and all images >>> seemed to update properly. >> >> The proxy approach was done so that cached references to images and >> copies of images would change when the theme changes, and we wouldn't >> need to go through the codebase changing all applications to either >> refrain from caching/copying named images, or be theme aware and >> refresh cached images when a theme changes. >> >> Unless you've done something I missed, this rewrite will have broken >> theming for any code which caches images rather than fetching them by >> name each time it needs to draw ... but this may not be an issue any >> more (we may have rewritten all such code to be theme aware by now) >> in the GUI, and being realistic, there are probably few enough gui >> apps that copy system images in existence, that we can ignore them. >> But ... it would make sense to go through the GUI code and look for >> any remaining cases where the change will have broken things (or just >> wait for bug reports I suppose). > > Richard, you may be missing the whole point of Eric's change. When you made > that proxy image change and I started criticising it we both didn't see the > obvious, that Eric easily spotted: NSImage itself is already a proxy! > His change now reuses the same NSImage object when the theme changes, but > stores the new NSImageReps in it. There still may be some minor flaws in the > code, but the basic concept sounds valid for me. The only thing about it that > I cannot stand is that I did not see it myself :-)
Yes ... I missed the fact that this change effectively makes an image into a proxy by having it completely reinitialise itself. That certainly copes with all those cases where people have retained instances of the system image. It's great. _______________________________________________ Gnustep-dev mailing list [email protected] https://lists.gnu.org/mailman/listinfo/gnustep-dev
