[comp.windows.open-look] HELP needed in setting values in XSetScreenSaver....

anil@lia (Anil Somani) (03/22/91)

Hi There,

I am trying to set the values in XScreenSaver as below but does not seem
to wook !!. I am runnig this program under Sun4.1 on a SPARC SLC.
I have a screenblank process running in the background (from the
rc.local file) with the timeout interval of 600 sec. Then I try to set
the new value through this small program. 

Can some kind soul help me in the trivial looking problem !!!.
I have tried runnig as a super-user on my client m/c where the program
is running. Should that affect.(Well it did not seem to affect)

Any pointers will be greatly appreciated.

If there is enough interest i will post the summary on the net.

Thanx in Advance.


#include <stdio.h>
#include <xview/panel.h>
#include <xview/canvas.h>
#include <xview/frame.h>
#include <X11/Xlib.h>

main(argc, argv)
int argc;
char *argv[];
{
	Frame	frame;
	Panel	panel;
	Xv_Window	canvas_pw;
	Canvas		canvas;
	Xv_screen	screen;
	Display		*dpy;
	int		screen_no;
	int	*time_out, *inter, *prefer_blank, *allow_exp;

	xv_init(XV_INIT_ARGC_PTR_ARGV, &argc, argv, NULL);
	frame = xv_create(XV_NULL, FRAME,
			FRAME_LABEL,	"Test Screen Saver",
			NULL );

	canvas = xv_create(frame, CANVAS,
			NULL );

	canvas_pw = canvas_paint_window(canvas);
	dpy = (Display *)xv_get(canvas_pw, XV_DISPLAY);

	XGetScreenSaver(dpy, &time_out, &inter, &prefer_blank, &allow_exp);
	fprintf(stdout, "Timeout = %d Inter =  %d  Blank = %d  Exp = %d\n", 
				time_out, inter, prefer_blank, allow_exp);
	XSetScreenSaver(dpy, 10, 7, DontPreferBlanking, AllowExposures);
	XActivateScreenSaver(dpy);

	fprintf(stdout, "\n");
	fprintf(stdout, "After Setting the values\n");
	fprintf(stdout, "\n");
	fprintf(stdout, "Timeout = %d Inter =  %d  Blank = %d  Exp = %d\n", 
				time_out, inter, prefer_blank, allow_exp);

	xv_main_loop (frame);

}

The two printf`s are to check the values of timeout. And both the values
seem to be the same all the time.(I expected it to be deff when i first
ran the program).

"We will have solar energy as soon as the utility companies 
    solve one technical problem -- 
    how to run a sunbeam through a meter."