The Land of Wind, Ghosts and Minimised Windows

Originally published 2006 in Atomic: Maximum Power Computing

Last modified 03-Dec-2011 .

There's a saying attributed to Otto von Bismarck: "People who enjoy eating sausage and obeying the law should not watch either being made".

The same goes for computer operating systems.

I'm indebted to famous Microsoftie (and compulsive liar) Raymond Chen for some insights (shamelessly stolen from his blog, to which you will find many links on this page) into the ingredients of that very special sausage called Windows.

I can't say my heart is overflowing with sympathy for the manifold difficulties that beset poor Microsoft, but learning about this stuff has made me mellower about Dumb Stuff Windows Does. Many apparently stupid features of Windows really have been forced upon Microsoft by their decision to give third-party developers free rein to make whatever programs they like, whether they stick to Microsoft's guidelines or not. That decision played a big part in giving Windows its huge software library, but it also caused problems.

Users, quite reasonably, expect to be able to install a new version of Windows without breaking their old applications. When developers do stupid, stupid things, Microsoft is then left with no alternative but to stick kludges and patches and shims into their operating system, to minimise the ability of crappy programs to screw stuff up.

Small quirks from back in the mists of Windows history can, therefore, still be seen in very obvious ways even today. Like, for instance, how everything on the Windows desktop is redrawn every now and then. And will probably continue to be for some time yet.

Some of this stuff is still entirely down to Microsoft, of course; keyboard navigation is a fine example of the kind of secret-handshake stuff that starts cropping up when developers paint themselves into a corner.

Some other results of backward-compatibility patching, though, are very strange indeed.

Here, for instance, is a Zen question for you:

Where is an icon?

How, in other words, does your computer know where on the on-screen desktop to draw a given icon?

And I've got another one:

Where do windows go when you minimise them?

Both of these questions seem to have simple enough answers.

Icon positioning, for instance, is just X and Y coordinates, innit?

OK, relative positions change when you change screen resolution, but that's no big deal. The interface can pile stuff up on the screen edges if the resolution drops, and create new empty space if it rises. Sorted.

And window minimisation seems simple, too. Stop drawing the window, draw instead (on Windows systems) a taskbar button, done.

Except that isn't how it works.

Windows PCs, you see, have screen coordinates, which are indeed your basic graph-paper X and Y, though they start from the top left, rather than the bottom left of common graph paper.

But Windows also has workspace coordinates. The workspace, basically, is the screen minus the taskbar. It's the area available for programs to put their stuff on, if they don't want to end up running into the taskbar.

You can see this difference if you put the Windows taskbar at the top of the screen, Mac-style. Now, some subtly buggy programs will move their window one taskbar-height higher every time you minimise and restore them. This happens because those programs save their pre-minimisation position using workspace coordinates (where 0,0 is the first "usable" pixel, the one at the left of the screen on the first line below your new top-mounted Taskbar) and then restore it using screen coordinates (where 0,0 is the actual top left corner of the screen).

Eventually, the window for a program with this bug will creep right up under the Taskbar. And if the program's happy with negative location coordinates, its window will keep on going - off the screen entirely.

The same problem can arise with a Taskbar on the left edge of the screen, but not with right- or bottom-edge Taskbars, because coordinates start from the top left. If the Taskbar isn't at the top or the left, the screen coordinates and workspace coordinates are the same, and the bug remains invisible.

Windows icon positions work in this way, too. So icon locations can, in theory, be screwed up in the same way.

But wait, there's more.

Imagine that you have two monitors, as indeed many people do these days. Your big main monitor is running at 1600 by 1200, and your smaller secondary monitor is running at 1024 by 768.

If you innocently position the second monitor to the left of the first, you'll now have a workspace which is 2624 pixels wide, and 768 pixels high... on the smaller left monitor. On the main monitor, it'll be 1200-minus-the-taskbar pixels high.

Programs which naively assume that the workspace must be a rectangle can, now, give icons or whole windows locations that lie in the black zone off the edge of the lower-resolution screen. Right-clicking on the taskbar button and selecting "Move" for such a window will help you not at all.

Workspace coordinates in the black zone are perfectly legal, but neither of your monitors can see that area - well, not unless you go into Display Properties -> Settings and move the secondary monitor around.

If you're in this predicament, by the way, I suggest you try the freeware utility Force Window Visible, which does what its name suggests. If you attempt to make black-zone areas visible by fiddling around with the location of your secondary screen, I've found you can end up with Windows doing neat things like not allowing any icons to be more than 1600 pixels from the left edge of the second screen, until you reboot.

(Since I put this page up, a couple of readers have pointed out that the "Move" option actually does work for off-screen windows - you just have to select Move and then press an arrow key, not click the mouse. The arrow key will attach your mouse cursor to the middle of the window's title bar, and now you can use the arrow keys or the mouse to move the window around! You'll still need Force Window Visible if the Move option isn't available, though - perhaps because the window in question doesn't have a taskbar button.)

(Oh, and Force Window Visible is pretty cool, but it's still not as good as the Amiga keyboard shortcut that let you override the minimum size that windows were meant to be allowed to have. If you wanted, you could then turn a window completely "inside out", moving its bottom-right corner above and to the left of its top-left corner. Letting go of the mouse button then would take you directly to visit the Guru.)

The workspace coordinate system also means that if you start Windows with your secondary, left-hand monitor turned off, your icons will all be squished up on the right-hand side of your main screen.

Why? Because without the left-hand monitor, the workspace started at the left edge of your primary monitor. Windows then started counting its icon X coordinates from there, even though it had saved the icon positions with X coordinates that counted from the left edge of the second monitor.

Tah-daah!

Window minimisation is the real champion, though. It's just great how Windows does that.

Windows can't, you see, just blithely stop drawing a program's window when that window is minimised. I think that's because you can't count on programs to redraw themselves correctly, or because they may freak out if one or more of their various window-drawing strategies is not correctly bit-bucketed.

Look, just trust me - there's a (fairly) good reason.

And yet, people want to be able to minimise windows. And not just by turning them into goofy desktop icons like Windows 3 did.

So what modern Windows versions actually do when you minimise a window is move the window. They put a new box on the taskbar too, but the window itself still exists... elsewhere.

WinNT and its descendants - possibly even Vista and Windows 7, though I'm not sure - move minimised windows to the undisplayable location -32000, -32000.

Way up there, eight to ten metres above and to the left of your monitor(s), all of your "minimised" windows are hanging in the air.

Windows 95 and its descendants, though, couldn't go that far. They should have been able to, but too many programs - serious expensive commercial programs from companies that should have known better and written their software to Microsoft's specifications - went crazy when presented with large and/or negative window locations. Windows 95 had to work with as much existing software as possible, so it ended up moving "minimised" windows to only +3000, +3000. (Read all about it on Raymond's blog here.)

The +3000, +3000 position stayed the same for the rest of the 95-derived Windows variants - Windows 95, 98, 98SE and ME. And it gives rise to an amusing artefact.

If you install one of those versions of Windows on a computer with two really humungous monitors (or three normal screens), and then tell Windows that the screens are positioned diagonally with the primary at the top left, you can see the Land of the Minimised Windows. Down there on the bottom-right monitor, they'll all start piling up.

Perhaps, one day, we'll all have hard drives big enough that we can also see the Home of the Overwritten Files.

Or enough RAM that we can load software that hasn't yet been written.

Or sound cards that can record one hand clapping.