Jump to page content

Window mismanagement page 5

The first myth of window management is that it exists…

I wouldn’t call GTK for Windows reliable, but some problems need more failure to succeed.

For example, the following situation:

The WIMP theme for GTK was leaking huge numbers of GDI handles within the gaim process. At the point where it had leaked a massive 10,000 handles, the program would spectacularly crash.

But like how Explorer can leak so many window handles that no process on the system can create another window (including menus), this bug was not constrained to gaim. For some reason, when handles get low, a program is quite at liberty to just draw all over the screen:

One notable difference with Mac OS X is that instead of drawing directly to the screen whenever you feel like it, you’re expected to create a transparent window and use its alpha channel to paint any floating content you need. I don’t know that Mac OS X enforces no drawing directly to the screen (which it should) but Windows certainly does not.

XN Resource Editor for example uses dockable tool palettes, which are generally dragged as an outline instead of a solid window to allow the outline to indicate the destination (floating or docked):

(I don’t know why the palette thinks it outranks the taskbar, but z-order in Windows is particularly lax and broken.) Note that two of the tray icons refresh themselves frequently and have drawn back over the area of the screen where the outline was drawn. If you now continue to drag the outline, XN Resource Editor unpaints the old outline, including where the icons have already redrawn:

So, how do proper programs do this? Simple: they freeze the entire screen until the user lets go of the mouse! You think I’m kidding? The following sequence was taken while I was dragging Paint’s colour palette:

Although the keyboard remains responsive (I could take screenshots with IrfanView) the rest of the screen remains frozen, system tray, Winamp and all. It should not be possible for a program to request that the desktop stop being redrawn, and anyone who gets the idea to do so, should be asking why on earth they want to do it?shot.

Windows XP also has a strange problem where taskbar tooltips get drawn behind the taskbar. For once, this is not a bug caused by putting the taskbar at the top of the screen, in fact I don’t think I’ve ever seen this with a top taskbar: