Sanding our assholes with 150 grit. Slowly. Lovingly.

The WM_PAINT abstraction leak

The window gets a WM_PAINT. The code gets a device context, calls Draw(), then releases the context. It's an abtraction.

Draw() tries to read internal data and put it on screen. But the data has been swapped out. There is a two-second penalty as existing data is swapped out, and application data is read back from disk.

The user stares at a window with a hole in the middle. 95% of Windows apps are like this; and it feels so "broken".
Permalink Alex 
August 16th, 2005
I suppose that Windows could pre-paint the window with previously-painted data, before asking the application to repaint it.
Permalink Christopher Wells 
August 16th, 2005
Should have done it like BeOS did, and have a second thread just for the UI.
Permalink example 
August 16th, 2005
When you say the data has been "swapped out", do you mean virtual memory swap?
Permalink ronk! 
August 16th, 2005
"95% of Windows apps are like this; and it feels so "broken"."

That's because Windows is broken. The NT series has always been way too aggressive about dumping useful code and data pages in favor of the disk cache. For example, if I have 1GB of RAM, 512MB of code and data loaded and pull several gigabytes of data off the disk for a backup or whatever then pretty much every page that wasn't locked or touched during the data retrieval is going to get swapped in favor of caching as much of the data as possible. It's crazy stupid for an interactive system to do that and it seems to be one of those issues Microsoft is most obstinate about. They designed it that way and it's going to stay that way no matter what anyone tells them.

Their own backup program doesn't even set the no cache option when reading/writing files during a backup. That's how little they pay attention to this issue.
Permalink Doug 
August 17th, 2005
X11 partially solves this by allowing applications to pick on a window-by-window basis whether the contents are cached at the server end.

Set the flag for all windows and you can just ignore the paint messages...


The bit that annoys me is grabbing a window to move it out of the way, and it doesn't move because the APPLICATION is responsible for moving its window and not the window manager and the application's been swapped out and so can't react.

That bit's a dumb design as well.
Permalink Katie Lucas 
August 17th, 2005
Yes, but if the app wasn't responsible then you wouldn't have some functionality of those cute little fuzzy creatures that inhabit your desktop molesting your icons and doing cute tricks.
Permalink I am Jack's infinite id 
August 17th, 2005

This topic was orginally posted to the off-topic forum of the
Joel on Software discussion board.

Other topics: August, 2005 Other topics: August, 2005 Recent topics Recent topics