Preventing screensaver when playing movie?

Erik esigra at
Tue Mar 4 07:44:43 PST 2008

Lubos Lunak skrev:
> On Tuesday 04 of March 2008, Erik wrote:
>> Lubos Lunak skrev:
>>> the previous discussion was about XResetScreenSaver(), and that one works
>>> with the KDE screensaver (3.5.9).
>> Could you point to a recent commit that fixed this? (Cause it fails on
>> 3.5.8.)
>  I can't. The latest changes that are possibly related happened more than a 
> year ago, so it's possible that maybe 3.5.5 or older don't work correctly, 
> but code from the 3.5.8 tag works correctly with XResetScreenSaver() here as 
> well.
>  The testing code is here, just in case. Maybe you forgot to flush the X queue 
> in your testapp?

I have this testapp:
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xos.h>
#include <X11/extensions/dpms.h>

#include <stdio.h>
#include <stdlib.h>

int main() {
    Display * display;
    if ((display = XOpenDisplay(0))) {
        int const screen = DefaultScreen (display);
        Window const win =
            (display, RootWindow (display, screen),
             0, 0, 96, 96, 4,
             BlackPixel (display, screen),
             WhitePixel (display, screen));
        XMapWindow (display, win);
        for (;;)
            XResetScreenSaver (display);
    } else {
        fprintf (stderr, "can not connect to X server %s\n", 
XDisplayName (0));
        exit (-1);

Run this program and the display should stay on forever (until the 
testapp is closed). I know that it works because I tested it with DPMS. 
But when I tried to turn off DPMS and turn on a KDE screensaver instead 
it falied. Therefore I assume that the problem is in kscreensaver.

More information about the xorg mailing list