Initial import of the CDE 2.1.30 sources from the Open Group.

This commit is contained in:
Peter Howkins
2012-03-10 18:21:40 +00:00
commit 83b6996daa
18978 changed files with 3945623 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
# $XConsortium: Makefile.hp /main/2 1996/05/13 11:48:11 drk $
##########################################################################
#
# Makefile for dtsession examples (HP)
#
# (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.
#
##########################################################################
CC = cc
RM = rm -f
PROGRAM = screensaver
SOURCES = screensaver.c
OBJECTS = screensaver.o
DEFINES =
CDEBUGFLAGS = -O
CFLAGS = -Aa -z $(DEFINES) $(CDEBUGFLAGS)
DTINCLUDE = -I/usr/dt/include
X11INCLUDE = -I/usr/include/X11R5
INCLUDES = $(DTINCLUDE) $(X11INCLUDE)
DTLIBS = -L/usr/dt/lib -lDtSvc
X11LIBS = -L/usr/lib/X11R5 -lXt -lX11
SYSLIBS = -lm
LIBRARIES = $(DTLIBS) $(X11LIBS) $(SYSLIBS)
LDFLAGS =
.c.o:
${CC} -c $(CFLAGS) $(INCLUDES) $<
all:: $(PROGRAM)
$(PROGRAM):: $(OBJECTS)
${CC} -o $(PROGRAM) $(LDFLAGS) $(OBJECTS) $(LIBRARIES)
clean::
${RM} $(PROGRAM) $(OBJECTS)

View File

@@ -0,0 +1,45 @@
# $XConsortium: Makefile.ibm /main/2 1996/05/13 11:48:29 drk $
##########################################################################
#
# Makefile for dtsession examples (IBM)
#
# (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.
#
##########################################################################
CC = cc
RM = rm -f
PROGRAM = screensaver
SOURCES = screensaver.c
OBJECTS = screensaver.o
DEFINES =
CDEBUGFLAGS = -O
CFLAGS = $(DEFINES) $(CDEBUGFLAGS)
DTINCLUDE = -I/usr/dt/include
X11INCLUDE = -I/usr/include
INCLUDES = $(DTINCLUDE) $(X11INCLUDE)
DTLIBS = -L/usr/dt/lib -lDtSvc
X11LIBS = -L/usr/lib -lX11
SYSLIBS = -lm
LIBRARIES = $(DTLIBS) $(X11LIBS) $(SYSLIBS)
LDFLAGS =
.c.o:
$(CC) -c $(CFLAGS) $(INCLUDES) $<
all:: $(PROGRAM)
$(PROGRAM):: $(OBJECTS)
$(CC) -o $(PROGRAM) $(LDFLAGS) $(OBJECTS) $(LIBRARIES)
clean::
$(RM) $(PROGRAM) $(OBJECTS)

View File

@@ -0,0 +1,45 @@
# $XConsortium: Makefile.novell /main/2 1996/05/13 11:48:47 drk $
##########################################################################
#
# Makefile for dtsession examples (Novell)
#
# (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.
#
##########################################################################
CC = cc
RM = rm -f
PROGRAM = screensaver
SOURCES = screensaver.c
OBJECTS = screensaver.o
DEFINES =
CDEBUGFLAGS = -O
CFLAGS = -Xc $(DEFINES) $(CDEBUGFLAGS)
DTINCLUDE = -I/usr/dt/include
X11INCLUDE = -I/usr/X/include
INCLUDES = $(DTINCLUDE) $(X11INCLUDE)
DTLIBS = -L/usr/dt/lib -lDtSvc
X11LIBS = -L/usr/X/lib -lXt -lX11
SYSLIBS = -lw -lgen -lnsl -lresolv -lsocket -lXIM -lm
LIBRARIES = $(DTLIBS) $(X11LIBS) $(SYSLIBS)
LDFLAGS =
.c.o:
$(CC) -c $(CFLAGS) $(INCLUDES) $<
all:: $(PROGRAM)
$(PROGRAM):: $(OBJECTS)
$(CC) -o $(PROGRAM) $(LDFLAGS) $(OBJECTS) $(LIBRARIES)
clean::
$(RM) $(PROGRAM) $(OBJECTS)

