index
Description of my method to remove flickering in a graphical program
for definition of flickering and the story of my work with this method see flicker page.
convention: background pixel or background pixmap are treated as one concept: BGP. In fact, all programs i
converted don't use bg pixmap, but only a bg pixel (i.e. the background is fixed/uniform color).
Removing flickering caused by Background pixel or pixmap (on Expose)
Find in the source code where BGP is set and change it, so that the requested Background pixmap is "None".
The relevant functions are:
- XSetWindowBackground --- remove completely
- XCreateWindow -- make sure you set the background_pixmap attribute
- XConfigureWindow -- idem
- XCreateSimpleWindow - add XConfigureWindow
You will notice (when you run the modified program), that now the window contains garbagge: contents of previously
visible windows mixed with the expected contents.
Removing the sources of garbagge
- explicit use of the BGP.
With "Background pixmap set to None", XClearWindow and XClearArea stop to have any influence.
XClearArea calls need to be replaced by XFillRectangle with a suitable GC, with the foreground color set to the intended
background color of the window. (I'm not considering transparent windows!)
- The other cause of the garbagge, is reliance on background being cleared implicitely.
That is the program does not draw in certain parts of the window.
You have to determinate all such parts, and fill them with the desired background color explicitely.
This is the hard part: for image displayers it's trivial: there is no such area. For cell oriented drawing, you
have to determine which cell is completely empty, and have an operation to draw a non-empty cell, which draws
the backgrand as well (example XDdrawImageString); this applies to terminal emulators, emacs.
I wonder about gtk+, I think many of its widgets have a way to enumerate such areas.
Removing flickering on window resizing.