<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>The Incrementalist &#187; mac</title>
	<atom:link href="http://retrovirus.com/incr/category/mac/feed/" rel="self" type="application/rss+xml" />
	<link>http://retrovirus.com/incr</link>
	<description></description>
	<lastBuildDate>Sun, 02 Oct 2011 14:24:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Building LuaJava on Mac OS X</title>
		<link>http://retrovirus.com/incr/2005/08/building-luajava/</link>
		<comments>http://retrovirus.com/incr/2005/08/building-luajava/#comments</comments>
		<pubDate>Sun, 21 Aug 2005 18:48:29 +0000</pubDate>
		<dc:creator>Joe</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[lua]]></category>
		<category><![CDATA[mac]]></category>

		<guid isPermaLink="false">/?p=24</guid>
		<description><![CDATA[In my previous post about coroutines, I mentioned that I&#8217;d be looking into LuaJava (a bridge between Java and the Lua language) as a way to get coroutine behavior in a Java environment. Since I had some time this afternoon, &#8230; <a href="http://retrovirus.com/incr/2005/08/building-luajava/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>In my previous <a href="http://retrovirus.com/incr/2005/08/coroutines/">post about coroutines</a>, I mentioned that I&#8217;d be looking into <a href="http://www.keplerproject.org/luajava/">LuaJava</a> (a bridge between Java and the <a href="http://www.lua.org/">Lua</a> language) as a way to get coroutine behavior in a Java environment.  Since I had some time this afternoon, I decided to get LuaJava up and running on my PowerBook.  Here are some steps that you can follow to build LuaJava on Mac OS X 10.4.2 Tiger.  (I&#8217;ve also successfully tested these instructions on Mac OS X  10.3.9 Panther.)</p>

<p>LuaJava requires Lua 5.0, so first we need to download the <a href="http://www.lua.org/ftp/lua-5.0.tar.gz">Lua 5.0 source</a> and build it:</p>

<pre><code>% tar xzvf lua-5.0.tar.gz
% cd lua-5.0
% make
% sudo make install
</code></pre>

<p>Next, we need to build LuaJava.  Download <a href="http://luaforge.net/frs/download.php/947/luajava-1.0.tar.gz">LuaJava 1.0</a>, then extract it and switch to its directory:</p>

<pre><code>% tar xzvf luajava-1.0.tar.gz
% cd luajava-1.0
</code></pre>

<p>Since LuaJava&#8217;s <code>config</code> file comes set up for Linux by default, we need to edit it to Mac OS X-friendly settings.  Comment the following lines:</p>

<pre><code>#JDK= $(JAVA_HOME)
#LIB_EXT= .so
#LIB_OPTION= -shared
#DLLIB= -ldl
</code></pre>

<p>and uncomment the corresponding ones:</p>

<pre><code>JDK=/Library/Java/Home
LIB_EXT= .jnilib
LIB_OPTION= -dynamiclib -all_load
</code></pre>

<p>We also need to change the <code>LIB_LUA</code> line to read:</p>

<pre><code>LIB_LUA=/usr/local/lib/liblua.a /usr/local/lib/liblualib.a
</code></pre>

<p>With those changes in place, we can just type</p>

<pre><code>% make
</code></pre>

<p>and apart from a few JavaDoc warnings, everything should go smoothly.  To test it, we can fire up the LuaJava Console:</p>

<pre><code>% java -cp "luajava-1.0.jar" org.keplerproject.luajava.Console
API Lua Java - console mode.
&gt; print('Hello, world!')
Hello, world!
&gt; exit
</code></pre>

<p>OK, that looks good.  How about the included tests?</p>

<pre><code>% cd test
% ./runawttest.sh
% ./runswingtest.sh
</code></pre>

<p>Again, working fine.  There are a couple of other Lua test files in the <code>test</code> directory that we can run like so:</p>

<pre><code>% java -cp "../luajava-1.0.jar" -Djava.library.path=.. 
    org.keplerproject.luajava.Console testMemory.lua
</code></pre>

<p>(replace <code>testMemory.lua</code> with the name of the file you want to run)</p>

<p>OK, let&#8217;s try creating a program of our own.  There&#8217;s a decent Hello World on the <a href="http://www.keplerproject.org/luajava/examples.html">LuaJava examples page</a>, so (after switching back to the <code>luajava-1.0</code> directory), create the <code>Hello.java</code> and <code>hello.lua</code> files depicted on the examples page.  You&#8217;ll need to add an import line to the top of <code>Hello.java</code> so that Java knows where to find all the LuaJava objects:</p>

<pre><code>import org.keplerproject.luajava.*;
</code></pre>

<p>Once you have the files, compile the Java class:</p>

<pre><code>% javac -classpath luajava-1.0.jar Hello.java
</code></pre>

<p>Now run it:</p>

<pre><code>% java -cp luajava-1.0.jar:. Hello
</code></pre>

<p>If everything is working correctly, you should see:</p>

<pre><code>Hello World from Lua!
Hello World from Java!
</code></pre>

<p>Huzzah!  Now we have all the pieces we need to start embedding Lua functionality in Java code.</p>
]]></content:encoded>
			<wfw:commentRss>http://retrovirus.com/incr/2005/08/building-luajava/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Teleport</title>
		<link>http://retrovirus.com/incr/2005/08/teleport/</link>
		<comments>http://retrovirus.com/incr/2005/08/teleport/#comments</comments>
		<pubDate>Tue, 16 Aug 2005 14:05:13 +0000</pubDate>
		<dc:creator>Joe</dc:creator>
				<category><![CDATA[gui]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">/?p=22</guid>
		<description><![CDATA[The typical setup in my office is that I have my G5 powering two monitors front and center, and the powerbook beside them, on a (modified) iCurve for ergonomic viewing. While this is great for the displays, it leaves the &#8230; <a href="http://retrovirus.com/incr/2005/08/teleport/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.abyssoft.com/software/teleport/"><img src="http://retrovirus.com/incr/images/2005/teleport.jpg" alt="" border=0 /></a></p>

<p>The typical setup in my office is that I have my G5 powering two monitors front and center, and the powerbook beside them, on a (modified) <a href="http://www.griffintechnology.com/products/icurve/">iCurve</a> for ergonomic viewing.  While this is great for the displays, it leaves the problem of controlling the laptop.  At one point I had a KVM switch set up, but the hassle of plugging in a USB cable and flipping the switch led me to just type un-ergonomically on the laptop&#8217;s keyboard.</p>

<p>Then I came across <a href="http://synergy2.sourceforge.net/">Synergy</a>.  It&#8217;s a cross-platform tool that lets you send your keyboard and mouse commands to other machines on your network&#8211;sort of like VNC without the screen-sharing (since the other screen is right in front of you).  The Synergy team&#8217;s most brilliant innovation, though, is the interface for switching machines.  Basically, you can configure your machines so that when you roll your mouse pointer off the edge of one machine&#8217;s screen, it magically appears on the corresponding edge of a different machine&#8217;s screen.  You can roll your mouse from your Linux box across your Windows box over to your Mac in one smooth motion.  It&#8217;s like the way that multi-monitor setups work, except that under the hood it&#8217;s seamlessly switching to sending your input to another machine over the network.</p>

<p>I&#8217;ve been using Synergy for a few months now, but it&#8217;s not without its rough edges.  Last time I did it, configuration was a text-editing affair, though the <a href="http://software.landryhetu.com/synergy/">SynergyKM</a> preference pane add-on for Mac OS X makes things much more automatic.  I also tended to experience general glitchiness on OS X.  A vestigial mouse pointer would often remain on my main monitor, twitching distractingly, as I controlled the laptop.  It also didn&#8217;t handle modifier and function keys, meaning I still had to press the function keys on the laptop directly to trigger Exposé.</p>

<p>Enter <a href="http://www.abyssoft.com/software/teleport/">Teleport</a>.  While (or perhaps because) it&#8217;s Mac-only, it solves most of the problems I had with Synergy.  The configuration is a breeze (using Rendezvous AKA Bonjour), and input forwarding is smooth and comprehensive.  It also seems to automatically sync clipboards well, something that I was using Erik Lagercrantz&#8217;s <a href="http://www.lagercrantz.ath.cx/software/clipboardsharing/">ClipboardSharing</a> utility for until he failed to update it for Tiger.</p>

<p>So far, I only have a few minor critiques.  First, it doesn&#8217;t appear to allow you to put two remote screens side-by-side&#8211;the remote screens must be adjacent to the main computer&#8217;s screens.  Also, it seems to hit the disk every time I roll over the boundary between two machines, which is audibly distracting and causes an annoying delay in which mouse motion isn&#8217;t counted on the new screen.  Even so, I think it will be a part of my desktop setup from now on.  Thanks <a href="http://www.abyssoft.com/about/?s=resume.html">Julien</a>!</p>
]]></content:encoded>
			<wfw:commentRss>http://retrovirus.com/incr/2005/08/teleport/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tiger Dashboard: First Impressions</title>
		<link>http://retrovirus.com/incr/2005/05/dashboard-first-impressions/</link>
		<comments>http://retrovirus.com/incr/2005/05/dashboard-first-impressions/#comments</comments>
		<pubDate>Mon, 02 May 2005 16:10:35 +0000</pubDate>
		<dc:creator>Joe</dc:creator>
				<category><![CDATA[gui]]></category>
		<category><![CDATA[mac]]></category>

		<guid isPermaLink="false">/?p=20</guid>
		<description><![CDATA[When people install a new operating system, one of the first things they do is go poking around to see what&#8217;s different. With Tiger, one of the first things that they&#8217;re going to notice is Dashboard. Pedigree While Dashboard was &#8230; <a href="http://retrovirus.com/incr/2005/05/dashboard-first-impressions/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>When people install a new operating system, one of the first things they do is go poking around to see what&#8217;s different.  With <a href="http://www.apple.com/macosx/">Tiger</a>, one of the first things that they&#8217;re going to notice is <a href="http://www.apple.com/macosx/features/dashboard/">Dashboard</a>.</p>

<h3>Pedigree</h3>

<p>While Dashboard was immediately <a href="http://www.geekpatrol.ca/archives/2004/06/28/specialpatrolarlo.php">compared</a> to <a href="http://www.konfabulator.com/">Konfabulator</a> because of its visual, technical, and &#8220;widget&#8221; naming similarities, it also owes much to Apple&#8217;s old <a href="http://folklore.org/StoryView.py?project=Macintosh&amp;story=Desk_Ornaments.txt&amp;sortOrder=Sort%20by%20Date&amp;detail=medium&amp;search=desk%20accessories">Desk Accessories</a>, as John Gruber and others have <a href="http://daringfireball.net/2004/06/dashboard_vs_konfabulator">pointed out</a>.  I think of them as a new version of the old <a href="http://en.wikipedia.org/wiki/Terminate_and_Stay_Resident">Terminate and Stay Resident</a> programs popular on MS-DOS.  Generally, those programs didn&#8217;t live on the same screen as the main program you were using.  Instead, they popped up when you pressed a keyboard combination.  Apple&#8217;s design decision to put Dashboard widgets on a separate &#8220;layer&#8221; that you can call up makes them much more useful to me than Konfabulator, because there truly is never enough screen real estate, and the Konfabulator widgets immediately got smothered under other windows when I tried to use them.  (I should note that it&#8217;s also possible to <a href="http://www.macosxhints.com/article.php?story=20050422172929402">keep Dashboard widgets on your desktop</a>.)</p>

<h3>Development Simplicity</h3>

<p>Apple&#8217;s decision to make HTML/CSS/Javascript the lingua franca is Dashboard&#8217;s most interesting feature to me.  Konfabulator&#8217;s XML/Javascript environment came close, but Apple&#8217;s &#8220;lazy&#8221; decision to use their Safari WebKit engine means that many widgets can actually be developed and viewed in a browser.  (Many of the early posters on the <a href="http://dashboardwidgets.com/">Dashboard Widgets</a> site were clearly developing their widgets without any access to Tiger.)</p>

<p>Using standard technologies means that their developer population is the large set of people who already know how to develop using web standards.  Furthermore, given the recent buzz around &#8220;<a href="http://www.adaptivepath.com/publications/essays/archives/000385.php">Ajax</a>&#8221; web applications, Dashboard gives people like me another excuse teach myself data-driven Javascript programming.</p>

<p>By effectively turning Ajax into a GUI library for desktop apps, Dashboard almost fulfills the plan that Netscape appeared to be working towards in the late 1990s.  While many widgets will be little more than borderless self-refreshing web pages, it&#8217;s also possible to hook up a Dashboard interface to native code.  In Apple&#8217;s first Dashboard widget contest at WWDC 2004, the top prize went to a widget which put an HTML face on the <a href="http://www.gnu.org/software/gnugo/gnugo.html">GNU Go</a> game engine.</p>

<h3>Constency</h3>

<p>Dashboard isn&#8217;t all roses though.  For one, going to HTML-based interfaces makes it even easier for Apple to continue their recent trend of ignoring their own interface conventions whenever it suits their fancy.  (See brushed metal vs. aqua, the woodgrain GarageBand window, the non-standard sets of widgets in the new iPhoto.)  In several of the sample widgets that ship with Dashboard, they go to great lengths in Javascript to create properly-behaving milky-white scroll bars rather than simply using the standard ones:</p>

<p><img src="http://retrovirus.com/incr/images/2005/dashboard-scroll.jpg" width="400" height="142" /></p>

<p>Even so, the initial set of widgets that Apple shares largely consistent features: the aforementioned white scroll bars, a circled <i>i</i> which fades in to trigger a flip to the preferences side, rounded square widget icons, and a dark textured flip side with a large &#8220;Done&#8221; button.  It&#8217;ll be interesting to which, if any, of these features get adopted by the third-party widget community.</p>

<h3>What is it good for?</h3>

<p>In the initial burst of activity following Tiger&#8217;s release, there&#8217;s a lot of experimentation going on in the Dashboard world.  The best place to watch this happen is the <a href="http://www.dashboardwidgets.com/showcase/">Dashboard Widgets Showcase</a>, which seems to have captured the, uh, Tiger&#8217;s share of widget-writing activity.  From what I&#8217;ve seen so far, widgets generally fall into the following categories (from most to least useful):</p>

<ul>
<li><strong>Status Displays</strong> &#8212; These display some piece of information which changes relatively frequently, and which you want to see at a moment&#8217;s notice.  Examples include Apple&#8217;s weather and stock displays, the <a href="http://www.apple.com/downloads/macosx/dashboard/itunesconnectionmonitor.html">iTunes Connection Monitor</a>, and my <a href="http://www.apple.com/downloads/macosx/dashboard/bloglinesnotifier.html">Bloglines Notifier</a>.</li>
<li><strong>Handy Controls</strong> &#8212; These are small bits of functionality that people want to have ready access to&#8211;good examples here are Apple&#8217;s iTunes widget, Panic&#8217;s <a href="http://www.apple.com/downloads/macosx/dashboard/transmitftpwidget.html">Transmit FTP</a> widget, and the <a href="http://www.apple.com/downloads/macosx/dashboard/capture.html">Capture</a> screenshot tool.</li>
<li><strong>Games and Geegaws</strong> &#8212; Games and toys like <a href="http://www.apple.com/downloads/macosx/dashboard/minipatience.html">miniPatience</a>, <a href="http://www.apple.com/downloads/macosx/dashboard/hulagirl.html">Hula Girl</a>, and <a href="http://www.maya.com/web/what/what_cards.mtml">MAYA Cards</a>.  These don&#8217;t necessarily benefit from being on Dashboard, other than not crowding up your desktop, and being quickly dismissable when your boss walks by.</li>
</ul>

<h3>Baby Steps</h3>

<p>As first experiments with Dashboard, I&#8217;ve put together a few widgets of my own.  The first is <a href="http://retrovirus.com/software/#bloglines">Bloglines Notifier</a>, featuring a gorgeous visual design by <a href="http://smalltransport.com/">Jeremy Koempel</a>:</p>

<p><a href="http://retrovirus.com/software/#bloglines"><img src="http://retrovirus.com/software/bloglines/bloglines-screenshot.jpg" width="270px" height="97px" border="0"/></a></p>

<p>It&#8217;s very simple, showing you the unread posts in your <a href="http://bloglines.com">Bloglines</a> online RSS reader account, and giving you a button to go read them.  The other is <a href="http://www.maya.com/web/what/what_cards.mtml">a little promotional widget</a> that I cooked up with some of my co-workers at <a href="http://www.maya.com">MAYA Design</a>:</p>

<p><a href="http://www.maya.com/web/what/what_cards.mtml"><img src="http://retrovirus.com/incr/images/2005/mayacards-200.jpg" width="200px" height="153px" border="0"/></a></p>

<p>This one&#8217;s a virtual version of our customized playing cards that we give out as promo schwag.  Each one features a different pithy design quote which reflects our design philosophy.  This one came about when I realized that Dashboard&#8217;s flipping functionality would be a good match for playing cards.</p>

<p>I&#8217;ve got a couple others in the works, so keep watching this space&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://retrovirus.com/incr/2005/05/dashboard-first-impressions/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Multi-Pointer Gestures</title>
		<link>http://retrovirus.com/incr/2005/01/multi-pointer/</link>
		<comments>http://retrovirus.com/incr/2005/01/multi-pointer/#comments</comments>
		<pubDate>Mon, 31 Jan 2005 15:30:41 +0000</pubDate>
		<dc:creator>Joe</dc:creator>
				<category><![CDATA[gui]]></category>
		<category><![CDATA[mac]]></category>

		<guid isPermaLink="false">/?p=17</guid>
		<description><![CDATA[Apple released another bump in the Powerbook line this morning. Typical weekday release, still no G5, no big deal&#8212;right? Well, there was one thing that caught my eye: So what? We&#8217;ve had things like SideTrack to set aside sections of &#8230; <a href="http://retrovirus.com/incr/2005/01/multi-pointer/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Apple released another bump in the <a href="http://www.apple.com/powerbook/">Powerbook line</a> this morning.  Typical weekday release, still no G5, no big deal&#8212;right?  Well, there was one thing that caught my eye:</p>

<p><img src="http://retrovirus.com/incr/images/2005/multifinger.gif" alt="Trackpad Scroll" /></p>

<p>So what?  We&#8217;ve had things like <a href="http://www.ragingmenace.com/software/sidetrack/">SideTrack</a> to set aside sections of the trackpad for scrolling for some time now.</p>

<p><img src="http://retrovirus.com/incr/images/2005/twoarrows.jpg" alt="Two Arrows" /></p>

<p>Wait, <em>two</em> fingers, you say?</p>

<p>For the past 15 years or so, we&#8217;ve pretty much been stuck with a single cursor with a couple buttons as our narrow pipeline into the world behind the screen.  A few niche products and research projects have demonstrated the potential of multiple-pointer interaction.  For instance, a SIGGRAPH video that I once saw showed a user holding a virtual tool palette with one hand, and clicking through it with the other hand&#8217;s cursor.  It also made rectangular selection more fluid, with each pointer getting one opposite corner.  A company called <a href="http://www.fingerworks.com/">FingerWorks</a> has been selling keyboards and touchpads that can detect multiple fingers.  I&#8217;ve been curious, but they&#8217;re pricey and I&#8217;ve never found a demo unit that I could try for myself.  With such a tiny market, developers and OS makers have had little incentive to investigate the possibilities of multi-pointer interaction.</p>

<p>That&#8217;s why Apple&#8217;s addition, if I&#8217;m guessing correctly and they&#8217;re not just using some capacitance trick, stirs my imagination.  If they eventually move to multi-finger touchpads across their entire portable line, it&#8217;d be the first wide-scale deployment of a multi-pointer input device.  (Nintendo blew their chance with the DS&#8212;it&#8217;s disappointing that its touchscreen can only detect one finger at a time, since it would otherwise serve as a great reconfigurable controller.)</p>

<p>The operating system could still be a bottleneck.  I have no idea whether OS X can support multiple pointers under the hood&#8212;their initial use of the multi-finger gestures for things like scrolling is easy enough to do at the driver level.  But I hope that if they expand the use of the multi-finger trackpads, they&#8217;ll eventually expose it at the OS level.  I would love to have the additional expressiveness in my work.  For example, I could use it to solve the ambiguity of whether the user wants to drag a frame or something inside of it&#8212;in the latter case, you could just pin down the frame with one finger and grab the contained element to yank it off.  You could zoom in or out by grabbing a map at two points and bringing your fingers further apart or closer together (Hiroshi Ishii prototyped this behavior with phycons on a projection table).  Or you might express the difference between &#8220;move&#8221; and &#8220;copy&#8221; operations by whether the user grabbed the item with one or two fingers.</p>

<p>Who knows, maybe Apple could end up doing for multi-pointer input what they did for USB and WiFi.  Well, I can dream&#8230;</p>

<p><strong>Update:</strong> As it turns out, some earlier Powerbooks and iBooks (though, sadly, none in my household) have trackpads that support this feature.  On those machines, you can install a <a href="http://www-users.kawo2.rwth-aachen.de/~razzfazz/">driver mod</a> to enable two-finger scrolling capabilities.</p>

<p><strong>Update:</strong> Looks like I missed another interesting feature of the new Powerbooks: <a href="http://www.kernelthread.com/software/ams/">an accelerometer</a>!  Enterprising hackers have already found ways to tap into it from software, yielding a &#8220;tilt&#8221;-control <a href="http://interconnected.org/home/2005/03/04/apples_powerbook">iTunes interface</a>.  I think it&#8217;s an unwritten law of Mac software development that every Mac I/O device must eventually be hooked up to iTunes.</p>
]]></content:encoded>
			<wfw:commentRss>http://retrovirus.com/incr/2005/01/multi-pointer/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Mac OS X Graphic Performance Tidbits</title>
		<link>http://retrovirus.com/incr/2004/12/mac-os-x-graphic-performance-tidbits/</link>
		<comments>http://retrovirus.com/incr/2004/12/mac-os-x-graphic-performance-tidbits/#comments</comments>
		<pubDate>Fri, 24 Dec 2004 11:46:31 +0000</pubDate>
		<dc:creator>Joe</dc:creator>
				<category><![CDATA[gui]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[mac]]></category>

		<guid isPermaLink="false">/?p=11</guid>
		<description><![CDATA[Lately I&#8217;ve been digging into the details of the Mac OS X graphics subsystem, both because a lot of my (Java) code exercises it, and partly because I might be building something similar at some point. OS X owes its &#8230; <a href="http://retrovirus.com/incr/2004/12/mac-os-x-graphic-performance-tidbits/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><img src="http://retrovirus.com/incr/images/2004/quartzdebug.jpg" alt="Quartz Debug" width="300" height="216" /><br /></p>

<p>Lately I&#8217;ve been digging into the details of the Mac OS X graphics subsystem, both because a lot of my (Java) code exercises it, and partly because I might be building something similar at some point.</p>

<p>OS X owes its renowned visual stability to the fact that every single window is buffered; to be exact, drawing commands from programs are executed into offscreen buffers, which are flushed to the screen (with an eye to <a href="http://lists.apple.com/archives/carbon-development/2003/May/msg00828.html">where the CRT beam is</a>!) when <code>WaitNextEvent</code> or <code>QDFlushPortBuffer</code> are called.  Keeping a bitmap for each window is what allows OS X to sling windows around without visual glitching, even when applications are frozen up compeletely.  It is, of course, a <a href="http://arstechnica.com/reviews/01q4/macosx-10.1/macosx-10.1-6.html#window-server">very expensive</a> proposition in terms of the system RAM that it consumes.  It hadn&#8217;t sunk in for me before that every single open window, visible or not, eats up significant RAM&#8212;maybe that&#8217;ll convince me to close old windows a little more often, especially on my poor 640MB iBook.</p>

<p>The other thing that I had heard about before but hadn&#8217;t tried before is the Quartz Debug utility, which you&#8217;ll find in <code>/Developer/Applications/Performance Tools/Quartz Debug</code> if you have the Developer Tools installed on your machine.  If you run that and check off <code>Flash screen updates (yellow)</code> and <code>No delay after flash</code>, you&#8217;ll get a nice view into the workings of the graphics system, because any area of the screen buffer that changes will flash yellow.  One interesting thing that this makes apparent is an advantage that Safari has over Firefox: when scrolling, Safari updates only the newly-exposed area of the window, making for smoother scrolling than Firefox, which always redraws the whole content pane.  Another thing that it made obvious to me is how horribly inefficient some parts of the Geobrowser are in terms of redrawing things which haven&#8217;t changed visually&#8212;I need to be more conscientious about calling <code>repaint()</code> with an affected area and minding the clip rectangle in <code>paintComponent()</code>.  (It actually makes me happy to discover clear-cut avenues for optimization like that.)</p>

<p>I&#8217;m still looking for real nuts-and-bolts details on what happens during screen updates.  Here&#8217;s the mental model that I&#8217;ve pieced together so far:</p>

<ol>
<li>An application performs some drawing operations, which modify an offscreen window buffer #1</li>
<li>The application calls <code>QDFlushPortBuffer</code> with an affected region rectangle, which blocks while&#8230;</li>
<li>The affected region of the application window is blitted from buffer #1 to buffer #2 (the Window Server&#8217;s buffer for that window)</li>
<li>The affected region of the screen is re-composited by Quartz Compositor (Extreme or otherwise) and blitted to the frame buffer when the CRT beam or LCD refresh point is elsewhere</li>
</ol>

<p>If you know better and I&#8217;m getting some details wrong, don&#8217;t hesitate to comment.</p>
]]></content:encoded>
			<wfw:commentRss>http://retrovirus.com/incr/2004/12/mac-os-x-graphic-performance-tidbits/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

