iTunes and window layering

Posted by Pierre Igot in: iTunes, Macintosh
November 29th, 2005 • 9:56 am

This is a long-standing issue in Mac OS X and it doesn’t look like it’s going away any time soon. Quite the contrary. As far as I can tell, it’s just become even worse.

The problem is with what happens to the iTunes window when you insert an audio CD for the first time and iTunes retrieves the CD information and track titles from the CDDB.

If iTunes is in the foreground and you insert your audio CD and wait for it to mount and wait for iTunes to retrieve the track information from the CDDB before you do anything, then everything works as expected. iTunes retrieves the track information, updates the CD information in its main window accordingly, and all is well.

But it also looks like this—i.e. staying with iTunes in the foreground during the whole process—is the only scenario that Apple has considered in its testing.

What Apple seems to have completely ignored is that some of us Mac OS X users simply do not like to wait. When we are faced with a computing task that we know is going to take some time—and mounting a CD is something that will always take time, simply because of the intrinsic slowness of CD drivers and of Mac OS X’s own mounting process—instead of waiting we switch to something else.

Why do we switch to something else? Because we can. Mac OS X is an operating system optimized for multi-tasking. Mac OS X is an operating system designed in a way that enables us to waste as little time as possible waiting for our computer to complete its tasks. While this audio CD is slowly mounting, I am allowed to switch to Mail to write an e-mail or to Safari to read a couple of web pages or to Word to continue to work on a couple of documents that I am currently working on.

And that’s where the problem surfaces. When I switch away from iTunes while Mac OS X is mounting a new audio CD and getting its track information, iTunes should complete its tasks in the background without interfering with what I am now doing in another application.

Unfortunately, it does interfere, and it does so by screwing up the window layering scheme in Mac OS X. Say I insert an audio CD, and then switch from iTunes to Word, where I currently have two document windows side by side. The window layering order is now as follows:

  1. Word document window A
  2. Word document window B
  3. iTunes window

Word document window A is the foreground window. Word document window B is a background window, but it’s in the background within the foreground application, i.e. Word. The iTunes window is in the background behind all this.

Yet as soon as iTunes retrieves the track information from the CDDB, it updates the contents of its window accordingly and… the iTunes window comes in front of Word document window B! In other words, after iTunes has retrieved the CDDB information, the window layering becomes this:

  1. Word document window A
  2. iTunes window
  3. Word document window B

Word document window A is still the foreground window, but the iTunes window is now in front of Word document window B, hiding it from me!

There is no possible justification for such a behaviour. I am in Word, I am working on my Word documents, and there’s nothing in my behaviour that indicated to Mac OS X that I actually want to see the refreshed iTunes window come before my background Word document window. If I want to see the updated iTunes window, I will switch back to iTunes, thank you very much.

As far as I can tell, this is a long-standing problem with iTunes in Mac OS X. I reported it to Apple as a bug a long time ago, during the AppleSeed program for Mac OS X 10.4. They acknowledged the issue and, if I remember correctly, it was fixed at some stage, for some build of the OS. But obviously it’s something that can easily become broken again if Apple’s engineers are not careful, but it’s very much broken again now.

It’s actually worse than it used to be. I have just experienced a situation where Mac OS X did something even worse. After I inserted an audio CD and switched from iTunes to Safari, when Mac OS X refreshed the iTunes window, it actually moved another window from a totally unrelated application (it was NetNewsWire) in front of my background windows in Safari!

This window layering scheme is completely screwed up. I am a big fan of document-centric computing, and I have absolutely nothing against the Mac OS X window layering scheme in principle. I am perfectly fine with the fact that clicking on a background window brings only that window to the foreground, and not all the other windows of the parent application as well.

But this problem with iTunes is a bug. It’s not a feature. And it’s been around for far too long. By not fixing it, Apple is sending the wrong signal. It’s saying, “Yeah, we do offer a true multi-tasking environment, but we don’t really want you to use it. When you are in iTunes and Mac OS X is in the process of mounting a CD and retrieving its track information, you should stay in iTunes and wait until it refreshes its window. Don’t switch to another application in the middle of this process.”

It’s the same with the similar window layering problem when using the “Cycle Through Windows” command, which I have already described here.

These problems need to be fixed, and they need to be fixed now.

5 Responses to “iTunes and window layering”

  1. ssp says:


    This one is really hard to pin down. Are you sure it’s iTunes specific? My impression so far was that it’s just the usual quirkyness (or brokenness) of OSX’s window layering. Particularly those window reorderings which move some windows behind others for no good reason give me the creeps.

  2. Pierre Igot says:

    This particular problem is definitely iTunes-specific, but of course it’s not the only problem with window layering in OS X. There is the problem with “Cycle Through Windows” referred to in the post, and then there are other problems which are, as you said, sometimes harder to pin down. But Apple has had more than enough time now to reproduce these problems in-house and fix them. It’s hard to imagine anyone using OS X on a day-to-day basis and not noticing such problems.

    My guess is that either the problem is a very fundamental flaw in OS X’s window layering scheme that would be difficult to fix without breaking all kinds of things, or Apple just doesn’t care and feels that OS X is “good enough” as it is. I don’t know which of the two options is more depressing…

  3. Mike Lauder says:

    I’m unable to reproduce exactly the problem that you have. If I switch to another application, using the dock or apple-tab switcher, while the CD is mounting, iTunes brings itself to the front tather than what you desribed – completely grabbing the focus even if I’m typing something in the window.

    Obviously this is really annoying and actually much worse than the problem you seem to have.

  4. Pierre Igot says:

    Mike: Like I said, this problem has been coming and going, so it could depend on which version of OS X and iTunes you are running.

    I am also referring to situations where I switch between applications using mouse clicks on windows, rather than the Dock or command-Tab, which bring all application windows to the foreground at once (like the classic Mac OS).

    In any case, the problem you describe is indeed even worse, but still part of the same family of problems, i.e. problems with window layering and focus.

  5. Paul Ingraham says:

    Thanks for writing about this, Pierre. This is one of my biggest gripes with OS X.

    My systems act like Mike’s, both 10.3.9 on a G4 tower and 10.4.3 on a 2.1GHz iMac. I’ve also noticed it with Toast, which launches when a disk mounts and sucks me out of whatever I’m doing. I particularly remember being interrupted in the middle of filename changes in Finder, and having to redo them.

    This has ticked me off many times lately. It’s a really user hostile interface behaviour. It’s like being yanked offstage by a cane! Every time it happens, it’s like there’s an Apple engineer sitting behind me saying, “You don’t know what you want. I know what you want.”

    Listen up, Apple!

Leave a Reply

Comments are closed.