View File

@@ -0,0 +1,45 @@
# $XConsortium: Makefile.sun /main/2 1996/05/13 11:49:03 drk $
##########################################################################
#
# Makefile for dtsession examples (SUN)
#
# (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.
#
##########################################################################
CC = cc
RM = rm -f
PROGRAM = screensaver
SOURCES = screensaver.c
OBJECTS = screensaver.o
DEFINES =
CDEBUGFLAGS = -O
CFLAGS = $(DEFINES) $(CDEBUGFLAGS)
DTINCLUDE = -I/usr/dt/include
X11INCLUDE = -I/usr/openwin/include
INCLUDES = $(DTINCLUDE) $(X11INCLUDE)
DTLIBS = -L/usr/dt/lib -lDtSvc
X11LIBS = -L/usr/openwin/lib -lXt -lX11
SYSLIBS = -ldl -lw -lgen -lm
LIBRARIES = $(DTLIBS) $(X11LIBS) $(SYSLIBS)
LDFLAGS = -R/usr/dt/lib:/usr/openwin/lib
.c.o:
$(CC) -c $(CFLAGS) $(INCLUDES) $<
all:: $(PROGRAM)
$(PROGRAM):: $(OBJECTS)
$(CC) -o $(PROGRAM) $(LDFLAGS) $(OBJECTS) $(LIBRARIES)
clean::
$(RM) $(PROGRAM) $(OBJECTS)

View File

@@ -0,0 +1,46 @@
# $XConsortium: Makefile.uxp /main/2 1996/05/13 11:49:20 drk $
##########################################################################
#
# Makefile for dtsession examples (UXP)
#
# (Fujitsu.patch applied)
#
# (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.
#
##########################################################################
CC = cc
RM = rm -f
PROGRAM = screensaver
SOURCES = screensaver.c
OBJECTS = screensaver.o
DEFINES =
CDEBUGFLAGS = -O
CFLAGS = -Xc $(DEFINES) $(CDEBUGFLAGS)
DTINCLUDE = -I/usr/dt/include
INCLUDES = $(DTINCLUDE)
DTLIBS = -L/usr/dt/lib -lDtSvc -ltt -lXm
X11LIBS = -lXt -lX11
SYSLIBS = -lw -lgen -lnsl -lresolv -lsocket -lm
LIBRARIES = $(DTLIBS) $(X11LIBS) $(SYSLIBS)
LDFLAGS =
.c.o:
$(CC) -c $(CFLAGS) $(INCLUDES) $<
all:: $(PROGRAM)
$(PROGRAM):: $(OBJECTS)
$(CC) -o $(PROGRAM) $(LDFLAGS) $(OBJECTS) $(LIBRARIES)
clean::
$(RM) $(PROGRAM) $(OBJECTS)

View File

