1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
|
/* -*- Mode: C; tab-width: 4 -*- */
/* blank --- blank screen */
#if !defined( lint ) && !defined( SABER )
static const char sccsid[] = "@(#)blank.c 4.07 97/11/24 xlockmore";
#endif
/*-
* Copyright (c) 1991 by Patrick J. Naughton.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted,
* provided that the above copyright notice appear in all copies and that
* both that copyright notice and this permission notice appear in
* supporting documentation.
*
* This file is provided AS IS with no warranties of any kind. The author
* shall have no liability with respect to the infringement of copyrights,
* trade secrets or any patents by this file or any part thereof. In no
* event will the author be liable for any lost revenue or profits or
* other special, indirect and consequential damages.
*
* Revision History:
* 10-May-97: Compatible with xscreensaver :) OK you probably should not
* use this for xscreensaver but I could not resist.
* 21-Mar-96: Ron Hitchens <ron@idiom.com>
* Bonehead alert. Don't blank during password prompting.
* 19-Mar-96: Ron Hitchens <ron@idiom.com>
* Changed to activate X server's native screensaver.
* On some devices, this will result in power saving "sleep"
* mode, or video blanking.
* 31-Aug-90: Written.
*/
#ifdef STANDALONE
#define PROGCLASS "Blank"
#define HACK_INIT init_blank
#define HACK_DRAW draw_blank
#define blank_opts xlockmore_opts
#define DEFAULTS "*delay: 1000000 \n"
#include "xlockmore.h" /* in xscreensaver distribution */
#else /* STANDALONE */
#include "xlock.h" /* in xlockmore distribution */
#endif /* STANDALONE */
ModeSpecOpt blank_opts =
{0, NULL, 0, NULL, NULL};
#ifdef USE_MODULES
ModStruct blank_description =
{"blank", "init_blank", "draw_blank", "release_blank",
"refresh_blank", "init_blank", NULL, &blank_opts,
3000000, 1, 1, 1, 64, 1.0, "",
"Shows nothing but a black screen", 0, NULL};
#endif
extern Bool enablesaver;
void
init_blank(ModeInfo * mi)
{
MI_CLEARWINDOW(mi);
/* Must set PreferBlanking, or XForceScreenSaver won't work */
if (!MI_IS_INWINDOW(mi) && !MI_IS_INROOT(mi) && enablesaver)
XSetScreenSaver(MI_DISPLAY(mi), 0, 0, PreferBlanking, 0);
}
/* ARGSUSED */
void
draw_blank(ModeInfo * mi)
{
/* Leave the lights on while user types password */
if (!MI_IS_INWINDOW(mi) && !MI_IS_INROOT(mi) && enablesaver) {
if (MI_IS_ICONIC(mi))
XForceScreenSaver(MI_DISPLAY(mi), ScreenSaverReset);
else
XForceScreenSaver(MI_DISPLAY(mi), ScreenSaverActive);
}
}
void
release_blank(ModeInfo * mi)
{
/* clear screensaver settings, just in case */
if (!MI_IS_INWINDOW(mi) && !MI_IS_INROOT(mi) && enablesaver) {
XForceScreenSaver(MI_DISPLAY(mi), ScreenSaverReset);
XSetScreenSaver(MI_DISPLAY(mi), 0, 0, 0, 0);
}
}
void
refresh_blank(ModeInfo * mi)
{
/* Do nothing, it will refresh by itself :) */
}
|