Initial import of the CDE 2.1.30 sources from the Open Group.
This commit is contained in:
55
cde/programs/dtscreen/Dtscreen.src
Normal file
55
cde/programs/dtscreen/Dtscreen.src
Normal file
@@ -0,0 +1,55 @@
|
||||
!######################################################################
|
||||
!#
|
||||
!# Dtscreen
|
||||
!#
|
||||
!# Application Defaults for the DT Screen Saver
|
||||
!#
|
||||
!# (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
!# (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
!# (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
!# (c) Copyright 1993, 1994 Novell, Inc.
|
||||
!#
|
||||
!# $XConsortium: Dtscreen.src /main/3 1995/11/02 16:05:53 rswiston $
|
||||
!#
|
||||
!######################################################################
|
||||
#ifdef __hpux
|
||||
!# hpux will be using blank because swarm creates a lot of lan traffic
|
||||
Dtscreen.mode: blank
|
||||
#else
|
||||
Dtscreen.mode: swarm
|
||||
#endif
|
||||
Dtscreen.background: White
|
||||
Dtscreen.foreground: Black
|
||||
Dtscreen.nice: 10
|
||||
Dtscreen.timeout: 30
|
||||
Dtscreen.mono: off
|
||||
Dtscreen.hop.delay: 500000
|
||||
Dtscreen.hop.batchcount: 1000
|
||||
Dtscreen.hop.saturation: 1
|
||||
Dtscreen.qix.delay: 30000
|
||||
Dtscreen.qix.batchcount: 64
|
||||
Dtscreen.qix.saturation: 1
|
||||
Dtscreen.image.delay: 2000000
|
||||
Dtscreen.image.batchcount: 8
|
||||
Dtscreen.image.saturation: 0.3
|
||||
Dtscreen.life.delay: 1000000
|
||||
Dtscreen.life.batchcount: 100
|
||||
Dtscreen.life.saturation: 1
|
||||
Dtscreen.swarm.delay: 10000
|
||||
Dtscreen.swarm.batchcount: 100
|
||||
Dtscreen.swarm.saturation: 1
|
||||
Dtscreen.rotor.delay: 10000
|
||||
Dtscreen.rotor.batchcount: 4
|
||||
Dtscreen.rotor.saturation: 0.4
|
||||
Dtscreen.pyro.delay: 15000
|
||||
Dtscreen.pyro.batchcount: 40
|
||||
Dtscreen.pyro.saturation: 1
|
||||
Dtscreen.flame.delay: 10000
|
||||
Dtscreen.flame.batchcount: 20
|
||||
Dtscreen.flame.saturation: 1
|
||||
Dtscreen.worm.delay: 10000
|
||||
Dtscreen.worm.batchcount: 20
|
||||
Dtscreen.worm.saturation: 1
|
||||
Dtscreen.blank.delay: 5000000
|
||||
Dtscreen.blank.batchcount: 1
|
||||
Dtscreen.blank.saturation: 1
|
||||
39
cde/programs/dtscreen/Imakefile
Normal file
39
cde/programs/dtscreen/Imakefile
Normal file
@@ -0,0 +1,39 @@
|
||||
XCOMM $XConsortium: Imakefile /main/10 1996/10/09 14:06:18 drk $
|
||||
|
||||
INCLUDES = -I.
|
||||
|
||||
DEPLIBS = $(DEPDTSVCLIB) $(DEPTTLIB) $(DEPXMLIB) $(DEPXTOOLLIB) $(DEPXPLIB) $(DEPXLIB)
|
||||
LOCAL_LIBRARIES = $(DTSVCLIB) $(TTLIB) $(XMLIB) $(XTOOLLIB) $(XPLIB) $(XLIB)
|
||||
SYS_LIBRARIES = -lm $(DYNLIBSYSLIB) $(REGEXSYSLIB)
|
||||
|
||||
|
||||
#if defined(SCOArchitecture)
|
||||
SYS_LIBRARIES = -lm -lcrypt
|
||||
#endif
|
||||
|
||||
SRCS = blank.c dtscreen.c flame.c hopalong.c \
|
||||
hsbramp.c image.c life.c pyro.c \
|
||||
qix.c resource.c rotor.c swarm.c \
|
||||
usleep.c worm.c
|
||||
|
||||
OBJS = blank.o dtscreen.o flame.o hopalong.o \
|
||||
hsbramp.o image.o life.o pyro.o \
|
||||
qix.o resource.o rotor.o swarm.o \
|
||||
usleep.o worm.o
|
||||
|
||||
all::
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Extra things for the Passwd Etc. version
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifdef USE_RGY
|
||||
EXTRA_DEFINES = -D__PASSWD_ETC +e
|
||||
EXTRA_LIBRARIES = $(RGYLIB) $(NCKLIB) -lndbm -lBSD ExtraLibraries
|
||||
#endif
|
||||
|
||||
CppSourceFile(Dtscreen,Dtscreen.src,$(LOCAL_CPP_DEFINES),)
|
||||
|
||||
ComplexProgramTarget(dtscreen)
|
||||
35
cde/programs/dtscreen/blank.c
Normal file
35
cde/programs/dtscreen/blank.c
Normal file
@@ -0,0 +1,35 @@
|
||||
/* $XConsortium: blank.c /main/3 1995/11/02 16:06:17 rswiston $ */
|
||||
/*
|
||||
*/
|
||||
/* *
|
||||
* (c) Copyright 1993, 1994 Hewlett-Packard Company *
|
||||
* (c) Copyright 1993, 1994 International Business Machines Corp. *
|
||||
* (c) Copyright 1993, 1994 Sun Microsystems, Inc. *
|
||||
* (c) Copyright 1993, 1994 Novell, Inc. *
|
||||
*/
|
||||
/*-
|
||||
* blank.c - blank screen for dtscreen, the X Window System lockscreen.
|
||||
*
|
||||
* Copyright (c) 1991 by Patrick J. Naughton.
|
||||
*
|
||||
* See dtscreen.c for copying information.
|
||||
*
|
||||
* Revision History:
|
||||
* 31-Aug-90: Written.
|
||||
*/
|
||||
|
||||
#include "dtscreen.h"
|
||||
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
drawblank(pwin)
|
||||
perwindow *pwin;
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
initblank(pwin)
|
||||
perwindow *pwin;
|
||||
{
|
||||
XClearWindow(dsp, pwin->w);
|
||||
}
|
||||
362
cde/programs/dtscreen/dtscreen.c
Normal file
362
cde/programs/dtscreen/dtscreen.c
Normal file
@@ -0,0 +1,362 @@
|
||||
/* $TOG: dtscreen.c /main/6 1998/04/20 12:58:46 mgreess $ */
|
||||
/*
|
||||
*/
|
||||
|
||||
/*-
|
||||
* dtscreen.c - X11 client to lock a display and show a screen saver.
|
||||
*
|
||||
* Copyright (c) 1988-91 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.
|
||||
*
|
||||
* Comments and additions should be sent to the author:
|
||||
*
|
||||
* naughton@eng.sun.com
|
||||
*
|
||||
* Patrick J. Naughton
|
||||
* MS 21-14
|
||||
* Sun Laboritories, Inc.
|
||||
* 2550 Garcia Ave
|
||||
* Mountain View, CA 94043
|
||||
*
|
||||
* Revision History:
|
||||
* 16-May-91: added pyro and random modes.
|
||||
* ripped big comment block out of all other files.
|
||||
* 29-Oct-90: added cast to XFree() arg.
|
||||
* added volume arg to call to XBell().
|
||||
* 31-Aug-90: added blank mode.
|
||||
* added swarm mode.
|
||||
* moved usleep() and seconds() out to usleep.c.
|
||||
* added SVR4 defines to dtscreen.h
|
||||
* 29-Jul-90: added support for multiple screens to be locked by one dtscreen.
|
||||
* moved global defines to dtscreen.h
|
||||
* removed use of allowsig().
|
||||
* 07-Jul-90: reworked commandline args and resources to use Xrm.
|
||||
* moved resource processing out to resource.c
|
||||
* 02-Jul-90: reworked colors to not use dynamic colormap.
|
||||
* 23-May-90: added autoraise when obscured.
|
||||
* 18-Feb-90: added SunOS3.5 fix.
|
||||
* changed -mono -> -color, and -saver -> -lock.
|
||||
* allow non-locking screensavers to display on remote machine.
|
||||
* added -echokeys to disable echoing of '?'s on input.
|
||||
* cleaned up all of the parameters and defaults.
|
||||
* 23-Sep-89: Added fix to allow local hostname:0 as a display.
|
||||
* Put empty case for Enter/Leave events.
|
||||
* Moved colormap installation later in startup.
|
||||
* 19-Sep-89: Added '?'s on input.
|
||||
* 27-Mar-89: Added -qix mode.
|
||||
* Fixed GContext->GC.
|
||||
* 08-Mar-89: Added -nice, -mode and -display, built vector for life and hop.
|
||||
* 24-Feb-89: Replaced hopalong display with life display from SunView1.
|
||||
* 22-Feb-89: Added fix for color servers with n < 8 planes.
|
||||
* 16-Feb-89: Updated calling conventions for XCreateHsbColormap();
|
||||
* Added -count for number of iterations per color.
|
||||
* Fixed defaulting mechanism.
|
||||
* Ripped out VMS hacks.
|
||||
* Sent to expo for X11R3 contrib.
|
||||
* 19-Jan-89: Fixed monochrome gc bug.
|
||||
* 19-Sep-88: Changed -color to -mono. (default is color on color displays).
|
||||
* Added -saver option. (just do display... don't lock.)
|
||||
* 01-Apr-88: Added XGrabServer/XUngrabServer for more security.
|
||||
* 27-Mar-88: Rotate fractal by 45 degrees clockwise.
|
||||
* 24-Mar-88: Added color support. [-color]
|
||||
* wrote the man page.
|
||||
* 23-Mar-88: Added HOPALONG routines from Scientific American Sept. 86 p. 14.
|
||||
* added requirement for display to be "unix:0".
|
||||
* 22-Mar-88: Recieved Walter Milliken's comp.windows.x posting.
|
||||
*
|
||||
*/
|
||||
|
||||
/* include file for message texts */
|
||||
#include <limits.h>
|
||||
#include <nl_types.h>
|
||||
#define MF_DTSCREEN "dtscreen"
|
||||
|
||||
#include <nl_types.h>
|
||||
#include <locale.h>
|
||||
nl_catd scmc_catd; /* Cat descriptor for scmc conversion */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <signal.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <X11/Intrinsic.h> /* For Boolean */
|
||||
#include <X11/Shell.h>
|
||||
#include "dtscreen.h"
|
||||
#ifdef NEVER
|
||||
/* We'd like to include DtP.h, but it interferes with dtscreen.h */
|
||||
# include <Dt/DtP.h>
|
||||
#endif /* NEVER */
|
||||
#include <Dt/EnvControlP.h>
|
||||
#include <Dt/Saver.h>
|
||||
|
||||
#if !defined(NL_CAT_LOCALE)
|
||||
#define NL_CAT_LOCALE 0
|
||||
#endif
|
||||
|
||||
char *ProgramName; /* argv[0] */
|
||||
Display *dsp = NULL; /* server display connection */
|
||||
void (*callback) () = NULL;
|
||||
void (*init) () = NULL;
|
||||
|
||||
static perwindow *Win; /* perwindow information */
|
||||
static int windows; /* number of windows */
|
||||
static Window *winprop = NULL; /* dtsession cover windows */
|
||||
|
||||
/* VARARGS1 */
|
||||
void
|
||||
error(s1, s2)
|
||||
char *s1, *s2;
|
||||
{
|
||||
fprintf(stderr, s1, ProgramName, s2);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Restore all grabs, reset screensaver, restore colormap, close connection.
|
||||
*/
|
||||
static void
|
||||
finish()
|
||||
{
|
||||
XSync(dsp, False);
|
||||
if (winprop)
|
||||
XFree((char *)winprop);
|
||||
XFlush(dsp);
|
||||
XCloseDisplay(dsp);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
justDisplay()
|
||||
{
|
||||
XEvent event;
|
||||
int window;
|
||||
|
||||
for (window = 0; window < windows; window++)
|
||||
init(Win+window);
|
||||
do {
|
||||
while (!XPending(dsp)) {
|
||||
for (window = 0; window < windows; window++)
|
||||
callback(Win+window);
|
||||
XSync(dsp, False);
|
||||
usleep(delay);
|
||||
}
|
||||
XNextEvent(dsp, &event);
|
||||
|
||||
#ifndef DEBUG
|
||||
if (event.type == VisibilityNotify)
|
||||
XRaiseWindow(dsp, event.xany.window);
|
||||
#endif
|
||||
} while (1);
|
||||
}
|
||||
|
||||
|
||||
long
|
||||
allocpixel(cmap, name, def)
|
||||
Colormap cmap;
|
||||
char *name;
|
||||
char *def;
|
||||
{
|
||||
XColor col;
|
||||
XColor tmp;
|
||||
XParseColor(dsp, cmap, name, &col);
|
||||
if (!XAllocColor(dsp, cmap, &col)) {
|
||||
#ifdef MIT_R5
|
||||
|
||||
fprintf(stderr,
|
||||
"couldn't allocate: %s, using %s instead\n",
|
||||
name, def);
|
||||
|
||||
#else
|
||||
fprintf(stderr, catgets(scmc_catd, 2, 35,
|
||||
"couldn't allocate: %s, using %s instead\n"),
|
||||
name, def);
|
||||
#endif
|
||||
|
||||
XAllocNamedColor(dsp, cmap, def, &col, &tmp);
|
||||
}
|
||||
return col.pixel;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
XSetWindowAttributes xswa;
|
||||
XGCValues xgcv;
|
||||
XColor nullcolor;
|
||||
int nitems = 0;
|
||||
int window;
|
||||
int i;
|
||||
|
||||
/*
|
||||
* So we can find the app-defaults file.
|
||||
*/
|
||||
_DtEnvControl(DT_ENV_SET);
|
||||
|
||||
/* set locale to what is defined by local environment */
|
||||
setlocale(LC_ALL,"");
|
||||
scmc_catd = catopen(MF_DTSCREEN, NL_CAT_LOCALE);
|
||||
|
||||
ProgramName = strrchr(argv[0], '/');
|
||||
if (ProgramName)
|
||||
ProgramName++;
|
||||
else
|
||||
ProgramName = argv[0];
|
||||
|
||||
srandom(time((time_t *) 0)); /* random mode needs the seed set. */
|
||||
|
||||
GetResources(argc, argv);
|
||||
|
||||
CheckResources();
|
||||
|
||||
if (!create)
|
||||
{
|
||||
/* Make sure DtSvc is initialized properly. */
|
||||
XtAppContext appContext;
|
||||
Widget shellWidget;
|
||||
int dummyArgc = 1;
|
||||
char *dummyArgv[1];
|
||||
|
||||
dummyArgv[0] = ProgramName;
|
||||
XtToolkitInitialize();
|
||||
appContext = XtCreateApplicationContext();
|
||||
XtDisplayInitialize(appContext, dsp, ProgramName, ProgramName,
|
||||
NULL, 0, &dummyArgc, dummyArgv);
|
||||
shellWidget = XtAppCreateShell(ProgramName, ProgramName,
|
||||
applicationShellWidgetClass,
|
||||
dsp, NULL, 0);
|
||||
DtAppInitialize(appContext, dsp, shellWidget,
|
||||
ProgramName, ProgramName);
|
||||
|
||||
/*
|
||||
* Try to get array of window ids from desktop. Also returned is
|
||||
* a property identifier whose change will tell us when to terminate.
|
||||
*/
|
||||
if (!DtSaverGetWindows(dsp, &winprop, &nitems))
|
||||
{
|
||||
fprintf(stderr, catgets(scmc_catd, 2, 40,
|
||||
"%s: Cannot locate window in which to draw. Using the -create\n"
|
||||
"option will cause %s to create its own window.\n"),
|
||||
ProgramName, ProgramName);
|
||||
|
||||
exit(1);
|
||||
}
|
||||
|
||||
Win = (perwindow *)malloc(nitems * sizeof(perwindow));
|
||||
windows = nitems;
|
||||
for (window = 0; window < windows; window++)
|
||||
{
|
||||
Win[window].w = winprop[window];
|
||||
Win[window].perscreen = NULL;
|
||||
Win[window].data = NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Screen *scr = ScreenOfDisplay(dsp, 0);
|
||||
|
||||
Win = (perwindow *)malloc(sizeof(perwindow));
|
||||
windows = 1;
|
||||
xswa.override_redirect = True;
|
||||
xswa.background_pixel = BlackPixelOfScreen(scr);
|
||||
xswa.event_mask = VisibilityChangeMask;
|
||||
|
||||
Win[0].w = XCreateWindow(
|
||||
dsp,
|
||||
RootWindowOfScreen(scr),
|
||||
0, 0,
|
||||
WidthOfScreen(scr) - 100, HeightOfScreen(scr) - 100,
|
||||
0, CopyFromParent, InputOutput, CopyFromParent,
|
||||
CWBackPixel | CWEventMask, &xswa);
|
||||
Win[0].perscreen = NULL;
|
||||
Win[0].data = NULL;
|
||||
XMapWindow(dsp, Win[0].w);
|
||||
XRaiseWindow(dsp, Win[0].w);
|
||||
}
|
||||
|
||||
for (window = 0; window < windows; window++)
|
||||
{
|
||||
XWindowAttributes attr;
|
||||
|
||||
XGetWindowAttributes(dsp, Win[window].w, &attr);
|
||||
|
||||
for (i = 0; i < window; i++)
|
||||
{
|
||||
if (Win[i].perscreen && Win[i].perscreen->screen == attr.screen)
|
||||
{
|
||||
Win[window].perscreen = Win[i].perscreen;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (Win[window].perscreen == NULL)
|
||||
{
|
||||
Colormap cmap;
|
||||
perscreen *pscreen;
|
||||
|
||||
pscreen = (perscreen *)malloc(sizeof(perscreen));
|
||||
Win[window].perscreen = pscreen;
|
||||
|
||||
pscreen->screen = attr.screen;
|
||||
cmap = DefaultColormapOfScreen(pscreen->screen);
|
||||
|
||||
pscreen->pixels[0] = allocpixel(cmap, "White", "White");
|
||||
pscreen->pixels[1] = allocpixel(cmap, "Black", "Black");
|
||||
if (mono || CellsOfScreen(pscreen->screen) == 2)
|
||||
{
|
||||
pscreen->npixels = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
int colorcount = NUMCOLORS;
|
||||
u_char red[NUMCOLORS];
|
||||
u_char green[NUMCOLORS];
|
||||
u_char blue[NUMCOLORS];
|
||||
|
||||
hsbramp(0.0, saturation, 1.0, 1.0, saturation, 1.0, colorcount,
|
||||
red, green, blue);
|
||||
pscreen->npixels = 0;
|
||||
for (i = 0; i < colorcount; i++)
|
||||
{
|
||||
XColor xcolor;
|
||||
|
||||
xcolor.red = red[i] << 8;
|
||||
xcolor.green = green[i] << 8;
|
||||
xcolor.blue = blue[i] << 8;
|
||||
xcolor.flags = DoRed | DoGreen | DoBlue;
|
||||
|
||||
if (!XAllocColor(dsp, cmap, &xcolor))
|
||||
break;
|
||||
|
||||
pscreen->pixels[i] = xcolor.pixel;
|
||||
pscreen->npixels++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
xgcv.foreground = WhitePixelOfScreen(Win[window].perscreen->screen);
|
||||
xgcv.background = BlackPixelOfScreen(Win[window].perscreen->screen);
|
||||
Win[window].gc = XCreateGC(dsp, Win[window].w,
|
||||
GCForeground | GCBackground, &xgcv);
|
||||
}
|
||||
nice(nicelevel);
|
||||
|
||||
justDisplay();
|
||||
|
||||
finish();
|
||||
|
||||
return 0;
|
||||
}
|
||||
101
cde/programs/dtscreen/dtscreen.h
Normal file
101
cde/programs/dtscreen/dtscreen.h
Normal file
@@ -0,0 +1,101 @@
|
||||
/* $XConsortium: dtscreen.h /main/5 1996/05/13 16:54:19 rswiston $ */
|
||||
/*
|
||||
*/
|
||||
/* *
|
||||
* (c) Copyright 1993, 1994 Hewlett-Packard Company *
|
||||
* (c) Copyright 1993, 1994 International Business Machines Corp. *
|
||||
* (c) Copyright 1993, 1994 Sun Microsystems, Inc. *
|
||||
* (c) Copyright 1993, 1994 Novell, Inc. *
|
||||
*/
|
||||
/*-
|
||||
*
|
||||
* xlock.h - external interfaces for new modes and SYSV OS defines.
|
||||
*
|
||||
* Copyright (c) 1991 by Patrick J. Naughton.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/Xos.h>
|
||||
|
||||
#define MAXSCREENS 3
|
||||
#define NUMCOLORS 64
|
||||
|
||||
typedef struct {
|
||||
Screen *screen;
|
||||
int npixels; /* number of valid entries in pixels */
|
||||
u_long pixels[NUMCOLORS]; /* pixel values in the colormap */
|
||||
} perscreen;
|
||||
|
||||
typedef struct {
|
||||
Window w; /* window id */
|
||||
GC gc; /* graphics context for animation */
|
||||
perscreen *perscreen; /* screen info for this window */
|
||||
void *data; /* mode data */
|
||||
} perwindow;
|
||||
|
||||
extern Display *dsp;
|
||||
|
||||
extern char *ProgramName;
|
||||
extern char *display;
|
||||
extern char *mode;
|
||||
extern float saturation;
|
||||
extern int nicelevel;
|
||||
extern int delay;
|
||||
extern int batchcount;
|
||||
extern int reinittime;
|
||||
extern Bool usefirst;
|
||||
extern Bool mono;
|
||||
extern Bool create;
|
||||
extern void (*callback) ();
|
||||
extern void (*init) ();
|
||||
|
||||
extern void GetResources();
|
||||
extern void hsbramp();
|
||||
extern void error();
|
||||
extern long seconds();
|
||||
extern void usage();
|
||||
extern void hide_hft_ring();
|
||||
extern void unhide_hft_ring();
|
||||
|
||||
|
||||
/* System V Release 4 redefinitions of BSD functions and structures */
|
||||
|
||||
#if defined (SYSV) || defined (SVR4)
|
||||
|
||||
#include <sys/time.h>
|
||||
#define passwd spwd
|
||||
#define pw_passwd sp_pwdp
|
||||
#if defined(AIXV3) || defined(hpux)
|
||||
#undef NULL
|
||||
#define NULL 0
|
||||
#include <sys/poll.h>
|
||||
|
||||
struct passwd {
|
||||
char *pw_name;
|
||||
char *pw_passwd;
|
||||
uid_t pw_uid;
|
||||
gid_t pw_gid;
|
||||
char *pw_gecos;
|
||||
char *pw_dir;
|
||||
char *pw_shell;
|
||||
};
|
||||
#else
|
||||
#include <poll.h>
|
||||
#include <shadow.h>
|
||||
#define getpwnam getspnam
|
||||
#endif
|
||||
#if !(defined(_AIX) || defined(hpux))
|
||||
# define srandom srand
|
||||
# define random rand
|
||||
# define MAXRAND (32767.0)
|
||||
#else
|
||||
# define MAXRAND (2147483648.0)
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#define MAXRAND (2147483648.0)
|
||||
|
||||
#endif
|
||||
49
cde/programs/dtscreen/dtscreen.msg
Normal file
49
cde/programs/dtscreen/dtscreen.msg
Normal file
@@ -0,0 +1,49 @@
|
||||
$ $XConsortium: dtscreen.msg /main/5 1996/08/12 12:02:15 pascale $
|
||||
$ @(#)25 1.1.1.1 com/XTOP/aixclients/xlock/xlock.msg, xclients, r5gos325, 9333325d 5/6/93 20:13:37
|
||||
$
|
||||
$ COMPONENT_NAME: dtscreen
|
||||
$
|
||||
$ FUNCTIONS: dtscreen.msg
|
||||
$
|
||||
$
|
||||
$ (C) COPYRIGHT International Business Machines Corp. 1987, 1993
|
||||
$ All Rights Reserved
|
||||
$ Licensed Materials - Property of IBM
|
||||
$
|
||||
$ US Government Users Restricted Rights - Use, duplication or
|
||||
$ disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
|
||||
$
|
||||
$
|
||||
$ * *
|
||||
$ * (c) Copyright 1993, 1994 Hewlett-Packard Company *
|
||||
$ * (c) Copyright 1993, 1994 International Business Machines Corp. *
|
||||
$ * (c) Copyright 1993, 1994 Sun Microsystems, Inc. *
|
||||
$ * (c) Copyright 1993, 1994 Novell, Inc. *
|
||||
$ *
|
||||
|
||||
$set 2
|
||||
$ message file created 1993
|
||||
|
||||
$quote "
|
||||
1 "1386-101 %s: Bad command line option: %s.\n\n"
|
||||
2 "1386-102 \nType %s -help for a full description.\n\n"
|
||||
|
||||
3 "1386-103 Usage:\n %s [-options ...]\n\n\where options include:\n"
|
||||
5 "1386-105 %-28s %s\n\t where mode is one of:\n\", \"-mode mode\", \"animation mode"
|
||||
|
||||
7 "1386-107 Unknown mode: "
|
||||
10 "1386-110 couldn't allocate: %s\n"
|
||||
11 "1386-111 %d pixels allocated\n"
|
||||
|
||||
17 "1386-117 %s: Unable to open display %s.\n"
|
||||
18 "1386-118 %s: GetResource - couldn't allocate memory"
|
||||
19 "1386-119 %s: Malformed -display argument, \"%s\"\n"
|
||||
|
||||
20 "1386-120 -batchcount argument must be positive."
|
||||
21 "1386-121 -saturation argument must be between 0.0 and 1.0."
|
||||
|
||||
25 "1386-125 %s: can only support %d screens.\n"
|
||||
30 "1386-130 -delay argument must be positive."
|
||||
35 "1386-135 couldn't allocate: %s, using %s instead\n"
|
||||
40 "%s: Cannot locate window in which to draw. Using the -create\n\
|
||||
option will cause %s to create its own window.\n"
|
||||
176
cde/programs/dtscreen/flame.c
Normal file
176
cde/programs/dtscreen/flame.c
Normal file
@@ -0,0 +1,176 @@
|
||||
/* $XConsortium: flame.c /main/3 1995/11/02 16:07:01 rswiston $ */
|
||||
/*
|
||||
*/
|
||||
/* *
|
||||
* (c) Copyright 1993, 1994 Hewlett-Packard Company *
|
||||
* (c) Copyright 1993, 1994 International Business Machines Corp. *
|
||||
* (c) Copyright 1993, 1994 Sun Microsystems, Inc. *
|
||||
* (c) Copyright 1993, 1994 Novell, Inc. *
|
||||
*/
|
||||
/*-
|
||||
* flame.c - recursive fractal cosmic flames.
|
||||
*
|
||||
* Copyright (c) 1991 by Patrick J. Naughton.
|
||||
*
|
||||
* See dtscreen.c for copying information.
|
||||
*
|
||||
* Revision History:
|
||||
* 27-Jun-91: vary number of functions used.
|
||||
* 24-Jun-91: fixed portability problem with integer mod (%).
|
||||
* 06-Jun-91: Written. (received from Scott Graves, spot@cs.cmu.edu).
|
||||
*/
|
||||
|
||||
#include "dtscreen.h"
|
||||
#include <math.h>
|
||||
|
||||
#define MAXTOTAL 10000
|
||||
#define MAXBATCH 10
|
||||
#define MAXLEV 4
|
||||
|
||||
typedef struct {
|
||||
double f[2][3][MAXLEV];/* three non-homogeneous transforms */
|
||||
int max_levels;
|
||||
int cur_level;
|
||||
int snum;
|
||||
int anum;
|
||||
int width, height;
|
||||
int num_points;
|
||||
int total_points;
|
||||
int pixcol;
|
||||
perwindow *pwin;
|
||||
XPoint pts[MAXBATCH];
|
||||
} flamestruct;
|
||||
|
||||
static short
|
||||
halfrandom(mv)
|
||||
int mv;
|
||||
{
|
||||
static short lasthalf = 0;
|
||||
unsigned long r;
|
||||
|
||||
if (lasthalf) {
|
||||
r = lasthalf;
|
||||
lasthalf = 0;
|
||||
} else {
|
||||
r = random();
|
||||
lasthalf = r >> 16;
|
||||
}
|
||||
return r % mv;
|
||||
}
|
||||
|
||||
void
|
||||
initflame(pwin)
|
||||
perwindow *pwin;
|
||||
{
|
||||
XWindowAttributes xwa;
|
||||
flamestruct *fs;
|
||||
|
||||
if (pwin->data) free(pwin->data);
|
||||
pwin->data = (void *)malloc(sizeof(flamestruct));
|
||||
memset(pwin->data, '\0', sizeof(flamestruct));
|
||||
fs = (flamestruct *)pwin->data;
|
||||
|
||||
srandom(time((time_t *) 0));
|
||||
|
||||
XGetWindowAttributes(dsp, pwin->w, &xwa);
|
||||
fs->width = xwa.width;
|
||||
fs->height = xwa.height;
|
||||
|
||||
fs->max_levels = batchcount;
|
||||
fs->pwin = pwin;
|
||||
|
||||
XSetForeground(dsp, pwin->gc, BlackPixelOfScreen(pwin->perscreen->screen));
|
||||
XFillRectangle(dsp, pwin->w, pwin->gc, 0, 0, fs->width, fs->height);
|
||||
|
||||
if (pwin->perscreen->npixels > 2) {
|
||||
fs->pixcol = halfrandom(pwin->perscreen->npixels);
|
||||
XSetForeground(dsp, pwin->gc, pwin->perscreen->pixels[fs->pixcol]);
|
||||
} else {
|
||||
XSetForeground(dsp, pwin->gc, WhitePixelOfScreen(pwin->perscreen->screen));
|
||||
}
|
||||
}
|
||||
|
||||
static Bool
|
||||
recurse(fs, x, y, l)
|
||||
flamestruct *fs;
|
||||
register double x, y;
|
||||
register int l;
|
||||
{
|
||||
int xp, yp, i;
|
||||
double nx, ny;
|
||||
|
||||
if (l == fs->max_levels) {
|
||||
fs->total_points++;
|
||||
if (fs->total_points > MAXTOTAL) /* how long each fractal runs */
|
||||
return False;
|
||||
|
||||
if (x > -1.0 && x < 1.0 && y > -1.0 && y < 1.0) {
|
||||
xp = fs->pts[fs->num_points].x = (int) ((fs->width / 2)
|
||||
* (x + 1.0));
|
||||
yp = fs->pts[fs->num_points].y = (int) ((fs->height / 2)
|
||||
* (y + 1.0));
|
||||
fs->num_points++;
|
||||
if (fs->num_points > MAXBATCH) { /* point buffer size */
|
||||
XDrawPoints(dsp, fs->pwin->w, fs->pwin->gc, fs->pts,
|
||||
fs->num_points, CoordModeOrigin);
|
||||
fs->num_points = 0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < fs->snum; i++) {
|
||||
nx = fs->f[0][0][i] * x + fs->f[0][1][i] * y + fs->f[0][2][i];
|
||||
ny = fs->f[1][0][i] * x + fs->f[1][1][i] * y + fs->f[1][2][i];
|
||||
if (i < fs->anum) {
|
||||
nx = sin(nx);
|
||||
ny = sin(ny);
|
||||
}
|
||||
if (!recurse(fs, nx, ny, l + 1))
|
||||
return False;
|
||||
}
|
||||
}
|
||||
return True;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
drawflame(pwin)
|
||||
perwindow *pwin;
|
||||
{
|
||||
flamestruct *fs = (flamestruct *)pwin->data;
|
||||
|
||||
int i, j, k;
|
||||
static alt = 0;
|
||||
|
||||
if (!(fs->cur_level++ % fs->max_levels)) {
|
||||
XClearWindow(dsp, fs->pwin->w);
|
||||
alt = !alt;
|
||||
} else {
|
||||
if (pwin->perscreen->npixels > 2) {
|
||||
XSetForeground(dsp, pwin->gc,
|
||||
pwin->perscreen->pixels[fs->pixcol]);
|
||||
if (--fs->pixcol < 0)
|
||||
fs->pixcol = pwin->perscreen->npixels - 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* number of functions */
|
||||
fs->snum = 2 + (fs->cur_level % (MAXLEV - 1));
|
||||
|
||||
/* how many of them are of alternate form */
|
||||
if (alt)
|
||||
fs->anum = 0;
|
||||
else
|
||||
fs->anum = halfrandom(fs->snum) + 2;
|
||||
|
||||
/* 6 dtfs per function */
|
||||
for (k = 0; k < fs->snum; k++) {
|
||||
for (i = 0; i < 2; i++)
|
||||
for (j = 0; j < 3; j++)
|
||||
fs->f[i][j][k] = ((double) (random() & 1023) / 512.0 - 1.0);
|
||||
}
|
||||
fs->num_points = 0;
|
||||
fs->total_points = 0;
|
||||
(void) recurse(fs, 0.0, 0.0, 0);
|
||||
XDrawPoints(dsp, pwin->w, pwin->gc,
|
||||
fs->pts, fs->num_points, CoordModeOrigin);
|
||||
}
|
||||
120
cde/programs/dtscreen/hopalong.c
Normal file
120
cde/programs/dtscreen/hopalong.c
Normal file
@@ -0,0 +1,120 @@
|
||||
/* $XConsortium: hopalong.c /main/3 1995/11/02 16:07:11 rswiston $ */
|
||||
/*
|
||||
*/
|
||||
/* *
|
||||
* (c) Copyright 1993, 1994 Hewlett-Packard Company *
|
||||
* (c) Copyright 1993, 1994 International Business Machines Corp. *
|
||||
* (c) Copyright 1993, 1994 Sun Microsystems, Inc. *
|
||||
* (c) Copyright 1993, 1994 Novell, Inc. *
|
||||
*/
|
||||
/*-
|
||||
* hopalong.c - Real Plane Fractals for dtscreen, the X Window System lockscreen.
|
||||
*
|
||||
* Copyright (c) 1991 by Patrick J. Naughton.
|
||||
*
|
||||
* See dtscreen.c for copying information.
|
||||
*
|
||||
* Revision History:
|
||||
* 29-Oct-90: fix bad (int) cast.
|
||||
* 29-Jul-90: support for multiple screens.
|
||||
* 08-Jul-90: new timing and colors and new algorithm for fractals.
|
||||
* 15-Dec-89: Fix for proper skipping of {White,Black}Pixel() in colors.
|
||||
* 08-Oct-89: Fixed long standing typo bug in RandomInitHop();
|
||||
* Fixed bug in memory allocation in inithop();
|
||||
* Moved seconds() to an extern.
|
||||
* Got rid of the % mod since .mod is slow on a sparc.
|
||||
* 20-Sep-89: Lint.
|
||||
* 31-Aug-88: Forked from dtscreen.c for modularity.
|
||||
* 23-Mar-88: Coded HOPALONG routines from Scientific American Sept. 86 p. 14.
|
||||
*/
|
||||
|
||||
#include "dtscreen.h"
|
||||
#include <math.h>
|
||||
|
||||
typedef struct {
|
||||
int centerx;
|
||||
int centery; /* center of the screen */
|
||||
double a;
|
||||
double b;
|
||||
double c;
|
||||
double i;
|
||||
double j; /* hopalong parameters */
|
||||
int inc;
|
||||
int pix;
|
||||
long startTime;
|
||||
} hopstruct;
|
||||
|
||||
static XPoint *pointBuffer = 0; /* pointer for XDrawPoints */
|
||||
|
||||
#define TIMEOUT 30
|
||||
|
||||
void
|
||||
inithop(pwin)
|
||||
perwindow *pwin;
|
||||
{
|
||||
double range;
|
||||
XWindowAttributes xgwa;
|
||||
hopstruct *hp;
|
||||
|
||||
if (pwin->data) free(pwin->data);
|
||||
pwin->data = (void *)malloc(sizeof(hopstruct));
|
||||
memset(pwin->data, '\0', sizeof(hopstruct));
|
||||
hp = (hopstruct *)pwin->data;
|
||||
XGetWindowAttributes(dsp, pwin->w, &xgwa);
|
||||
hp->centerx = xgwa.width / 2;
|
||||
hp->centery = xgwa.height / 2;
|
||||
range = sqrt((double) hp->centerx * hp->centerx +
|
||||
(double) hp->centery * hp->centery) /
|
||||
(10.0 + random() % 10);
|
||||
|
||||
hp->pix = 0;
|
||||
hp->inc = (int) ((random() / MAXRAND) * 200) - 100;
|
||||
hp->a = (random() / MAXRAND) * range - range / 2.0;
|
||||
hp->b = (random() / MAXRAND) * range - range / 2.0;
|
||||
hp->c = (random() / MAXRAND) * range - range / 2.0;
|
||||
if (!(random() % 2))
|
||||
hp->c = 0.0;
|
||||
|
||||
hp->i = hp->j = 0.0;
|
||||
|
||||
if (!pointBuffer)
|
||||
pointBuffer = (XPoint *) malloc(batchcount * sizeof(XPoint));
|
||||
|
||||
XSetForeground(dsp, pwin->gc, BlackPixelOfScreen(pwin->perscreen->screen));
|
||||
XFillRectangle(dsp, pwin->w, pwin->gc, 0, 0,
|
||||
hp->centerx * 2, hp->centery * 2);
|
||||
XSetForeground(dsp, pwin->gc, WhitePixelOfScreen(pwin->perscreen->screen));
|
||||
hp->startTime = seconds();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
drawhop(pwin)
|
||||
perwindow *pwin;
|
||||
{
|
||||
double oldj;
|
||||
int k = batchcount;
|
||||
XPoint *xp = pointBuffer;
|
||||
hopstruct *hp = (hopstruct *)pwin->data;
|
||||
|
||||
hp->inc++;
|
||||
if (!mono && pwin->perscreen->npixels > 2) {
|
||||
XSetForeground(dsp, pwin->gc, pwin->perscreen->pixels[hp->pix]);
|
||||
if (++hp->pix >= pwin->perscreen->npixels)
|
||||
hp->pix = 0;
|
||||
}
|
||||
while (k--) {
|
||||
oldj = hp->j;
|
||||
hp->j = hp->a - hp->i;
|
||||
hp->i = oldj + (hp->i < 0
|
||||
? sqrt(fabs(hp->b * (hp->i + hp->inc) - hp->c))
|
||||
: -sqrt(fabs(hp->b * (hp->i + hp->inc) - hp->c)));
|
||||
xp->x = hp->centerx + (int) (hp->i + hp->j);
|
||||
xp->y = hp->centery - (int) (hp->i - hp->j);
|
||||
xp++;
|
||||
}
|
||||
XDrawPoints(dsp, pwin->w, pwin->gc,
|
||||
pointBuffer, batchcount, CoordModeOrigin);
|
||||
if (seconds() - hp->startTime > TIMEOUT)
|
||||
inithop(pwin);
|
||||
}
|
||||
120
cde/programs/dtscreen/hsbramp.c
Normal file
120
cde/programs/dtscreen/hsbramp.c
Normal file
@@ -0,0 +1,120 @@
|
||||
/* $XConsortium: hsbramp.c /main/3 1995/11/02 16:07:23 rswiston $ */
|
||||
/*
|
||||
*/
|
||||
/* *
|
||||
* (c) Copyright 1993, 1994 Hewlett-Packard Company *
|
||||
* (c) Copyright 1993, 1994 International Business Machines Corp. *
|
||||
* (c) Copyright 1993, 1994 Sun Microsystems, Inc. *
|
||||
* (c) Copyright 1993, 1994 Novell, Inc. *
|
||||
*/
|
||||
/*-
|
||||
* hsbramp.c - Create an HSB ramp.
|
||||
*
|
||||
* Copyright (c) 1991 by Patrick J. Naughton.
|
||||
*
|
||||
* See dtscreen.c for copying information.
|
||||
*
|
||||
* Revision History:
|
||||
* 29-Jul-90: renamed hsbramp.c from HSBmap.c
|
||||
* minor optimizations.
|
||||
* 01-Sep-88: Written.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <math.h>
|
||||
|
||||
void
|
||||
hsb2rgb(H, S, B, r, g, b)
|
||||
double H,
|
||||
S,
|
||||
B;
|
||||
u_char *r,
|
||||
*g,
|
||||
*b;
|
||||
{
|
||||
int i;
|
||||
double f;
|
||||
double bb;
|
||||
u_char p;
|
||||
u_char q;
|
||||
u_char t;
|
||||
|
||||
H -= floor(H); /* remove anything over 1 */
|
||||
H *= 6.0;
|
||||
i = floor(H); /* 0..5 */
|
||||
f = H - (float) i; /* f = fractional part of H */
|
||||
bb = 255.0 * B;
|
||||
p = (u_char) (bb * (1.0 - S));
|
||||
q = (u_char) (bb * (1.0 - (S * f)));
|
||||
t = (u_char) (bb * (1.0 - (S * (1.0 - f))));
|
||||
switch (i) {
|
||||
case 0:
|
||||
*r = (u_char) bb;
|
||||
*g = t;
|
||||
*b = p;
|
||||
break;
|
||||
case 1:
|
||||
*r = q;
|
||||
*g = (u_char) bb;
|
||||
*b = p;
|
||||
break;
|
||||
case 2:
|
||||
*r = p;
|
||||
*g = (u_char) bb;
|
||||
*b = t;
|
||||
break;
|
||||
case 3:
|
||||
*r = p;
|
||||
*g = q;
|
||||
*b = (u_char) bb;
|
||||
break;
|
||||
case 4:
|
||||
*r = t;
|
||||
*g = p;
|
||||
*b = (u_char) bb;
|
||||
break;
|
||||
case 5:
|
||||
*r = (u_char) bb;
|
||||
*g = p;
|
||||
*b = q;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Input is two points in HSB color space and a count
|
||||
* of how many discreet rgb space values the caller wants.
|
||||
*
|
||||
* Output is that many rgb triples which describe a linear
|
||||
* interpolate ramp between the two input colors.
|
||||
*/
|
||||
|
||||
void
|
||||
hsbramp(h1, s1, b1, h2, s2, b2, count, red, green, blue)
|
||||
double h1,
|
||||
s1,
|
||||
b1,
|
||||
h2,
|
||||
s2,
|
||||
b2;
|
||||
int count;
|
||||
|
||||
u_char *red,
|
||||
*green,
|
||||
*blue;
|
||||
{
|
||||
double dh;
|
||||
double ds;
|
||||
double db;
|
||||
|
||||
dh = (h2 - h1) / count;
|
||||
ds = (s2 - s1) / count;
|
||||
db = (b2 - b1) / count;
|
||||
while (count--) {
|
||||
hsb2rgb(h1, s1, b1, red++, green++, blue++);
|
||||
h1 += dh;
|
||||
s1 += ds;
|
||||
b1 += db;
|
||||
}
|
||||
}
|
||||
120
cde/programs/dtscreen/image.c
Normal file
120
cde/programs/dtscreen/image.c
Normal file
@@ -0,0 +1,120 @@
|
||||
/* $XConsortium: image.c /main/3 1995/11/02 16:07:35 rswiston $ */
|
||||
/*
|
||||
*/
|
||||
/* *
|
||||
* (c) Copyright 1993, 1994 Hewlett-Packard Company *
|
||||
* (c) Copyright 1993, 1994 International Business Machines Corp. *
|
||||
* (c) Copyright 1993, 1994 Sun Microsystems, Inc. *
|
||||
* (c) Copyright 1993, 1994 Novell, Inc. *
|
||||
*/
|
||||
/*-
|
||||
* image.c - image bouncer for dtscreen, the X Window System lockscreen.
|
||||
*
|
||||
* Copyright (c) 1991 by Patrick J. Naughton.
|
||||
*
|
||||
* See dtscreen.c for copying information.
|
||||
*
|
||||
* Revision History:
|
||||
* 29-Jul-90: Written.
|
||||
*/
|
||||
|
||||
#include "dtscreen.h"
|
||||
#include "xlogo.bit"
|
||||
|
||||
static XImage logo = {
|
||||
0, 0, /* width, height */
|
||||
0, XYBitmap, 0, /* xoffset, format, data */
|
||||
LSBFirst, 8, /* byte-order, bitmap-unit */
|
||||
LSBFirst, 8, 1 /* bitmap-bit-order, bitmap-pad, depth */
|
||||
};
|
||||
|
||||
#define MAXICONS 256
|
||||
|
||||
typedef struct {
|
||||
int x;
|
||||
int y;
|
||||
} point;
|
||||
|
||||
typedef struct {
|
||||
int width;
|
||||
int height;
|
||||
int nrows;
|
||||
int ncols;
|
||||
int xb;
|
||||
int yb;
|
||||
int iconmode;
|
||||
int iconcount;
|
||||
point icons[MAXICONS];
|
||||
long startTime;
|
||||
} imagestruct;
|
||||
|
||||
void
|
||||
drawimage(pwin)
|
||||
perwindow *pwin;
|
||||
{
|
||||
imagestruct *ip;
|
||||
int i;
|
||||
|
||||
ip = (imagestruct *)pwin->data;
|
||||
XSetForeground(dsp, pwin->gc, BlackPixelOfScreen(pwin->perscreen->screen));
|
||||
for (i = 0; i < ip->iconcount; i++) {
|
||||
if (!ip->iconmode)
|
||||
XFillRectangle(dsp, pwin->w, pwin->gc,
|
||||
ip->xb + xlogo_width * ip->icons[i].x,
|
||||
ip->yb + xlogo_height * ip->icons[i].y,
|
||||
xlogo_width, xlogo_height);
|
||||
|
||||
ip->icons[i].x = random() % ip->ncols;
|
||||
ip->icons[i].y = random() % ip->nrows;
|
||||
}
|
||||
if (pwin->perscreen->npixels == 2)
|
||||
XSetForeground(dsp, pwin->gc, WhitePixelOfScreen(pwin->perscreen->screen));
|
||||
for (i = 0; i < ip->iconcount; i++) {
|
||||
if (pwin->perscreen->npixels > 2)
|
||||
XSetForeground(dsp, pwin->gc,
|
||||
pwin->perscreen->pixels[random() % pwin->perscreen->npixels]);
|
||||
|
||||
XPutImage(dsp, pwin->w, pwin->gc, &logo,
|
||||
0, 0,
|
||||
ip->xb + xlogo_width * ip->icons[i].x,
|
||||
ip->yb + xlogo_height * ip->icons[i].y,
|
||||
xlogo_width, xlogo_height);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
initimage(pwin)
|
||||
perwindow *pwin;
|
||||
{
|
||||
XWindowAttributes xgwa;
|
||||
imagestruct *ip;
|
||||
|
||||
if (pwin->data) free(pwin->data);
|
||||
pwin->data = (void *)malloc(sizeof(imagestruct));
|
||||
memset(pwin->data, '\0', sizeof(imagestruct));
|
||||
ip = (imagestruct *)pwin->data;
|
||||
ip->startTime = seconds();
|
||||
|
||||
logo.data = (char *) xlogo_bits;
|
||||
logo.width = xlogo_width;
|
||||
logo.height = xlogo_height;
|
||||
logo.bytes_per_line = (xlogo_width + 7) / 8;
|
||||
|
||||
XGetWindowAttributes(dsp, pwin->w, &xgwa);
|
||||
ip->width = xgwa.width;
|
||||
ip->height = xgwa.height;
|
||||
ip->ncols = ip->width / xlogo_width;
|
||||
ip->nrows = ip->height / xlogo_height;
|
||||
ip->iconmode = (ip->ncols < 2 || ip->nrows < 2);
|
||||
if (ip->iconmode) {
|
||||
ip->xb = 0;
|
||||
ip->yb = 0;
|
||||
ip->iconcount = 1; /* icon mode */
|
||||
} else {
|
||||
ip->xb = (ip->width - xlogo_width * ip->ncols) / 2;
|
||||
ip->yb = (ip->height - xlogo_height * ip->nrows) / 2;
|
||||
ip->iconcount = batchcount;
|
||||
}
|
||||
XSetForeground(dsp, pwin->gc, BlackPixelOfScreen(pwin->perscreen->screen));
|
||||
XFillRectangle(dsp, pwin->w, pwin->gc, 0, 0, ip->width, ip->height);
|
||||
}
|
||||
634
cde/programs/dtscreen/life.c
Normal file
634
cde/programs/dtscreen/life.c
Normal file
@@ -0,0 +1,634 @@
|
||||
/* $XConsortium: life.c /main/3 1995/11/02 16:07:44 rswiston $ */
|
||||
/* *
|
||||
* (c) Copyright 1993, 1994 Hewlett-Packard Company *
|
||||
* (c) Copyright 1993, 1994 International Business Machines Corp. *
|
||||
* (c) Copyright 1993, 1994 Sun Microsystems, Inc. *
|
||||
* (c) Copyright 1993, 1994 Novell, Inc. *
|
||||
*/
|
||||
/*-
|
||||
* life.c - Conway's game of Life for dtscreen, the X Window System lockscreen.
|
||||
*
|
||||
* Copyright (c) 1991 by Patrick J. Naughton.
|
||||
*
|
||||
* See dtscreen.c for copying information.
|
||||
*
|
||||
* Revision History:
|
||||
* 24-May-91: Added wraparound code from johnson@bugs.comm.mot.com.
|
||||
* Made old cells stay blue.
|
||||
* Made batchcount control the number of generations till restart.
|
||||
* 29-Jul-90: support for multiple screens.
|
||||
* 07-Feb-90: remove bogus semi-colon after #include line.
|
||||
* 15-Dec-89: Fix for proper skipping of {White,Black}Pixel() in colors.
|
||||
* 08-Oct-89: Moved seconds() to an extern.
|
||||
* 20-Sep-89: Written (life algorithm courtesy of Jim Graham, flar@sun.com).
|
||||
*/
|
||||
|
||||
#include "dtscreen.h"
|
||||
#include "lifeicon.bit"
|
||||
|
||||
static XImage logo = {
|
||||
0, 0, /* width, height */
|
||||
0, XYBitmap, 0, /* xoffset, format, data */
|
||||
LSBFirst, 8, /* byte-order, bitmap-unit */
|
||||
LSBFirst, 8, 1 /* bitmap-bit-order, bitmap-pad, depth */
|
||||
};
|
||||
#define min(a, b) ((a)<(b)?(a):(b))
|
||||
#define MAXROWS 155
|
||||
#define MAXCOLS 144
|
||||
#define TIMEOUT 30
|
||||
|
||||
typedef struct {
|
||||
int pixelmode;
|
||||
int xs;
|
||||
int ys;
|
||||
int xb;
|
||||
int yb;
|
||||
int generation;
|
||||
long shooterTime;
|
||||
int nrows;
|
||||
int ncols;
|
||||
int width;
|
||||
int height;
|
||||
unsigned char buffer[(MAXROWS + 2) * (MAXCOLS + 2) + 2];
|
||||
unsigned char tempbuf[MAXCOLS * 2];
|
||||
unsigned char lastbuf[MAXCOLS];
|
||||
unsigned char agebuf[(MAXROWS + 2) * (MAXCOLS + 2)];
|
||||
} lifestruct;
|
||||
|
||||
static int icon_width, icon_height;
|
||||
|
||||
/* Buffer stores the data for each cell. Each cell is stored as
|
||||
* 8 bits representing the presence of a critter in each of it's
|
||||
* surrounding 8 cells. There is an empty row and column around
|
||||
* the whole array to allow stores without bounds checking as well
|
||||
* as an extra row at the end for the fetches into tempbuf.
|
||||
*
|
||||
* Tempbuf stores the data for the next two rows so that we know
|
||||
* the state of those critter before he was modified by the fate
|
||||
* of the critters that have already been processed.
|
||||
*
|
||||
* Agebuf stores the age of each critter.
|
||||
*/
|
||||
|
||||
#define UPLT 0x01
|
||||
#define UP 0x02
|
||||
#define UPRT 0x04
|
||||
#define LT 0x08
|
||||
#define RT 0x10
|
||||
#define DNLT 0x20
|
||||
#define DN 0x40
|
||||
#define DNRT 0x80
|
||||
|
||||
/* Fates is a lookup table for the fate of a critter. The 256
|
||||
* entries represent the 256 possible combinations of the 8
|
||||
* neighbor cells. Each entry is one of BIRTH (create a cell
|
||||
* or leave one alive), SAME (leave the cell alive or dead),
|
||||
* or DEATH (kill anything in the cell).
|
||||
*/
|
||||
#define BIRTH 0
|
||||
#define SAME 1
|
||||
#define DEATH 2
|
||||
static unsigned char fates[256];
|
||||
static int initialized = 0;
|
||||
|
||||
const int patterns[][128] = {
|
||||
{ /* EIGHT */
|
||||
-3, -3, -2, -3, -1, -3,
|
||||
-3, -2, -2, -2, -1, -2,
|
||||
-3, -1, -2, -1, -1, -1,
|
||||
0, 0, 1, 0, 2, 0,
|
||||
0, 1, 1, 1, 2, 1,
|
||||
0, 2, 1, 2, 2, 2,
|
||||
99
|
||||
},
|
||||
{ /* PULSAR */
|
||||
1, 1, 2, 1, 3, 1, 4, 1, 5, 1,
|
||||
1, 2, 5, 2,
|
||||
99
|
||||
},
|
||||
{ /* BARBER */
|
||||
-7, -7, -6, -7,
|
||||
-7, -6, -5, -6,
|
||||
-5, -4, -3, -4,
|
||||
-3, -2, -1, -2,
|
||||
-1, 0, 1, 0,
|
||||
1, 2, 3, 2,
|
||||
3, 4, 5, 4,
|
||||
4, 5, 5, 5,
|
||||
99
|
||||
},
|
||||
{ /* HERTZ */
|
||||
-2, -6, -1, -6,
|
||||
-2, -5, -1, -5,
|
||||
-7, -3, -6, -3, -2, -3, -1, -3, 0, -3, 1, -3, 5, -3, 6, -3,
|
||||
-7, -2, -5, -2, -3, -2, 2, -2, 4, -2, 6, -2,
|
||||
-5, -1, -3, -1, -2, -1, 2, -1, 4, -1,
|
||||
-7, 0, -5, 0, -3, 0, 2, 0, 4, 0, 6, 0,
|
||||
-7, 1, -6, 1, -2, 1, -1, 1, 0, 1, 1, 1, 5, 1, 6, 1,
|
||||
-2, 3, -1, 3,
|
||||
-2, 4, -1, 4,
|
||||
99
|
||||
},
|
||||
{ /* TUMBLER */
|
||||
-6, -6, -5, -6, 6, -6, 7, -6,
|
||||
-6, -5, -5, -5, 6, -5, 7, -5,
|
||||
-5, 5, 6, 5,
|
||||
-7, 6, -5, 6, 6, 6, 8, 6,
|
||||
-7, 7, -5, 7, 6, 7, 8, 7,
|
||||
-7, 8, -6, 8, 7, 8, 8, 8,
|
||||
99
|
||||
},
|
||||
{ /* PERIOD4 */
|
||||
-5, -8, -4, -8,
|
||||
-7, -7, -5, -7,
|
||||
-8, -6, -2, -6,
|
||||
-7, -5, -3, -5, -2, -5,
|
||||
-5, -3, -3, -3,
|
||||
-4, -2,
|
||||
99
|
||||
},
|
||||
{ /* PERIOD5 */
|
||||
-5, -8, -4, -8,
|
||||
-6, -7, -3, -7,
|
||||
-7, -6, -2, -6,
|
||||
-8, -5, -1, -5,
|
||||
-8, -4, -1, -4,
|
||||
-7, -3, -2, -3,
|
||||
-6, -2, -3, -2,
|
||||
-5, -1, -4, -1,
|
||||
99
|
||||
},
|
||||
{ /* PERIOD6 */
|
||||
-4, -8, -3, -8,
|
||||
-8, -7, -7, -7, -5, -7,
|
||||
-8, -6, -7, -6, -4, -6, -1, -6,
|
||||
-3, -5, -1, -5,
|
||||
-2, -4,
|
||||
-3, -2, -2, -2,
|
||||
-3, -1, -2, -1,
|
||||
99
|
||||
},
|
||||
{ /* PINWHEEL */
|
||||
-4, -8, -3, -8,
|
||||
-4, -7, -3, -7,
|
||||
-4, -5, -3, -5, -2, -5, -1, -5,
|
||||
-5, -4, -3, -4, 0, -4, 2, -4, 3, -4,
|
||||
-5, -3, -1, -3, 0, -3, 2, -3, 3, -3,
|
||||
-8, -2, -7, -2, -5, -2, -2, -2, 0, -2,
|
||||
-8, -1, -7, -1, -5, -1, 0, -1,
|
||||
-4, 0, -3, 0, -2, 0, -1, 0,
|
||||
-2, 2, -1, 2,
|
||||
-2, 3, -1, 3,
|
||||
99
|
||||
},
|
||||
{ /* ] */
|
||||
-1, -1, 0, -1, 1, -1,
|
||||
0, 0, 1, 0,
|
||||
-1, 1, 0, 1, 1, 1,
|
||||
99
|
||||
},
|
||||
{ /* cc: */
|
||||
-3, -1, -2, -1, -1, -1, 1, -1, 2, -1, 3, -1,
|
||||
-3, 0, -2, 0, 1, 0, 2, 0,
|
||||
-3, 1, -2, 1, -1, 1, 1, 1, 2, 1, 3, 1,
|
||||
99
|
||||
},
|
||||
{ /* DOLBY */
|
||||
-3, -1, -2, -1, -1, -1, 1, -1, 2, -1, 3, -1,
|
||||
-3, 0, -2, 0, 2, 0, 3, 0,
|
||||
-3, 1, -2, 1, -1, 1, 1, 1, 2, 1, 3, 1,
|
||||
99
|
||||
},
|
||||
{ /* HORIZON */
|
||||
-15, 0, -14, 0, -13, 0, -12, 0, -11, 0,
|
||||
-10, 0, -9, 0, -8, 0, -7, 0, -6, 0,
|
||||
-5, 0, -4, 0, -3, 0, -2, 0, -1, 0,
|
||||
4, 0, 3, 0, 2, 0, 1, 0, 0, 0,
|
||||
9, 0, 8, 0, 7, 0, 6, 0, 5, 0,
|
||||
14, 0, 13, 0, 12, 0, 11, 0, 10, 0,
|
||||
99
|
||||
},
|
||||
{ /* SHEAR */
|
||||
-7, -2, -6, -2, -5, -2, -4, -2, -3, -2,
|
||||
-2, -2, -1, -2, 0, -2, 1, -2, 2, -2,
|
||||
-5, -1, -4, -1, -3, -1, -2, -1, -1, -1,
|
||||
0, -1, 1, -1, 2, -1, 3, -1, 4, -1,
|
||||
-3, 0, -2, 0, -1, 0, 0, 0, 1, 0,
|
||||
2, 0, 3, 0, 4, 0, 5, 0, 6, 0,
|
||||
-10, 1, -9, 1, -8, 1, -7, 1, -6, 1,
|
||||
-5, 1, -4, 1, -3, 1, -2, 1, -1, 1,
|
||||
-10, 2, -9, 2, -8, 2, -7, 2, -6, 2,
|
||||
-5, 2, -4, 2, -3, 2, -2, 2, -1, 2,
|
||||
99
|
||||
},
|
||||
{ /* VERTIGO */
|
||||
0, -7,
|
||||
0, -6,
|
||||
0, -5,
|
||||
0, -4,
|
||||
0, -3,
|
||||
0, -2,
|
||||
0, -1,
|
||||
0, 0,
|
||||
0, 7,
|
||||
0, 6,
|
||||
0, 5,
|
||||
0, 4,
|
||||
0, 3,
|
||||
0, 2,
|
||||
0, 1,
|
||||
99
|
||||
},
|
||||
{ /* CROSSBAR */
|
||||
-5, 0, -4, 0, -3, 0, -2, 0, -1, 0, 4, 0, 3, 0, 2, 0, 1, 0, 0, 0,
|
||||
99
|
||||
},
|
||||
{ /* GOALPOSTS */
|
||||
-8, -7, 8, -7,
|
||||
-8, -6, 8, -6,
|
||||
-8, -5, 8, -5,
|
||||
-8, -4, 8, -4,
|
||||
-8, -3, 8, -3,
|
||||
-8, -2, 8, -2,
|
||||
-8, -1, 8, -1,
|
||||
-8, 0, 8, 0,
|
||||
-8, 1, 8, 1,
|
||||
-8, 2, 8, 2,
|
||||
-8, 3, 8, 3,
|
||||
-8, 4, 8, 4,
|
||||
-8, 5, 8, 5,
|
||||
-8, 6, 8, 6,
|
||||
-8, 7, 8, 7,
|
||||
99
|
||||
},
|
||||
{ /* \ */
|
||||
-8, -8, -7, -8,
|
||||
-7, -7, -6, -7,
|
||||
-6, -6, -5, -6,
|
||||
-5, -5, -4, -5,
|
||||
-4, -4, -3, -4,
|
||||
-3, -3, -2, -3,
|
||||
-2, -2, -1, -2,
|
||||
-1, -1, 0, -1,
|
||||
0, 0, 1, 0,
|
||||
1, 1, 2, 1,
|
||||
2, 2, 3, 2,
|
||||
3, 3, 4, 3,
|
||||
4, 4, 5, 4,
|
||||
5, 5, 6, 5,
|
||||
6, 6, 7, 6,
|
||||
7, 7, 8, 7,
|
||||
99
|
||||
},
|
||||
{ /* LABYRINTH */
|
||||
-4, -4, -3, -4, -2, -4, -1, -4, 0, -4, 1, -4, 2, -4, 3, -4, 4, -4,
|
||||
-4, -3, 0, -3, 4, -3,
|
||||
-4, -2, -2, -2, -1, -2, 0, -2, 1, -2, 2, -2, 4, -2,
|
||||
-4, -1, -2, -1, 2, -1, 4, -1,
|
||||
-4, 0, -2, 0, -1, 0, 0, 0, 1, 0, 2, 0, 4, 0,
|
||||
-4, 1, -2, 1, 2, 1, 4, 1,
|
||||
-4, 2, -2, 2, -1, 2, 0, 2, 1, 2, 2, 2, 4, 2,
|
||||
-4, 3, 0, 3, 4, 3,
|
||||
-4, 4, -3, 4, -2, 4, -1, 4, 0, 4, 1, 4, 2, 4, 3, 4, 4, 4,
|
||||
99
|
||||
}
|
||||
};
|
||||
|
||||
#define NPATS (sizeof patterns / sizeof patterns[0])
|
||||
|
||||
|
||||
static void
|
||||
drawcell(pwin, row, col)
|
||||
perwindow *pwin;
|
||||
int row, col;
|
||||
{
|
||||
lifestruct *lp;
|
||||
|
||||
lp = (lifestruct *)pwin->data;
|
||||
XSetForeground(dsp, pwin->gc, WhitePixelOfScreen(pwin->perscreen->screen));
|
||||
if (!mono && pwin->perscreen->npixels > 2) {
|
||||
unsigned char *loc = lp->buffer + ((row + 1) * (lp->ncols + 2)) + col + 1;
|
||||
unsigned char *ageptr = lp->agebuf + (loc - lp->buffer);
|
||||
unsigned char age = *ageptr;
|
||||
|
||||
/* if we aren't up to blue yet, then keep aging the cell. */
|
||||
if (age < (unsigned char) (pwin->perscreen->npixels * 0.7))
|
||||
++age;
|
||||
|
||||
XSetForeground(dsp, pwin->gc, pwin->perscreen->pixels[age]);
|
||||
*ageptr = age;
|
||||
}
|
||||
if (lp->pixelmode)
|
||||
XFillRectangle(dsp, pwin->w, pwin->gc,
|
||||
lp->xb + lp->xs * col, lp->yb + lp->ys * row, lp->xs, lp->ys);
|
||||
else
|
||||
XPutImage(dsp, pwin->w, pwin->gc, &logo,
|
||||
0, 0, lp->xb + lp->xs * col, lp->yb + lp->ys * row,
|
||||
icon_width, icon_height);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
erasecell(pwin, row, col)
|
||||
perwindow *pwin;
|
||||
int row, col;
|
||||
{
|
||||
lifestruct *lp = (lifestruct *)pwin->data;
|
||||
XSetForeground(dsp, pwin->gc, BlackPixelOfScreen(pwin->perscreen->screen));
|
||||
XFillRectangle(dsp, pwin->w, pwin->gc,
|
||||
lp->xb + lp->xs * col, lp->yb + lp->ys * row, lp->xs, lp->ys);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
spawn(pwin, loc)
|
||||
perwindow *pwin;
|
||||
unsigned char *loc;
|
||||
{
|
||||
lifestruct *lp = (lifestruct *)pwin->data;
|
||||
unsigned char *ulloc, *ucloc, *urloc, *clloc, *crloc, *llloc, *lcloc, *lrloc,
|
||||
*arloc;
|
||||
int off, row, col, lastrow;
|
||||
|
||||
lastrow = (lp->nrows) * (lp->ncols + 2);
|
||||
off = loc - lp->buffer;
|
||||
col = off % (lp->ncols + 2);
|
||||
row = (off - col) / (lp->ncols + 2);
|
||||
ulloc = loc - lp->ncols - 3;
|
||||
ucloc = loc - lp->ncols - 2;
|
||||
urloc = loc - lp->ncols - 1;
|
||||
clloc = loc - 1;
|
||||
crloc = loc + 1;
|
||||
arloc = loc + 1;
|
||||
llloc = loc + lp->ncols + 1;
|
||||
lcloc = loc + lp->ncols + 2;
|
||||
lrloc = loc + lp->ncols + 3;
|
||||
if (row == 1) {
|
||||
ulloc += lastrow;
|
||||
ucloc += lastrow;
|
||||
urloc += lastrow;
|
||||
}
|
||||
if (row == lp->nrows) {
|
||||
llloc -= lastrow;
|
||||
lcloc -= lastrow;
|
||||
lrloc -= lastrow;
|
||||
}
|
||||
if (col == 1) {
|
||||
ulloc += lp->ncols;
|
||||
clloc += lp->ncols;
|
||||
llloc += lp->ncols;
|
||||
}
|
||||
if (col == lp->ncols) {
|
||||
urloc -= lp->ncols;
|
||||
crloc -= lp->ncols;
|
||||
lrloc -= lp->ncols;
|
||||
}
|
||||
*ulloc |= UPLT;
|
||||
*ucloc |= UP;
|
||||
*urloc |= UPRT;
|
||||
*clloc |= LT;
|
||||
*crloc |= RT;
|
||||
*arloc |= RT;
|
||||
*llloc |= DNLT;
|
||||
*lcloc |= DN;
|
||||
*lrloc |= DNRT;
|
||||
|
||||
*(lp->agebuf + (loc - lp->buffer)) = 0;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
life_kill(pwin, loc)
|
||||
perwindow *pwin;
|
||||
unsigned char *loc;
|
||||
{
|
||||
lifestruct *lp = (lifestruct *)pwin->data;
|
||||
|
||||
unsigned char *ulloc, *ucloc, *urloc, *clloc, *crloc, *llloc, *lcloc,
|
||||
*lrloc, *arloc;
|
||||
int off, row, col, lastrow;
|
||||
|
||||
lastrow = (lp->nrows) * (lp->ncols + 2);
|
||||
off = loc - lp->buffer;
|
||||
row = off / (lp->ncols + 2);
|
||||
col = off % (lp->ncols + 2);
|
||||
row = (off - col) / (lp->ncols + 2);
|
||||
ulloc = loc - lp->ncols - 3;
|
||||
ucloc = loc - lp->ncols - 2;
|
||||
urloc = loc - lp->ncols - 1;
|
||||
clloc = loc - 1;
|
||||
crloc = loc + 1;
|
||||
arloc = loc + 1;
|
||||
llloc = loc + lp->ncols + 1;
|
||||
lcloc = loc + lp->ncols + 2;
|
||||
lrloc = loc + lp->ncols + 3;
|
||||
if (row == 1) {
|
||||
ulloc += lastrow;
|
||||
ucloc += lastrow;
|
||||
urloc += lastrow;
|
||||
}
|
||||
if (row == lp->nrows) {
|
||||
llloc -= lastrow;
|
||||
lcloc -= lastrow;
|
||||
lrloc -= lastrow;
|
||||
}
|
||||
if (col == 1) {
|
||||
ulloc += lp->ncols;
|
||||
clloc += lp->ncols;
|
||||
llloc += lp->ncols;
|
||||
}
|
||||
if (col == lp->ncols) {
|
||||
urloc -= lp->ncols;
|
||||
crloc -= lp->ncols;
|
||||
lrloc -= lp->ncols;
|
||||
}
|
||||
*ulloc &= ~UPLT;
|
||||
*ucloc &= ~UP;
|
||||
*urloc &= ~UPRT;
|
||||
*clloc &= ~LT;
|
||||
*crloc &= ~RT;
|
||||
*arloc &= ~RT;
|
||||
*llloc &= ~DNLT;
|
||||
*lcloc &= ~DN;
|
||||
*lrloc &= ~DNRT;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
setcell(pwin, row, col)
|
||||
perwindow *pwin;
|
||||
int row;
|
||||
int col;
|
||||
{
|
||||
lifestruct *lp = (lifestruct *)pwin->data;
|
||||
unsigned char *loc;
|
||||
|
||||
loc = lp->buffer + ((row + 1) * (lp->ncols + 2)) + col + 1;
|
||||
spawn(pwin, loc);
|
||||
drawcell(pwin, row, col);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
init_fates()
|
||||
{
|
||||
int i, bits, neighbors;
|
||||
|
||||
for (i = 0; i < 256; i++) {
|
||||
neighbors = 0;
|
||||
for (bits = i; bits; bits &= (bits - 1))
|
||||
neighbors++;
|
||||
if (neighbors == 3)
|
||||
fates[i] = BIRTH;
|
||||
else if (neighbors == 2)
|
||||
fates[i] = SAME;
|
||||
else
|
||||
fates[i] = DEATH;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
initlife(pwin)
|
||||
perwindow *pwin;
|
||||
{
|
||||
int row, col;
|
||||
int *patptr;
|
||||
XWindowAttributes xgwa;
|
||||
lifestruct *lp;
|
||||
|
||||
if (pwin->data) free(pwin->data);
|
||||
pwin->data = (void *)malloc(sizeof(lifestruct));
|
||||
memset(pwin->data, '\0', sizeof(lifestruct));
|
||||
lp = (lifestruct *)pwin->data;
|
||||
lp->generation = 0;
|
||||
lp->shooterTime = seconds();
|
||||
icon_width = lifeicon_width;
|
||||
icon_height = lifeicon_height;
|
||||
|
||||
if (!initialized) {
|
||||
initialized = 1;
|
||||
init_fates();
|
||||
logo.data = (char *) lifeicon_bits;
|
||||
logo.width = icon_width;
|
||||
logo.height = icon_height;
|
||||
logo.bytes_per_line = (icon_width + 7) / 8;
|
||||
}
|
||||
XGetWindowAttributes(dsp, pwin->w, &xgwa);
|
||||
lp->width = xgwa.width;
|
||||
lp->height = xgwa.height;
|
||||
lp->pixelmode = (lp->width < 4 * icon_width);
|
||||
if (lp->pixelmode) {
|
||||
lp->ncols = 32;
|
||||
lp->nrows = 32;
|
||||
} else {
|
||||
lp->ncols = min(lp->width / icon_width, MAXCOLS);
|
||||
lp->nrows = min(lp->height / icon_height, MAXROWS);
|
||||
}
|
||||
/* For the dtstyle preview screen, the rows and columns can
|
||||
* be less than 32 regardless of the pixelmode calculation.
|
||||
* This can cause the row/column calculations below to go
|
||||
* negative, which causes very bad things to happen. Until we
|
||||
* get an official fix, this will keep life from core dumping.
|
||||
*/
|
||||
if ((lp->ncols < 32) || (lp->nrows < 32)) {
|
||||
lp->pixelmode = 1;
|
||||
lp->ncols = 32;
|
||||
lp->nrows = 32;
|
||||
}
|
||||
lp->xs = lp->width / lp->ncols;
|
||||
lp->ys = lp->height / lp->nrows;
|
||||
lp->xb = (lp->width - lp->xs * lp->ncols) / 2;
|
||||
lp->yb = (lp->height - lp->ys * lp->nrows) / 2;
|
||||
|
||||
XSetForeground(dsp, pwin->gc, BlackPixelOfScreen(pwin->perscreen->screen));
|
||||
XFillRectangle(dsp, pwin->w, pwin->gc, 0, 0, lp->width, lp->height);
|
||||
|
||||
memset(lp->buffer, '\0', sizeof(lp->buffer));
|
||||
patptr = (int *)&patterns[random() % NPATS][0];
|
||||
while ((col = *patptr++) != 99) {
|
||||
row = *patptr++;
|
||||
col += lp->ncols / 2;
|
||||
row += lp->nrows / 2;
|
||||
if ((row >= 0) && (row < lp->nrows) && (col >= 0) && (col < lp->ncols))
|
||||
setcell(pwin, row, col);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
drawlife(pwin)
|
||||
perwindow *pwin;
|
||||
{
|
||||
unsigned char *loc, *temploc, *lastloc;
|
||||
int row, col;
|
||||
unsigned char fate;
|
||||
lifestruct *lp = (lifestruct *)pwin->data;
|
||||
|
||||
loc = lp->buffer + lp->ncols + 2 + 1;
|
||||
temploc = lp->tempbuf;
|
||||
/* copy the first 2 rows to the tempbuf */
|
||||
memcpy(temploc, loc, lp->ncols);
|
||||
memcpy(temploc + lp->ncols, loc + lp->ncols + 2, lp->ncols);
|
||||
|
||||
lastloc = lp->lastbuf;
|
||||
/* copy the last row to another buffer for wraparound */
|
||||
memcpy(lastloc, loc + ((lp->nrows - 1) * (lp->ncols + 2)), lp->ncols);
|
||||
|
||||
for (row = 0; row < lp->nrows; ++row) {
|
||||
for (col = 0; col < lp->ncols; ++col) {
|
||||
fate = fates[*temploc];
|
||||
*temploc = (row == (lp->nrows - 3)) ?
|
||||
*(lastloc + col) :
|
||||
*(loc + (lp->ncols + 2) * 2);
|
||||
switch (fate) {
|
||||
case BIRTH:
|
||||
if (!(*(loc + 1) & RT)) {
|
||||
spawn(pwin, loc);
|
||||
}
|
||||
/* NO BREAK */
|
||||
case SAME:
|
||||
if (*(loc + 1) & RT) {
|
||||
drawcell(pwin, row, col);
|
||||
}
|
||||
break;
|
||||
case DEATH:
|
||||
if (*(loc + 1) & RT) {
|
||||
life_kill(pwin, loc);
|
||||
erasecell(pwin, row, col);
|
||||
}
|
||||
break;
|
||||
}
|
||||
loc++;
|
||||
temploc++;
|
||||
}
|
||||
loc += 2;
|
||||
if (temploc >= lp->tempbuf + lp->ncols * 2)
|
||||
temploc = lp->tempbuf;
|
||||
}
|
||||
|
||||
if (++lp->generation > batchcount)
|
||||
initlife(pwin);
|
||||
|
||||
/*
|
||||
* generate a randomized shooter aimed roughly toward the center of the
|
||||
* screen after timeout.
|
||||
*/
|
||||
|
||||
if (seconds() - lp->shooterTime > TIMEOUT) {
|
||||
int hsp = random() % (lp->ncols - 5) + 3;
|
||||
int vsp = random() % (lp->nrows - 5) + 3;
|
||||
int hoff = 1;
|
||||
int voff = 1;
|
||||
if (vsp > lp->nrows / 2)
|
||||
voff = -1;
|
||||
if (hsp > lp->ncols / 2)
|
||||
hoff = -1;
|
||||
setcell(pwin, vsp + 0 * voff, hsp + 2 * hoff);
|
||||
setcell(pwin, vsp + 1 * voff, hsp + 2 * hoff);
|
||||
setcell(pwin, vsp + 2 * voff, hsp + 2 * hoff);
|
||||
setcell(pwin, vsp + 2 * voff, hsp + 1 * hoff);
|
||||
setcell(pwin, vsp + 1 * voff, hsp + 0 * hoff);
|
||||
lp->shooterTime = seconds();
|
||||
}
|
||||
}
|
||||
35
cde/programs/dtscreen/lifeicon.bit
Normal file
35
cde/programs/dtscreen/lifeicon.bit
Normal file
@@ -0,0 +1,35 @@
|
||||
/* @(#)52 1.2 src/gos/2d/XTOP/aixclients/xlock/lifeicon.bit, xclients, gos410, gos4.17293b 3/8/93 13:19:14 */
|
||||
/*
|
||||
* COMPONENT_NAME: XLOCK (lifeicon.bit)
|
||||
*
|
||||
* FUNCTIONS: none
|
||||
*
|
||||
* ORIGINS: 16,27
|
||||
*
|
||||
* (C) COPYRIGHT International Business Machines Corp. 1992, 1993
|
||||
* All Rights Reserved
|
||||
* Licensed Materials - Property of IBM
|
||||
*
|
||||
* US Government Users Restricted Rights - Use, duplication or
|
||||
* disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
|
||||
*/
|
||||
/* *
|
||||
* (c) Copyright 1993, 1994 Hewlett-Packard Company *
|
||||
* (c) Copyright 1993, 1994 International Business Machines Corp. *
|
||||
* (c) Copyright 1993, 1994 Sun Microsystems, Inc. *
|
||||
* (c) Copyright 1993, 1994 Novell, Inc. *
|
||||
*/
|
||||
|
||||
#define lifeicon_width 29
|
||||
#define lifeicon_height 29
|
||||
static unsigned char lifeicon_bits[] = {
|
||||
0x7f, 0x00, 0x00, 0x1c, 0xfe, 0x00, 0x00, 0x0e, 0xfc, 0x01, 0x00, 0x07,
|
||||
0xfc, 0x01, 0x00, 0x07, 0xf8, 0x03, 0x80, 0x03, 0xf0, 0x07, 0xc0, 0x01,
|
||||
0xe0, 0x0f, 0xe0, 0x00, 0xc0, 0x0f, 0xe0, 0x00, 0xc0, 0x1f, 0x70, 0x00,
|
||||
0x80, 0x3f, 0x38, 0x00, 0x00, 0x7f, 0x1c, 0x00, 0x00, 0x7e, 0x0e, 0x00,
|
||||
0x00, 0xfe, 0x0e, 0x00, 0x00, 0x7c, 0x07, 0x00, 0x00, 0xb8, 0x03, 0x00,
|
||||
0x00, 0xdc, 0x07, 0x00, 0x00, 0xee, 0x0f, 0x00, 0x00, 0xce, 0x0f, 0x00,
|
||||
0x00, 0xc7, 0x1f, 0x00, 0x80, 0x83, 0x3f, 0x00, 0xc0, 0x01, 0x7f, 0x00,
|
||||
0xc0, 0x01, 0x7f, 0x00, 0xe0, 0x00, 0xfe, 0x00, 0x70, 0x00, 0xfc, 0x01,
|
||||
0x38, 0x00, 0xf8, 0x03, 0x1c, 0x00, 0xf0, 0x07, 0x1c, 0x00, 0xf0, 0x07,
|
||||
0x0e, 0x00, 0xe0, 0x0f, 0x07, 0x00, 0xc0, 0x1f};
|
||||
395
cde/programs/dtscreen/pyro.c
Normal file
395
cde/programs/dtscreen/pyro.c
Normal file
@@ -0,0 +1,395 @@
|
||||
/* $XConsortium: pyro.c /main/3 1995/11/02 16:07:59 rswiston $ */
|
||||
/*
|
||||
*/
|
||||
/* *
|
||||
* (c) Copyright 1993, 1994 Hewlett-Packard Company *
|
||||
* (c) Copyright 1993, 1994 International Business Machines Corp. *
|
||||
* (c) Copyright 1993, 1994 Sun Microsystems, Inc. *
|
||||
* (c) Copyright 1993, 1994 Novell, Inc. *
|
||||
*/
|
||||
/*-
|
||||
* pyro.c - Fireworks for dtscreen, the X Window System lockscreen.
|
||||
*
|
||||
* Copyright (c) 1991 by Patrick J. Naughton.
|
||||
*
|
||||
* See dtscreen.c for copying information.
|
||||
*
|
||||
* Revision History:
|
||||
* 16-Mar-91: Written. (received from David Brooks, brooks@osf.org).
|
||||
*/
|
||||
|
||||
/* The physics of the rockets is a little bogus, but it looks OK. Each is
|
||||
* given an initial velocity impetus. They decelerate slightly (gravity
|
||||
* overcomes the rocket's impulse) and explode as the rocket's main fuse
|
||||
* gives out (we could add a ballistic stage, maybe). The individual
|
||||
* stars fan out from the rocket, and they decelerate less quickly.
|
||||
* That's called bouyancy, but really it's again a visual preference.
|
||||
*/
|
||||
|
||||
#include "dtscreen.h"
|
||||
#include <math.h>
|
||||
#define TWOPI 6.2831853
|
||||
|
||||
/* Define this >1 to get small rectangles instead of points */
|
||||
#ifndef STARSIZE
|
||||
#define STARSIZE 2
|
||||
#endif
|
||||
|
||||
#define SILENT 0
|
||||
#define REDGLARE 1
|
||||
#define BURSTINGINAIR 2
|
||||
|
||||
#define CLOUD 0
|
||||
#define DOUBLECLOUD 1
|
||||
/* Clearly other types and other fascinating visual effects could be added...*/
|
||||
|
||||
/* P_xxx parameters represent the reciprocal of the probability... */
|
||||
#define P_IGNITE 5000 /* ...of ignition per cycle */
|
||||
#define P_DOUBLECLOUD 10 /* ...of an ignition being double */
|
||||
#define P_MULTI 75 /* ...of an ignition being several @ once */
|
||||
#define P_FUSILLADE 250 /* ...of an ignition starting a fusillade */
|
||||
|
||||
#define ROCKETW 2 /* Dimensions of rocket */
|
||||
#define ROCKETH 4
|
||||
#define XVELFACTOR 0.0025 /* Max horizontal velocity / screen width */
|
||||
#define MINYVELFACTOR 0.016 /* Min vertical velocity / screen height */
|
||||
#define MAXYVELFACTOR 0.018
|
||||
#define GRAVFACTOR 0.0002 /* delta v / screen height */
|
||||
#define MINFUSE 50 /* range of fuse lengths for rocket */
|
||||
#define MAXFUSE 100
|
||||
|
||||
#define FUSILFACTOR 10 /* Generate fusillade by reducing P_IGNITE */
|
||||
#define FUSILLEN 100 /* Length of fusillade, in ignitions */
|
||||
|
||||
#define SVELFACTOR 0.1 /* Max star velocity / yvel */
|
||||
#define BOUYANCY 0.2 /* Reduction in grav deceleration for stars */
|
||||
#define MAXSTARS 75 /* Number of stars issued from a shell */
|
||||
#define MINSTARS 50
|
||||
#define MINSFUSE 50 /* Range of fuse lengths for stars */
|
||||
#define MAXSFUSE 100
|
||||
|
||||
#define INTRAND(min,max) (random()%((max+1)-(min))+(min))
|
||||
#define FLOATRAND(min,max) ((min)+(random()/MAXRAND)*((max)-(min)))
|
||||
|
||||
static void ignite();
|
||||
static void animate();
|
||||
static void shootup();
|
||||
static void burst();
|
||||
|
||||
typedef struct {
|
||||
int state;
|
||||
int shelltype;
|
||||
int color1, color2;
|
||||
int fuse;
|
||||
float xvel, yvel;
|
||||
float x, y;
|
||||
int nstars;
|
||||
#if STARSIZE > 1
|
||||
XRectangle Xpoints[MAXSTARS];
|
||||
XRectangle Xpoints2[MAXSTARS];
|
||||
#else
|
||||
XPoint Xpoints[MAXSTARS];
|
||||
XPoint Xpoints2[MAXSTARS];
|
||||
#endif
|
||||
float sx[MAXSTARS], sy[MAXSTARS]; /* Distance from notional
|
||||
* center */
|
||||
float sxvel[MAXSTARS], syvel[MAXSTARS]; /* Relative to notional
|
||||
* center */
|
||||
} rocket;
|
||||
|
||||
typedef struct {
|
||||
Screen *scr;
|
||||
Colormap cmap;
|
||||
int p_ignite;
|
||||
unsigned long bgpixel;
|
||||
unsigned long fgpixel;
|
||||
unsigned long rockpixel;
|
||||
GC bgGC;
|
||||
int nflying;
|
||||
int fusilcount;
|
||||
int width, lmargin, rmargin, height;
|
||||
float minvelx, maxvelx;
|
||||
float minvely, maxvely;
|
||||
float maxsvel;
|
||||
float rockdecel, stardecel;
|
||||
rocket *rockq;
|
||||
} pyrostruct;
|
||||
|
||||
static int orig_p_ignite;
|
||||
static int just_started = True;/* Greet the user right away */
|
||||
|
||||
void
|
||||
initpyro(pwin)
|
||||
perwindow *pwin;
|
||||
{
|
||||
pyrostruct *pp;
|
||||
rocket *rp;
|
||||
XWindowAttributes xwa;
|
||||
XGCValues xgcv;
|
||||
int rockn, starn, bsize;
|
||||
|
||||
if (pwin->data) free(pwin->data);
|
||||
pwin->data = (pyrostruct *)malloc(sizeof(pyrostruct));
|
||||
memset(pwin->data, '\0', sizeof(pyrostruct));
|
||||
pp = (pyrostruct *)pwin->data;
|
||||
XGetWindowAttributes(dsp, pwin->w, &xwa);
|
||||
|
||||
orig_p_ignite = P_IGNITE / batchcount;
|
||||
if (orig_p_ignite <= 0)
|
||||
orig_p_ignite = 1;
|
||||
pp->p_ignite = orig_p_ignite;
|
||||
|
||||
pp->rockq = (rocket *) malloc(batchcount * sizeof(rocket));
|
||||
|
||||
pp->nflying = pp->fusilcount = 0;
|
||||
|
||||
bsize = (xwa.height <= 64) ? 1 : STARSIZE;
|
||||
for (rockn = 0, rp = pp->rockq; rockn < batchcount; rockn++, rp++) {
|
||||
rp->state = SILENT;
|
||||
#if STARSIZE > 1
|
||||
for (starn = 0; starn < MAXSTARS; starn++) {
|
||||
rp->Xpoints[starn].width = rp->Xpoints[starn].height =
|
||||
rp->Xpoints2[starn].width = rp->Xpoints2[starn].height = bsize;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
pp->width = xwa.width;
|
||||
pp->lmargin = xwa.width / 16;
|
||||
pp->rmargin = xwa.width - pp->lmargin;
|
||||
pp->height = xwa.height;
|
||||
pp->scr = pwin->perscreen->screen;
|
||||
pp->cmap = DefaultColormapOfScreen(pp->scr);
|
||||
|
||||
pp->fgpixel = WhitePixelOfScreen(pp->scr);
|
||||
pp->bgpixel = BlackPixelOfScreen(pp->scr);
|
||||
if (!mono && pwin->perscreen->npixels > 3)
|
||||
pp->rockpixel = pwin->perscreen->pixels[3];/* Just the right shade of
|
||||
* orange */
|
||||
else
|
||||
pp->rockpixel = pp->fgpixel;
|
||||
|
||||
xgcv.foreground = pp->bgpixel;
|
||||
pp->bgGC = XCreateGC(dsp, pwin->w, GCForeground, &xgcv);
|
||||
|
||||
/* Geometry-dependent physical data: */
|
||||
pp->maxvelx = (float) (xwa.width) * XVELFACTOR;
|
||||
pp->minvelx = -pp->maxvelx;
|
||||
pp->minvely = -(float) (xwa.height) * MINYVELFACTOR;
|
||||
pp->maxvely = -(float) (xwa.height) * MAXYVELFACTOR;
|
||||
pp->maxsvel = pp->minvely * SVELFACTOR;
|
||||
pp->rockdecel = (float) (pp->height) * GRAVFACTOR;
|
||||
pp->stardecel = pp->rockdecel * BOUYANCY;
|
||||
|
||||
XFillRectangle(dsp, pwin->w, pp->bgGC, 0, 0, xwa.width, xwa.height);
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
drawpyro(pwin)
|
||||
perwindow *pwin;
|
||||
{
|
||||
pyrostruct *pp;
|
||||
rocket *rp;
|
||||
int rockn;
|
||||
|
||||
pp = (pyrostruct *)pwin->data;
|
||||
if (just_started || (random() % pp->p_ignite == 0)) {
|
||||
just_started = False;
|
||||
if (random() % P_FUSILLADE == 0) {
|
||||
pp->p_ignite = orig_p_ignite / FUSILFACTOR;
|
||||
pp->fusilcount = INTRAND(FUSILLEN * 9 / 10, FUSILLEN * 11 / 10);
|
||||
}
|
||||
ignite(pwin, pp);
|
||||
if (pp->fusilcount > 0) {
|
||||
if (--pp->fusilcount == 0)
|
||||
pp->p_ignite = orig_p_ignite;
|
||||
}
|
||||
}
|
||||
for (rockn = pp->nflying, rp = pp->rockq; rockn > 0; rp++) {
|
||||
if (rp->state != SILENT) {
|
||||
animate(pwin, pp, rp);
|
||||
rockn--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
ignite(pwin, pp)
|
||||
perwindow *pwin;
|
||||
pyrostruct *pp;
|
||||
{
|
||||
rocket *rp;
|
||||
int multi, shelltype, nstars, fuse, npix, pix, color1, color2;
|
||||
float xvel, yvel, x;
|
||||
|
||||
x = random() % pp->width;
|
||||
xvel = FLOATRAND(-pp->maxvelx, pp->maxvelx);
|
||||
/* All this to stop too many rockets going offscreen: */
|
||||
if (x < pp->lmargin && xvel < 0.0 || x > pp->rmargin && xvel > 0.0)
|
||||
xvel = -xvel;
|
||||
yvel = FLOATRAND(pp->minvely, pp->maxvely);
|
||||
fuse = INTRAND(MINFUSE, MAXFUSE);
|
||||
nstars = INTRAND(MINSTARS, MAXSTARS);
|
||||
if (!mono && (npix = pwin->perscreen->npixels) > 2) {
|
||||
color1 = pwin->perscreen->pixels[pix = random() % npix];
|
||||
color2 = pwin->perscreen->pixels[(pix + (npix / 2)) % npix];
|
||||
} else {
|
||||
color1 = color2 = WhitePixelOfScreen(pwin->perscreen->screen);
|
||||
}
|
||||
|
||||
multi = 1;
|
||||
if (random() % P_DOUBLECLOUD == 0)
|
||||
shelltype = DOUBLECLOUD;
|
||||
else {
|
||||
shelltype = CLOUD;
|
||||
if (random() % P_MULTI == 0)
|
||||
multi = INTRAND(5, 15);
|
||||
}
|
||||
|
||||
rp = pp->rockq;
|
||||
while (multi--) {
|
||||
if (pp->nflying >= batchcount)
|
||||
return;
|
||||
while (rp->state != SILENT)
|
||||
rp++;
|
||||
pp->nflying++;
|
||||
rp->shelltype = shelltype;
|
||||
rp->state = REDGLARE;
|
||||
rp->color1 = color1;
|
||||
rp->color2 = color2;
|
||||
rp->xvel = xvel;
|
||||
rp->yvel = FLOATRAND(yvel * 0.97, yvel * 1.03);
|
||||
rp->fuse = INTRAND((fuse * 90) / 100, (fuse * 110) / 100);
|
||||
rp->x = x + FLOATRAND(multi * 7.6, multi * 8.4);
|
||||
rp->y = pp->height - 1;
|
||||
rp->nstars = nstars;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
animate(pwin, pp, rp)
|
||||
perwindow *pwin;
|
||||
pyrostruct *pp;
|
||||
rocket *rp;
|
||||
{
|
||||
int starn;
|
||||
float r, theta;
|
||||
|
||||
if (rp->state == REDGLARE) {
|
||||
shootup(pwin, pp, rp);
|
||||
|
||||
/* Handle setup for explosion */
|
||||
if (rp->state == BURSTINGINAIR) {
|
||||
for (starn = 0; starn < rp->nstars; starn++) {
|
||||
rp->sx[starn] = rp->sy[starn] = 0.0;
|
||||
rp->Xpoints[starn].x = (int) rp->x;
|
||||
rp->Xpoints[starn].y = (int) rp->y;
|
||||
if (rp->shelltype == DOUBLECLOUD) {
|
||||
rp->Xpoints2[starn].x = (int) rp->x;
|
||||
rp->Xpoints2[starn].y = (int) rp->y;
|
||||
}
|
||||
/* This isn't accurate solid geometry, but it looks OK. */
|
||||
|
||||
r = FLOATRAND(0.0, pp->maxsvel);
|
||||
theta = FLOATRAND(0.0, TWOPI);
|
||||
rp->sxvel[starn] = r * cos(theta);
|
||||
rp->syvel[starn] = r * sin(theta);
|
||||
}
|
||||
rp->fuse = INTRAND(MINSFUSE, MAXSFUSE);
|
||||
}
|
||||
}
|
||||
if (rp->state == BURSTINGINAIR) {
|
||||
burst(pwin, pp, rp);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
shootup(pwin, pp, rp)
|
||||
perwindow *pwin;
|
||||
pyrostruct *pp;
|
||||
rocket *rp;
|
||||
{
|
||||
XFillRectangle(dsp, pwin->w, pp->bgGC, (int) (rp->x), (int) (rp->y),
|
||||
ROCKETW, ROCKETH + 3);
|
||||
|
||||
if (rp->fuse-- <= 0) {
|
||||
rp->state = BURSTINGINAIR;
|
||||
return;
|
||||
}
|
||||
rp->x += rp->xvel;
|
||||
rp->y += rp->yvel;
|
||||
rp->yvel += pp->rockdecel;
|
||||
XSetForeground(dsp, pwin->gc, pp->rockpixel);
|
||||
XFillRectangle(dsp, pwin->w, pwin->gc, (int) (rp->x), (int) (rp->y),
|
||||
ROCKETW, ROCKETH + random() % 4);
|
||||
}
|
||||
|
||||
static void
|
||||
burst(pwin, pp, rp)
|
||||
perwindow *pwin;
|
||||
pyrostruct *pp;
|
||||
rocket *rp;
|
||||
{
|
||||
register int starn;
|
||||
register int nstars, stype;
|
||||
register float rx, ry, sd; /* Help compiler optimize :-) */
|
||||
register float sx, sy;
|
||||
|
||||
nstars = rp->nstars;
|
||||
stype = rp->shelltype;
|
||||
|
||||
#if STARSIZE > 1
|
||||
XFillRectangles(dsp, pwin->w, pp->bgGC, rp->Xpoints, nstars);
|
||||
if (stype == DOUBLECLOUD)
|
||||
XFillRectangles(dsp, pwin->w, pp->bgGC, rp->Xpoints2, nstars);
|
||||
#else
|
||||
XDrawPoints(dsp, pwin->w, pp->bgGC, rp->Xpoints, nstars, CoordModeOrigin);
|
||||
if (stype == DOUBLECLOUD)
|
||||
XDrawPoints(dsp, pwin->w, pp->bgGC, rp->Xpoints2, nstars, CoordModeOrigin);
|
||||
#endif
|
||||
|
||||
if (rp->fuse-- <= 0) {
|
||||
rp->state = SILENT;
|
||||
pp->nflying--;
|
||||
return;
|
||||
}
|
||||
/* Stagger the stars' decay */
|
||||
if (rp->fuse <= 7) {
|
||||
if ((rp->nstars = nstars = nstars * 90 / 100) == 0)
|
||||
return;
|
||||
}
|
||||
rx = rp->x;
|
||||
ry = rp->y;
|
||||
sd = pp->stardecel;
|
||||
for (starn = 0; starn < nstars; starn++) {
|
||||
sx = rp->sx[starn] += rp->sxvel[starn];
|
||||
sy = rp->sy[starn] += rp->syvel[starn];
|
||||
rp->syvel[starn] += sd;
|
||||
rp->Xpoints[starn].x = (int) (rx + sx);
|
||||
rp->Xpoints[starn].y = (int) (ry + sy);
|
||||
if (stype == DOUBLECLOUD) {
|
||||
rp->Xpoints2[starn].x = (int) (rx + 1.7 * sx);
|
||||
rp->Xpoints2[starn].y = (int) (ry + 1.7 * sy);
|
||||
}
|
||||
}
|
||||
rp->x = rx + rp->xvel;
|
||||
rp->y = ry + rp->yvel;
|
||||
rp->yvel += sd;
|
||||
|
||||
XSetForeground(dsp, pwin->gc, rp->color1);
|
||||
#if STARSIZE > 1
|
||||
XFillRectangles(dsp, pwin->w, pwin->gc, rp->Xpoints, nstars);
|
||||
if (stype == DOUBLECLOUD) {
|
||||
XSetForeground(dsp, pwin->gc, rp->color2);
|
||||
XFillRectangles(dsp, pwin->w, pwin->gc, rp->Xpoints2, nstars);
|
||||
}
|
||||
#else
|
||||
XDrawPoints(dsp, pwin->w, pwin->gc, rp->Xpoints, nstars, CoordModeOrigin);
|
||||
if (stype == DOUBLECLOUD) {
|
||||
XSetForeground(dsp, pwin->gc, rp->color2);
|
||||
XDrawPoints(dsp, pwin->w, pwin->gc, rp->Xpoints2, nstars,
|
||||
CoordModeOrigin);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
147
cde/programs/dtscreen/qix.c
Normal file
147
cde/programs/dtscreen/qix.c
Normal file
@@ -0,0 +1,147 @@
|
||||
/* $XConsortium: qix.c /main/3 1995/11/02 16:08:11 rswiston $ */
|
||||
/*
|
||||
*/
|
||||
/* *
|
||||
* (c) Copyright 1993, 1994 Hewlett-Packard Company *
|
||||
* (c) Copyright 1993, 1994 International Business Machines Corp. *
|
||||
* (c) Copyright 1993, 1994 Sun Microsystems, Inc. *
|
||||
* (c) Copyright 1993, 1994 Novell, Inc. *
|
||||
*/
|
||||
/*-
|
||||
* qix.c - Vector swirl for dtscreen, the X Window System lockscreen.
|
||||
*
|
||||
* Copyright (c) 1991 by Patrick J. Naughton.
|
||||
*
|
||||
* See dtscreen.c for copying information.
|
||||
*
|
||||
* Revision History:
|
||||
* 29-Jul-90: support for multiple screens.
|
||||
* made check_bounds_?() a macro.
|
||||
* fixed initial parameter setup.
|
||||
* 15-Dec-89: Fix for proper skipping of {White,Black}Pixel() in colors.
|
||||
* 08-Oct-89: Fixed bug in memory allocation in initqix().
|
||||
* Moved seconds() to an extern.
|
||||
* 23-Sep-89: Switch to random() and fixed bug w/ less than 4 lines.
|
||||
* 20-Sep-89: Lint.
|
||||
* 24-Mar-89: Written.
|
||||
*/
|
||||
|
||||
#include "dtscreen.h"
|
||||
|
||||
typedef struct {
|
||||
int x;
|
||||
int y;
|
||||
} point;
|
||||
|
||||
typedef struct {
|
||||
int pix;
|
||||
long startTime;
|
||||
int first;
|
||||
int last;
|
||||
int dx1;
|
||||
int dy1;
|
||||
int dx2;
|
||||
int dy2;
|
||||
int x1;
|
||||
int y1;
|
||||
int x2;
|
||||
int y2;
|
||||
int offset;
|
||||
int delta;
|
||||
int width;
|
||||
int height;
|
||||
int nlines;
|
||||
point *lineq;
|
||||
} qixstruct;
|
||||
|
||||
void
|
||||
initqix(pwin)
|
||||
perwindow *pwin;
|
||||
{
|
||||
XWindowAttributes xgwa;
|
||||
qixstruct *qp;
|
||||
|
||||
if (pwin->data) free(pwin->data);
|
||||
pwin->data = (void *)malloc(sizeof(qixstruct));
|
||||
memset(pwin->data, '\0', sizeof(qixstruct));
|
||||
qp = (qixstruct *)pwin->data;
|
||||
qp->startTime = seconds();
|
||||
qp->nlines = (batchcount + 1) * 2;
|
||||
|
||||
qp->lineq = (point *) malloc(qp->nlines * sizeof(point));
|
||||
memset(qp->lineq, '\0', qp->nlines * sizeof(point));
|
||||
|
||||
XGetWindowAttributes(dsp, pwin->w, &xgwa);
|
||||
qp->width = xgwa.width;
|
||||
qp->height = xgwa.height;
|
||||
qp->delta = 16;
|
||||
|
||||
if (qp->width < 100) { /* icon window */
|
||||
qp->nlines /= 4;
|
||||
qp->delta /= 4;
|
||||
}
|
||||
qp->offset = qp->delta / 3;
|
||||
qp->last = 0;
|
||||
qp->pix = 0;
|
||||
qp->dx1 = random() % qp->delta + qp->offset;
|
||||
qp->dy1 = random() % qp->delta + qp->offset;
|
||||
qp->dx2 = random() % qp->delta + qp->offset;
|
||||
qp->dy2 = random() % qp->delta + qp->offset;
|
||||
qp->x1 = random() % qp->width;
|
||||
qp->y1 = random() % qp->height;
|
||||
qp->x2 = random() % qp->width;
|
||||
qp->y2 = random() % qp->height;
|
||||
XSetForeground(dsp, pwin->gc, BlackPixelOfScreen(pwin->perscreen->screen));
|
||||
XFillRectangle(dsp, pwin->w, pwin->gc, 0, 0, qp->width, qp->height);
|
||||
}
|
||||
|
||||
#define check_bounds(qp, val, del, max) \
|
||||
{ \
|
||||
if ((val) < 0) { \
|
||||
*(del) = (random() % (qp)->delta) + (qp)->offset; \
|
||||
} else if ((val) > (max)) { \
|
||||
*(del) = -(random() % (qp)->delta) - (qp)->offset; \
|
||||
} \
|
||||
}
|
||||
|
||||
void
|
||||
drawqix(pwin)
|
||||
perwindow *pwin;
|
||||
{
|
||||
qixstruct *qp = (qixstruct *)pwin->data;
|
||||
|
||||
qp->first = (qp->last + 2) % qp->nlines;
|
||||
|
||||
qp->x1 += qp->dx1;
|
||||
qp->y1 += qp->dy1;
|
||||
qp->x2 += qp->dx2;
|
||||
qp->y2 += qp->dy2;
|
||||
check_bounds(qp, qp->x1, &qp->dx1, qp->width);
|
||||
check_bounds(qp, qp->y1, &qp->dy1, qp->height);
|
||||
check_bounds(qp, qp->x2, &qp->dx2, qp->width);
|
||||
check_bounds(qp, qp->y2, &qp->dy2, qp->height);
|
||||
XSetForeground(dsp, pwin->gc, BlackPixelOfScreen(pwin->perscreen->screen));
|
||||
XDrawLine(dsp, pwin->w, pwin->gc,
|
||||
qp->lineq[qp->first].x, qp->lineq[qp->first].y,
|
||||
qp->lineq[qp->first + 1].x, qp->lineq[qp->first + 1].y);
|
||||
if (!mono && pwin->perscreen->npixels > 2) {
|
||||
XSetForeground(dsp, pwin->gc, pwin->perscreen->pixels[qp->pix]);
|
||||
if (++qp->pix >= pwin->perscreen->npixels)
|
||||
qp->pix = 0;
|
||||
} else
|
||||
XSetForeground(dsp, pwin->gc, WhitePixelOfScreen(pwin->perscreen->screen));
|
||||
|
||||
XDrawLine(dsp, pwin->w, pwin->gc, qp->x1, qp->y1, qp->x2, qp->y2);
|
||||
|
||||
qp->lineq[qp->last].x = qp->x1;
|
||||
qp->lineq[qp->last].y = qp->y1;
|
||||
qp->last++;
|
||||
if (qp->last >= qp->nlines)
|
||||
qp->last = 0;
|
||||
|
||||
qp->lineq[qp->last].x = qp->x2;
|
||||
qp->lineq[qp->last].y = qp->y2;
|
||||
qp->last++;
|
||||
if (qp->last >= qp->nlines)
|
||||
qp->last = 0;
|
||||
}
|
||||
718
cde/programs/dtscreen/resource.c
Normal file
718
cde/programs/dtscreen/resource.c
Normal file
@@ -0,0 +1,718 @@
|
||||
/* $XConsortium: resource.c /main/4 1996/06/19 09:47:56 mustafa $ */
|
||||
/*
|
||||
*/
|
||||
/* *
|
||||
* (c) Copyright 1993, 1994 Hewlett-Packard Company *
|
||||
* (c) Copyright 1993, 1994 International Business Machines Corp. *
|
||||
* (c) Copyright 1993, 1994 Sun Microsystems, Inc. *
|
||||
* (c) Copyright 1993, 1994 Novell, Inc. *
|
||||
*/
|
||||
/*-
|
||||
* resource.c - resource management for dtscreen, the X Window System lockscreen.
|
||||
*
|
||||
* Copyright (c) 1991 by Patrick J. Naughton.
|
||||
*
|
||||
* See dtscreen.c for copying information.
|
||||
*
|
||||
* Revision History:
|
||||
* 25-Sep-91: added worm mode.
|
||||
* 06-Jun-91: Added flame mode.
|
||||
* 16-May-91: Added random mode and pyro mode.
|
||||
* 26-Mar-91: CheckResources: delay must be >= 0.
|
||||
* 29-Oct-90: Added #include <ctype.h> for missing isupper() on some OS revs.
|
||||
* moved -mode option, reordered Xrm database evaluation.
|
||||
* 28-Oct-90: Added text strings.
|
||||
* 26-Oct-90: Fix bug in mode specific options.
|
||||
* 31-Jul-90: Fix ':' handling in parsefilepath
|
||||
* 07-Jul-90: Created from resource work in dtscreen.c
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "dtscreen.h"
|
||||
#include <netdb.h>
|
||||
#include <math.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include <X11/Xresource.h>
|
||||
|
||||
/* include file for message texts */
|
||||
#include <limits.h>
|
||||
#include <nl_types.h>
|
||||
#define MF_DTSCREEN "dtscreen.cat"
|
||||
|
||||
#include <locale.h>
|
||||
extern nl_catd scmc_catd; /* Cat descriptor for scmc conversion */
|
||||
|
||||
/*
|
||||
* Declare external interface routines for supported screen savers.
|
||||
*/
|
||||
|
||||
extern void inithop();
|
||||
extern void drawhop();
|
||||
|
||||
extern void initlife();
|
||||
extern void drawlife();
|
||||
|
||||
extern void initqix();
|
||||
extern void drawqix();
|
||||
|
||||
extern void initimage();
|
||||
extern void drawimage();
|
||||
|
||||
extern void initblank();
|
||||
extern void drawblank();
|
||||
|
||||
extern void initswarm();
|
||||
extern void drawswarm();
|
||||
|
||||
extern void initrotor();
|
||||
extern void drawrotor();
|
||||
|
||||
extern void initpyro();
|
||||
extern void drawpyro();
|
||||
|
||||
extern void initflame();
|
||||
extern void drawflame();
|
||||
|
||||
extern void initworm();
|
||||
extern void drawworm();
|
||||
|
||||
typedef struct {
|
||||
char *cmdline_arg;
|
||||
void (*lp_init) ();
|
||||
void (*lp_callback) ();
|
||||
int def_delay;
|
||||
int def_batchcount;
|
||||
float def_saturation;
|
||||
char *desc;
|
||||
} LockStruct;
|
||||
|
||||
static char randomstring[] = "random";
|
||||
|
||||
static LockStruct LockProcs[] = {
|
||||
{"hop", inithop, drawhop, 0, 1000, 1.0, "Hopalong iterated fractals"},
|
||||
{"qix", initqix, drawqix, 30000, 64, 1.0, "Spinning lines a la Qix(tm)"},
|
||||
{"image", initimage, drawimage, 2000000, 8, 0.3, "Random bouncing image"},
|
||||
{"life", initlife, drawlife, 1000000, 100, 1.0, "Conway's game of Life"},
|
||||
{"swarm", initswarm, drawswarm, 10000, 100, 1.0, "Swarm of bees"},
|
||||
{"rotor", initrotor, drawrotor, 10000, 4, 0.4, "Rotor"},
|
||||
{"pyro", initpyro, drawpyro, 15000, 40, 1.0, "Fireworks"},
|
||||
{"flame", initflame, drawflame, 10000, 20, 1.0, "Cosmic Flame Fractals"},
|
||||
{"worm", initworm, drawworm, 10000, 20, 1.0, "Wiggly Worms"},
|
||||
{"blank", initblank, drawblank, 5000000, 1, 1.0, "Blank screen"},
|
||||
{randomstring, NULL, NULL, 0, 0, 0.0, "Random mode"},
|
||||
};
|
||||
#define NUMPROCS (sizeof LockProcs / sizeof LockProcs[0])
|
||||
|
||||
|
||||
extern char *getenv();
|
||||
|
||||
#ifndef DEF_FILESEARCHPATH
|
||||
#define DEF_FILESEARCHPATH "/usr/lib/X11/%T/%N%S"
|
||||
#endif
|
||||
#define DEF_DISPLAY ":0"
|
||||
#define DEF_MODE "swarm"
|
||||
#define DEF_BG "White"
|
||||
#define DEF_FG "Black"
|
||||
#define DEF_BC "100" /* vectors (or whatever) per batch */
|
||||
#define DEF_DELAY "200000"/* microseconds between batches */
|
||||
#define DEF_NICE "10" /* dtscreen process nicelevel */
|
||||
#define DEF_SAT "1.0" /* color ramp saturation 0->1 */
|
||||
#define DEF_CLASSNAME "Dtscreen"
|
||||
|
||||
static char *classname;
|
||||
static char modename[1024];
|
||||
static char modeclass[1024];
|
||||
|
||||
static XrmOptionDescRec genTable[] = {
|
||||
{"-mode", ".mode", XrmoptionSepArg, (caddr_t) NULL},
|
||||
{"-mono", ".mono", XrmoptionNoArg, (caddr_t) "on"},
|
||||
{"+mono", ".mono", XrmoptionNoArg, (caddr_t) "off"},
|
||||
{"-nice", ".nice", XrmoptionSepArg, (caddr_t) NULL},
|
||||
{"-create", ".create", XrmoptionNoArg, (caddr_t) "on"},
|
||||
};
|
||||
#define genEntries (sizeof genTable / sizeof genTable[0])
|
||||
|
||||
/*************************************************************/
|
||||
/** This table was changed for AIX. In order to read these **/
|
||||
/** command line options properly, the specifier field must **/
|
||||
/** be built on the fly. **/
|
||||
/*************************************************************/
|
||||
static XrmOptionDescRec modeTable[] = {
|
||||
{"-delay", NULL, XrmoptionSepArg, (caddr_t) NULL},
|
||||
{"-batchcount", NULL, XrmoptionSepArg, (caddr_t) NULL},
|
||||
{"-saturation", NULL, XrmoptionSepArg, (caddr_t) NULL},
|
||||
};
|
||||
#define modeEntries (sizeof modeTable / sizeof modeTable[0])
|
||||
|
||||
static XrmOptionDescRec cmdlineTable[] = {
|
||||
{"-display", ".display", XrmoptionSepArg, (caddr_t) NULL},
|
||||
{"-xrm", NULL, XrmoptionResArg, (caddr_t) NULL},
|
||||
};
|
||||
#define cmdlineEntries (sizeof cmdlineTable / sizeof cmdlineTable[0])
|
||||
|
||||
static XrmOptionDescRec nameTable[] = {
|
||||
{"-name", ".name", XrmoptionSepArg, (caddr_t) NULL},
|
||||
};
|
||||
|
||||
|
||||
typedef struct {
|
||||
char *opt;
|
||||
char *desc;
|
||||
} OptionStruct;
|
||||
|
||||
static OptionStruct opDesc[] = {
|
||||
{"-help", "print out this message"},
|
||||
{"-resources", "print default resource file to standard output"},
|
||||
{"-display displayname", "X server to contact"},
|
||||
{"-/+mono", "turn on/off monochrome override"},
|
||||
{"-delay usecs", "microsecond delay between screen updates"},
|
||||
{"-batchcount num", "number of things per batch"},
|
||||
{"-nice level", "nice level for dtscreen process"},
|
||||
{"-saturation value", "saturation of color ramp"},
|
||||
{"-create", "create a window in which to draw"},
|
||||
};
|
||||
#define opDescEntries (sizeof opDesc / sizeof opDesc[0])
|
||||
|
||||
char *display;
|
||||
char *mode;
|
||||
float saturation;
|
||||
int nicelevel;
|
||||
int delay;
|
||||
int batchcount;
|
||||
Bool mono;
|
||||
Bool create;
|
||||
|
||||
|
||||
#define t_String 0
|
||||
#define t_Float 1
|
||||
#define t_Int 2
|
||||
#define t_Bool 3
|
||||
|
||||
typedef struct {
|
||||
caddr_t *var;
|
||||
char *name;
|
||||
char *class;
|
||||
char *def;
|
||||
int type;
|
||||
} argtype;
|
||||
|
||||
static argtype genvars[] = {
|
||||
{(caddr_t *) &nicelevel, "nice", "Nice", DEF_NICE, t_Int},
|
||||
{(caddr_t *) &mono, "mono", "Mono", "off", t_Bool},
|
||||
{(caddr_t *) &create, "create", "Create", "off", t_Bool},
|
||||
};
|
||||
#define NGENARGS (sizeof genvars / sizeof genvars[0])
|
||||
|
||||
static argtype modevars[] = {
|
||||
{(caddr_t *) &delay, "delay", "Delay", DEF_DELAY, t_Int},
|
||||
{(caddr_t *) &batchcount, "batchcount", "BatchCount", DEF_BC, t_Int},
|
||||
{(caddr_t *) &saturation, "saturation", "Saturation", DEF_SAT, t_Float},
|
||||
};
|
||||
#define NMODEARGS (sizeof modevars / sizeof modevars[0])
|
||||
|
||||
|
||||
static void
|
||||
Syntax(badOption)
|
||||
char *badOption;
|
||||
{
|
||||
int col, len, i;
|
||||
|
||||
#ifdef MIT_R5
|
||||
fprintf(stderr, "%s: bad command line option: %s.\n\n",
|
||||
ProgramName, badOption);
|
||||
#else
|
||||
fprintf(stderr, catgets(scmc_catd, 2, 1,
|
||||
"%s: Bad command line option: %s.\n\n"),
|
||||
ProgramName, badOption);
|
||||
#endif
|
||||
|
||||
fprintf(stderr, "usage: %s", ProgramName);
|
||||
col = 8 + strlen(ProgramName);
|
||||
for (i = 0; i < opDescEntries; i++) {
|
||||
len = 3 + strlen(opDesc[i].opt); /* space [ string ] */
|
||||
if (col + len > 79) {
|
||||
fprintf(stderr, "\n "); /* 3 spaces */
|
||||
col = 3;
|
||||
}
|
||||
fprintf(stderr, " [%s]", opDesc[i].opt);
|
||||
col += len;
|
||||
}
|
||||
|
||||
len = 8 + strlen(LockProcs[0].cmdline_arg);
|
||||
if (col + len > 79) {
|
||||
fprintf(stderr, "\n "); /* 3 spaces */
|
||||
col = 3;
|
||||
}
|
||||
fprintf(stderr, " [-mode %s", LockProcs[0].cmdline_arg);
|
||||
col += len;
|
||||
for (i = 1; i < NUMPROCS; i++) {
|
||||
len = 3 + strlen(LockProcs[i].cmdline_arg);
|
||||
if (col + len > 79) {
|
||||
fprintf(stderr, "\n "); /* 3 spaces */
|
||||
col = 3;
|
||||
}
|
||||
fprintf(stderr, " | %s", LockProcs[i].cmdline_arg);
|
||||
col += len;
|
||||
}
|
||||
fprintf(stderr, "]\n");
|
||||
|
||||
#ifdef MIT_R5
|
||||
fprintf(stderr, "\nType %s -help for a full description.\n\n",
|
||||
ProgramName);
|
||||
#else
|
||||
fprintf(stderr, catgets(scmc_catd, 2, 2,
|
||||
"\nType %s -help for a full description.\n\n"),
|
||||
ProgramName);
|
||||
#endif
|
||||
exit(1);
|
||||
}
|
||||
|
||||
static void
|
||||
Help()
|
||||
{
|
||||
int i;
|
||||
|
||||
#ifdef MIT_R5
|
||||
fprintf(stderr, "usage:\n %s [-options ...]\n\n", ProgramName);
|
||||
fprintf(stderr, "where options include:\n");
|
||||
|
||||
#else
|
||||
fprintf(stderr, catgets(scmc_catd, 2, 3,
|
||||
"Usage:\n %s [-options ...]\n\n\
|
||||
where options include:\n"), ProgramName);
|
||||
#endif
|
||||
|
||||
for (i = 0; i < opDescEntries; i++) {
|
||||
fprintf(stderr, " %-28s %s\n", opDesc[i].opt, opDesc[i].desc);
|
||||
}
|
||||
|
||||
#ifdef MIT_R5
|
||||
fprintf(stderr, " %-28s %s\n", "-mode mode", "animation mode");
|
||||
fprintf(stderr, " where mode is one of:\n");
|
||||
#else
|
||||
fprintf(stderr, catgets(scmc_catd, 2, 5,
|
||||
" %-28s %s\n\t where mode is one of:\n"),
|
||||
"-mode mode", "animation mode");
|
||||
#endif
|
||||
for (i = 0; i < NUMPROCS; i++) {
|
||||
fprintf(stderr, " %-23s %s\n",
|
||||
LockProcs[i].cmdline_arg, LockProcs[i].desc);
|
||||
}
|
||||
putc('\n', stderr);
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
static void
|
||||
DumpResources()
|
||||
{
|
||||
int i;
|
||||
|
||||
printf("%s.mode: %s\n", classname, DEF_MODE);
|
||||
|
||||
for (i = 0; i < NGENARGS; i++)
|
||||
printf("%s.%s: %s\n",
|
||||
classname, genvars[i].name, genvars[i].def);
|
||||
|
||||
for (i = 0; i < NUMPROCS - 1; i++) {
|
||||
printf("%s.%s.%s: %d\n", classname, LockProcs[i].cmdline_arg,
|
||||
"delay", LockProcs[i].def_delay);
|
||||
printf("%s.%s.%s: %d\n", classname, LockProcs[i].cmdline_arg,
|
||||
"batchcount", LockProcs[i].def_batchcount);
|
||||
printf("%s.%s.%s: %g\n", classname, LockProcs[i].cmdline_arg,
|
||||
"saturation", LockProcs[i].def_saturation);
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
LowerString(s)
|
||||
char *s;
|
||||
{
|
||||
|
||||
while (*s) {
|
||||
if (isupper(*s))
|
||||
*s += ('a' - 'A');
|
||||
s++;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
GetResource(database, parentname, parentclass,
|
||||
name, class, valueType, def, valuep)
|
||||
XrmDatabase database;
|
||||
char *parentname;
|
||||
char *parentclass;
|
||||
char *name;
|
||||
char *class;
|
||||
int valueType;
|
||||
char *def;
|
||||
caddr_t *valuep; /* RETURN */
|
||||
{
|
||||
char *type;
|
||||
XrmValue value;
|
||||
char *string;
|
||||
char buffer[1024];
|
||||
char fullname[1024];
|
||||
char fullclass[1024];
|
||||
int len;
|
||||
|
||||
sprintf(fullname, "%s.%s", parentname, name);
|
||||
sprintf(fullclass, "%s.%s", parentclass, class);
|
||||
if (XrmGetResource(database, fullname, fullclass, &type, &value)) {
|
||||
string = value.addr;
|
||||
len = value.size;
|
||||
} else {
|
||||
string = def;
|
||||
len = strlen(string);
|
||||
}
|
||||
(void) strncpy(buffer, string, sizeof(buffer));
|
||||
buffer[sizeof(buffer) - 1] = '\0';
|
||||
|
||||
switch (valueType) {
|
||||
case t_String:
|
||||
{
|
||||
char *s;
|
||||
s = (char *) malloc(len + 1);
|
||||
if (s == (char *) NULL)
|
||||
#ifdef MIT_R5
|
||||
error("%s: GetResource - couldn't allocate memory");
|
||||
#else
|
||||
{
|
||||
fprintf(stderr, catgets(scmc_catd, 2, 18,
|
||||
"%s: GetResource - couldn't allocate memory.\n"),ProgramName);
|
||||
exit(1);
|
||||
}
|
||||
#endif
|
||||
(void) strncpy(s, string, len);
|
||||
s[len] = '\0';
|
||||
*((char **) valuep) = s;
|
||||
}
|
||||
break;
|
||||
case t_Bool:
|
||||
LowerString(buffer);
|
||||
*((int *) valuep) = (!strcmp(buffer, "true") ||
|
||||
!strcmp(buffer, "on") ||
|
||||
!strcmp(buffer, "enabled") ||
|
||||
!strcmp(buffer, "yes")) ? True : False;
|
||||
break;
|
||||
case t_Int:
|
||||
*((int *) valuep) = atoi(buffer);
|
||||
break;
|
||||
case t_Float:
|
||||
*((float *) valuep) = (float) atof(buffer);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static XrmDatabase
|
||||
parsefilepath(xfilesearchpath, TypeName, ClassName)
|
||||
char *xfilesearchpath;
|
||||
char *TypeName;
|
||||
char *ClassName;
|
||||
{
|
||||
XrmDatabase database = NULL;
|
||||
char appdefaults[1024];
|
||||
char *src;
|
||||
char *dst;
|
||||
|
||||
src = xfilesearchpath;
|
||||
appdefaults[0] = '\0';
|
||||
dst = appdefaults;
|
||||
while (1) {
|
||||
if (*src == '%') {
|
||||
src++;
|
||||
switch (*src) {
|
||||
case '%':
|
||||
case ':':
|
||||
*dst++ = *src++;
|
||||
*dst = '\0';
|
||||
break;
|
||||
case 'T':
|
||||
(void) strcat(dst, TypeName);
|
||||
src++;
|
||||
dst += strlen(TypeName);
|
||||
break;
|
||||
case 'N':
|
||||
(void) strcat(dst, ClassName);
|
||||
src++;
|
||||
dst += strlen(ClassName);
|
||||
break;
|
||||
case 'S':
|
||||
src++;
|
||||
break;
|
||||
default:
|
||||
src++;
|
||||
break;
|
||||
}
|
||||
} else if (*src == ':') {
|
||||
database = XrmGetFileDatabase(appdefaults);
|
||||
if (database == NULL) {
|
||||
dst = appdefaults;
|
||||
src++;
|
||||
} else
|
||||
break;
|
||||
} else if (*src == '\0') {
|
||||
database = XrmGetFileDatabase(appdefaults);
|
||||
break;
|
||||
} else {
|
||||
*dst++ = *src++;
|
||||
*dst = '\0';
|
||||
}
|
||||
}
|
||||
return database;
|
||||
}
|
||||
|
||||
/*******************************************************************/
|
||||
/** screenIOErrorHandler **/
|
||||
/** **/
|
||||
/** this function will exit cleanly when the connection is broken **/
|
||||
/*******************************************************************/
|
||||
static int screenIOErrorHandler(dpy)
|
||||
Display *dpy;
|
||||
{
|
||||
exit(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
open_display()
|
||||
{
|
||||
if (display != NULL) {
|
||||
char *colon = strchr(display, ':');
|
||||
int n = colon - display;
|
||||
|
||||
if (colon == NULL)
|
||||
#ifdef MIT_R5
|
||||
error("%s: Malformed -display argument, \"%s\"\n", display);
|
||||
#else
|
||||
{
|
||||
fprintf(stderr, catgets(scmc_catd, 2, 19,
|
||||
"%s: Malformed -display argument: %s.\n"), ProgramName,display);
|
||||
exit(1);
|
||||
}
|
||||
#endif
|
||||
|
||||
} else
|
||||
display = ":0.0";
|
||||
if (!(dsp = XOpenDisplay(display)))
|
||||
#ifdef MIT_R5
|
||||
error("%s: unable to open display %s.\n", display);
|
||||
#else
|
||||
{
|
||||
fprintf(stderr, catgets(scmc_catd, 2, 17,
|
||||
"%s: Unable to open display %s.\n"),ProgramName, display);
|
||||
exit(1);
|
||||
}
|
||||
#endif
|
||||
|
||||
XSetIOErrorHandler(screenIOErrorHandler);
|
||||
}
|
||||
|
||||
void
|
||||
printvar(class, var)
|
||||
char *class;
|
||||
argtype var;
|
||||
{
|
||||
switch (var.type) {
|
||||
case t_String:
|
||||
fprintf(stderr, "%s.%s: %s\n",
|
||||
class, var.name, *((char **) var.var));
|
||||
break;
|
||||
case t_Bool:
|
||||
fprintf(stderr, "%s.%s: %s\n",
|
||||
class, var.name, *((int *) var.var)
|
||||
? "True" : "False");
|
||||
break;
|
||||
case t_Int:
|
||||
fprintf(stderr, "%s.%s: %d\n",
|
||||
class, var.name, *((int *) var.var));
|
||||
break;
|
||||
case t_Float:
|
||||
fprintf(stderr, "%s.%s: %g\n",
|
||||
class, var.name, *((float *) var.var));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
GetResources(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
XrmDatabase RDB = NULL;
|
||||
XrmDatabase modeDB = NULL;
|
||||
XrmDatabase nameDB = NULL;
|
||||
XrmDatabase cmdlineDB = NULL;
|
||||
XrmDatabase generalDB = NULL;
|
||||
XrmDatabase homeDB = NULL;
|
||||
XrmDatabase applicationDB = NULL;
|
||||
XrmDatabase serverDB = NULL;
|
||||
XrmDatabase userDB = NULL;
|
||||
char userfile[1024];
|
||||
char *homeenv;
|
||||
char *userpath;
|
||||
char *env;
|
||||
char *serverString;
|
||||
int i;
|
||||
/***************************/
|
||||
/** new variables for AIX **/
|
||||
/***************************/
|
||||
char delaySpecifier[64];
|
||||
char batchcountSpecifier[64];
|
||||
char saturationSpecifier[64];
|
||||
|
||||
XrmInitialize();
|
||||
|
||||
for (i = 0; i < argc; i++) {
|
||||
if (!strncmp(argv[i], "-help", strlen(argv[i])))
|
||||
Help();
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
||||
/*
|
||||
* get -name arg from command line so you can have different resource
|
||||
* files for different configurations/machines etc...
|
||||
*/
|
||||
XrmParseCommand(&nameDB, nameTable, 1, ProgramName,
|
||||
&argc, argv);
|
||||
GetResource(nameDB, ProgramName, "*", "name", "Name", t_String,
|
||||
DEF_CLASSNAME, &classname);
|
||||
|
||||
homeenv = getenv("HOME");
|
||||
if (!homeenv)
|
||||
homeenv = "";
|
||||
|
||||
env = getenv("XFILESEARCHPATH");
|
||||
applicationDB = parsefilepath(env ? env : DEF_FILESEARCHPATH,
|
||||
"app-defaults", classname);
|
||||
|
||||
XrmParseCommand(&cmdlineDB, cmdlineTable, cmdlineEntries, ProgramName,
|
||||
&argc, argv);
|
||||
|
||||
userpath = getenv("XUSERFILESEARCHPATH");
|
||||
if (!userpath) {
|
||||
env = getenv("XAPPLRESDIR");
|
||||
if (env)
|
||||
sprintf(userfile, "%s/%%N:%s/%%N", env, homeenv);
|
||||
else
|
||||
sprintf(userfile, "%s/%%N", homeenv);
|
||||
userpath = userfile;
|
||||
}
|
||||
userDB = parsefilepath(userpath, "app-defaults", classname);
|
||||
|
||||
(void) XrmMergeDatabases(applicationDB, &RDB);
|
||||
(void) XrmMergeDatabases(userDB, &RDB);
|
||||
(void) XrmMergeDatabases(cmdlineDB, &RDB);
|
||||
|
||||
env = getenv("DISPLAY");
|
||||
GetResource(RDB, ProgramName, classname, "display", "Display", t_String,
|
||||
env ? env : DEF_DISPLAY, &display);
|
||||
open_display();
|
||||
serverString = XResourceManagerString(dsp);
|
||||
if (serverString) {
|
||||
serverDB = XrmGetStringDatabase(serverString);
|
||||
(void) XrmMergeDatabases(serverDB, &RDB);
|
||||
} else {
|
||||
char buf[1024];
|
||||
sprintf(buf, "%s/.Xdefaults", homeenv);
|
||||
homeDB = XrmGetFileDatabase(buf);
|
||||
(void) XrmMergeDatabases(homeDB, &RDB);
|
||||
}
|
||||
|
||||
XrmParseCommand(&generalDB, genTable, genEntries, ProgramName, &argc, argv);
|
||||
(void) XrmMergeDatabases(generalDB, &RDB);
|
||||
|
||||
GetResource(RDB, ProgramName, classname, "mode", "Mode", t_String,
|
||||
DEF_MODE, (caddr_t *) &mode);
|
||||
|
||||
/*
|
||||
* if random< mode, then just grab a random entry from the table
|
||||
*/
|
||||
if (!strcmp(mode, randomstring))
|
||||
mode = LockProcs[random() % (NUMPROCS - 2)].cmdline_arg;
|
||||
|
||||
sprintf(modename, "%s.%s", ProgramName, mode);
|
||||
sprintf(modeclass, "%s.%s", classname, mode);
|
||||
|
||||
|
||||
/*********************************************************************/
|
||||
/** New code for AIX **/
|
||||
/** We must build the specifier fields of the modeTable on the fly. **/
|
||||
/*********************************************************************/
|
||||
sprintf(delaySpecifier, ".%s.delay", mode);
|
||||
sprintf(batchcountSpecifier, ".%s.batchcount", mode);
|
||||
sprintf(saturationSpecifier, ".%s.saturation", mode);
|
||||
modeTable[0].specifier = delaySpecifier;
|
||||
modeTable[1].specifier = batchcountSpecifier;
|
||||
modeTable[2].specifier = saturationSpecifier;
|
||||
|
||||
|
||||
XrmParseCommand(&modeDB, modeTable, modeEntries, ProgramName, &argc, argv);
|
||||
(void) XrmMergeDatabases(modeDB, &RDB);
|
||||
|
||||
/* Parse the rest of the command line */
|
||||
for (argc--, argv++; argc > 0; argc--, argv++) {
|
||||
if (**argv != '-')
|
||||
Syntax(*argv);
|
||||
switch (argv[0][1]) {
|
||||
case 'r':
|
||||
DumpResources();
|
||||
/* NOTREACHED */
|
||||
default:
|
||||
Syntax(*argv);
|
||||
/* NOTREACHED */
|
||||
}
|
||||
}
|
||||
|
||||
/* the RDB is set, now query load the variables from the database */
|
||||
|
||||
for (i = 0; i < NGENARGS; i++)
|
||||
GetResource(RDB, ProgramName, classname,
|
||||
genvars[i].name, genvars[i].class,
|
||||
genvars[i].type, genvars[i].def, genvars[i].var);
|
||||
|
||||
for (i = 0; i < NMODEARGS; i++)
|
||||
GetResource(RDB, modename, modeclass,
|
||||
modevars[i].name, modevars[i].class,
|
||||
modevars[i].type, modevars[i].def, modevars[i].var);
|
||||
|
||||
(void) XrmDestroyDatabase(RDB);
|
||||
|
||||
}
|
||||
|
||||
|
||||
CheckResources()
|
||||
{
|
||||
int i;
|
||||
|
||||
if (batchcount < 1)
|
||||
Syntax("-batchcount argument must be positive.");
|
||||
if (saturation < 0.0 || saturation > 1.0)
|
||||
Syntax("-saturation argument must be between 0.0 and 1.0.");
|
||||
if (delay < 0)
|
||||
Syntax("-delay argument must be positive.");
|
||||
|
||||
for (i = 0; i < NUMPROCS; i++) {
|
||||
if (!strncmp(LockProcs[i].cmdline_arg, mode, strlen(mode))) {
|
||||
init = LockProcs[i].lp_init;
|
||||
callback = LockProcs[i].lp_callback;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i == NUMPROCS) {
|
||||
#ifdef MIT_R5
|
||||
fprintf(stderr, "Unknown mode: ");
|
||||
#else
|
||||
fprintf(stderr, catgets(scmc_catd, 2, 7,
|
||||
"Unknown mode: "));
|
||||
#endif
|
||||
Syntax(mode);
|
||||
}
|
||||
}
|
||||
257
cde/programs/dtscreen/rotor.c
Normal file
257
cde/programs/dtscreen/rotor.c
Normal file
@@ -0,0 +1,257 @@
|
||||
/* $XConsortium: rotor.c /main/3 1995/11/02 16:08:34 rswiston $ */
|
||||
/*
|
||||
*/
|
||||
/* *
|
||||
* (c) Copyright 1993, 1994 Hewlett-Packard Company *
|
||||
* (c) Copyright 1993, 1994 International Business Machines Corp. *
|
||||
* (c) Copyright 1993, 1994 Sun Microsystems, Inc. *
|
||||
* (c) Copyright 1993, 1994 Novell, Inc. *
|
||||
*/
|
||||
/*-
|
||||
* rotor.c - A swirly rotor for dtscreen, the X Window System lockscreen.
|
||||
*
|
||||
* Copyright (c) 1991 by Patrick J. Naughton.
|
||||
*
|
||||
* See dtscreen.c for copying information.
|
||||
*
|
||||
* Revision History:
|
||||
* 11-Nov-90: put into dtscreen (by Steve Zellers, zellers@sun.com)
|
||||
* 16-Oct-90: Received from Tom Lawrence (tcl@cs.brown.edu: 'flight' simulator)
|
||||
*/
|
||||
|
||||
/*
|
||||
* A 'batchcount' of 3 or 4 works best!
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include "dtscreen.h"
|
||||
|
||||
#define SAVE 100 /* this is a good constant to tweak */
|
||||
#define REPS 50
|
||||
|
||||
#define MAXANGLE 10000.0 /* irrectangular */
|
||||
#define DEFAULTCOUNT 3
|
||||
|
||||
typedef unsigned char Boolean;
|
||||
|
||||
#define IDENT(X) X
|
||||
#if defined (__STDC__) || defined (AIXV3)
|
||||
#define CAT(X,Y) X##Y
|
||||
#else
|
||||
#define CAT(X,Y) IDENT(X)Y
|
||||
#endif
|
||||
|
||||
struct elem {
|
||||
float angle;
|
||||
float radius;
|
||||
float start_radius;
|
||||
float end_radius;
|
||||
float radius_drift_max;
|
||||
float radius_drift_now;
|
||||
|
||||
float ratio;
|
||||
float start_ratio;
|
||||
float end_ratio;
|
||||
float ratio_drift_max;
|
||||
float ratio_drift_now;
|
||||
};
|
||||
|
||||
typedef struct flightstruct {
|
||||
struct elem *elements;
|
||||
int pix;
|
||||
int lastx,
|
||||
lasty;
|
||||
int num,
|
||||
rotor,
|
||||
prev;
|
||||
int savex[SAVE],
|
||||
savey[SAVE];
|
||||
float angle;
|
||||
int centerx,
|
||||
centery;
|
||||
Boolean firsttime;
|
||||
Boolean smallscreen; /* for iconified view */
|
||||
Boolean forward;
|
||||
Boolean unused;
|
||||
} flightstruct;
|
||||
|
||||
|
||||
void
|
||||
initrotor(pwin)
|
||||
perwindow *pwin;
|
||||
{
|
||||
flightstruct *fs;
|
||||
XWindowAttributes xgwa;
|
||||
int x;
|
||||
struct elem *pelem;
|
||||
Boolean wassmall;
|
||||
|
||||
if (pwin->data) free(pwin->data);
|
||||
pwin->data = (void *)malloc(sizeof(flightstruct));
|
||||
memset(pwin->data, 0, sizeof(flightstruct));
|
||||
fs = (flightstruct *)pwin->data;
|
||||
XGetWindowAttributes(dsp, pwin->w, &xgwa);
|
||||
fs->centerx = xgwa.width / 2;
|
||||
fs->centery = xgwa.height / 2;
|
||||
|
||||
/*
|
||||
* sometimes, you go into small view, only to see a really whizzy pattern
|
||||
* that you would like to look more closely at. Normally, clicking in the
|
||||
* icon reinitializes everything - but I don't, cuz I'm that kind of guy.
|
||||
* HENCE, the wassmall stuff you see here.
|
||||
*/
|
||||
|
||||
wassmall = fs->smallscreen;
|
||||
fs->smallscreen = (xgwa.width < 100);
|
||||
|
||||
if (wassmall && !fs->smallscreen)
|
||||
fs->firsttime = True;
|
||||
else {
|
||||
if (batchcount > 12)
|
||||
batchcount = DEFAULTCOUNT;
|
||||
fs->num = batchcount;
|
||||
|
||||
if ((fs->elements = (struct elem *)
|
||||
malloc(sizeof(struct elem) * fs->num)) == 0) {
|
||||
perror("malloc");
|
||||
exit(1);
|
||||
}
|
||||
memset(fs->savex, 0, sizeof(fs->savex));
|
||||
|
||||
pelem = fs->elements;
|
||||
|
||||
for (x = fs->num; --x >= 0; pelem++) {
|
||||
pelem->radius_drift_max = 1.0;
|
||||
pelem->radius_drift_now = 1.0;
|
||||
|
||||
pelem->end_radius = 100.0;
|
||||
|
||||
pelem->ratio_drift_max = 1.0;
|
||||
pelem->ratio_drift_now = 1.0;
|
||||
pelem->end_ratio = 10.0;
|
||||
}
|
||||
|
||||
fs->rotor = 0;
|
||||
fs->prev = 1;
|
||||
fs->lastx = fs->centerx;
|
||||
fs->lasty = fs->centery;
|
||||
fs->angle = (random() % (long) MAXANGLE) / 3;
|
||||
fs->forward = fs->firsttime = True;
|
||||
}
|
||||
XSetForeground(dsp, pwin->gc, BlackPixelOfScreen(pwin->perscreen->screen));
|
||||
XFillRectangle(dsp, pwin->w, pwin->gc, 0, 0, xgwa.width, xgwa.height);
|
||||
}
|
||||
|
||||
void
|
||||
drawrotor(pwin)
|
||||
perwindow *pwin;
|
||||
{
|
||||
register flightstruct *fs;
|
||||
register struct elem *pelem;
|
||||
int thisx,
|
||||
thisy;
|
||||
int i,
|
||||
rp;
|
||||
int x1,
|
||||
y1,
|
||||
x2,
|
||||
y2;
|
||||
|
||||
#define SCALE(W,N) CAT(W,N)/=12; CAT(W,N)+=(CAT(fs->center,W)-2)
|
||||
#define SCALEIFSMALL() if (fs->smallscreen) { \
|
||||
SCALE(x,1); SCALE(x,2); \
|
||||
SCALE(y,1); SCALE(y,2); \
|
||||
}
|
||||
|
||||
fs = (flightstruct *)pwin->data;
|
||||
for (rp = 0; rp < REPS; rp++) {
|
||||
thisx = fs->centerx;
|
||||
thisy = fs->centery;
|
||||
|
||||
for (i = fs->num, pelem = fs->elements; --i >= 0; pelem++) {
|
||||
if (pelem->radius_drift_max <= pelem->radius_drift_now) {
|
||||
pelem->start_radius = pelem->end_radius;
|
||||
pelem->end_radius =
|
||||
(float) (random() % 40000) / 100.0 - 200.0;
|
||||
pelem->radius_drift_max =
|
||||
(float) (random() % 100000) + 10000.0;
|
||||
pelem->radius_drift_now = 0.0;
|
||||
}
|
||||
if (pelem->ratio_drift_max <= pelem->ratio_drift_now) {
|
||||
pelem->start_ratio = pelem->end_ratio;
|
||||
pelem->end_ratio =
|
||||
(float) (random() % 2000) / 100.0 - 10.0;
|
||||
pelem->ratio_drift_max =
|
||||
(float) (random() % 100000) + 10000.0;
|
||||
pelem->ratio_drift_now = 0.0;
|
||||
}
|
||||
pelem->ratio = pelem->start_ratio +
|
||||
(pelem->end_ratio - pelem->start_ratio) /
|
||||
pelem->ratio_drift_max * pelem->ratio_drift_now;
|
||||
pelem->angle = fs->angle * pelem->ratio;
|
||||
pelem->radius = pelem->start_radius +
|
||||
(pelem->end_radius - pelem->start_radius) /
|
||||
pelem->radius_drift_max * pelem->radius_drift_now;
|
||||
|
||||
thisx += (int) (cos(pelem->angle) * pelem->radius);
|
||||
thisy += (int) (sin(pelem->angle) * pelem->radius);
|
||||
|
||||
pelem->ratio_drift_now += 1.0;
|
||||
pelem->radius_drift_now += 1.0;
|
||||
}
|
||||
|
||||
if (fs->firsttime)
|
||||
fs->firsttime = False;
|
||||
else {
|
||||
XSetForeground(dsp, pwin->gc, BlackPixelOfScreen(pwin->perscreen->screen));
|
||||
|
||||
x1 = (int) fs->savex[fs->rotor];
|
||||
y1 = (int) fs->savey[fs->rotor];
|
||||
x2 = (int) fs->savex[fs->prev];
|
||||
y2 = (int) fs->savey[fs->prev];
|
||||
|
||||
SCALEIFSMALL()
|
||||
|
||||
XDrawLine(dsp, pwin->w, pwin->gc, x1, y1, x2, y2);
|
||||
|
||||
if (!mono && pwin->perscreen->npixels > 2) {
|
||||
XSetForeground(dsp, pwin->gc,
|
||||
pwin->perscreen->pixels[fs->pix]);
|
||||
if (++fs->pix >= pwin->perscreen->npixels)
|
||||
fs->pix = 0;
|
||||
} else
|
||||
XSetForeground(dsp, pwin->gc,
|
||||
WhitePixelOfScreen(pwin->perscreen->screen));
|
||||
|
||||
x1 = fs->lastx;
|
||||
y1 = fs->lasty;
|
||||
x2 = thisx;
|
||||
y2 = thisy;
|
||||
|
||||
SCALEIFSMALL()
|
||||
|
||||
XDrawLine(dsp, pwin->w, pwin->gc, x1, y1, x2, y2);
|
||||
}
|
||||
fs->savex[fs->rotor] = fs->lastx = thisx;
|
||||
fs->savey[fs->rotor] = fs->lasty = thisy;
|
||||
|
||||
++fs->rotor;
|
||||
fs->rotor %= SAVE;
|
||||
++fs->prev;
|
||||
fs->prev %= SAVE;
|
||||
if (fs->forward) {
|
||||
fs->angle += 0.01;
|
||||
if (fs->angle >= MAXANGLE) {
|
||||
fs->angle = MAXANGLE;
|
||||
fs->forward = False;
|
||||
}
|
||||
} else {
|
||||
fs->angle -= 0.1;
|
||||
if (fs->angle <= 0) {
|
||||
fs->angle = 0.0;
|
||||
fs->forward = True;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
210
cde/programs/dtscreen/swarm.c
Normal file
210
cde/programs/dtscreen/swarm.c
Normal file
@@ -0,0 +1,210 @@
|
||||
/* $XConsortium: swarm.c /main/3 1995/11/02 16:08:42 rswiston $ */
|
||||
/*
|
||||
*/
|
||||
/* *
|
||||
* (c) Copyright 1993, 1994 Hewlett-Packard Company *
|
||||
* (c) Copyright 1993, 1994 International Business Machines Corp. *
|
||||
* (c) Copyright 1993, 1994 Sun Microsystems, Inc. *
|
||||
* (c) Copyright 1993, 1994 Novell, Inc. *
|
||||
*/
|
||||
/*-
|
||||
* swarm.c - swarm of bees for dtscreen, the X Window System lockscreen.
|
||||
*
|
||||
* Copyright (c) 1991 by Patrick J. Naughton.
|
||||
*
|
||||
* Revision History:
|
||||
* 31-Aug-90: Adapted from xswarm by Jeff Butterworth. (butterwo@ncsc.org)
|
||||
*/
|
||||
|
||||
#include "dtscreen.h"
|
||||
|
||||
#define TIMES 4 /* number of time positions recorded */
|
||||
#define BEEACC 3 /* acceleration of bees */
|
||||
#define WASPACC 5 /* maximum acceleration of wasp */
|
||||
#define BEEVEL 11 /* maximum bee velocity */
|
||||
#define WASPVEL 12 /* maximum wasp velocity */
|
||||
#define BORDER 50 /* wasp won't go closer than this to the edge */
|
||||
|
||||
/* Macros */
|
||||
#define X(t,b) (sp->x[(t)*sp->beecount+(b)])
|
||||
#define Y(t,b) (sp->y[(t)*sp->beecount+(b)])
|
||||
#define RAND(v) ((random()%(v))-((v)/2)) /* random number around 0 */
|
||||
|
||||
typedef struct {
|
||||
int pix;
|
||||
long startTime;
|
||||
int width;
|
||||
int height;
|
||||
int beecount; /* number of bees */
|
||||
XSegment *segs; /* bee lines */
|
||||
XSegment *old_segs; /* old bee lines */
|
||||
short *x;
|
||||
short *y; /* bee positions x[time][bee#] */
|
||||
short *xv;
|
||||
short *yv; /* bee velocities xv[bee#] */
|
||||
short wx[3];
|
||||
short wy[3];
|
||||
short wxv;
|
||||
short wyv;
|
||||
} swarmstruct;
|
||||
|
||||
void
|
||||
initswarm(pwin)
|
||||
perwindow *pwin;
|
||||
{
|
||||
XWindowAttributes xgwa;
|
||||
swarmstruct *sp;
|
||||
int b;
|
||||
|
||||
if (pwin->data) free(pwin->data);
|
||||
pwin->data = (void *)malloc(sizeof(swarmstruct));
|
||||
memset(pwin->data, '\0', sizeof(swarmstruct));
|
||||
sp = (swarmstruct *)pwin->data;
|
||||
sp->startTime = seconds();
|
||||
sp->beecount = batchcount;
|
||||
|
||||
XGetWindowAttributes(dsp, pwin->w, &xgwa);
|
||||
sp->width = xgwa.width;
|
||||
sp->height = xgwa.height;
|
||||
|
||||
/* Clear the background. */
|
||||
XSetForeground(dsp, pwin->gc, BlackPixelOfScreen(pwin->perscreen->screen));
|
||||
XFillRectangle(dsp, pwin->w, pwin->gc, 0, 0, sp->width, sp->height);
|
||||
|
||||
/* Allocate memory. */
|
||||
|
||||
sp->segs = (XSegment *) malloc(sizeof(XSegment) * sp->beecount);
|
||||
sp->old_segs = (XSegment *) malloc(sizeof(XSegment) * sp->beecount);
|
||||
sp->x = (short *) malloc(sizeof(short) * sp->beecount * TIMES);
|
||||
sp->y = (short *) malloc(sizeof(short) * sp->beecount * TIMES);
|
||||
sp->xv = (short *) malloc(sizeof(short) * sp->beecount);
|
||||
sp->yv = (short *) malloc(sizeof(short) * sp->beecount);
|
||||
|
||||
/* Initialize point positions, velocities, etc. */
|
||||
|
||||
/* wasp */
|
||||
sp->wx[0] = BORDER + random() % (sp->width - 2 * BORDER);
|
||||
sp->wy[0] = BORDER + random() % (sp->height - 2 * BORDER);
|
||||
sp->wx[1] = sp->wx[0];
|
||||
sp->wy[1] = sp->wy[0];
|
||||
sp->wxv = 0;
|
||||
sp->wyv = 0;
|
||||
|
||||
/* bees */
|
||||
for (b = 0; b < sp->beecount; b++) {
|
||||
X(0, b) = random() % sp->width;
|
||||
X(1, b) = X(0, b);
|
||||
Y(0, b) = random() % sp->height;
|
||||
Y(1, b) = Y(0, b);
|
||||
sp->xv[b] = RAND(7);
|
||||
sp->yv[b] = RAND(7);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
drawswarm(pwin)
|
||||
perwindow *pwin;
|
||||
{
|
||||
swarmstruct *sp;
|
||||
int b;
|
||||
|
||||
sp = (swarmstruct *)pwin->data;
|
||||
/* <=- Wasp -=> */
|
||||
/* Age the arrays. */
|
||||
sp->wx[2] = sp->wx[1];
|
||||
sp->wx[1] = sp->wx[0];
|
||||
sp->wy[2] = sp->wy[1];
|
||||
sp->wy[1] = sp->wy[0];
|
||||
/* Accelerate */
|
||||
sp->wxv += RAND(WASPACC);
|
||||
sp->wyv += RAND(WASPACC);
|
||||
|
||||
/* Speed Limit Checks */
|
||||
if (sp->wxv > WASPVEL)
|
||||
sp->wxv = WASPVEL;
|
||||
if (sp->wxv < -WASPVEL)
|
||||
sp->wxv = -WASPVEL;
|
||||
if (sp->wyv > WASPVEL)
|
||||
sp->wyv = WASPVEL;
|
||||
if (sp->wyv < -WASPVEL)
|
||||
sp->wyv = -WASPVEL;
|
||||
|
||||
/* Move */
|
||||
sp->wx[0] = sp->wx[1] + sp->wxv;
|
||||
sp->wy[0] = sp->wy[1] + sp->wyv;
|
||||
|
||||
/* Bounce Checks */
|
||||
if ((sp->wx[0] < BORDER) || (sp->wx[0] > sp->width - BORDER - 1)) {
|
||||
sp->wxv = -sp->wxv;
|
||||
sp->wx[0] += sp->wxv;
|
||||
}
|
||||
if ((sp->wy[0] < BORDER) || (sp->wy[0] > sp->height - BORDER - 1)) {
|
||||
sp->wyv = -sp->wyv;
|
||||
sp->wy[0] += sp->wyv;
|
||||
}
|
||||
/* Don't let things settle down. */
|
||||
sp->xv[random() % sp->beecount] += RAND(3);
|
||||
sp->yv[random() % sp->beecount] += RAND(3);
|
||||
|
||||
/* <=- Bees -=> */
|
||||
for (b = 0; b < sp->beecount; b++) {
|
||||
int distance,
|
||||
dx,
|
||||
dy;
|
||||
/* Age the arrays. */
|
||||
X(2, b) = X(1, b);
|
||||
X(1, b) = X(0, b);
|
||||
Y(2, b) = Y(1, b);
|
||||
Y(1, b) = Y(0, b);
|
||||
|
||||
/* Accelerate */
|
||||
dx = sp->wx[1] - X(1, b);
|
||||
dy = sp->wy[1] - Y(1, b);
|
||||
distance = abs(dx) + abs(dy); /* approximation */
|
||||
if (distance == 0)
|
||||
distance = 1;
|
||||
sp->xv[b] += (dx * BEEACC) / distance;
|
||||
sp->yv[b] += (dy * BEEACC) / distance;
|
||||
|
||||
/* Speed Limit Checks */
|
||||
if (sp->xv[b] > BEEVEL)
|
||||
sp->xv[b] = BEEVEL;
|
||||
if (sp->xv[b] < -BEEVEL)
|
||||
sp->xv[b] = -BEEVEL;
|
||||
if (sp->yv[b] > BEEVEL)
|
||||
sp->yv[b] = BEEVEL;
|
||||
if (sp->yv[b] < -BEEVEL)
|
||||
sp->yv[b] = -BEEVEL;
|
||||
|
||||
/* Move */
|
||||
X(0, b) = X(1, b) + sp->xv[b];
|
||||
Y(0, b) = Y(1, b) + sp->yv[b];
|
||||
|
||||
/* Fill the segment lists. */
|
||||
sp->segs[b].x1 = X(0, b);
|
||||
sp->segs[b].y1 = Y(0, b);
|
||||
sp->segs[b].x2 = X(1, b);
|
||||
sp->segs[b].y2 = Y(1, b);
|
||||
sp->old_segs[b].x1 = X(1, b);
|
||||
sp->old_segs[b].y1 = Y(1, b);
|
||||
sp->old_segs[b].x2 = X(2, b);
|
||||
sp->old_segs[b].y2 = Y(2, b);
|
||||
}
|
||||
|
||||
XSetForeground(dsp, pwin->gc, BlackPixelOfScreen(pwin->perscreen->screen));
|
||||
XDrawLine(dsp, pwin->w, pwin->gc,
|
||||
sp->wx[1], sp->wy[1], sp->wx[2], sp->wy[2]);
|
||||
XDrawSegments(dsp, pwin->w, pwin->gc, sp->old_segs, sp->beecount);
|
||||
|
||||
XSetForeground(dsp, pwin->gc, WhitePixelOfScreen(pwin->perscreen->screen));
|
||||
XDrawLine(dsp, pwin->w, pwin->gc,
|
||||
sp->wx[0], sp->wy[0], sp->wx[1], sp->wy[1]);
|
||||
if (!mono && pwin->perscreen->npixels > 2) {
|
||||
XSetForeground(dsp, pwin->gc, pwin->perscreen->pixels[sp->pix]);
|
||||
if (++sp->pix >= pwin->perscreen->npixels)
|
||||
sp->pix = 0;
|
||||
}
|
||||
XDrawSegments(dsp, pwin->w, pwin->gc, sp->segs, sp->beecount);
|
||||
}
|
||||
49
cde/programs/dtscreen/usleep.c
Normal file
49
cde/programs/dtscreen/usleep.c
Normal file
@@ -0,0 +1,49 @@
|
||||
/* $TOG: usleep.c /main/6 1998/04/06 13:32:38 mgreess $ */
|
||||
/*
|
||||
*/
|
||||
/* *
|
||||
* (c) Copyright 1993, 1994 Hewlett-Packard Company *
|
||||
* (c) Copyright 1993, 1994 International Business Machines Corp. *
|
||||
* (c) Copyright 1993, 1994 Sun Microsystems, Inc. *
|
||||
* (c) Copyright 1993, 1994 Novell, Inc. *
|
||||
*/
|
||||
/*-
|
||||
* usleep.c - OS dependant implementation of usleep().
|
||||
*
|
||||
* Copyright (c) 1991 by Patrick J. Naughton.
|
||||
*
|
||||
* Revision History:
|
||||
* 30-Aug-90: written.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "dtscreen.h"
|
||||
|
||||
#if !defined(_AIX) && !defined(hpV4) && !defined(linux)
|
||||
int
|
||||
usleep(unsigned long usec)
|
||||
{
|
||||
#ifdef SYSV
|
||||
poll((struct poll *) 0, (size_t) 0, usec / 1000); /* ms resolution */
|
||||
#else
|
||||
struct timeval timeout;
|
||||
timeout.tv_usec = usec % (unsigned long) 1000000;
|
||||
timeout.tv_sec = usec / (unsigned long) 1000000;
|
||||
select(0, (void *) 0, (void *) 0, (void *) 0, &timeout);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
#endif /* !_AIX && !hpV4*/
|
||||
|
||||
/*
|
||||
* returns the number of seconds since 01-Jan-70.
|
||||
* This is used to control rate and timeout in many of the animations.
|
||||
*/
|
||||
long
|
||||
seconds()
|
||||
{
|
||||
struct timeval now;
|
||||
|
||||
gettimeofday(&now, (struct timezone *) 0);
|
||||
return now.tv_sec;
|
||||
}
|
||||
210
cde/programs/dtscreen/worm.c
Normal file
210
cde/programs/dtscreen/worm.c
Normal file
@@ -0,0 +1,210 @@
|
||||
/* $XConsortium: worm.c /main/3 1995/11/02 16:09:04 rswiston $ */
|
||||
/*
|
||||
*/
|
||||
/* *
|
||||
* (c) Copyright 1993, 1994 Hewlett-Packard Company *
|
||||
* (c) Copyright 1993, 1994 International Business Machines Corp. *
|
||||
* (c) Copyright 1993, 1994 Sun Microsystems, Inc. *
|
||||
* (c) Copyright 1993, 1994 Novell, Inc. *
|
||||
*/
|
||||
/*-
|
||||
* worm.c - draw wiggly worms.
|
||||
*
|
||||
* Copyright (c) 1991 by Patrick J. Naughton.
|
||||
*
|
||||
* See dtscreen.c for copying information.
|
||||
*
|
||||
* Revision History:
|
||||
* 27-Sep-91: got rid of all malloc calls since there were no calls to free().
|
||||
* 25-Sep-91: Integrated into X11R5 contrib dtscreen.
|
||||
*
|
||||
* Adapted from a concept in the Dec 87 issue of Scientific American.
|
||||
*
|
||||
* SunView version: Brad Taylor (brad@sun.com)
|
||||
* X11 version: Dave Lemke (lemke@ncd.com)
|
||||
* xlock version: Boris Putanec (bp@cs.brown.edu)
|
||||
*
|
||||
* This code is a static memory pig... like almost 200K... but as contributed
|
||||
* it leaked at a massive rate, so I made everything static up front... feel
|
||||
* free to contribute the proper memory management code.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "dtscreen.h"
|
||||
#include <math.h>
|
||||
|
||||
#define MAXCOLORS 64
|
||||
#define MAXWORMS 64
|
||||
#define CIRCSIZE 2
|
||||
#define MAXWORMLEN 50
|
||||
|
||||
#define PI 3.14159265358979323844
|
||||
#define SEGMENTS 36
|
||||
static int sintab[SEGMENTS];
|
||||
static int costab[SEGMENTS];
|
||||
static int init_table = 0;
|
||||
|
||||
typedef struct {
|
||||
int xcirc[MAXWORMLEN];
|
||||
int ycirc[MAXWORMLEN];
|
||||
int dir;
|
||||
int tail;
|
||||
int x;
|
||||
int y;
|
||||
} wormstuff;
|
||||
|
||||
typedef struct {
|
||||
int xsize;
|
||||
int ysize;
|
||||
int wormlength;
|
||||
int monopix;
|
||||
int nc;
|
||||
int nw;
|
||||
wormstuff worm[MAXWORMS];
|
||||
XRectangle rects[MAXCOLORS][MAXWORMS];
|
||||
int size[MAXCOLORS];
|
||||
} wormstruct;
|
||||
|
||||
int
|
||||
round(x)
|
||||
float x;
|
||||
{
|
||||
return ((int) floor((double) x));
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
worm_doit(pwin, wp, which, color)
|
||||
perwindow *pwin;
|
||||
wormstruct *wp;
|
||||
int which;
|
||||
unsigned long color;
|
||||
{
|
||||
wormstuff *ws = &wp->worm[which];
|
||||
int x, y;
|
||||
|
||||
ws->tail++;
|
||||
if (ws->tail == wp->wormlength)
|
||||
ws->tail = 0;
|
||||
|
||||
x = ws->xcirc[ws->tail];
|
||||
y = ws->ycirc[ws->tail];
|
||||
XClearArea(dsp, pwin->w, x, y, CIRCSIZE, CIRCSIZE, False);
|
||||
|
||||
if (random() & 1) {
|
||||
ws->dir = (ws->dir + 1) % SEGMENTS;
|
||||
} else {
|
||||
ws->dir = (ws->dir + SEGMENTS - 1) % SEGMENTS;
|
||||
}
|
||||
|
||||
x = (ws->x + costab[ws->dir] + wp->xsize) % wp->xsize;
|
||||
y = (ws->y + sintab[ws->dir] + wp->ysize) % wp->ysize;
|
||||
|
||||
ws->xcirc[ws->tail] = x;
|
||||
ws->ycirc[ws->tail] = y;
|
||||
ws->x = x;
|
||||
ws->y = y;
|
||||
|
||||
wp->rects[color][wp->size[color]].x = x;
|
||||
wp->rects[color][wp->size[color]].y = y;
|
||||
wp->size[color]++;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
initworm(pwin)
|
||||
perwindow *pwin;
|
||||
{
|
||||
int i, j;
|
||||
wormstruct *wp;
|
||||
XWindowAttributes xwa;
|
||||
|
||||
if (pwin->data) free(pwin->data);
|
||||
pwin->data = (void *)malloc(sizeof(wormstruct));
|
||||
memset(pwin->data, '\0', sizeof(wormstruct));
|
||||
wp = (wormstruct *)pwin->data;
|
||||
wp->nc = pwin->perscreen->npixels;
|
||||
if (wp->nc > MAXCOLORS)
|
||||
wp->nc = MAXCOLORS;
|
||||
|
||||
wp->nw = batchcount;
|
||||
if (wp->nw > MAXWORMS)
|
||||
wp->nw = MAXWORMS;
|
||||
|
||||
if (!init_table) {
|
||||
init_table = 1;
|
||||
for (i = 0; i < SEGMENTS; i++) {
|
||||
sintab[i] = round(CIRCSIZE * sin(i * 2 * PI / SEGMENTS));
|
||||
costab[i] = round(CIRCSIZE * cos(i * 2 * PI / SEGMENTS));
|
||||
}
|
||||
}
|
||||
XGetWindowAttributes(dsp, pwin->w, &xwa);
|
||||
wp->xsize = xwa.width;
|
||||
wp->ysize = xwa.height;
|
||||
|
||||
if (xwa.width < 100) {
|
||||
wp->monopix = BlackPixelOfScreen(pwin->perscreen->screen);
|
||||
wp->wormlength = MAXWORMLEN / 10;
|
||||
} else {
|
||||
wp->monopix = WhitePixelOfScreen(pwin->perscreen->screen);
|
||||
wp->wormlength = MAXWORMLEN;
|
||||
}
|
||||
|
||||
for (i = 0; i < wp->nc; i++) {
|
||||
for (j = 0; j < wp->nw / wp->nc + 1; j++) {
|
||||
wp->rects[i][j].width = CIRCSIZE;
|
||||
wp->rects[i][j].height = CIRCSIZE;
|
||||
}
|
||||
}
|
||||
memset(wp->size, '\0', wp->nc * sizeof(int));
|
||||
|
||||
for (i = 0; i < wp->nw; i++) {
|
||||
for (j = 0; j < wp->wormlength; j++) {
|
||||
wp->worm[i].xcirc[j] = wp->xsize / 2;
|
||||
wp->worm[i].ycirc[j] = wp->ysize / 2;
|
||||
}
|
||||
wp->worm[i].dir = (unsigned) random() % SEGMENTS;
|
||||
wp->worm[i].tail = 0;
|
||||
wp->worm[i].x = wp->xsize / 2;
|
||||
wp->worm[i].y = wp->ysize / 2;
|
||||
}
|
||||
|
||||
XClearWindow(dsp, pwin->w);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
drawworm(pwin)
|
||||
perwindow *pwin;
|
||||
{
|
||||
int i;
|
||||
wormstruct *wp = (wormstruct *)pwin->data;
|
||||
unsigned int wcolor;
|
||||
static unsigned int chromo = 0;
|
||||
|
||||
memset(wp->size, '\0', wp->nc * sizeof(int));
|
||||
|
||||
for (i = 0; i < wp->nw; i++) {
|
||||
if (!mono && wp->nc > 2) {
|
||||
wcolor = (i + chromo) % wp->nc;
|
||||
|
||||
worm_doit(pwin, wp, i, wcolor);
|
||||
} else
|
||||
worm_doit(pwin, wp, i, 0);
|
||||
}
|
||||
|
||||
if (!mono && wp->nc > 2) {
|
||||
for (i = 0; i < wp->nc; i++) {
|
||||
XSetForeground(dsp, pwin->gc, pwin->perscreen->pixels[i]);
|
||||
XFillRectangles(dsp, pwin->w, pwin->gc, wp->rects[i],
|
||||
wp->size[i]);
|
||||
}
|
||||
} else {
|
||||
XSetForeground(dsp, pwin->gc, wp->monopix);
|
||||
XFillRectangles(dsp, pwin->w, pwin->gc, wp->rects[0],
|
||||
wp->size[0]);
|
||||
}
|
||||
|
||||
if (++chromo == wp->nc)
|
||||
chromo = 0;
|
||||
}
|
||||
68
cde/programs/dtscreen/xlogo.bit
Normal file
68
cde/programs/dtscreen/xlogo.bit
Normal file
@@ -0,0 +1,68 @@
|
||||
/* @(#)44 1.2 src/gos/2d/XTOP/aixclients/xlock/xlogo.bit, xclients, gos410, gos4.17293b 3/8/93 13:19:44 */
|
||||
/*
|
||||
* COMPONENT_NAME: XLOCK (xlogo.bit)
|
||||
*
|
||||
* FUNCTIONS: none
|
||||
*
|
||||
* ORIGINS: 16,27
|
||||
*
|
||||
* (C) COPYRIGHT International Business Machines Corp. 1992, 1993
|
||||
* All Rights Reserved
|
||||
* Licensed Materials - Property of IBM
|
||||
*
|
||||
* US Government Users Restricted Rights - Use, duplication or
|
||||
* disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
|
||||
*/
|
||||
/* *
|
||||
* (c) Copyright 1993, 1994 Hewlett-Packard Company *
|
||||
* (c) Copyright 1993, 1994 International Business Machines Corp. *
|
||||
* (c) Copyright 1993, 1994 Sun Microsystems, Inc. *
|
||||
* (c) Copyright 1993, 1994 Novell, Inc. *
|
||||
*/
|
||||
|
||||
#define xlogo_width 64
|
||||
#define xlogo_height 64
|
||||
static unsigned char xlogo_bits[] = {
|
||||
0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xfe, 0xff, 0x01, 0x00,
|
||||
0x00, 0x00, 0x00, 0x7f, 0xfc, 0xff, 0x03, 0x00, 0x00, 0x00, 0x80, 0x3f,
|
||||
0xfc, 0xff, 0x03, 0x00, 0x00, 0x00, 0x80, 0x3f, 0xf8, 0xff, 0x07, 0x00,
|
||||
0x00, 0x00, 0xc0, 0x1f, 0xf0, 0xff, 0x0f, 0x00, 0x00, 0x00, 0xe0, 0x0f,
|
||||
0xe0, 0xff, 0x1f, 0x00, 0x00, 0x00, 0xf0, 0x07, 0xe0, 0xff, 0x1f, 0x00,
|
||||
0x00, 0x00, 0xf0, 0x07, 0xc0, 0xff, 0x3f, 0x00, 0x00, 0x00, 0xf8, 0x03,
|
||||
0x80, 0xff, 0x7f, 0x00, 0x00, 0x00, 0xfc, 0x01, 0x00, 0xff, 0xff, 0x00,
|
||||
0x00, 0x00, 0xfe, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0xfe, 0x00,
|
||||
0x00, 0xfe, 0xff, 0x01, 0x00, 0x00, 0x7f, 0x00, 0x00, 0xfc, 0xff, 0x03,
|
||||
0x00, 0x80, 0x3f, 0x00, 0x00, 0xf8, 0xff, 0x07, 0x00, 0xc0, 0x1f, 0x00,
|
||||
0x00, 0xf8, 0xff, 0x07, 0x00, 0xc0, 0x1f, 0x00, 0x00, 0xf0, 0xff, 0x0f,
|
||||
0x00, 0xe0, 0x0f, 0x00, 0x00, 0xe0, 0xff, 0x1f, 0x00, 0xf0, 0x07, 0x00,
|
||||
0x00, 0xc0, 0xff, 0x3f, 0x00, 0xf8, 0x03, 0x00, 0x00, 0xc0, 0xff, 0x7f,
|
||||
0x00, 0xf8, 0x03, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0xfc, 0x01, 0x00,
|
||||
0x00, 0x00, 0xff, 0xff, 0x01, 0xfe, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff,
|
||||
0x01, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0x83, 0x3f, 0x00, 0x00,
|
||||
0x00, 0x00, 0xfc, 0xff, 0x83, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff,
|
||||
0xc7, 0x1f, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xe7, 0x0f, 0x00, 0x00,
|
||||
0x00, 0x00, 0xe0, 0xff, 0xe3, 0x07, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff,
|
||||
0xf3, 0x07, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xf9, 0x03, 0x00, 0x00,
|
||||
0x00, 0x00, 0x80, 0xff, 0xfc, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f,
|
||||
0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xfe, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x80, 0x3f, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x9f,
|
||||
0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xcf, 0xff, 0x07, 0x00, 0x00,
|
||||
0x00, 0x00, 0xe0, 0xcf, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xe7,
|
||||
0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xe3, 0xff, 0x1f, 0x00, 0x00,
|
||||
0x00, 0x00, 0xfc, 0xc1, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xc1,
|
||||
0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x80, 0xff, 0x7f, 0x00, 0x00,
|
||||
0x00, 0x00, 0x7f, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x00,
|
||||
0xfe, 0xff, 0x01, 0x00, 0x00, 0xc0, 0x1f, 0x00, 0xfc, 0xff, 0x03, 0x00,
|
||||
0x00, 0xc0, 0x1f, 0x00, 0xfc, 0xff, 0x03, 0x00, 0x00, 0xe0, 0x0f, 0x00,
|
||||
0xf8, 0xff, 0x07, 0x00, 0x00, 0xf0, 0x07, 0x00, 0xf0, 0xff, 0x0f, 0x00,
|
||||
0x00, 0xf8, 0x03, 0x00, 0xe0, 0xff, 0x1f, 0x00, 0x00, 0xf8, 0x03, 0x00,
|
||||
0xe0, 0xff, 0x1f, 0x00, 0x00, 0xfc, 0x01, 0x00, 0xc0, 0xff, 0x3f, 0x00,
|
||||
0x00, 0xfe, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00, 0x7f, 0x00, 0x00,
|
||||
0x00, 0xff, 0xff, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00,
|
||||
0x80, 0x3f, 0x00, 0x00, 0x00, 0xfe, 0xff, 0x01, 0xc0, 0x1f, 0x00, 0x00,
|
||||
0x00, 0xfc, 0xff, 0x03, 0xe0, 0x0f, 0x00, 0x00, 0x00, 0xf8, 0xff, 0x07,
|
||||
0xe0, 0x0f, 0x00, 0x00, 0x00, 0xf8, 0xff, 0x07, 0xf0, 0x07, 0x00, 0x00,
|
||||
0x00, 0xf0, 0xff, 0x0f, 0xf8, 0x03, 0x00, 0x00, 0x00, 0xe0, 0xff, 0x1f,
|
||||
0xfc, 0x01, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x3f, 0xfc, 0x01, 0x00, 0x00,
|
||||
0x00, 0xc0, 0xff, 0x3f, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f,
|
||||
0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff};
|
||||
Reference in New Issue
Block a user