@@ -0,0 +1,98 @@
/* $XConsortium: README /main/3 1996/07/15 14:01:10 drk $ */
This directory contains demonstrations of the Dt Screen Saver API
screensaver - Example of a simple screen saver that uses the DT Screen
Saver API and techniques to make that screen saver
available to all desktop users or your own session.
The desktop provides a set of screen savers for use
in desktop sessions. This set of screen savers can
be previewed and selected from the Style Manager Screen
dialog.
Each screen saver is known to the desktop by the screen
saver's action definition. The screen saver's action
definition provides the desktop with a short localizable
title for the screen saver, as well as the command line
and options required to start the screen saver. When the
desktop starts a screen saver, it is started by invoking a
screen saver action.
The set of screen saver actions available to a user's
desktop session is defined by the DTSCREENSAVERLIST
environment variable. The default DTSCREENSAVERLIST
set is defined when you start a desktop session. A
system administrator can change this set by creating
a script in directory /etc/dt/config/$LANG/Xsession.d
that modifies DTSCREENSAVERLIST. A user can do the
same in their $HOME/.dtprofile.
A desktop screen saver is a simple application that
uses the DtSaverGetWindows() API to obtain a list of
windows, and draws on those windows. The desktop handles
the starting and stopping of the screen saver application.
The 'screensaver' application is an example that shows
how the DtSaverGetWindows() API may be used, how the
screen saver action may be defined for 'screensaver' and
how the screen saver can be integrated into the desktop for
all desktop users or an individual desktop user. The screen
saver action is named SampleScreenSaver and is defined in
/usr/dt/examples/dtscreen/dt/appconfig/types/C/screensaver.dt.
Making the screen saver available to all users
----------------------------------------------
You must be root to make the screen saver available
to all users. This example assumes you are building
'screensaver' directly in /usr/dt/examples/dtscreen.
1) Build the 'screensaver' application
make -f Makefile.<platform>
2) Register the screen saver action with the desktop
dtappintegrate -s /usr/dt/examples/dtscreen
3) Add the screen saver action to the list of available savers
#create file /etc/dt/config/Xsession.d/myvars containing:
DTSCREENSAVERLIST="SampleScreenSaver $DTSCREENSAVERLIST"
4) Make the /etc/dt/config/Xsession.d/myvars file executable:
chmod 755 /etc/dt/config/Xsession.d/myvars
The next time a user starts the desktop, the example screen
saver will be available for use.
Making the screen saver to your own desktop session
---------------------------------------------------
1) Copy the screen saver example to $HOME/dtscreen
cp -r /usr/dt/examples/dtscreen $HOME/dtscreen
cd $HOME/dtscreen
2) Build the 'screensaver' application
make -f Makefile.<platform>
3) Register the screen saver action with the desktop
cp $HOME/dtscreen/dt/appconfig/types/C/screensaver.dt \
$HOME/.dt/types
4) Change the action EXEC_STRING path
vi $HOME/.dt/types/screensaver.dt
#change the EXEC_STRING to '<home>/dtscreen/screensaver',
#replacing <home> with the value of $HOME
5) Add the screen saver action to the list of available savers
#edit $HOME/.dtprofile and add:
DTSCREENSAVERLIST="SampleScreenSaver $DTSCREENSAVERLIST"
The next time a user starts the desktop, the example screen
saver will be available for use.

View File

