IT lexicon › Programming › ClearArea

ClearArea

Programming På svenska → Updated: 2026-10-11

Wipes a rectangle of an X window back to its background — and can order up an Expose event for the program itself while it's at it.

The request takes a window, a rectangle and a flag. The rectangle is filled with the window's background colour or background pixmap; a width or height of zero means “all the way to the edge”, so XClearWindow is just ClearArea with zeros. If the window's background is None, the pixels are left untouched. It only works on windows, not pixmaps, and an InputOnly window yields BadMatch.

The interesting part is the exposures flag. When set, the server generates Expose events for the cleared area, as if something had just moved off it. That became the standard way to ask for a redraw: rather than calling its paint routine directly, a program clears the area and lets the event loop do the work, so all drawing takes the same path and multiple requests get merged. Toolkit calls like queue_draw and update are the same idea with better manners.

← Back to the lexicon