Universal Binary Widget

The Watershed What‘s OnWidget is now a Universal Binary

We have a few MacOS X applications, written against the Cocoa frameworks, that are used internally. Until very recently we didn't have any Intel Macintoshes. No problem so far.

In his keynote at WWDC 2005, Steve Jobs announced that Intel Macintoshes would ship by summer 2006 and almost all developers assumed this meant shipping in summer 2006. So when Apple announced the new Core Duo iMac and MacBook Pro in January it was a bit of a surprise. Still the only 'native' Macintosh software that was anything near public was a Dashboard Widget. Widgets are primarily HTML, CSS & Javascript. No problem so far.

The Widget started out as an experiment/toy not long after the first developer previews of Tiger were released in 2004. Almost all of the work was done and the Widget had been hanging around for over a year with no work done on it. A link(commented out) has been present in the Accessing Calendar Data page in the Watershed site since the site's redevelopment.

Unfortunately, the Widget uses a couple of plug-ins to provide some of its functionality:

  • a widget plug-in, Watershed Utilities, is used to bridge Javascript into the Address Book;
  • a webkit browser plug-in, RippleSelector, displays the thumbnails and draws the Core Image ripple transitions.

The Widget, not being a 'standard' desktop application, had escaped my attention when looking for projects that needed to be re-built as Universal Binaries.

I didn't envision any problems building the Universal versions of the plug-ins as Apple had advised that in most cases it was just a checkbox tick. The WatershedUtilities plug-in re-built and worked as advertised. The RippleSelector plug-in was a little more trouble. I should explain that the build-run-debug cycle was slightly more convoluted than usal:

  1. compile and link on my PPC PowerBook
  2. install the plugin into a Widget bundle in my public folder
  3. walk across the office to Maddie's Core Duo iMac
  4. launch Dashboard and the Widget from my mounted public folder
  5. wait for the Widget to launch, get the SOAP results and crash

Eventually I tracked down the problem to a method that dealt with calculating the layout and positions of the thumbnails in the view. The method -(int)batchCount; calculates the number of batches required to display all the thumbnails and.contains a line something like:

if (batchVolume % [items count])...

The number of events is rarely 0, apart from Christmas Day, Boxing Day... and the time window between when the plug-in is first drawn to the screen and when the results of the Javascript XMLHttpRequest SOAP call are returned. This isn't a problem because zero events means zero batches required. Exept when running on an Intel chip; zero batches means crash.

So the moral of this story is:
/0
ppc - OK
i386 - BAD

The Universal Binary version of thc Watershed widget is fixed now and can now be downloaded.

|

odds&ends…
Benjamin Miller