@@ -0,0 +1,167 @@
/* $XConsortium: screensaver.c /main/3 1995/10/27 10:40:15 rswiston $ */
/************************************/
/** Sample CDE Screen Saver Client **/
/************************************/
#include <locale.h>
#include <stdio.h>
#include <sys/time.h>
#include <math.h>
#include <X11/Xlib.h>
#include <X11/Intrinsic.h>
#include <Dt/Saver.h>
#define SS_MAX_COLORS 6
typedef struct {
Window id;
int width;
int height;
unsigned long ssPixels[SS_MAX_COLORS];
Colormap cmap;
GC gc;
} WinDataStruct;
int
usleep(usec)
unsigned long usec;
{
poll((struct poll *) 0, (size_t) 0, usec / 1000); /* milliseconds */
return 0;
}
int main(int argc, char *argv[])
{
Display *dpy; /* Display connection */
Window *winprop = NULL; /* dtsession cover windows */
int nWindows; /* number of windows */
WinDataStruct *perWindow; /* per-window information */
int i, j; /* index variable */
XColor actual, exact; /* color structs */
int colorRotate = 0; /* color rotation counter */
setlocale(LC_ALL, "");
/*******************************/
/** open a display connection **/
/*******************************/
if (!(dpy = XOpenDisplay(NULL)) ) {
fprintf(stderr, "Unable to open the Display.\n");
exit(1);
}
/***********************************************************/
/** Get the list of screen saver windows from the desktop **/
/***********************************************************/
if (!DtSaverGetWindows(dpy, &winprop, &nWindows)) {
fprintf(stderr, "Unable to get screen saver info.\n");
XCloseDisplay(dpy);
exit(1);
}
/******************************************************/
/** allocate an array to hold per window information **/
/******************************************************/
if ( (perWindow = (WinDataStruct *)malloc(nWindows * sizeof(WinDataStruct)))
== NULL) {
fprintf(stderr, "Out of memory.\n");
XCloseDisplay(dpy);
exit(1);
}
/*****************************************************/
/** get things set up for each window we were given **/
/*****************************************************/
for (i = 0; i < nWindows; i++) {
XWindowAttributes attr;
perWindow[i].id = winprop[i];
/*************************************/
/** get information for each window **/
/*************************************/
if (! XGetWindowAttributes(dpy, perWindow[i].id, &attr)) {
fprintf(stderr, "Unable to get window %d attributes.\n",
perWindow[i].id);
free((void *)perWindow);
XCloseDisplay(dpy);
exit(1);
}
/***************************************/
/** save the window info we will need **/
/***************************************/
perWindow[i].width = attr.width;
perWindow[i].height = attr.height;
perWindow[i].cmap = DefaultColormapOfScreen(attr.screen);
perWindow[i].gc = DefaultGCOfScreen(attr.screen);
/***********************************************/
/** Allocate the colors we will use, fallback **/
/** to black and white if necessary **/
/***********************************************/
if (XAllocNamedColor(dpy,perWindow[i].cmap,"red",&actual,&exact)){
perWindow[i].ssPixels[0] = actual.pixel;
} else {
perWindow[i].ssPixels[0] = BlackPixelOfScreen(attr.screen);
}
if (XAllocNamedColor(dpy,perWindow[i].cmap,"orange",&actual,&exact)){
perWindow[i].ssPixels[1] = actual.pixel;
} else {
perWindow[i].ssPixels[1] = WhitePixelOfScreen(attr.screen);
}
if (XAllocNamedColor(dpy,perWindow[i].cmap,"yellow",&actual,&exact)){
perWindow[i].ssPixels[2] = actual.pixel;
} else {
perWindow[i].ssPixels[2] = BlackPixelOfScreen(attr.screen);
}
if (XAllocNamedColor(dpy,perWindow[i].cmap,"green",&actual,&exact)){
perWindow[i].ssPixels[3] = actual.pixel;
} else {
perWindow[i].ssPixels[3] = WhitePixelOfScreen(attr.screen);
}
if (XAllocNamedColor(dpy,perWindow[i].cmap,"blue",&actual,&exact)){
perWindow[i].ssPixels[4] = actual.pixel;
} else {
perWindow[i].ssPixels[4] = BlackPixelOfScreen(attr.screen);;
}
if (XAllocNamedColor(dpy,perWindow[i].cmap,"purple",&actual,&exact)){
perWindow[i].ssPixels[5] = actual.pixel;
} else {
perWindow[i].ssPixels[5] = WhitePixelOfScreen(attr.screen);
}
}
/************************************/
/** OK, now enter our drawing loop **/
/************************************/
while (1) {
/************************/
/** update each window **/
/************************/
for (i = 0; i < nWindows; i++) {
/***************************/
/** for each color we use **/
/***************************/
for (j = 0; j < SS_MAX_COLORS; j++) {
int x, y, width, height;
unsigned long curColor;
curColor = perWindow[i].ssPixels[
(int)fmod((j + colorRotate),SS_MAX_COLORS)];
XSetBackground(dpy, perWindow[i].gc, curColor);
XSetForeground(dpy, perWindow[i].gc, curColor);
x = j * ((perWindow[i].width/2) / (SS_MAX_COLORS));
y = j * ((perWindow[i].height/2) / (SS_MAX_COLORS));
width = perWindow[i].width - (2 * x);
height = perWindow[i].height - (2 * y);
XFillRectangle(dpy, perWindow[i].id, perWindow[i].gc,
x, y, width, height);
}
}
/**XFlush(dpy); **/
XSync(dpy, False);
colorRotate = (int) fmod ((colorRotate + 1), SS_MAX_COLORS);
usleep(200000);
}
}

View File

@@ -0,0 +1,30 @@
###############################################################################
#
# screensaver.dt
#
# Actions for defining screen savers to the Common Desktop Environment.
#
# (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: screensaver.dt /main/3 1995/10/27 10:40:23 rswiston $
#
###############################################################################
set DtDbVersion=1.0
###################################################################
#
# Actions
#
###################################################################
ACTION SampleScreenSaver
{
LABEL SampleScreenSaver
TYPE COMMAND
WINDOW_TYPE NO_STDIO
EXEC_STRING /usr/dt/examples/dtscreen/screensaver
DESCRIPTION Sample Screen Saver
}