This isn't anything mind-blowing or anything, but since I asked about
this problem last year, and no one had any useful answer for me, I
thought I'd share my solution. Besides, many programs, like mplayer,
that need to disable the screen saver during play seem to cause some
screen savers (like xscreensaver) to crash.

The problem I had was that I wanted a way to temporarily turn off the
screen saver. I wanted it to work with the X11 built-in screen saver
("xset s off" sort of thing), CDE's screen saver (which is some weird
animal with no public API), and the one used by KDE and GNOME
(xscreensaver). It was also important to not have any side-effects
like leaving the screen saver off if my program were to crash.

My solution was dead simple:

[1] Use my own window or create an input-only window
[2] Periodically send that window a keypress using the XTEST extension.

The keypress I used was shift-down followed by shift-up.

Worked like a charm.