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,30 @@
!######################################################################
!#
!# Dtsession
!#
!# Common Desktop Environment (CDE)
!#
!# (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.
!#
!# Application Defaults for the CDE DT Session Manager
!#
!# $XConsortium: Dtsession.src /main/5 1996/04/21 19:51:03 drk $
!#
!######################################################################
XCOMM include "Dt"
!#Dtsession*wmStartupCommand: CDE_INSTALLATION_TOP/bin/dtwm
!#Dtsession*coverScreen: False
Dtsession*drawArea.background: black
#ifdef __osf__
Dtsession*lockLabelPixmap.imageName: DECDtlogo
#else
Dtsession*lockLabelPixmap.imageName: Dtlogo
#endif
Dtsession*ignoreEnvironment: DISPLAY,SESSION_MANAGER,AUDIOSERVER

View File

@@ -0,0 +1,189 @@
XCOMM $TOG: Imakefile /main/22 1998/04/06 13:33:41 mgreess $
DEFINES = -DCDE_INSTALLATION_TOP=\"$(CDE_INSTALLATION_TOP)\" \
-DCDE_CONFIGURATION_TOP=\"$(CDE_CONFIGURATION_TOP)\"
#if defined(SunArchitecture)
DEPLIBS = $(DEPDTWIDGETLIB) $(DEPDTSVCLIB) $(DEPTTLIB) \
$(DEPXMLIB) $(DEPXTOOLLIB) $(DEPXLIB)
LOCAL_LIBRARIES = $(DTWIDGETLIB) $(DTSVCLIB) $(TTLIB) \
$(XMLIB) $(XTOOLLIB) $(USE_XHPLIB) $(XLIB)
#else
DEPLIBS = $(DEPDTHELPLIB) $(DEPDTWIDGETLIB) $(DEPDTSVCLIB) $(DEPTTLIB) \
$(DEPXMLIB) $(DEPXTOOLLIB) $(DEPXLIB)
LOCAL_LIBRARIES = $(DTHELPLIB) $(DTWIDGETLIB) $(DTSVCLIB) $(TTLIB) \
$(XMLIB) $(XTOOLLIB) $(USE_XHPLIB) $(XLIB)
#endif /* SunArchitecture */
SYS_LIBRARIES = -lm
#ifdef AlphaArchitecture
SYS_LIBRARIES = -lm
EXTRA_DEFINES = -DMULTIBYTE -DXLIB_ILLEGAL_ACCESS -DSIA
#endif
#ifdef HPArchitecture
EXTRA_DEFINES = -DMULTIBYTE -DUSE_HPSSEXT
USE_XHPLIB = $(XHPLIB)
#endif
#if defined(RsArchitecture)
EXTRA_DEFINES = -D_ILS_MACROS -DSBSTDINC_H_NO_REDEFINE
SYS_LIBRARIES = -lm -lbsd -ls -liconv
#if (OSMajorVersion == 3)
EXTRA_SRC = SmHftRing.c SmMigResources.c
EXTRA_OBJS = $(ALTDIRECTORY)SmHftRing.o $(ALTDIRECTORY)SmMigResources.o
#else
EXTRA_SRC = SmMigResources.c
EXTRA_OBJS = $(ALTDIRECTORY)SmMigResources.o
#endif
#endif
#if defined(SCOArchitecture) || defined(LinuxArchitecture)
SYS_LIBRARIES = -lcrypt -lm
#endif
#if defined(SunArchitecture)
EXTRA_SRC = OWsync.c
EXTRA_OBJS = $(ALTDIRECTORY)OWsync.o
EXTRA_DEFINES = -D${PROGRAMS}
SYS_LIBRARIES = -lelf -lm -ldl
#endif
#if defined(USLArchitecture)
/* not needed for archive. usl shared libs must resolve every
* reference whether used or not.
*/
SYS_LIBRARIES = -lelf -lm -ldl -lgen -liaf
PROTO_DEFINES =
DEFINES = -DCDE_INSTALLATION_TOP=\"$(CDE_INSTALLATION_TOP)\" \
-DCDE_CONFIGURATION_TOP=\"$(CDE_CONFIGURATION_TOP)\"
#endif
#if defined(UXPArchitecture)
/* not needed for archive. usl shared libs must resolve every
* reference whether used or not.
*/
SYS_LIBRARIES = -lelf -lm -ldl -lgen
#endif
PROGRAMS=dtsession
/**** Every .o except version.o may only be built in a remote
**** directory as we do with rgy -> $(ALTDIRECTORY)
****/
OBJS= $(ALTDIRECTORY)SmMain.o \
$(ALTDIRECTORY)SmGlobals.o \
$(ALTDIRECTORY)SmHelp.o \
$(ALTDIRECTORY)SmCommun.o \
$(ALTDIRECTORY)SmError.o \
$(ALTDIRECTORY)SmProperty.o \
$(ALTDIRECTORY)SmProtocol.o \
$(ALTDIRECTORY)SmSave.o \
$(ALTDIRECTORY)SmScreen.o \
$(ALTDIRECTORY)SmRestore.o \
$(ALTDIRECTORY)SmUI.o \
$(ALTDIRECTORY)SmWindow.o \
$(ALTDIRECTORY)SmLock.o \
$(ALTDIRECTORY)SrvPalette.o\
$(ALTDIRECTORY)SrvFile_io.o\
$(ALTDIRECTORY)SmStrDefs.o \
$(ALTDIRECTORY)SmConMgmt.o \
$(EXTRA_OBJS) \
$(ALTDIRECTORY)SmXSMP.o \
$(ALTDIRECTORY)SmAuth.o \
$(ALTDIRECTORY)SmWatch.o \
$(ALTDIRECTORY)SmProp.o \
$(ALTDIRECTORY)SmDB.o \
version.o
SRCS= SmMain.c \
SmHelp.c \
SmGlobals.c \
SmCommun.c \
SmError.c \
SmProperty.c \
SmProtocol.c \
SmSave.c \
SmScreen.c \
SmRestore.c \
SmUI.c \
SmWindow.c \
SmLock.c \
SrvPalette.c\
SrvFile_io.c\
SmStrDefs.c \
SmConMgmt.c \
$(EXTRA_SRC) \
SmXSMP.c \
SmAuth.c \
SmWatch.c \
SmProp.c \
SmDB.c \
version.c
/**************************************************************************
*
* Extra things for the Passwd Etc. version
*
**************************************************************************/
#ifdef USE_RGY
EXTRA_DEFINES = -DMULTIBYTE -DUSE_HPSSEXT -D__PASSWD_ETC +e
EXTRA_LIBRARIES = $(RGYLIB) $(NCKLIB) -lndbm -lBSD ExtraLibraries
#endif
/******* RGY or KRB CASE *******************************/
#if (defined(USE_KRB) || defined(USE_RGY)) && defined(HPArchitecture)
/*******************************************************/
ALTDIRECTORY = $(CDESRC)/dtsession/
SRCS= version.c
includes::
@echo " linking $(ALTDIRECTORY)version.c to version.c";\
ln -f -s $(ALTDIRECTORY)version.c .
version.o: version.c
ObjectCompile($(_NOOP_))
/* don't build other .o's */
.c.o:
ComplexProgramTarget($(PROGRAMS))
/******* NORMAL NON-RGY CASE *******************************/
#else
/***************************************************/
ComplexProgramTarget($(PROGRAMS))
DTSM_CMD1 = $(CDE_INSTALLATION_TOP)/bin/dtaction OpenHomeDir
DTSM_CMD2 = $(CDE_INSTALLATION_TOP)/bin/dtfile -dir ~ -geometry +700+0
DTSM_CMD4 = $(CDE_INSTALLATION_TOP)/bin/dthelpview -helpVolume Intromgr
DTSM_CMD5 = $(CDE_INSTALLATION_TOP)/bin/dtaction Dthelpgen_delay
LOCAL_CPP_DEFINES = -DCDE_CONFIGURATION_TOP=$(CDE_CONFIGURATION_TOP) \
-DCDE_INSTALLATION_TOP=$(CDE_INSTALLATION_TOP) \
-DXBINDIR=$(XPROJECTROOT)/bin \
-DDTSM_CMD1="\"$(DTSM_CMD1)\"" \
-DDTSM_CMD2="\"$(DTSM_CMD2)\"" \
-DDTSM_CMD4="\"$(DTSM_CMD4)\"" \
-DDTSM_CMD5="\"$(DTSM_CMD5)\""
CPP_TARGETS = Dtsession dtloadresources dtsession.msg \
sys.font sys.resources sys.resources.ive sys.session sys.session.ive
AllTarget($(CPP_TARGETS))
CppSourceFile(Dtsession,Dtsession.src,$(LOCAL_CPP_DEFINES),)
CppScriptTarget(dtloadresources,dtloadresources.src,$(LOCAL_CPP_DEFINES),)
CppSourceFile(dtsession.msg,dtsession.msg.src,$(LOCAL_CPP_DEFINES),)
CppSourceFile(sys.font,sys.font.src,$(LOCAL_CPP_DEFINES),)
CppSourceFile(sys.resources,sys.resources.src,$(LOCAL_CPP_DEFINES),)
CppSourceFile(sys.resources.ive,sys.resources.src,-DIVE $(LOCAL_CPP_DEFINES),)
CppSourceFile(sys.session,sys.session.src,$(LOCAL_CPP_DEFINES),)
CppSourceFile(sys.session.ive,sys.session.src,-DIVE $(LOCAL_CPP_DEFINES),)
#endif /* KRB || RGY */
/* These headers are for using installed build. dthello uses these files */
HEADERS = Srv.h SrvFile_io.h SrvPalette.h

View File

@@ -0,0 +1,128 @@
/* $TOG: OWsync.c /main/4 1998/07/23 18:11:12 mgreess $ */
/*******************************************************************************
**
** OWsync.c
**
** Implements functions to synchronize CDE and OpenWindows resources.
**
** Copyright 1995 Sun Microsystems, Inc. All rights reserved.
**
*******************************************************************************/
#include <stdio.h>
#include <X11/Xlib.h>
#include <Dt/DtP.h>
/*
* Include the appropriate header for the ColorSet structure
*/
#if defined(dtsession)
#include "Srv.h"
#elif defined(dtstyle)
#include "ColorMain.h"
#endif
/*
* Sync OW Color resources with CDE color object values
*/
void
OWsyncColorResources(
Display * display,
int monitorType,
ColorSet * colors)
{
char colorRes[512];
int winChip, dataChip, wsChip;
switch (monitorType) {
case XmCO_HIGH_COLOR:
winChip = 4; dataChip = 3; wsChip = 7;
break;
case XmCO_MEDIUM_COLOR:
winChip = 1; dataChip = 3; wsChip = 1;
break;
case XmCO_LOW_COLOR:
case XmCO_BLACK_WHITE:
winChip = 1; dataChip = 1; wsChip = 1;
break;
default:
return;
}
sprintf(colorRes,
"*background:\t#%04X%04X%04X\n\
*foreground:\t#%04X%04X%04X\n\
OpenWindows.WindowColor:\t#%04X%04X%04X\n\
OpenWindows.WindowForeground:\t#%04X%04X%04X\n\
OpenWindows.WorkspaceColor:\t#%04X%04X%04X\n\
OpenWindows.DataBackground:\t#%04X%04X%04X\n\
OpenWindows.DataForeground:\t#%04X%04X%04X\n\
Window.Color.Background:\t#%04X%04X%04X\n\
Window.Color.Foreground:\t#%04X%04X%04X\n",
colors[winChip].bg.red,
colors[winChip].bg.green,
colors[winChip].bg.blue,
colors[winChip].fg.red,
colors[winChip].fg.green,
colors[winChip].fg.blue,
colors[winChip].bg.red,
colors[winChip].bg.green,
colors[winChip].bg.blue,
colors[winChip].fg.red,
colors[winChip].fg.green,
colors[winChip].fg.blue,
colors[wsChip].bg.red,
colors[wsChip].bg.green,
colors[wsChip].bg.blue,
colors[dataChip].bg.red,
colors[dataChip].bg.green,
colors[dataChip].bg.blue,
colors[dataChip].fg.red,
colors[dataChip].fg.green,
colors[dataChip].fg.blue,
colors[dataChip].bg.red,
colors[dataChip].bg.green,
colors[dataChip].bg.blue,
colors[dataChip].fg.red,
colors[dataChip].fg.green,
colors[dataChip].fg.blue);
#ifdef DEBUG
fprintf(stderr,"OWsyncColorResource: setting\n%s\n",colorRes);
#endif
_DtAddToResource(display, colorRes);
}
/*
* Sync OW locale resources with CDE's use of the LANG environment variable
*/
void
OWsyncLocaleResources(
Display * display)
{
char *localeRes;
char *lang;
lang = getenv("LANG");
if (lang == NULL || *lang == 0)
lang = "C";
localeRes = XtMalloc(BUFSIZ);
sprintf(localeRes,
"OpenWindows.BasicLocale:\t%s\n\
OpenWindows.InputLang:\t%s\n\
OpenWindows.DisplayLang:\t%s\n\
OpenWindows.TimeFormat:\t%s\n\
OpenWindows.NumericFormat:\t%s\n",
lang, lang, lang, lang, lang);
#ifdef DEBUG
fprintf(stderr,"OWsyncLocaleResource: setting\n%s\n",localeRes);
#endif
_DtAddToResource(display, localeRes);
XtFree(localeRes);
}

View File

@@ -0,0 +1,23 @@
/* $XConsortium: OWsync.h /main/2 1996/05/08 20:11:18 drk $ */
/*******************************************************************************
**
** OWsync.h
**
** Defines functions to synchronize CDE and OpenWindows resources.
**
** Copyright 1995 Sun Microsystems, Inc. All rights reserved.
**
*******************************************************************************/
/*
* External function declarations
*/
extern void OWsyncColorResources(
Display * display,
int monitorType,
ColorSet * colors);
extern void OWsyncLocaleResources(
Display * display);

390
cde/programs/dtsession/Sm.h Normal file
View File

@@ -0,0 +1,390 @@
/* $XConsortium: Sm.h /main/15 1996/09/14 14:48:18 drk $ */
/*************************************<+>*************************************
*****************************************************************************
**
** File: Sm.h
**
** Project: HP DT Session Manager (dtsession)
**
** Description:
** -----------
** Contains all general, global variables used by the session manager
**
**
**
*****************************************************************************
*************************************<+>*************************************/
/*
* (c) Copyright 1996 Digital Equipment Corporation.
* (c) Copyright 1990, 1993, 1994, 1996 Hewlett-Packard Company
* (c) Copyright 1993, 1994, 1996 International Business Machines Corp.
* (c) Copyright 1993, 1994, 1996 Sun Microsystems, Inc.
* (c) Copyright 1993, 1994, 1996 Novell, Inc.
* (c) Copyright 1996 FUJITSU LIMITED.
* (c) Copyright 1996 Hitachi.
*/
#ifndef _sm_h
#define _sm_h
/*
* #include statements
*/
#include <signal.h>
#include <sys/param.h>
#include <X11/Xlib.h>
#include <Dt/DtP.h>
#include <Dt/UserMsg.h>
#include <Tt/tt_c.h>
#include "SmError.h"
/*
* #define statements
*/
#define HELPVIEW_COMMAND_LINE CDE_INSTALLATION_TOP "/bin/dthelpview -helpVolume Dtintro"
/*
* Wrappers for system calls
*/
#define SM_MALLOC(SIZE) XtMalloc(SIZE)
#define SM_REALLOC(PTR, SIZE) XtRealloc(PTR, SIZE)
#define SM_FREE(PTR) XtFree(PTR)
#define SM_EXIT(STATUS) SmExit(STATUS)
#ifdef __hpux
#define SM_SETEUID(EUID) setresuid(-1, EUID, -1)
#define SM_SETESUID(UID) setresuid(-1, UID, UID)
#else
#ifndef SVR4
#define SM_SETEUID(EUID) seteuid(EUID)
#define SM_SETESUID(UID) setreuid(UID, UID)
#else
#define SM_SETEUID(EUID) seteuid(EUID)
#define SM_SETESUID(UID) (setuid(UID), seteuid(UID))
#endif
#endif
/*
* Types of states the session manager can be in
*/
#define READY 0
#define IN_PROCESS 1
/*
* session types .. home or current or default
*/
#define DEFAULT_SESSION 0
#define HOME_SESSION 1
#define CURRENT_SESSION 2
/*
* The lower bounds for each resolution of display - caculated
* as Y Resolution - which is pixels/meter
*/
#define HIGH_RES_Y_RES 3583
#define MED_RES_Y_RES 3150
#define LOW_RES_Y_RES 1
/*
* Maximum number of screens saved during a session
*/
#define MAX_SCREENS_SAVED 10
/* contention management definitions */
#define SM_CM_SYSTEM (1L << 0)
#define SM_CM_HANDSHAKE (1L << 1)
#define SM_CM_ALL (SM_CM_SYSTEM | SM_CM_HANDSHAKE)
#define SM_CM_NONE 0
#define SM_CM_DEFAULT SM_CM_NONE
#ifndef NO_MESSAGE_CATALOG
# ifdef __ultrix
# define _CLIENT_CAT_NAME "dtsession.cat"
# else /* __ultrix */
# define _CLIENT_CAT_NAME "dtsession"
# endif /* __ultrix */
extern char *_DtGetMessage(char *filename, int set, int n, char *s);
# define GETMESSAGE(set, number, string)\
(_DtGetMessage(_CLIENT_CAT_NAME, set, number, string))
#else
# define GETMESSAGE(set, number, string)\
string
#endif
typedef int (*IOErrorHandlerProc)(
Display *
);
/*
* typedef statements
*/
/*
* Pointer to hold information returned by session settings
*/
typedef struct
{
int accelNum; /* Pointer Control Information */
int accelDenom;
int threshold;
int timeout; /*Screen Saver Information */
int interval;
int preferBlank;
int allowExp;
char *fontDirs; /*Font path Information */
XKeyboardState kbdState; /* Keyboard Control Information */
char *autoRepeats;
char *buttonMap; /*Button Mapping Information */
int numKeyCode; /*Key Mapping information */
int keySymPerCode;
char *keySyms;
int maxKeyPerMod; /*Modifier Mapping Information */
char *modSyms;
Boolean didQuery; /*Was this information queried for*/
int confirmMode;
int startState;
} SessionSettings, *SessionSettingsPtr;
/*
* Structure to save all of the session manager resources
*/
typedef struct
{
char *wmStartup;
Boolean querySettings;
char *keyholders;
int alarmTime;
int memThreshold;
char *sessionVersion;
int displayResolution;
char *sessionLang;
long contManagement;
int waitClientTimeout;
int waitWmTimeout;
Boolean useBMS;
Boolean saveFontPath;
int saveYourselfTimeout;
Boolean mergeXdefaults;
int numSessionsBackedup;
char *ignoreEnvironment;
} SessionResources, *SessionResourcesPtr;
/*
* Screen saver resources.
*/
typedef struct
{
int cycleTimeout;
int saverTimeout;
int lockTimeout;
Boolean random;
char *saverList;
} SaverResources, *SaverResourcesPtr;
/*
* Structure to hold global state settings
*/
typedef struct
{
Boolean audioChange;
Boolean pointerChange;
Boolean pointerMapChange;
char pointerMap[5];
int numButton;
Boolean keyboardChange;
Boolean screenSavChange;
char dClickBuf[50];
} SettingsSet;
typedef struct
{
Boolean audioChange;
Boolean pointerChange;
Boolean keyboardChange;
Boolean screenSavChange;
Boolean dClickChange;
Boolean fontChange;
Boolean preeditChange;
} SettingsCust;
/*
* Structure to hold general information needed to be shared by
* different modules in the session manager
*/
typedef struct
{
Display *display;
Widget topLevelWid;
Window topLevelWindow;
XtAppContext appCon;
char *programName; /* main()'s argv[0] */
int numSavedScreens;
int screen;
int lockedState;
int smState;
short sessionType;
unsigned long blackPixel;
unsigned long whitePixel;
unsigned long foregroundPix;
unsigned long backgroundPix;
Cursor lockCursor, padlockCursor, blankCursor;
Cursor waitCursor;
char resourcePath[MAXPATHLEN + 1];
char settingPath[MAXPATHLEN + 1];
char clientPath[MAXPATHLEN + 1];
char fontPath[MAXPATHLEN + 1];
char exitPath[MAXPATHLEN + 1];
char etcPath[MAXPATHLEN + 1]; /*
* Used for sessionEtc on
* the way up and for
* moving current to
* current.old on the way
* down
*/
char *savePath;
char *restoreSession;
Boolean dtwmRunning;
Boolean bmsDead;
Tt_pattern requests2Handle;
Tt_pattern events2Watch;
Boolean compatMode;
Boolean lockOnTimeoutStatus;
gid_t runningGID, conMgmtGID;
uid_t runningUID, unLockUID;
Boolean secureSystem;
Boolean screenSaver; /* obsolete */
Boolean screenSaverRunning; /* obsolete */
Boolean userSetWaitWmTimeout;
int savedWaitWmTimeout;
/*
* These strings are for our copy once we
* fetch resources with XtGetApplicationResources.
* These string returned can be overwritten anytime
* another Xrm call is made as in MergeCoeResources (libXv3.0)
* or in our own calls to XrmGetFileDatabase.
*/
/*
* This set is the for smRes
*/
char *wmStartup;
char *keyholders;
char *sessionVersion;
char *sessionLang;
/*
* This set is the for smSettings
*/
char *fontDirs; /*Font path Information */
char *autoRepeats;
char *buttonMap; /*Button Mapping Information */
char *keySyms;
char *modSyms;
char *saverList; /* Current screen saver list */
void *saverListParse; /* Current parsed screen saver list */
Boolean coverScreen; /* full screen cover */
char *SmNextension; /* screen saver extension name */
char *SmCextension; /* screen saver extension class */
char *extensionSpec; /* sprintf specification */
#if defined (USE_X11SSEXT)
int ssEventType; /* screen saver event type */
#endif /* USE_X11SSEXT */
struct sigaction childvec;
struct sigaction defvec;
Boolean homeSave; /* True if the save is via the Style
Manager's Save Home Session button. */
Boolean displaySpecific; /* Is Ture if the session is for a
specific display, otherwise False */
Boolean loggingOut; /* Is True if the current save is for
a logout; False otherwise. */
} GeneralData;
/*
* External variables
*/
extern char *_dtsessionMG();
/*
* Files that the session manager saves sessions to and restores sessions
* from. allocated in SmStrDef.c
*/
extern char SM_CLIENT_FILE[];
extern char SM_CLIENT_FILE2[];
extern char SM_RESOURCE_FILE[];
extern char SM_FONT_FILE[];
extern char SM_LOW_RES_EXT[];
extern char SM_MED_RES_EXT[];
extern char SM_HIGH_RES_EXT[];
extern char SM_SETTING_FILE[];
extern char SM_CONVERSION_FILE[];
extern char SM_SYSTEM_CLIENT_FILE[];
extern char SM_SYSTEM_RESOURCE_FILE[];
extern char SM_SYSTEM_FONT_FILE[];
extern char SM_SYSTEM_PATH[];
extern char SM_SECURE_PATH[];
extern char SM_CURRENT_DIRECTORY[];
extern char SM_CURRENT_FONT_DIRECTORY[];
extern char SM_HOME_DIRECTORY[];
extern char SM_HOME_FONT_DIRECTORY[];
extern char SM_OLD_EXTENSION[];
extern char SM_SYSTEM_DIRECTORY[];
extern char smEtcFile[];
extern char smExitFile[];
/*
* Session manager name and class used to get resources allocated in SmStrDef.c
*/
extern char SM_RESOURCE_CLASS[];
extern char SM_RESOURCE_NAME[];
extern char SM_HELP_VOLUME[];
/*
* Name of the lock the session manager has to make sure it's the only
* session manager running
*/
extern char SM_RUNNING_LOCK[];
/*
* Location and name of the screen saver program
*/
extern char SM_SCREEN_SAVER_LOC[];
extern char SM_SCREEN_SAVER_NAME[];
/*
* Global resource settings. These settings determine program behavior
* wrt settings restoration, lock behavior, window manager startup etc
*/
extern SessionResources smRes;
extern SaverResources smSaverRes;
extern SettingsSet smToSet;
extern SettingsCust smCust;
extern SessionSettings smSettings;
extern GeneralData smGD;
/*
* External Interface
*/
#endif /* __sm_h*/

View File

@@ -0,0 +1,370 @@
/*
* (c) Copyright 1995 Digital Equipment Corporation.
* (c) Copyright 1995 Hewlett-Packard Company.
* (c) Copyright 1995 International Business Machines Corp.
* (c) Copyright 1995 Sun Microsystems, Inc.
* (c) Copyright 1995 Novell, Inc.
* (c) Copyright 1995 FUJITSU LIMITED.
* (c) Copyright 1995 Hitachi.
*
* $TOG: SmAuth.c /main/4 1997/03/14 14:11:50 barstow $
*/
/******************************************************************************
Copyright (c) 1993 X Consortium
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of the X Consortium shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from the X Consortium.
******************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/param.h>
#include <X11/Intrinsic.h>
#include <X11/SM/SMlib.h>
#include <X11/ICE/ICEutil.h>
#include "SmAuth.h"
typedef struct _IceAuthFileEntryList
{
IceAuthFileEntry *fileEntry;
struct _IceAuthFileEntryList *next;
} IceAuthFileEntryList;
/*
* Private data
*/
#define MAGIC_COOKIE_LEN 16
#define AUTH_RETRIES 10
#define AUTH_TIMEOUT 2
#define AUTH_DEADTIME 600L
/*
* Private functions - forward declarations
*/
static int
writeIceauth (
int nEntries,
IceAuthDataEntry *entries,
int restore);
static int
addToEntryList (
IceAuthFileEntryList **entryListP,
IceAuthFileEntry *fileEntry);
static int
fileEntryInDataEntries (
int nEntries,
IceAuthDataEntry *entries,
IceAuthFileEntry *fileEntry);
static void
freeEntryList (
IceAuthFileEntryList *entryList);
/*
* Private functions - implemenation.
*/
static void
freeEntryList (
IceAuthFileEntryList *entryList)
{
IceAuthFileEntryList *nextEntryP;
while (entryList != (IceAuthFileEntryList *)NULL)
{
nextEntryP = entryList->next;
IceFreeAuthFileEntry(entryList->fileEntry);
XtFree((char *)entryList);
entryList = nextEntryP;
}
}
static int
fileEntryInDataEntries (
int nEntries,
IceAuthDataEntry *entries,
IceAuthFileEntry *fileEntry)
{
int i;
#define SAME_STR(field) \
((entries->field != (char *)NULL) &&\
(fileEntry->field != (char *)NULL) &&\
(strcmp(entries->field, fileEntry->field) == 0))
for (i = 0; i < nEntries; i++, entries++)
{
if (SAME_STR(protocol_name) &&
SAME_STR(network_id) &&
SAME_STR(auth_name))
return 1;
}
#undef SAME_STR
return 0;
}
static int
addToEntryList (
IceAuthFileEntryList **entryListP,
IceAuthFileEntry *fileEntry)
{
IceAuthFileEntryList *newItem;
if ((newItem =
(IceAuthFileEntryList *)XtMalloc(sizeof(IceAuthFileEntryList)))
== (IceAuthFileEntryList *)NULL)
return 0;
/* I assume it's ok to reverse the order; otherwise */
/* we need to add the new item onto the end of the list. */
newItem->fileEntry = fileEntry;
newItem->next = *entryListP;
*entryListP = newItem;
return 1;
}
static int
writeIceauth (
int nEntries,
IceAuthDataEntry *entries,
int restore)
{
FILE *fp = NULL;
char *path;
char *extraPath;
int oldUmask;
int i;
IceAuthDataEntry *dataEntry;
IceAuthFileEntry *fileEntry;
IceAuthFileEntry newEntry;
IceAuthFileEntryList *fileEntryList = (IceAuthFileEntryList *)NULL;
IceAuthFileEntryList *fileEntryP;
if ((path = IceAuthFileName()) == (char *)NULL)
return 0;
if (IceLockAuthFile(path, AUTH_RETRIES, AUTH_TIMEOUT, AUTH_DEADTIME)
!= IceAuthLockSuccess) {
/*
* Let's try another PATH, in case IceLockAuthFile's call to
* link() fails. This workaround code was taken from
* dtlogin/auth.c.
*/
IceUnlockAuthFile(path);
extraPath = XtMalloc (MAXPATHLEN);
(void) strcpy (extraPath, CDE_CONFIGURATION_TOP ".ICEauthority");
if (IceLockAuthFile(extraPath, AUTH_RETRIES, AUTH_TIMEOUT, AUTH_DEADTIME)
!= IceAuthLockSuccess) {
IceUnlockAuthFile (extraPath);
return 0;
}
path = extraPath;
}
/* If file exists, read entries into memory. */
if (access(path, F_OK) == 0)
{
if ((fp = fopen(path, "rb")) == (FILE *)NULL)
{
IceUnlockAuthFile(path);
return 0;
}
/* For each file entry: if matches something in entries, discard. */
/* Otherwise, hold onto it - we'll be writing it back to file. */
while ((fileEntry = IceReadAuthFileEntry(fp))
!= (IceAuthFileEntry *)NULL)
{
if (!fileEntryInDataEntries(nEntries, entries, fileEntry) &&
!addToEntryList(&fileEntryList, fileEntry))
{
freeEntryList(fileEntryList);
IceUnlockAuthFile(path);
fclose(fp);
return 0;
}
}
fclose(fp);
}
/* Set umask to disallow non-owner access. */
oldUmask = umask(0077);
/* Write entries and fileEntryList to file. */
if ((fp = fopen(path, "wb")) == (FILE *)NULL)
{
freeEntryList(fileEntryList);
IceUnlockAuthFile(path);
umask(oldUmask);
return 0;
}
for (fileEntryP = fileEntryList;
fileEntryP != (IceAuthFileEntryList *)NULL;
fileEntryP = fileEntryP->next)
{
if (IceWriteAuthFileEntry(fp, fileEntryP->fileEntry) == 0)
{
fclose(fp);
umask(oldUmask);
freeEntryList(fileEntryList);
IceUnlockAuthFile(path);
return 0;
}
}
/* Done with fileEntryList - free it up. */
freeEntryList(fileEntryList);
if (!restore)
{
for (i = 0; i < nEntries; i++)
{
dataEntry = &(entries[i]);
newEntry.protocol_name = dataEntry->protocol_name;
newEntry.protocol_data_length = 0;
newEntry.protocol_data = "";
newEntry.network_id = dataEntry->network_id;
newEntry.auth_name = dataEntry->auth_name;
newEntry.auth_data_length = dataEntry->auth_data_length;
newEntry.auth_data = dataEntry->auth_data;
if (IceWriteAuthFileEntry(fp, &newEntry) == 0)
{
fclose(fp);
umask(oldUmask);
IceUnlockAuthFile(path);
return 0;
}
}
}
/* Success! */
fclose(fp);
umask(oldUmask);
IceUnlockAuthFile(path);
return 1;
}
/*
* Host Based Authentication Callback. This callback is invoked if
* the connecting client can't offer any authentication methods that
* we can accept. We can accept/reject based on the hostname.
*/
Bool
HostBasedAuthProc (
char *hostname)
{
/*
* For now, we don't support host based authentication
*/
return (0);
}
/*
* Provide authentication data to clients that wish to connect
*/
Status
SetAuthentication (
int count,
IceListenObj *listenObjs,
IceAuthDataEntry **authDataEntries)
{
int i;
int nEntries = count * 2;
if ((*authDataEntries = (IceAuthDataEntry *) XtMalloc (
nEntries * sizeof (IceAuthDataEntry))) == NULL)
return 0;
for (i = 0; i < nEntries; i += 2)
{
(*authDataEntries)[i].network_id =
IceGetListenConnectionString (listenObjs[i/2]);
(*authDataEntries)[i].protocol_name = "ICE";
(*authDataEntries)[i].auth_name = "MIT-MAGIC-COOKIE-1";
(*authDataEntries)[i].auth_data =
IceGenerateMagicCookie (MAGIC_COOKIE_LEN);
(*authDataEntries)[i].auth_data_length = MAGIC_COOKIE_LEN;
(*authDataEntries)[i+1].network_id =
IceGetListenConnectionString (listenObjs[i/2]);
(*authDataEntries)[i+1].protocol_name = "XSMP";
(*authDataEntries)[i+1].auth_name = "MIT-MAGIC-COOKIE-1";
(*authDataEntries)[i+1].auth_data =
IceGenerateMagicCookie (MAGIC_COOKIE_LEN);
(*authDataEntries)[i+1].auth_data_length = MAGIC_COOKIE_LEN;
IceSetHostBasedAuthProc (listenObjs[i/2], HostBasedAuthProc);
}
/* Merge new entries into auth file. */
if (!writeIceauth(nEntries, *authDataEntries, 0))
return 0;
IceSetPaAuthData(nEntries, *authDataEntries);
return 1;
}
/*
* Free up authentication data.
*/
void
FreeAuthenticationData (
int count,
IceAuthDataEntry *authDataEntries)
{
int i;
int nEntries = count * 2;
/* Restore auth file to (approx) state before we ran. We remove all */
/* new entries... some of these entries may have existed in the auth */
/* file before but were replaced when we came up. */
writeIceauth(nEntries, authDataEntries, 1);
/* Each transport has entries for ICE and XSMP */
for (i = 0; i < nEntries; i++)
{
free (authDataEntries[i].network_id);
free (authDataEntries[i].auth_data);
}
XtFree ((char *) authDataEntries);
}

View File

@@ -0,0 +1,55 @@
/*
* (c) Copyright 1995 Digital Equipment Corporation.
* (c) Copyright 1995 Hewlett-Packard Company.
* (c) Copyright 1995 International Business Machines Corp.
* (c) Copyright 1995 Sun Microsystems, Inc.
* (c) Copyright 1995 Novell, Inc.
* (c) Copyright 1995 FUJITSU LIMITED.
* (c) Copyright 1995 Hitachi.
*
* $XConsortium: SmAuth.h /main/1 1995/12/29 20:17:43 barstow $
*/
/******************************************************************************
Copyright (c) 1993 X Consortium
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of the X Consortium shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from the X Consortium.
******************************************************************************/
#ifndef _smauth_h
#define _smauth_h
#include <X11/ICE/ICEutil.h>
Bool HostBasedAuthProc (
char *hostname);
Status SetAuthentication (
int count,
IceListenObj *listenObjs,
IceAuthDataEntry **authDataEntries);
void FreeAuthenticationData (
int count,
IceAuthDataEntry *authDataEntries);
#endif /* _smauth_h */

View File

@@ -0,0 +1,941 @@
/* $TOG: SmCommun.c /main/14 1999/09/20 13:47:25 mgreess $ */
/*
* (c) Copyright 1997, The Open Group
*/
/*************************************<+>*************************************
*****************************************************************************
**
** File: SmCommun.c
**
** Project: HP DT Session Manager (dtsession)
**
** Description:
** -----------
** This file contains functionality needed to communicate with the
** other DT components. This includes initialization and callback code.
**
*****************************************************************************
*************************************<+>*************************************/
/*
* (c) Copyright 1996 Digital Equipment Corporation.
* (c) Copyright 1990, 1993, 1994, 1996 Hewlett-Packard Company
* (c) Copyright 1993, 1994, 1996 International Business Machines Corp.
* (c) Copyright 1993, 1994, 1996 Sun Microsystems, Inc.
* (c) Copyright 1993, 1994, 1996 Novell, Inc.
* (c) Copyright 1996 FUJITSU LIMITED.
* (c) Copyright 1996 Hitachi.
*/
#include <stdio.h>
#ifdef _SUN_OS /* for the strtok calls */
#include <string.h>
#endif
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
#if defined (USE_X11SSEXT)
#include <X11/extensions/scrnsaver.h>
#endif /* USE_X11SSEXT */
#include <Xm/Xm.h>
#include <Dt/DtP.h>
#include <Dt/Action.h>
#include <Dt/SessionM.h>
#include <Dt/UserMsg.h>
#include <Dt/Indicator.h>
#include <Dt/MsgLog.h>
#include <Tt/tttk.h>
#include "Sm.h"
#include "SmError.h"
#include "SmLock.h"
#include "SmCommun.h"
#include "SmRestore.h"
#include "SmSave.h"
#include "SmUI.h"
#include "SmProtocol.h"
#include "SmGlobals.h"
#include "SmXSMP.h"
/*
* Pulic var declarations
*/
extern int clientRunning; /* from SmConMgmt.c */
extern char **smExecArray;
/*
* Defines for this file only
*/
#define SS_ON 0
#define SS_OFF 1
#define SS_DRAW 2
/*
* Constants for the Save_Session ToolTalk message
*/
static const char *SAVE_TYPE = "save_type";
static const char *SHUTDOWN = "shutdown";
static const char *INTERACT_STYLE = "interact_style";
static const char *FAST = "fast";
static const char *GLOBAL = "global";
static const char *NUM_BACKUPS = "num_sessions_backedup";
static const char *SAVE_LOCAL = "Local";
static const char *SAVE_GLOBAL = "Global";
static const char *SAVE_BOTH = "Both";
static const char *INTERACT_NONE = "None";
static const char *INTERACT_ERRORS = "Errors";
static const char *TRUE_STR = "True";
static const char *FALSE_STR = "False";
/*
* Local function definitions
*/
static void DtwmStarted(void);
static void
ProcessSaveSessionMessage (
Tt_message saveMsg )
{
int i;
int saveType = -1;
Boolean shutdown = DEFAULT_SHUTDOWN;
int interactStyle = DEFAULT_INTERACT_STYLE;
Boolean fast = DEFAULT_FAST;
Boolean global = DEFAULT_GLOBAL;
int numSessionsBackedup;
char * type;
char * value;
int num_args = tt_message_args_count (saveMsg);
Tt_message tmpMsg;
Tt_status status;
for (i = 0; i < num_args; i++) {
type = tt_message_arg_type (saveMsg, i);
status = tt_ptr_error (type);
if (status != TT_OK || type == NULL)
continue;
value = tt_message_arg_val (saveMsg, i);
status = tt_ptr_error (value);
if (status != TT_OK || value == NULL)
continue;
if (!strcmp (type, SAVE_TYPE)) {
if (!strcmp (value, SAVE_LOCAL))
saveType = SmSaveLocal;
else if (!strcmp (value, SAVE_GLOBAL))
saveType = SmSaveGlobal;
else if (!strcmp (value, SAVE_BOTH))
saveType = SmSaveBoth;
else {
tt_free (type);
tt_free (value);
break;
}
}
else if (!strcmp (type, SHUTDOWN)) {
if (!strcmp (value, TRUE_STR))
shutdown = True;
else if (!strcmp (value, FALSE_STR))
shutdown = False;
}
else if (!strcmp (type, INTERACT_STYLE)){
if (!strcmp (value, INTERACT_NONE))
interactStyle = SmInteractStyleNone;
else if (!strcmp (value, INTERACT_ERRORS))
interactStyle = SmInteractStyleErrors;
}
else if (!strcmp (type, FAST)) {
if (!strcmp (value, TRUE_STR))
fast = True;
else if (!strcmp (value, FALSE_STR))
fast = False;
}
else if (!strcmp (type, GLOBAL)) {
if (!strcmp (value, TRUE_STR))
global = True;
else if (!strcmp (value, FALSE_STR))
global = False;
}
else if (!strcmp (type, NUM_BACKUPS)) {
numSessionsBackedup = atoi (value);
if (numSessionsBackedup > 0)
smRes.numSessionsBackedup = numSessionsBackedup;
}
else {
char *pch1;
char *pch2;
pch1 = strdup ((char *) GETMESSAGE (40, 16,
"The Save_Session message contains the unrecognized argument '%s'."));
if (pch1) {
pch2 = XtMalloc (strlen (pch1)+strlen (type)+3);
if (pch2) {
(void) sprintf (pch2, pch1, type);
DtMsgLogMessage (smGD.programName,
DtMsgLogWarning, pch2);
free (pch1); free (pch2);
}
else {
free (pch1);
}
}
}
tt_free (type);
tt_free (value);
}
if (saveType == -1) {
PostSaveSessionErrorDialog ();
return;
}
smGD.smState = IN_PROCESS;
tmpMsg = tttk_message_create (0, TT_NOTICE, TT_SESSION, 0,
"DtActivity_Beginning", 0);
tt_message_send (tmpMsg);
tt_message_destroy (tmpMsg);
SaveState ((smGD.sessionType == HOME_SESSION),
smSettings.startState, saveType, shutdown,
interactStyle, fast, global);
tmpMsg = tttk_message_create (0, TT_NOTICE, TT_SESSION, 0,
"DtActivity_Began", 0);
tt_message_send (tmpMsg);
tt_message_destroy (tmpMsg);
SetSystemReady ();
}
/*************************************<->*************************************
*
* handleSessionMgrRequest ()
*
*
* Description:
* -----------
* Handle ToolTalk requests for which the session manager is responsible.
*
*
* Inputs:
* ------
* Incoming request, and the pattern it matched.
*
*
* Outputs:
* -------
* Whether the message has been consumed.
*
*
* Comments:
* --------
*
*************************************<->***********************************/
Tt_callback_action
handleSessionMgrRequest(
Tt_message msg,
Tt_pattern pat
)
{
char *op;
Tt_status status;
Tt_callback_action rc;
Boolean destroyMsg;
if (tt_message_state( msg ) != TT_SENT)
{
/* msg is a reply to ourself */
return TT_CALLBACK_CONTINUE;
}
op = tt_message_op( msg );
status = tt_ptr_error( op );
if ((status != TT_OK) || (op == 0))
{
/* Let tttk_Xt_input_handler() Do The Right Thing */
return TT_CALLBACK_CONTINUE;
}
destroyMsg = True;
if (strcmp( op, SM_DISPLAY_LOCK ) == 0)
{
if(smGD.smState == READY)
{
smGD.smState = IN_PROCESS;
LockDisplay(True);
}
rc = TT_CALLBACK_PROCESSED;
}
else if (strcmp( op, SM_XSESSION_EXIT ) == 0)
{
if(smGD.smState == READY)
{
smGD.smState = IN_PROCESS;
ExitSession( msg );
/*
* The session may have been canceled so set the smState
* back to ready.
*/
smGD.smState = READY;
destroyMsg = False; /* done in SmUI.c */
}
rc = TT_CALLBACK_PROCESSED;
}
else if (strcmp( op, SM_RESOURCES_RELOAD ) == 0)
{
if(smGD.smState == READY)
{
smGD.smState = IN_PROCESS;
ReloadResources();
}
rc = TT_CALLBACK_PROCESSED;
}
else if (strcmp( op, SM_SAVE_SESSION ) == 0)
{
if(smGD.smState == READY)
{
smGD.smState = IN_PROCESS;
ProcessSaveSessionMessage (msg);
}
rc = TT_CALLBACK_PROCESSED;
}
else
{
rc = TT_CALLBACK_CONTINUE;
destroyMsg = False;
}
if (destroyMsg == True)
{
tt_message_reply( msg );
tt_message_destroy( msg );
}
tt_free( op );
return (rc);
}
/*************************************<->*************************************
*
* StartMsgServer ()
*
*
* Description:
* -----------
* Initialize the BMS and register the session manager with it. Then
* register all requests and notifications that the session manager is
* interested in.
*
*
* Inputs:
* ------
* app = Application context for dtsession
*
*
* Outputs:
* -------
*
*
* Comments:
* --------
*
*************************************<->***********************************/
void
StartMsgServer(void)
{
Boolean makeConnect;
String tmpString;
char * sessId;
char * procId;
int fd;
Tt_status status;
/*
* Before we start anything - initialize the customize data structure
*/
smCust.screenSavChange = False;
smCust.audioChange = False;
smCust.keyboardChange = False;
smCust.fontChange = False;
smCust.pointerChange = False;
smCust.dClickChange = False;
smCust.preeditChange = False;
makeConnect = DtAppInitialize(smGD.appCon, smGD.display, smGD.topLevelWid,
SM_RESOURCE_NAME,
DtSM_TOOL_CLASS);
smDD.okString = XmStringCreateLocalized(((char *)GETMESSAGE(18, 39, "OK")));
smDD.okLogoutString = XmStringCreateLocalized(((char *)GETMESSAGE(18, 39, "OK")));
smDD.cancelLogoutString = XmStringCreateLocalized(((char *)GETMESSAGE(18,40, "Cancel")));
smDD.helpString = XmStringCreateLocalized(((char *)GETMESSAGE(18, 41, "Help")));
if(makeConnect == False)
{
smGD.bmsDead = True;
}
else
{
smGD.bmsDead = False;
}
procId = tt_open();
status = tt_ptr_error( procId );
if (status == TT_OK) {
fd = tt_fd();
status = tt_int_error( fd );
if (status == TT_OK) {
XtAppAddInput( smGD.appCon, fd, (XtPointer)XtInputReadMask,
tttk_Xt_input_handler, procId );
}
}
if (status != TT_OK) {
smGD.bmsDead = True;
}
smGD.requests2Handle = 0;
if (status == TT_OK) {
smGD.requests2Handle = tt_pattern_create();
tt_pattern_category_set( smGD.requests2Handle, TT_HANDLE );
tt_pattern_class_add( smGD.requests2Handle, TT_REQUEST );
tt_pattern_scope_add( smGD.requests2Handle, TT_SESSION );
sessId = tt_default_session();
tt_pattern_session_add( smGD.requests2Handle, sessId );
tt_free( sessId );
tt_pattern_op_add( smGD.requests2Handle, SM_DISPLAY_LOCK );
tt_pattern_op_add( smGD.requests2Handle, SM_XSESSION_EXIT );
tt_pattern_op_add( smGD.requests2Handle, SM_RESOURCES_RELOAD );
tt_pattern_op_add( smGD.requests2Handle, SM_SAVE_SESSION );
tt_pattern_callback_add( smGD.requests2Handle,
handleSessionMgrRequest );
status = tt_pattern_register( smGD.requests2Handle );
if (status != TT_OK) {
smGD.bmsDead = True;
}
}
if (smGD.bmsDead) {
char *errfmt, *errmsg, *statmsg;
errfmt = SmNewString((char *) GETMESSAGE (6, 1,
"Could not connect to ToolTalk message server:\n%sExiting ...\n"));
statmsg = tt_status_message(status);
errmsg = XtMalloc(strlen(errfmt) + strlen(statmsg) + 2);
sprintf(errmsg, errfmt, statmsg);
PrintError(DtError, errmsg);
SM_FREE(errfmt);
XtFree(errmsg);
WarnNoStartup();
}
} /* END OF FUNCTION StartMsgServer */
/*************************************<->*************************************
*
* DtwmStarted (fields, client_data, num_words)
*
*
* Description:
* -----------
*
* Inputs:
* ------
*
*
* Outputs:
* -------
*
*
* Comments:
* --------
*
*************************************<->***********************************/
static void
DtwmStarted()
{
smGD.dtwmRunning = True;
} /* END OF FUNCTION DtwmStarted */
/*************************************<->*************************************
*
* RestoreDefaults ()
*
*
* Description:
* -----------
* A request has come in (usually from the customizer) to restore one of
* the settings to their default states
*
* Inputs:
* ------
*
*
* Outputs:
* -------
* smToSet = (global) turns off flag of setting no longer set
*
*
* Comments:
* --------
*
*************************************<->***********************************/
void
RestoreDefaults(
Atom toRestore)
{
if(toRestore == XaDtSmScreenInfo)
{
smToSet.screenSavChange = False;
}
else if(toRestore == XaDtSmAudioInfo)
{
smToSet.audioChange = False;
}
else if(toRestore == XaDtSmKeyboardInfo)
{
smToSet.keyboardChange = False;
}
else if(toRestore == XaDtSmPointerInfo)
{
smToSet.pointerChange = False;
smToSet.pointerMapChange = False;
}
} /* END OF FUNCTION RestoreDefaults */
/*************************************<->*************************************
*
* ProcessPropertyNotify ()
*
*
* Description:
* -----------
* The customizer has changed one of the properties on the sm top level
* window. This fact is remembered, so that at shutdown the information
* can be saved
*
* Inputs:
* ------
*
*
* Outputs:
* -------
* smToSet = (global) turns on flag of setting being set
*
*
* Comments:
* --------
*
*************************************<->***********************************/
void
ProcessPropertyNotify(
XEvent *next)
{
XPropertyEvent *pEvent = (XPropertyEvent *) next;
if (pEvent->state != PropertyNewValue)
{
return;
}
if(pEvent->atom == XaDtSmScreenInfo)
{
smToSet.screenSavChange = True;
smCust.screenSavChange = True;
}
else if(pEvent->atom == XaDtSmAudioInfo)
{
smToSet.audioChange = True;
smCust.audioChange = True;
}
else if(pEvent->atom == XaDtSmKeyboardInfo)
{
smToSet.keyboardChange = True;
smCust.keyboardChange = True;
}
else if(pEvent->atom == XaDtSmFontInfo)
{
smCust.fontChange = True;
}
else if(pEvent->atom == XaDtSmPreeditInfo)
{
smCust.preeditChange = True;
}
else if(pEvent->atom == XaDtSmPointerInfo)
{
smToSet.pointerChange = True;
smCust.pointerChange = True;
smToSet.pointerMapChange = True;
smCust.dClickChange = True;
}
} /* END OF FUNCTION RecordChanges */
/*************************************<->*************************************
*
* ProcessClientMessage(next)
*
*
* Description:
* -----------
* A client message has come from somewhere. Process it if we know how.
*
* Inputs:
* ------
* next - the client message event
*
*
* Outputs:
* -------
*
*
* Comments:
* --------
*
*************************************<->***********************************/
void
ProcessClientMessage(
XEvent *next)
{
XClientMessageEvent *cEvent = (XClientMessageEvent *) next;
/*
* If this event came from the style manager - process it
*/
if(cEvent->message_type == XaDtSmStmProtocol)
{
if(cEvent->data.l[0] == XaDtSmSaveToHome)
{
/*
* The style manager is asking for a save home session
*/
if(smGD.smState == READY)
{
int startStateOrig;
int confirmModeOrig;
Tt_message msg;
smGD.smState = IN_PROCESS;
msg = tttk_message_create( 0, TT_NOTICE, TT_SESSION, 0,
"DtActivity_Beginning", 0 );
tt_message_send( msg );
tt_message_destroy( msg );
startStateOrig = smSettings.startState;
confirmModeOrig = smSettings.confirmMode;
smSettings.startState = cEvent->data.l[1];
smSettings.confirmMode = cEvent->data.l[2];;
smGD.homeSave = True;
SaveState(True, smSettings.startState, SmSaveLocal,
DEFAULT_SHUTDOWN, SmInteractStyleNone,
DEFAULT_FAST, DEFAULT_GLOBAL);
smGD.homeSave = False;
smSettings.startState = startStateOrig;
smSettings.confirmMode = confirmModeOrig;
msg = tttk_message_create( 0, TT_NOTICE, TT_SESSION, 0,
"DtActivity_Began", 0 );
tt_message_send( msg );
tt_message_destroy( msg );
SetSystemReady();
}
}
else if (cEvent->data.l[0] == XaDtSmRestoreDefault)
{
RestoreDefaults((Atom) cEvent->data.l[1]);
}
}
else if(cEvent->message_type == XaSmWmProtocol)
{
/*
* If this event came from the ws manager - process it
*/
if(cEvent->data.l[0] == XaWmExitSession)
{
/*
* The ws manager is sending an exit session message
*/
if(smGD.smState == READY)
{
smGD.smState = IN_PROCESS;
ExitSession(0);
}
}
else if(cEvent->data.l[0] == XaWmLockDisplay)
{
/*
* The ws manager is sending an lock display message
*/
if(smGD.smState == READY)
{
smGD.smState = IN_PROCESS;
LockDisplay(True);
}
}
else if(cEvent->data.l[0] == XaWmWindowAck)
{
/*
* The ws manager is sending a "client has been managed"
*/
clientRunning = True;
}
else if(cEvent->data.l[0] == XaWmReady)
{
/*
* The ws manager is sending a "ready for clients"
*/
smGD.dtwmRunning = True;
}
}
else if (cEvent->message_type == XaDtSmStateInfo)
{
SmStateInfo state;
int flags = (int)cEvent->data.l[0];
/*
* Session state has been changed. Get new values.
*/
if(_DtGetSmState(smGD.display, smGD.topLevelWindow, &state) == Success)
{
char *newRes = malloc(BUFSIZ);
/*
* Copy selected changes to data areas.
*/
if (flags & SM_STATE_START)
{
smSettings.startState = state.smStartState;
}
if (flags & SM_STATE_CONFIRM)
{
smSettings.confirmMode = state.smConfirmMode;
}
newRes[0] = '\0';
if (flags & SM_STATE_CYCLETIMEOUT)
{
smSaverRes.cycleTimeout = state.smCycleTimeout;
sprintf(newRes+strlen(newRes), "dtsession*%scycleTimeout: %d\n",
smGD.extensionSpec,
smSaverRes.cycleTimeout/60);
}
if (flags & SM_STATE_LOCKTIMEOUT)
{
smSaverRes.lockTimeout = state.smLockTimeout;
sprintf(newRes+strlen(newRes), "dtsession*%slockTimeout: %d\n",
smGD.extensionSpec,
smSaverRes.lockTimeout/60);
}
if (flags & SM_STATE_SAVERTIMEOUT)
{
smSaverRes.saverTimeout = state.smSaverTimeout;
sprintf(newRes+strlen(newRes), "dtsession*%ssaverTimeout: %d\n",
smGD.extensionSpec,
smSaverRes.saverTimeout/60);
}
if (flags & SM_STATE_RANDOM)
{
smSaverRes.random = state.smRandom;
sprintf(newRes+strlen(newRes), "dtsession*%srandom: %s\n",
smGD.extensionSpec,
smSaverRes.random ? "True\n" : "False\n");
}
if (newRes[0] != '\0')
{
_DtAddToResource(smGD.display, newRes);
}
if (NULL != newRes) free(newRes);
}
}
else if (cEvent->message_type == XaDtSmSaverInfo)
{
SmSaverInfo saver;
/*
* Session screen saver list has been changed. Get new values.
*/
if(_DtGetSmSaver(smGD.display, smGD.topLevelWindow, &saver) == Success)
{
char *pRes;
SM_FREE(smGD.saverList);
smGD.saverList = SmNewString(saver.saverList);
SM_FREE(saver.saverList);
pRes = malloc(strlen("dtsession*saverList: ") +
strlen(smGD.saverList) +
strlen(smGD.extensionSpec) +
2); /* for the '/n' and '/0' */
if (pRes)
{
sprintf(pRes, "dtsession*%ssaverList: %s\n",
smGD.extensionSpec,
smGD.saverList);
_DtAddToResource(smGD.display, pRes);
free(pRes);
}
if (smGD.saverListParse)
{
SM_FREE(smGD.saverListParse);
smGD.saverListParse = NULL;
}
}
}
#if defined (USE_HPSSEXT)
else if(cEvent->message_type == XaSmScreenSaveRet)
{
if(cEvent->data.l[0] == SS_ON)
{
if (smSaverRes.saverTimeout + smSaverRes.lockTimeout > 0 &&
smGD.smState == READY)
{
smGD.smState = IN_PROCESS;
LockDisplay(False);
}
}
}
#endif /* USE_HPSSEXT */
return;
} /* END OF FUNCTION ProcessClientMessage */
/*************************************<->*************************************
*
* ProcessScreenSaverMessage(next)
*
*
* Description:
* -----------
* A screen saver message has come from the server. Process it if we know how.
*
* Inputs:
* ------
* next - the client message event
*
*
* Outputs:
* -------
*
*
* Comments:
* --------
*
*************************************<->***********************************/
#if defined (USE_X11SSEXT)
void
ProcessScreenSaverMessage(
XEvent *next)
{
XScreenSaverNotifyEvent *ssEvent = (XScreenSaverNotifyEvent *) next;
static int ssCount = 0;
if (ssEvent->state == ScreenSaverOn)
{
/*
* Screen saver activated.
*/
if (smSaverRes.saverTimeout + smSaverRes.lockTimeout > 0 &&
smGD.smState == READY)
{
/*
* Resource says to lock the display and SM is ready, so lock it.
*/
smGD.smState = IN_PROCESS;
LockDisplay(False);
}
}
}
#endif /* USE_X11SSEXT */
/*************************************<->*************************************
*
* ProcessReloadActionsDatabase(void)
*
*
* Description:
* -----------
* Register for notification of action database changes and load the action
* database into our address space. This function can be called directly
* by session mgr code, or called as a callback by the actions database.
*
* Inputs:
* ------
*
* Outputs:
* -------
*
* Comments:
* --------
* The first time in, this call registers itself as a callback routine with
* the actions database. The first and subsequent times in, this call will
* load the actions database into the session mgr address space.
*
*************************************<->***********************************/
void
ProcessReloadActionsDatabase(void)
{
static int needtoregister = 1;
if (needtoregister)
{
/*
* Have not yet registered with the actions database to call this
* callback when the database changes. Do so.
*/
DtDbReloadNotify((DtDbReloadCallbackProc) ProcessReloadActionsDatabase,
(XtPointer) NULL);
needtoregister = 0;
}
/*
* Our copy of the actions database must be out of date. Reload.
*/
DtDbLoad();
}
void
ProcessEvent(w, client_data, event, continue_to_dispatch)
Widget w;
XtPointer client_data;
XEvent *event;
Boolean *continue_to_dispatch;
{
switch(event->type)
{
case ClientMessage:
ProcessClientMessage(event);
break;
case PropertyNotify:
ProcessPropertyNotify(event);
break;
default:
#if defined (USE_X11SSEXT)
if (event->type == smGD.ssEventType)
ProcessScreenSaverMessage(event);
#endif
break;
}
}

View File

@@ -0,0 +1,63 @@
/* $XConsortium: SmCommun.h /main/5 1996/01/04 19:29:28 barstow $ */
/* *
* (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. *
*/
/************************************<+>*************************************
****************************************************************************
**
** File: SmCommun.h
**
** Project: HP DT
**
** Description
** -----------
** Variables and declarations
** needed for Communication for the session manager
**
**
** (c) Copyright Hewlett-Packard Company, 1990.
**
**
**
****************************************************************************
************************************<+>*************************************/
#ifndef _smcommun_h
#define _smcommun_h
/*
* #include statements
*/
/*
* #define statements
*/
/*
* typedef statements
*/
/*
* External variables
*/
extern char SM_DISPLAY_LOCK[];
extern char SM_XSESSION_EXIT[];
extern char SM_RESOURCES_RELOAD[];
extern char SM_SAVE_SESSION[];
/*
* External Interface
*/
extern void StartMsgServer(void) ;
extern void ProcessClientMessage(XEvent *);
extern void ProcessScreenSaverMessage(XEvent *);
extern void RestoreDefaults(Atom) ;
extern void ProcessPropertyNotify(XEvent *) ;
extern void ProcessReloadActionsDatabase(void);
extern void ProcessEvent(Widget, XtPointer, XEvent *, Boolean *);
#endif /*_smcommun_h*/
/* DON'T ADD ANYTHING AFTER THIS #endif */

View File

@@ -0,0 +1,373 @@
/* $TOG: SmConMgmt.c /main/6 1998/04/06 14:35:42 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. *
*/
/*************************************<+>*************************************
*****************************************************************************
**
** File: SmConMgmt.c
**
** Project: HP DT Session Manager (dtsession)
**
** Description:
** -----------
** Contains all code which performs contention management functionality
**
**
*******************************************************************
** (c) Copyright Hewlett-Packard Company, 1990. All rights are
** reserved. Copying or other reproduction of this program
** except for archival purposes is prohibited without prior
** written consent of Hewlett-Packard Company.
********************************************************************
**
**
**
*****************************************************************************
*************************************<+>*************************************/
#include <stdio.h>
#include <fcntl.h>
#if !defined(linux)
#include <nlist.h>
#endif
#include <X11/Intrinsic.h>
#include "Sm.h"
#include "SmProtocol.h"
#include "SmConMgmt.h"
#include "SmCommun.h"
/*
* Define statements
*/
#ifdef mips
#include <sys/fixpoint.h>
#endif /* mips */
#ifndef KMEM_FILE
#define KMEM_FILE "/dev/kmem"
#endif
#ifndef KERNEL_FILE
# ifdef mips
# define KERNEL_FILE "/vmunix"
# else /* not mips */
# define KERNEL_FILE "/hp-ux"
# endif /* mips */
#endif
#ifdef mips
#define GPGSLIM "gpgslim"
#define FREEMEM "freemem"
#else /* not mips */
# ifdef __hpux
# ifdef __hp9000s800
# define GPGSLIM "gpgslim"
# define FREEMEM "freemem"
# endif /* __hp9000s800 */
# endif /* __hpux */
#endif /* mips */
#ifndef GPGSLIM
#define GPGSLIM "_gpgslim"
#endif /* not defined GPGSLIM */
#ifndef FREEMEM
#define FREEMEM "_freemem"
#endif /* not defined FREEMEM */
int clientRunning;
/*
* Variables global to this module only
*/
#if !defined(linux)
static struct nlist namelist[3];
#endif
static int freemem_loc, gpgslim_loc, gpgslim, freemem;
static int clientTimeout;
/*
* Functions local to this module
*/
static void HandleClientMessage(Widget smWidget, XtPointer dummy,
XEvent *event);
static void WaitClientTimeout(XtPointer, XtIntervalId *);
/*************************************<->*************************************
*
* GetMemoryUtilization ()
*
*
* Description:
* -----------
* Returns 1 of 3 values. Tells the calling program that memory is not
* available, that it is full (paging has started), or that it is not
* full.
*
*
* Inputs:
* ------
*
*
* Outputs:
* -------
* An integer value representing the current memory utilization of the
* system.
*
*
* Comments:
* --------
* WARNING: This routine, by its very nature is non-portable. It depends
* on an OS having some kind of access to its memory utilization.
*
* DOUBLE WARNING: The mips architecture code has never been tested.
*
*
*************************************<->***********************************/
int
GetMemoryUtilization(void)
{
#if !defined(linux)
static int init = 0;
static kmem;
#if !defined(SVR4) && !defined(sco) && !defined(hpV4) && !defined(_POWER) && !defined (__osf__)
extern void nlist();
#endif
int i;
#ifdef __hpux
setresgid(-1, smGD.conMgmtGID, -1);
#else
#ifndef SVR4
setregid(smGD.runningGID, smGD.conMgmtGID);
#else
setgid(smGD.runningGID);
setegid(smGD.conMgmtGID);
#endif
#endif
if(!init)
{
namelist[0].n_name = FREEMEM;
namelist[1].n_name = GPGSLIM;
namelist[2].n_name = (char *) NULL;
nlist( KERNEL_FILE, namelist);
for(i = 0; i < 2; i++)
{
if (namelist[i].n_type == 0 ||
namelist[i].n_value == 0)
{
#ifdef __hpux
setresgid(-1, smGD.runningGID, -1);
#else
#ifndef SVR4
setregid(smGD.conMgmtGID, smGD.runningGID);
#else
setgid(smGD.conMgmtGID);
setegid(smGD.runningGID);
#endif
#endif
return(MEM_NOT_AVAILABLE);
}
}
freemem_loc = namelist[0].n_value;
gpgslim_loc = namelist[1].n_value;
kmem = open(KMEM_FILE, O_RDONLY);
if (kmem < 0)
{
#ifdef __hpux
setresgid(-1, smGD.runningGID, -1);
#else
#ifndef SVR4
setregid(smGD.conMgmtGID, smGD.runningGID);
#else
setgid(smGD.conMgmtGID);
setegid(smGD.runningGID);
#endif
#endif
return(MEM_NOT_AVAILABLE);
}
(void) lseek(kmem, gpgslim_loc, 0);
#ifdef mips
{
fix temp;
(void) read(kmem, (char *)&temp, sizeof(fix));
gpgslim = FIX_TO_DBL(temp);
}
#else /* not mips */
(void) read(kmem, (char *)&gpgslim, sizeof(int));
#endif /* mips */
init = 1;
}
(void) lseek(kmem, freemem_loc, 0);
#ifdef mips
{
fix temp;
(void) read(kmem, (char *)&temp, sizeof(fix));
freemem = FIX_TO_DBL(temp);
}
#else /* not mips */
(void) read(kmem, (char *)&freemem, sizeof(int));
#endif /* mips */
#ifdef __hpux
setresgid(-1, smGD.runningGID, -1);
#else
#ifndef SVR4
setregid(smGD.conMgmtGID, smGD.runningGID);
#else
setgid(smGD.conMgmtGID);
setegid(smGD.runningGID);
#endif
#endif
if(freemem >= gpgslim)
{
return(MEM_NOT_FULL);
}
else
{
return(MEM_FULL);
}
#else /* linux */
return(MEM_NOT_FULL);
#endif /* linux */
}
/*************************************<->*************************************
*
* WaitForClientMap ()
*
*
* Description:
* -----------
* This routine waits for the workspace manager to send it information
* about a client being mapped, before returning to start the next client
*
*
* Inputs:
* ------
*
*
* Outputs:
* -------
*
* Comments:
* --------
*
*************************************<->***********************************/
void
WaitForClientMap( void )
{
XtInputMask isThere;
XEvent event;
XClientMessageEvent *cEvent = (XClientMessageEvent *) &event;
XtIntervalId clientTimerId;
XtAddEventHandler(smGD.topLevelWid,
0,
True,
(XtEventHandler)HandleClientMessage,
(XtPointer) NULL);
/*
* Set a timer which stops the block on waiting for the
* client to start. This value is fetched from the
* waitClientTimeout resource.
*/
clientRunning = False;
clientTimeout = False;
clientTimerId = XtAppAddTimeOut(smGD.appCon,
smRes.waitClientTimeout,
WaitClientTimeout, NULL);
while((clientRunning == False) && (clientTimeout == False))
{
XtAppProcessEvent(smGD.appCon, XtIMAll);
}
XtRemoveTimeOut(clientTimerId);
XtRemoveEventHandler(smGD.topLevelWid,
0,
True,
(XtEventHandler)HandleClientMessage,
(XtPointer) NULL);
return;
}
/*************************************<->*************************************
*
* WaitClientTimeout
*
*
* Description:
* -----------
* Timeout procedure the WaitForClientMap routine. It stops a loop waiting
* for the last started app to get mapped.
*
*
* Inputs:
* ------
*
*
* Outputs:
* -------
* clientTimeout = (global) flag that stops the loop
*
* Comments:
* --------
*
*************************************<->***********************************/
static void
WaitClientTimeout(
XtPointer client_data,
XtIntervalId *id )
{
clientTimeout = True;
return;
}
/*************************************<->*************************************
*
* HandleClientMessage
*
*
* Description:
* -----------
* This is the event handler registered to recieve the client message
* from dtwm when a client has beem managed
*
*
*************************************<->***********************************/
static void
HandleClientMessage( Widget smWidget,
XtPointer dummy,
XEvent *event)
{
if (event->type == ClientMessage)
{
ProcessClientMessage(event);
}
return;
} /* END OF FUNCTION HandleClientMessage */

View File

@@ -0,0 +1,63 @@
/* $XConsortium: SmConMgmt.h /main/4 1995/10/30 09:34:31 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. *
*/
/************************************<+>*************************************
****************************************************************************
**
** File: SmConMgmt.h
**
** Project: HP DT
**
** Description
** -----------
** Variables and declarations needed for
** Contention Management for the session manager
**
**
** (c) Copyright Hewlett-Packard Company, 1990.
**
**
**
****************************************************************************
************************************<+>*************************************/
#ifndef _smconmgmt_h
#define _smconmgmt_h
/*
* #include statements
*/
/*
* #define statements
*/
#define MEM_NOT_AVAILABLE -1
#define MEM_NOT_FULL 0
#define MEM_FULL 1
/*
* typedef statements
*/
/*
* External variables
*/
/*
* External Interface
*/
extern int GetMemoryUtilization(void);
extern void WaitForClientMap(void);
#endif /*_smprotocols_h*/
/* DON'T ADD ANYTHING AFTER THIS #endif */

View File

@@ -0,0 +1,728 @@
/* $TOG: SmDB.c /main/5 1998/07/23 18:11:31 mgreess $ */
/*
* (c) Copyright 1996 Digital Equipment Corporation.
* (c) Copyright 1996 Hewlett-Packard Company.
* (c) Copyright 1996 International Business Machines Corp.
* (c) Copyright 1996 Sun Microsystems, Inc.
* (c) Copyright 1996 Novell, Inc.
* (c) Copyright 1996 FUJITSU LIMITED.
* (c) Copyright 1996 Hitachi.
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include "SmDB.h"
#define RESOURCE_BUF_SZ 1024
#define CLIENT_ID_SZ 20
typedef struct _ClientDBRec
{
XrmDatabase xrmDB; /* Xrm resource database. */
Boolean openForInput; /* True if input, False if output. */
char *xrmDBFileName; /* Filename, for openForInput == False. */
char *tmpDBFileName;
FILE *xrmDBFile;
/* Below used if openForInput. */
char **XSMPClients; /* malloc'd array of XSMP client IDs. */
int nXSMPClients; /* number of XSMP clients. */
int nextXSMPClientIndex; /* index of next XSMP client to Get;
* also used as sequence # for Put. */
char **proxyClients; /* malloc'd array of Proxy client IDs. */
int nProxyClients; /* number of Proxy clients. */
int nextProxyClientIndex; /* index of next Proxy client to Get;
* also used as sequence # for Put. */
} ClientDBRec;
static Boolean xrmInitialized = False;
static XrmName XSMPName[2];
static XrmClass XSMPClass[2];
static XrmName proxyName[2];
static XrmClass proxyClass[2];
static XrmQuark anyQuark;
static char *resourceBuf = NULL;
static char *clientIDBuf = NULL;
/* Public strings */
char *versionStr = ".version";
char *dtsessionIDStr = ".dtsessionID";
/* Strings for XSMP clients. */
static char *clientStr = "!\nClient.%s";
static char *programStr = "%s.Program";
static char *cwdStr = "%s.Cwd";
static char *restartCmdStr = "%s.RestartCommand";
static char *cloneCmdStr = "%s.CloneCommand";
static char *discardCmdStr = "%s.DiscardCommand";
static char *environmentStr = "%s.Environment";
static char *restartHintStr = "%s.RestartHint";
static char *sessionIDStr = "%s.SessionID";
/* Strings for Proxy clients. */
static char *proxyStr = "!\nProxyClient.%s";
static char *commandStr = "%s.Command";
/* Common resources (XSMP and Proxy). */
static char *clientHostStr = "%s.ClientHost";
static char *screenNumStr = "%s.ScreenNum";
static void _initXrm(void);
static Bool _countProc(XrmDatabase *, XrmBindingList, XrmQuarkList,
XrmRepresentation *, XrmValue *, XPointer);
static Bool _fillClientIDProc(XrmDatabase *, XrmBindingList, XrmQuarkList,
XrmRepresentation *, XrmValue *, XPointer);
static Bool _fillStringArrayProc(XrmDatabase *, XrmBindingList, XrmQuarkList,
XrmRepresentation *, XrmValue *, XPointer);
static Boolean _getStringResource(XrmDatabase, char *,
char *, char **, char *);
static Boolean _getIntResource(XrmDatabase, char *, char *, int *, int);
static Boolean _getStringArrayResource(XrmDatabase, char *, char *,
char ***, char **);
static void _freeStringArray(char **);
static Boolean _putStringResource(ClientDBRec *, char *, char *, char *);
static Boolean _putIntResource(ClientDBRec *, char *, char *, int);
static Boolean _putStringArrayResource(ClientDBRec *, char *, char *, char **);
static char *_tmpFileName(char *);
static void
_initXrm(void)
{
if (!xrmInitialized)
{
XrmInitialize(); /* Just in case. */
anyQuark = XrmStringToQuark("?");
XSMPName[0] = proxyName[0] = anyQuark;
XSMPClass[0] = XrmStringToClass("Client");
proxyClass[0] = XrmStringToClass("ProxyClient");
XSMPName[1] = XSMPClass[1] =
proxyName[1] = proxyClass[1] = NULLQUARK;
xrmInitialized = True;
}
}
static Bool
_countProc(XrmDatabase *clientDB, XrmBindingList bindingList,
XrmQuarkList quarkList, XrmRepresentation *reps,
XrmValue *value, XPointer uData)
{
int *countP = (int *)uData;
(*countP)++;
return FALSE;
}
static Bool
_fillClientIDProc(XrmDatabase *clientDB, XrmBindingList bindingList,
XrmQuarkList quarkList, XrmRepresentation *reps,
XrmValue *value, XPointer uData)
{
char ***idListPtr = (char ***)uData;
char **clientIDPtr = *idListPtr;
*clientIDPtr = (char *)value->addr;
(*idListPtr)++;
return FALSE;
}
static Bool
_fillStringArrayProc(XrmDatabase *clientDB, XrmBindingList bindingList,
XrmQuarkList quarkList, XrmRepresentation *reps,
XrmValue *value, XPointer uData)
{
char **stringsPtr = (char **)uData;
char *indexStr;
/* Our index into this string array is at quarkList[2]. */
if ((indexStr = XrmQuarkToString(quarkList[2])) == (char *)NULL)
return True;
if ((stringsPtr[atoi(indexStr)] = XtNewString((char *)value->addr))
== (char *)NULL)
return True;
return FALSE;
}
static Boolean
_getStringResource(XrmDatabase xrmDB, char *fmtStr,
char *clientID, char **resourcePtr, char *defaultVal)
{
char *resourceType;
XrmValue resourceValue;
if (NULL == resourceBuf) resourceBuf = XtMalloc(RESOURCE_BUF_SZ);
sprintf(resourceBuf, fmtStr, clientID);
if (XrmGetResource(xrmDB, resourceBuf, resourceBuf,
&resourceType, &resourceValue))
{
if ((*resourcePtr = XtNewString(resourceValue.addr)) == (char *)NULL)
return False;
return True;
}
*resourcePtr = defaultVal;
return True;
}
static Boolean
_getIntResource(XrmDatabase xrmDB, char *fmtStr,
char *clientID, int *resourcePtr, int defaultVal)
{
char *resourceType;
XrmValue resourceValue;
if (NULL == resourceBuf) resourceBuf = XtMalloc(RESOURCE_BUF_SZ);
sprintf(resourceBuf, fmtStr, clientID);
*resourcePtr = (XrmGetResource(xrmDB, resourceBuf, resourceBuf,
&resourceType, &resourceValue)) ?
atoi(resourceValue.addr) : defaultVal;
return True;
}
static Boolean
_getStringArrayResource(XrmDatabase xrmDB, char *fmtStr,
char *clientID, char ***resourcePtr,
char **defaultVal)
{
XrmQuark resourceName[3];
XrmQuark resourceClass[3];
char *resourceType;
XrmValue resourceValue;
int nStrings;
resourceName[0] = resourceName[1] = anyQuark;
resourceName[2] = NULLQUARK;
if (NULL == resourceBuf) resourceBuf = XtMalloc(RESOURCE_BUF_SZ);
sprintf(resourceBuf, fmtStr, clientID);
XrmStringToQuarkList(resourceBuf, resourceClass);
nStrings = 0;
XrmEnumerateDatabase(xrmDB, resourceName, resourceClass,
XrmEnumOneLevel, _countProc,
(XPointer)&nStrings);
if (nStrings > 0)
{
char **stringsPtr;
int i;
if ((stringsPtr = (char **)XtMalloc((nStrings + 1) * sizeof(char *)))
== (char **)NULL)
return False;
/* Initialize array entries to NULL so free can work. */
/* NOTE: Final entry (nStrings) will remain NULL. */
for (i = 0; i <= nStrings; i++)
stringsPtr[i] = (char *)NULL;
if (XrmEnumerateDatabase(xrmDB,
resourceName, resourceClass,
XrmEnumOneLevel, _fillStringArrayProc,
(XPointer)stringsPtr))
{
for (i = 0; i < nStrings; i++)
XtFree(stringsPtr[i]);
XtFree((char *)stringsPtr);
return False;
}
*resourcePtr = stringsPtr;
return True;
}
*resourcePtr = defaultVal;
return True;
}
static void
_freeStringArray(char **stringsPtr)
{
if (stringsPtr)
{
int i;
for (i = 0; stringsPtr[i] != (char *)NULL; i++)
XtFree(stringsPtr[i]);
XtFree((char *)stringsPtr);
}
}
static Boolean
_putStringResource(ClientDBRec *clientDB, char *fmtStr, char *clientID,
char *resourceVal)
{
if (resourceVal != (char *)NULL)
{
if (NULL == clientIDBuf) clientIDBuf = XtMalloc(RESOURCE_BUF_SZ);
sprintf(clientIDBuf, fmtStr, clientID);
if (fprintf(clientDB->xrmDBFile, "%s: %s\n", clientIDBuf, resourceVal)
< 0)
return False;
}
return True;
}
static Boolean
_putIntResource(ClientDBRec *clientDB, char *fmtStr, char *clientID,
int resourceVal)
{
if (NULL == clientIDBuf) clientIDBuf = XtMalloc(RESOURCE_BUF_SZ);
sprintf(clientIDBuf, fmtStr, clientID);
if (fprintf(clientDB->xrmDBFile, "%s: %d\n", clientIDBuf, resourceVal)
< 0)
return False;
return True;
}
static Boolean
_putStringArrayResource(ClientDBRec *clientDB, char *fmtStr, char *clientID,
char **resourceVal)
{
int i;
if (resourceVal != (char **)NULL)
{
for (i = 0; resourceVal[i] != (char *)NULL; i++)
{
if (NULL == clientIDBuf) clientIDBuf = XtMalloc(RESOURCE_BUF_SZ);
sprintf(clientIDBuf, fmtStr, clientID);
if (fprintf(clientDB->xrmDBFile, "%s.%d: %s\n",
clientIDBuf, i, resourceVal[i]) < 0)
return False;
}
}
return True;
}
static char *
_tmpFileName(char *fileName)
{
int fileNameLen = strlen(fileName);
char *newFileName =
(char *)XtMalloc((fileNameLen + 20) * sizeof(char));
if (newFileName != (char *)NULL)
{
int i;
char *ptr = &(newFileName[fileNameLen]);
strcpy(newFileName, fileName);
/* Hm. I suppose if a couple billion versions of this file exist */
/* we could loop forever, but that's not likely. */
for (i = 0; ; i++)
{
sprintf(ptr, "%d", i);
if (access(newFileName, F_OK) != 0)
break;
}
}
return newFileName;
}
ClientDB
OpenInputClientDB(char *fileName,
char **version,
char **dtsessionID)
{
ClientDBRec *inputDB;
char **tmpPtr;
char *resourceType;
XrmValue resourceValue;
*version = (char *)NULL;
*dtsessionID = (char *)NULL;
_initXrm();
if ((fileName == (char *)NULL) ||
((inputDB = (ClientDBRec *)XtMalloc(sizeof(ClientDBRec)))
== (ClientDBRec *)NULL))
return (ClientDB)NULL;
if ((inputDB->xrmDB = XrmGetFileDatabase(fileName))
== (XrmDatabase)NULL)
{
XtFree((char *)inputDB);
return (ClientDB)NULL;
}
inputDB->openForInput = True;
inputDB->XSMPClients = inputDB->proxyClients = (char **)NULL;
inputDB->nXSMPClients = inputDB->nProxyClients = 0;
inputDB->nextXSMPClientIndex = inputDB->nextProxyClientIndex = 0;
/* Count the number of XSMP and Proxy clients. */
XrmEnumerateDatabase(inputDB->xrmDB, XSMPName, XSMPClass,
XrmEnumOneLevel, _countProc,
(XPointer)&inputDB->nXSMPClients);
XrmEnumerateDatabase(inputDB->xrmDB, proxyName, proxyClass,
XrmEnumOneLevel, _countProc,
(XPointer)&inputDB->nProxyClients);
/* Allocate space for the client IDs and fill from database. */
if (inputDB->nXSMPClients > 0)
{
if ((inputDB->XSMPClients =
(char **)XtMalloc(inputDB->nXSMPClients * sizeof(char *)))
== (char **)NULL)
{
XrmDestroyDatabase(inputDB->xrmDB);
XtFree((char *)inputDB);
return (ClientDB)NULL;
}
tmpPtr = inputDB->XSMPClients;
XrmEnumerateDatabase(inputDB->xrmDB, XSMPName, XSMPClass,
XrmEnumOneLevel, _fillClientIDProc,
(XPointer)&tmpPtr);
}
if (inputDB->nProxyClients > 0)
{
if ((inputDB->proxyClients =
(char **)XtMalloc(inputDB->nProxyClients * sizeof(char *)))
== (char **)NULL)
{
XrmDestroyDatabase(inputDB->xrmDB);
XtFree((char *)inputDB->XSMPClients);
XtFree((char *)inputDB);
return (ClientDB)NULL;
}
tmpPtr = inputDB->proxyClients;
XrmEnumerateDatabase(inputDB->xrmDB, proxyName, proxyClass,
XrmEnumOneLevel, _fillClientIDProc,
(XPointer)&tmpPtr);
}
if ((!XrmGetResource(inputDB->xrmDB, versionStr, versionStr,
&resourceType, &resourceValue)) ||
((*version = XtNewString(resourceValue.addr)) == (char *)NULL) ||
(!XrmGetResource(inputDB->xrmDB, dtsessionIDStr, dtsessionIDStr,
&resourceType, &resourceValue)) ||
((*dtsessionID = XtNewString(resourceValue.addr)) == (char *)NULL))
{
if (*version)
{
XtFree(*version);
*version = (char *)NULL;
}
XrmDestroyDatabase(inputDB->xrmDB);
XtFree((char *)inputDB->XSMPClients);
XtFree((char *)inputDB->proxyClients);
XtFree((char *)inputDB);
return (ClientDB)NULL;
}
return (ClientDB)inputDB;
}
ClientDB
OpenOutputClientDB(char *fileName,
char *version,
char *dtsessionID)
{
ClientDBRec *outputDB;
_initXrm();
if ((fileName == (char *)NULL) ||
(version == (char *)NULL) ||
(dtsessionID == (char *)NULL) ||
((outputDB = (ClientDBRec *)XtMalloc(sizeof(ClientDBRec)))
== (ClientDBRec *)NULL))
return (ClientDB)NULL;
outputDB->xrmDB = (XrmDatabase)NULL;
outputDB->openForInput = False;
outputDB->nextXSMPClientIndex = 0;
outputDB->nextProxyClientIndex = 0;
/* Save current DB to tmp file in case we need to restore later. */
if (((outputDB->xrmDBFileName = XtNewString(fileName)) == (char *)NULL) ||
((outputDB->tmpDBFileName = _tmpFileName(fileName)) == (char *)NULL))
{
if (outputDB->xrmDBFileName != (char *)NULL)
XtFree(outputDB->xrmDBFileName);
XtFree((char *)outputDB);
return (ClientDB)NULL;
}
if ((rename(fileName, outputDB->tmpDBFileName) != 0) &&
(errno != ENOENT))
{
XtFree(outputDB->xrmDBFileName);
XtFree(outputDB->tmpDBFileName);
XtFree((char *)outputDB);
return (ClientDB)NULL;
}
/* Open fileName for writing. */
if ((outputDB->xrmDBFile = fopen(fileName, "w")) == (FILE *)NULL)
{
rename(outputDB->tmpDBFileName, fileName);
XtFree(outputDB->xrmDBFileName);
XtFree(outputDB->tmpDBFileName);
XtFree((char *)outputDB);
return (ClientDB)NULL;
}
/* Store version and session ID. */
fprintf(outputDB->xrmDBFile, "! dtsession.db\n!\n%s: %s\n",
versionStr, version);
fprintf(outputDB->xrmDBFile, "%s: %s\n", dtsessionIDStr, dtsessionID);
return (ClientDB)outputDB;
}
XSMPClientDBRecPtr
GetXSMPClientDBRec(ClientDB inputDBPtr)
{
ClientDBRec *inputDB = (ClientDBRec *)inputDBPtr;
XSMPClientDBRecPtr clientPtr;
char *clientID;
if ((inputDB == (ClientDBRec *)NULL) ||
(!inputDB->openForInput) ||
(inputDB->nextXSMPClientIndex >= inputDB->nXSMPClients) ||
((clientPtr = (XSMPClientDBRecPtr)XtMalloc(sizeof(XSMPClientDBRec)))
== (XSMPClientDBRecPtr)NULL))
{
return (XSMPClientDBRecPtr)NULL;
}
clientID = inputDB->XSMPClients[inputDB->nextXSMPClientIndex];
/* Initialize pointers so Free is easy. */
clientPtr->clientId = (char *)NULL;
clientPtr->clientHost = clientPtr->program =
clientPtr->cwd = (char *)NULL;
clientPtr->restartCommand = clientPtr->cloneCommand =
clientPtr->discardCommand = clientPtr->environment = (char **)NULL;
/* Retrieve resources from the database. */
if (!_getStringResource(inputDB->xrmDB, sessionIDStr, clientID,
&clientPtr->clientId, (char *)NULL) ||
!_getStringResource(inputDB->xrmDB, clientHostStr, clientID,
&clientPtr->clientHost, (char *)NULL) ||
!_getStringResource(inputDB->xrmDB, programStr, clientID,
&clientPtr->program, (char *)NULL) ||
!_getStringResource(inputDB->xrmDB, cwdStr, clientID,
&clientPtr->cwd, (char *)NULL) ||
!_getIntResource(inputDB->xrmDB, screenNumStr, clientID,
&clientPtr->screenNum, 0) ||
!_getStringArrayResource(inputDB->xrmDB, restartCmdStr, clientID,
&clientPtr->restartCommand, (char **)NULL) ||
!_getStringArrayResource(inputDB->xrmDB, cloneCmdStr, clientID,
&clientPtr->cloneCommand, (char **)NULL) ||
!_getStringArrayResource(inputDB->xrmDB, discardCmdStr, clientID,
&clientPtr->discardCommand, (char **)NULL) ||
!_getStringArrayResource(inputDB->xrmDB, environmentStr, clientID,
&clientPtr->environment, (char **)NULL) ||
!_getIntResource(inputDB->xrmDB, restartHintStr, clientID,
(int *)&clientPtr->restartHint, 0))
{
FreeXSMPClientDBRec(clientPtr);
return (XSMPClientDBRecPtr)NULL;
}
clientPtr->next = (XSMPClientDBRec *)NULL;
inputDB->nextXSMPClientIndex++;
return clientPtr;
}
ProxyClientDBRecPtr
GetProxyClientDBRec(ClientDB inputDBPtr)
{
ClientDBRec *inputDB = (ClientDBRec *)inputDBPtr;
ProxyClientDBRecPtr clientPtr;
char *clientID;
if ((inputDB == (ClientDBRec *)NULL) ||
(!inputDB->openForInput) ||
(inputDB->nextProxyClientIndex >= inputDB->nProxyClients) ||
((clientPtr = (ProxyClientDBRecPtr)XtMalloc(sizeof(ProxyClientDBRec)))
== (ProxyClientDBRecPtr)NULL))
{
return (ProxyClientDBRecPtr)NULL;
}
clientID = inputDB->proxyClients[inputDB->nextProxyClientIndex];
/* Initialize pointers so Free is easy. */
clientPtr->clientHost = (char *)NULL;
clientPtr->command = (char **)NULL;
/* Retrieve resources from the database. */
if (!_getStringResource(inputDB->xrmDB, clientHostStr, clientID,
&clientPtr->clientHost, (char *)NULL) ||
!_getStringArrayResource(inputDB->xrmDB, commandStr, clientID,
&clientPtr->command, (char **)NULL) ||
!_getIntResource(inputDB->xrmDB, screenNumStr, clientID,
&clientPtr->screenNum, 0))
{
FreeProxyClientDBRec(clientPtr);
return (ProxyClientDBRecPtr)NULL;
}
inputDB->nextProxyClientIndex++;
return clientPtr;
}
Boolean
PutXSMPClientDBRec(ClientDB outputDBPtr,
XSMPClientDBRecPtr clientPtr)
{
ClientDBRec *outputDB = (ClientDBRec *)outputDBPtr;
char clientID[CLIENT_ID_SZ];
if ((outputDB == (ClientDBRec *)NULL) ||
(outputDB->openForInput) ||
(clientPtr == (XSMPClientDBRecPtr)NULL) ||
(clientPtr->clientId == (char *)NULL))
return False;
sprintf(clientID, "C%d", outputDB->nextXSMPClientIndex++);
if (!_putStringResource(outputDB, clientStr, clientID, clientID) ||
!_putStringResource(outputDB, sessionIDStr, clientID,
clientPtr->clientId) ||
!_putStringResource(outputDB, clientHostStr, clientID,
clientPtr->clientHost) ||
!_putStringResource(outputDB, programStr, clientID,
clientPtr->program) ||
!_putStringResource(outputDB, cwdStr, clientID,
clientPtr->cwd) ||
!_putIntResource(outputDB, screenNumStr, clientID,
clientPtr->screenNum) ||
!_putStringArrayResource(outputDB, restartCmdStr, clientID,
clientPtr->restartCommand) ||
!_putStringArrayResource(outputDB, cloneCmdStr, clientID,
clientPtr->cloneCommand) ||
!_putStringArrayResource(outputDB, discardCmdStr, clientID,
clientPtr->discardCommand) ||
!_putStringArrayResource(outputDB, environmentStr, clientID,
clientPtr->environment) ||
!_putIntResource(outputDB, restartHintStr, clientID,
(int)clientPtr->restartHint))
return False;
return True;
}
Boolean
PutProxyClientDBRec(ClientDB outputDBPtr,
ProxyClientDBRecPtr clientPtr)
{
ClientDBRec *outputDB = (ClientDBRec *)outputDBPtr;
char clientID[CLIENT_ID_SZ];
if ((outputDB == (ClientDBRec *)NULL) ||
(outputDB->openForInput) ||
(clientPtr == (ProxyClientDBRecPtr)NULL))
return False;
sprintf(clientID, "PC%d", outputDB->nextProxyClientIndex++);
if (!_putStringResource(outputDB, proxyStr, clientID, clientID) ||
!_putStringResource(outputDB, clientHostStr, clientID,
clientPtr->clientHost) ||
!_putStringArrayResource(outputDB, commandStr, clientID,
clientPtr->command) ||
!_putIntResource(outputDB, screenNumStr, clientID,
clientPtr->screenNum))
return False;
return True;
}
Boolean
CloseClientDB(ClientDB clientDBPtr, Boolean writeDB)
{
ClientDBRec *clientDB = (ClientDBRec *)clientDBPtr;
if (clientDB == (ClientDBRec *)NULL)
return False;
/* Input? */
if (clientDB->openForInput)
{
XtFree((char *)clientDB->XSMPClients);
XtFree((char *)clientDB->proxyClients);
XrmDestroyDatabase(clientDB->xrmDB);
XtFree((char *)clientDB);
return True;
}
/* Otherwise, output. */
if (writeDB)
{
/* Close file and remove temp DB. */
fclose(clientDB->xrmDBFile);
unlink(clientDB->tmpDBFileName);
}
else
{
/* Close file and remove it; restore original DB. */
fclose(clientDB->xrmDBFile);
rename(clientDB->tmpDBFileName, clientDB->xrmDBFileName);
}
XtFree(clientDB->xrmDBFileName);
XtFree(clientDB->tmpDBFileName);
XtFree((char *)clientDB);
return True;
}
void
FreeXSMPClientDBRec(XSMPClientDBRecPtr clientPtr)
{
if (clientPtr != (XSMPClientDBRecPtr)NULL)
{
XtFree(clientPtr->clientId);
XtFree(clientPtr->clientHost);
XtFree(clientPtr->program);
XtFree(clientPtr->cwd);
_freeStringArray(clientPtr->restartCommand);
_freeStringArray(clientPtr->cloneCommand);
_freeStringArray(clientPtr->discardCommand);
_freeStringArray(clientPtr->environment);
XtFree((char *)clientPtr);
}
}
void
FreeProxyClientDBRec(ProxyClientDBRecPtr clientPtr)
{
if (clientPtr != (ProxyClientDBRecPtr)NULL)
{
XtFree(clientPtr->clientHost);
_freeStringArray(clientPtr->command);
XtFree((char *)clientPtr);
}
}

View File

@@ -0,0 +1,71 @@
#ifndef SM_DB_H
#define SM_DB_H
/* $XConsortium: SmDB.h /main/3 1996/02/02 16:03:03 rswiston $ */
/*
* (c) Copyright 1996 Digital Equipment Corporation.
* (c) Copyright 1996 Hewlett-Packard Company.
* (c) Copyright 1996 International Business Machines Corp.
* (c) Copyright 1996 Sun Microsystems, Inc.
* (c) Copyright 1996 Novell, Inc.
* (c) Copyright 1996 FUJITSU LIMITED.
* (c) Copyright 1996 Hitachi.
*/
#include "SmXSMP.h"
#include <X11/Intrinsic.h>
typedef void *ClientDB;
/* Public variables */
extern char *versionStr;
extern char *dtsessionIDStr;
/********* Open the client database *********/
/*
* Open client database for reading.
*/
extern ClientDB OpenInputClientDB(char *fileName,
char **version,
char **dtsessionID);
/*
* Open client database for writing.
*/
extern ClientDB OpenOutputClientDB(char *fileName,
char *version,
char *dtsessionID);
/********* Retrieve client record from database *********/
/*
* Retrieve the next XSMP client record from the database.
*/
extern XSMPClientDBRecPtr GetXSMPClientDBRec(ClientDB inputDB);
/*
* Retrieve the next Proxy client record from the database.
*/
extern ProxyClientDBRecPtr GetProxyClientDBRec(ClientDB inputDB);
/********* Save client record to database *********/
/*
* Save XSMP client record to database.
*/
extern Boolean PutXSMPClientDBRec(ClientDB outputDB,
XSMPClientDBRecPtr clientPtr);
/*
* Save Proxy client record to database.
*/
extern Boolean PutProxyClientDBRec(ClientDB outputDB,
ProxyClientDBRecPtr clientPtr);
/********* Close client database *********/
extern Boolean CloseClientDB(ClientDB clientDB, Boolean writeDB);
/********* Free memory allocated for client records. *********/
extern void FreeXSMPClientDBRec(XSMPClientDBRecPtr);
extern void FreeProxyClientDBRec(ProxyClientDBRecPtr);
#endif /* SM_DB_H */

View File

@@ -0,0 +1,324 @@
/* $TOG: SmError.c /main/5 1998/10/26 17:20:29 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. *
*/
/*************************************<+>*************************************
*****************************************************************************
**
** File: SmError.c
**
** Project: HP DT Session Manager (dtsession)
**
** Description:
** -----------
** This file contains all session manager error functions. The session
** manager traps all errors from the toolkit and server, and takes action
** depending on the type of the error.
**
**
**
*******************************************************************
** (c) Copyright Hewlett-Packard Company, 1990. All rights are
** reserved. Copying or other reproduction of this program
** except for archival purposes is prohibited without prior
** written consent of Hewlett-Packard Company.
********************************************************************
**
**
**
*****************************************************************************
*************************************<+>*************************************/
#include <stdio.h>
#ifdef _SUN_OS
#include <string.h>
#endif
#include <X11/Intrinsic.h>
#include <Dt/UserMsg.h>
#include "Sm.h"
#include "SmError.h"
#include "SmGlobals.h"
/*
* Global variables
*/
NlsStrings smNLS;
/*
* Local functions
*/
static int LibError( Display *, XErrorEvent *) ;
static int LibIOError( void ) ;
static void ToolkitWarning( char *) ;
static void ToolkitError( char *) ;
/*************************************<->*************************************
*
* InitErrorHandler ()
*
*
* Description:
* -----------
* Initialize all error handlers for use with the session manager
* session manager should only exit on real severe conditions.
* it should try to gracefully recover on the rest.
*
*
* Inputs:
* ------
*
*
* Outputs:
* -------
*
*
* Comments:
* --------
*
*************************************<->***********************************/
void
InitErrorHandler( void )
{
XSetErrorHandler(LibError);
XSetIOErrorHandler( (IOErrorHandlerProc) LibIOError);
XtSetWarningHandler(ToolkitWarning);
XtSetErrorHandler(ToolkitError);
}
/*************************************<->*************************************
*
* LibError (display, errorEvent)
*
*
* Description:
* -----------
* X error handler. Takes care of X errors so that the server will
* not terminate the session manager on any error.
*
*
* Inputs:
* ------
* errorEvent = pointer to error event returned by the server.
*
*
* Outputs:
* -------
*
* Comments:
* --------
*
*************************************<->***********************************/
static int
LibError(
Display *display,
XErrorEvent *errorEvent )
{
#ifdef DEBUG
switch (errorEvent->error_code)
{
case Success:
break;
case BadAccess:
PrintError(DtError, BAD_ACCESS);
break;
case BadAtom:
PrintError(DtError, BAD_ATOM);
break;
case BadDrawable:
PrintError(DtError, BAD_DRAWABLE);
break;
case BadMatch:
PrintError(DtError, BAD_MATCH);
break;
case BadValue:
PrintError(DtError, BAD_VALUE);
break;
case BadWindow:
PrintError(DtError, BAD_WINDOW);
break;
default:
PrintError(DtError, DEFAULT_ERROR);
break;
}
#endif /*DEBUG*/
return 0;
}
/*************************************<->*************************************
*
* LibIOError ()
*
*
* Description:
* -----------
* IO error handler. In charge of handling IO events from the
* X server
*
*
* Inputs:
* ------
*
*
* Outputs:
* -------
*
* Comments:
* --------
*
*************************************<->***********************************/
static int
LibIOError( void )
{
PrintError(DtError, GETMESSAGE(8, 1, "Connection to server lost - exiting."));
SM_EXIT(-1);
return 0;
}
/*************************************<->*************************************
*
* ToolkitWarning (message)
*
*
* Description:
* -----------
* Handles all toolkit warnings
*
*
* Inputs:
* ------
* message = error message sent by toolkit
*
*
* Outputs:
* -------
*
* Comments:
* --------
*
*************************************<->***********************************/
static void
ToolkitWarning(
char *message )
{
#ifdef DEBUG
PrintError(DtError, message);
#endif /*DEBUG*/
}
/*************************************<->*************************************
*
* ToolkitError (message)
*
*
* Description:
* -----------
* Handles all toolkit errors
*
*
* Inputs:
* ------
* message = error message sent by toolkit
*
*
* Outputs:
* -------
*
* Comments:
* --------
*
* Xt assumes the client will exit when an XtError is generated
* so we must exit since the state will be undefined if we
* continue
*
*
*************************************<->***********************************/
static void
ToolkitError(
char *message )
{
PrintError(DtError, message);
SM_EXIT(-1);
}
/*************************************<->*************************************
*
* PrintError (severity, help)
*
*
* Description:
* -----------
* Handles the printing of all session manager errors using the dt API
* These are simple errors that don't set errno
*
*
* Inputs:
* ------
* severity = severity of the error
* help = help message to user (what type of error)
*
*
* Outputs:
* -------
*
* Comments:
* --------
* WARNING: Currently the va_alist parameter is not used in the
* DtSimpleError is not used
*
*************************************<->***********************************/
void
PrintError(
DtSeverity severity,
char *help )
{
_DtSimpleError(DtProgName, severity, NULL, "%.2000s", help);
}
/*************************************<->*************************************
*
* PrintErrnoError (severity, help)
*
*
* Description:
* -----------
* Handles the printing of all session manager errors using the dt API
* These are simple errors that set errno
*
*
* Inputs:
* ------
* severity = severity of the error
* help = help message to user (what type of error)
*
*
* Outputs:
* -------
*
* Comments:
* --------
* WARNING: Currently the va_alist parameter is not used in the
* DtSimpleErrnoError is not used
*
*************************************<->***********************************/
void
PrintErrnoError(
DtSeverity severity,
char *help )
{
_DtSimpleErrnoError(DtProgName, severity, NULL, "%s", help);
}

View File

@@ -0,0 +1,89 @@
/* $TOG: SmError.h /main/6 1998/10/26 17:20:54 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. *
*/
/************************************<+>*************************************
****************************************************************************
**
** File: SmError.h
**
** Project: HP DT
**
** Description
** -----------
** Variables and definitions needed for
** Error Handling for the session manager
**
**
** (c) Copyright Hewlett-Packard Company, 1990.
**
**
**
****************************************************************************
************************************<+>*************************************/
#ifndef _smerror_h
#define _smerror_h
/*
* #include statements
*/
/*
* #define statements
*/
/*
* Error messages trapped by X window calls - These are never displayed
*/
#define BAD_ACCESS "Attempt to access unavailable resource"
#define BAD_ATOM "Atom for argument is not a defined atom"
#define BAD_DRAWABLE "Drawable argument is invalid"
#define BAD_MATCH "Drawable is a invalid match for operation"
#define BAD_VALUE "Value in X call is invalid"
#define BAD_WINDOW "Window does not exist"
#define DEFAULT_ERROR "Non-fatal error from X server"
/*
* typedef statements
*/
/*
* All NLS error messages
*/
typedef struct _NlsStrings
{
char *cantLockErrorString;
char *trustedSystemErrorString;
char *cantMallocErrorString;
char *cantOpenFileString;
char *cantForkClientString;
char *cantExecClientString;
char *cantCreateDirsString;
} NlsStrings;
/*
* External variables
*/
extern NlsStrings smNLS;
/*
* External Interface
*/
extern void InitErrorHandler( void ) ;
extern void PrintError( DtSeverity , char *) ;
extern void PrintErrnoError( DtSeverity , char *) ;
#ifndef NO_MESSAGE_CATALOG
char * GetMessage( int, int, char * );
#endif
#endif /*_smerror_h*/
/* DON'T ADD ANYTHING AFTER THIS #endif */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,67 @@
/* $TOG: SmGlobals.h /main/10 1997/03/20 16:04:11 barstow $ */
/* *
* (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. *
*/
/************************************<+>*************************************
****************************************************************************
**
** File: SmGlobals.h
**
** Project: HP DT
**
** Description
** -----------
** Variables and declarations needed for
** the global processing routines for the session manager
**
**
** (c) Copyright Hewlett-Packard Company, 1990.
**
**
**
****************************************************************************
************************************<+>*************************************/
#ifndef _smglobals_h
#define _smglobals_h
/*
* #include statements
*/
/*
* #define statements
*/
#define SM_DISPLAY_HOME "display-home"
#define SM_DISPLAY_CURRENT "display-current"
#define SmNewString(str) strdup(str)
/*
* typedef statements
*/
/*
* External variables
*/
/*
* External Interface
*/
extern void WaitChildDeath(int i);
extern void InitSMGlobals( void ) ;
extern int SetRestorePath( unsigned int , char **) ;
extern int SetSavePath( Boolean , int ) ;
extern int SetFontSavePath(char *) ;
extern void InitNlsStrings( void ) ;
extern void MoveDirectory( char *, char *, Boolean) ;
extern void SetSystemReady();
extern void SmExit ( int exitStatus);
extern void UndoSetSavePath ( );
extern void SetSIGPIPEToDefault ( );
extern void FixPath ( char * the1stPath );
#endif /*_smglobals_h*/
/* DON'T ADD ANYTHING AFTER THIS #endif */

View File

@@ -0,0 +1,217 @@
/* $XConsortium: SmHelp.c /main/4 1995/10/30 09:35:21 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. *
*/
/*************************************<+>*************************************
*****************************************************************************
**
** File: SmHelp.c
**
** Project: HP DT Session Manager (dtsession)
**
** Description:
** -----------
** This module is in charge of all interaction between the session
** manager and the help subsystem. Anytime the user requests help,
** it goes through this routine.
**
**
**
*******************************************************************
** (c) Copyright Hewlett-Packard Company, 1990. All rights are
** reserved. Copying or other reproduction of this program
** except for archival purposes is prohibited without prior
** written consent of Hewlett-Packard Company.
********************************************************************
**
**
**
*****************************************************************************
*************************************<+>*************************************/
#include <stdio.h>
#include <X11/Intrinsic.h>
#include <X11/Shell.h>
#include <Xm/Xm.h>
#include <Xm/MwmUtil.h>
#include <Dt/HelpQuickD.h>
#include "Sm.h"
#include "SmUI.h"
#include "SmHelp.h"
#include "SmGlobals.h"
#ifdef __apollo
#include <X11/apollosys.h>
#endif /* __apollo */
/*
* #define statements
*/
/*
* Global variables
*/
/*
* Local Function Declarations
*/
static void CloseHelpDialog (Widget, XtPointer, XtPointer);
/*************************************<->*************************************
*
* TopicHelpRequested ()
*
*
* Description:
* -----------
* When a user requests help on a given topic - display that topic in a
* new or cached help dialog
*
*
* Inputs:
* ------
* client_data - the id that is sent to Cache Creek which tells it which
* topic to display
*
*
* Outputs:
* -------
* None.
*
*
* Comments:
* --------
*
*************************************<->***********************************/
void
TopicHelpRequested(
Widget w,
XtPointer client_data,
XtPointer call_data )
{
int i;
char *locationId = (char *) client_data;
Widget transientShell;
Arg setArgs2[5];
int n2;
Widget printButton = NULL;
Widget helpButton = NULL;
Widget backButton = NULL;
Widget okButton = NULL;
/*
* Find the shell to make this a transient for for
*/
transientShell = w;
while(!XtIsSubclass(transientShell, shellWidgetClass))
{
transientShell = XtParent(transientShell);
}
if((smDD.smHelpDialog != NULL) &&
(XtIsManaged(smDD.smHelpDialog)))
{
return ;
}
/*
* Use the help dialog already created if it has been - otherwise
* create it
*/
if (smDD.smHelpDialog != NULL)
{
i = 0;
XtSetArg(uiArgs[i], DtNlocationId,locationId); i++;
XtSetValues(smDD.smHelpDialog, uiArgs, i);
i = 0;
XtSetArg(uiArgs[i], XmNtransientFor, transientShell); i++;
XtSetValues(XtParent(smDD.smHelpDialog), uiArgs, i);
XtManageChild(smDD.smHelpDialog);
}
else
{
i = 0;
XtSetArg(uiArgs[i], XmNtitle, GETMESSAGE(29, 1,
"Session Manager Help")); i++;
XtSetArg (uiArgs[i],DtNhelpVolume, SM_HELP_VOLUME); i++;
XtSetArg (uiArgs[i],DtNhelpType, DtHELP_TYPE_TOPIC); i++;
XtSetArg (uiArgs[i], DtNlocationId,locationId); i++;
smDD.smHelpDialog = DtCreateHelpQuickDialog(smGD.topLevelWid,
"helpWidget", uiArgs, i);
i = 0;
XtSetArg(uiArgs[i], XmNtransientFor, transientShell); i++;
XtSetValues(XtParent(smDD.smHelpDialog), uiArgs, i);
XtAddCallback(smDD.smHelpDialog, DtNcloseCallback,
CloseHelpDialog, NULL);
okButton = DtHelpQuickDialogGetChild(smDD.smHelpDialog,
DtHELP_QUICK_CLOSE_BUTTON );
n2=0;
XtSetArg (setArgs2[n2], XmNlabelString, smDD.okString); n2++;
XtSetValues(okButton, setArgs2, n2);
printButton = DtHelpQuickDialogGetChild(smDD.smHelpDialog,
DtHELP_QUICK_PRINT_BUTTON );
helpButton = DtHelpQuickDialogGetChild(smDD.smHelpDialog,
DtHELP_QUICK_HELP_BUTTON );
backButton = DtHelpQuickDialogGetChild(smDD.smHelpDialog,
DtHELP_QUICK_BACK_BUTTON );
XtUnmanageChild(printButton);
XtUnmanageChild(helpButton);
XtUnmanageChild(backButton);
XtAddCallback (XtParent(smDD.smHelpDialog), XmNpopupCallback,
DialogUp, NULL);
XtManageChild(smDD.smHelpDialog);
}
}
/*************************************<->*************************************
*
* CloseHelpDialog ()
*
*
* Description:
* -----------
* This callback is called when the user wishes to dismiss the help callback
*
*
* Inputs:
* ------
*
*
* Outputs:
* -------
*
*
* Comments:
* --------
*
*************************************<->***********************************/
static void
CloseHelpDialog (Widget w,
XtPointer clientData,
XtPointer callData)
{
XtUnmanageChild(smDD.smHelpDialog);
}

View File

@@ -0,0 +1,62 @@
/* $XConsortium: SmHelp.h /main/8 1996/02/09 16:01:30 barstow $ */
/* *
* (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. *
*/
/************************************<+>*************************************
****************************************************************************
**
** File: SmHelp.h
**
** Project: HP DT
**
** Description
** -----------
** Variables and declarations needed for
** Help for the session manager
**
**
** (c) Copyright Hewlett-Packard Company, 1990.
**
**
**
****************************************************************************
************************************<+>*************************************/
#ifndef _smhelp_h
#define _smhelp_h
#include <Xm/Xm.h>
/*
* #define statements
*/
#define HELP_LOGOUT_STR "ConfirmLogoutDE"
#define HELP_LOGOUT_QUERY_STR "SEConfirmLogoutWithChoiceDE"
#define HELP_LOGOUT_COMPAT_MODE_STR "logoutCompatModeHelp"
#define HELP_BMS_DEAD_STR "bmsDeadHelp"
#define HELP_CONFIRMATION_SESSION_STR "ConfirmSessionCreation"
#define HELP_XSMP_INIT_FAILURE_STR "SessionInitFailure"
#define HELP_SESSION_SAVE_ERROR_STR "SessionSaveError"
#define HELP_APP_CLOSE_REASONS_STR "ApplicationCloseReasons"
/*
* typedef statements
*/
/*
* External variables
*/
/*
* External Interface
*/
extern void TopicHelpRequested( Widget, XtPointer, XtPointer ) ;
#endif /*_smhelp_h*/
/* DON'T ADD ANYTHING AFTER THIS #endif */

View File

@@ -0,0 +1,177 @@
/* $XConsortium: SmHftRing.c /main/5 1996/11/01 10:17:15 drk $ */
/* *
* (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. *
*/
/*************************************<+>*************************************
*****************************************************************************
**
** File: SmHftRing.c
**
** Project: DT Session Manager (dtsession)
**
** Description:
** -----------
** This file contains the AIX 3.2.x specific code required to enable and
** disable the HFT ring. This is used for session locking.
**
*****************************************************************************
*************************************<+>*************************************/
#include <stdio.h>
#include <sys/hft.h>
#include <fcntl.h>
#include "Sm.h"
#include <X11/Xosdefs.h>
#include <errno.h>
#ifdef X_NOT_STDC_ENV
extern int errno;
#endif
/*
* Local functions.
*/
static int open_hft_file(char *);
static void close_hft_file(int);
static int get_hft_ring(void);
static int process_hft(int, unsigned int);
static int scan_hft_ring(int);
static int my_strpos(char *, char);
static int is_local_display(void);
#define HFTRFILE "/dev/hft/0"
#define HFQSTAT hftqstat
#define HFSMGRCMD hftsmgrcmd
#define HFQEIO HFQERROR
#define HFCSMGR HFTCSMGR
#define HFQSMGR HFTQSMGR
#define HFVTSTATUS (HFVTACTIVE | HFVTNOHOTKEY)
#define HF_VTIODN hf_vtid
/*
* Global variables.
*/
int hft_file;
struct HFQSTAT hft_ring;
static int
open_hft_file(char *hft_file_name)
{
return(open(hft_file_name, O_RDONLY));
}
static void
close_hft_file(int hft_file)
{
close(hft_file);
}
static int
get_hft_ring(void)
{
int rc = -1;
struct hfbuf hft_buffer;
hft_buffer.hf_bufp = (char *)&hft_ring;
hft_buffer.hf_buflen = sizeof(hft_ring);
/*
* Open the hft queue manager.
*/
if ((hft_file = open_hft_file(HFTRFILE)) >= 0)
{
rc = ioctl(hft_file, HFQSMGR, &hft_buffer);
close_hft_file(hft_file);
}
return(rc);
}
static int
process_hft(int hft_action, unsigned int hft_vtid)
{
struct HFSMGRCMD hft_manager;
char hft_file_name[20];
int rc = -1;
hft_manager.hf_cmd = hft_action;
hft_manager.hf_vtid = hft_vtid;
sprintf(hft_file_name, "/dev/hft/%u", hft_vtid);
if ((hft_file = open_hft_file(hft_file_name)) >= 0)
{
rc = ioctl(hft_file, HFCSMGR, &hft_manager);
close_hft_file(hft_file);
}
return(rc);
}
static int
scan_hft_ring(int hft_action)
{
int hft;
int rc = 0;
if (get_hft_ring() != 0)
{
return(-1);
}
for (hft = 0; hft < hft_ring.hf_numvts; hft++)
{
if (!(hft_ring.hf_vtinfo[hft].hf_vtstate & HFVTSTATUS))
{
if (process_hft(hft_action, hft_ring.hf_vtinfo[hft].HF_VTIODN) != 0)
{
return(-1);
}
}
}
return(0);
}
static int
my_strpos(char *s, char c)
{
char *t;
return((t=strchr(s,c)) == NULL ? -1 : t - s);
}
static int
is_local_display(void)
{
static int is_local = -1; /* display status */
char *dpyname; /* display name */
int n; /* position of colon char */
char hostname[MAXHOSTNAMELEN]; /* host name */
if (is_local == -1)
{
is_local =
(((dpyname = getenv("DISPLAY")) != NULL) && /* name not null */
((n = my_strpos(dpyname, ':')) != -1) && /* name has a colon */
((n == 0) || /* name is :n */
(strncmp(dpyname, "unix", n) == 0) || /* name is unix:n */
(strncmp(dpyname, "localhost", n) == 0) || /* name is localhost:n */
((gethostname(hostname, MAXHOSTNAMELEN) == 0) && /* hostname ok */
(strncmp(dpyname, hostname, n) == 0)))); /* name == hostname */
}
return(is_local);
}
void
AixEnableHftRing(int enable)
{
if (is_local_display())
{
scan_hft_ring(enable ? SMUNHIDE : SMHIDE);
}
}

View File

@@ -0,0 +1,51 @@
/* $XConsortium: SmHftRing.h /main/4 1995/10/30 09:35:50 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. *
*/
/************************************<+>*************************************
****************************************************************************
**
** File: SmHftRing.h
**
** Project: DT Session Manager (dtsession)
**
** Description
** -----------
** This file contains the AIX 3.2.x specific declarations required to
** enable and disable the HFT ring. This is used for session locking.
**
****************************************************************************
************************************<+>*************************************/
#ifndef _smhftring_h
#define _smhftring_h
/*
* #include statements
*/
/*
* #define statements
*/
/*
* typedef statements
*/
/*
* External variables
*/
/*
* External Interface
*/
extern void AixEnableHftRing(int);
#endif /*_smhftring_h*/
/* DON'T ADD ANYTHING AFTER THIS #endif */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,63 @@
/* $XConsortium: SmLock.h /main/4 1995/10/30 09:36:10 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. *
*/
/************************************<+>*************************************
****************************************************************************
**
** File: SmLock.h
**
** Project: HP DT
**
** Description
** -----------
** Variables and declarations needed for
** Lock Handling for the session manager
**
**
** (c) Copyright Hewlett-Packard Company, 1990.
**
**
**
****************************************************************************
************************************<+>*************************************/
#ifndef _smlock_h
#define _smlock_h
/*
* #include statements
*/
/*
* #define statements
*/
/*
* Type of lock states possible during session
*/
#define UNLOCKED 0
#define LOCKED 1
/*
* typedef statements
*/
/*
* External variables
*/
/*
* External Interface
*/
extern void LockDisplay( Boolean locknow ) ;
extern void CreateLockCursor( void ) ;
#endif /*_smlock_h*/
/* DON'T ADD ANYTHING AFTER THIS #endif */

View File

@@ -0,0 +1,648 @@
/* $TOG: SmMain.c /main/18 1998/04/20 12:59:26 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. *
*/
/*************************************<+>*************************************
*****************************************************************************
**
** File: SmMain.c
**
** Project: HP DT Session Manager (dtsession)
**
** Description:
** -----------
** This is the controlling program for the session manager. It
** calls routines to start the BMS, initialize globals and handlers,
** and restore the correct session.
**
**
*******************************************************************
** (c) Copyright Hewlett-Packard Company, 1990. All rights are
** reserved. Copying or other reproduction of this program
** except for archival purposes is prohibited without prior
** written consent of Hewlett-Packard Company.
********************************************************************
**
**
**
*****************************************************************************
*************************************<+>*************************************/
#include <stdio.h>
#include <locale.h>
#ifdef __osf__
#include <sys/access.h>
#endif
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
#if defined (USE_X11SSEXT)
#include <X11/extensions/scrnsaver.h>
#endif /* USE_X11SSEXT */
#include <Xm/Xm.h>
#include <Dt/UserMsg.h>
#include <Dt/EnvControlP.h>
#include <Dt/DtP.h>
#include "Sm.h"
#include "SmError.h"
#include "SmGlobals.h"
#include "SmCommun.h"
#include "SmRestore.h"
#include "SmUI.h"
#include "SrvPalette.h"
#include "SmProtocol.h"
#include "SmXSMP.h"
/*
* Internal Functions
*/
void main(int, char **);
static void StopAll(int i);
static int RegisterX11ScreenSaver(Display *display, int *ssEventType);
/*
* Internal Defines
*/
#ifdef __hpux
#define SECURE_SYS_PATH "/.secure/etc/passwd"
#endif
#ifdef _AIX
#define SECURE_SYS_PATH "/etc/security/passwd"
#endif
#ifdef SVR4
#define SECURE_SYS_PATH "/etc/shadow"
#endif
/*************************************<->*************************************
*
* main (argc, argv)
*
*
* Description:
* -----------
* Controls the startup and event dispatching of the session manager.
*
*
* Inputs:
* ------
* argc = command line options
* argv = number of command line options
*
*
* Outputs:
* -------
*
*
* Comments:
* --------
*
*************************************<->***********************************/
void
main (int argc,
char **argv)
{
int n, tmp;
Arg args[10];
XEvent next;
String tmpString;
XWindowAttributes windAtt;
XPropertyEvent *pEvent = (XPropertyEvent *) &next;
int status;
struct stat buf;
Display *srvDisplay;
struct sigaction stopvec;
char *lang;
#ifdef __osf__
# include <sys/sysinfo.h>
# include <sys/proc.h>
unsigned long op;
int buffer[2];
unsigned long nbytes = 1;
char* arg = 0;
unsigned long flag = 0;
int ssi_status;
op = SSI_NVPAIRS;
buffer[0] = SSIN_UACPROC;
buffer[1] = UAC_NOPRINT;
# ifdef DEBUG_UAC
buffer[1] |= UAC_SIGBUS;
# endif
ssi_status = setsysinfo ( op, buffer, nbytes, arg, flag );
#endif
setlocale( LC_ALL, "" );
XtSetLanguageProc( NULL, NULL, NULL );
smGD.smState = IN_PROCESS;
smGD.programName = strdup (argv[0]);
/*
* We report some errors before we call the DtInitialize procedure.
* The Dt initialize procedure sets this name. If we report
* an error via DtSimple error before this is set we see the message
* prepended with <unknown program name> in the error log.
*/
DtProgName = SM_RESOURCE_NAME ;
#ifdef DEBUG
if(argc > 5)
{
int junk = 1;
while(junk)
{
junk = 1;
}
}
#endif /* DEBUG */
/*
* Set our effective gid to the real gid until we need it to be
* sys (during contention management)
*/
smGD.runningGID = getgid();
smGD.conMgmtGID = getegid();
/*
* Set uid up according to whether this is a secure system
* Secure systems need root priviledges to read the /etc/passwd file
*/
smGD.runningUID = getuid();
#ifdef SECURE_SYS_PATH
status = stat(SECURE_SYS_PATH, &buf);
#else
status = -1;
#endif
/*
* Initialize LANG if it isn't defined.
*/
if ((lang = getenv ("LANG")) == NULL)
{
lang = XtMalloc (7);
(void) strcpy (lang, "LANG=C");
(void) putenv (lang);
}
if(status == -1)
{
/*
* this is not a secure system - remove all suid priviledges
*/
smGD.unLockUID = smGD.runningUID;
smGD.secureSystem = False;
SM_SETESUID(smGD.runningUID);
}
else
{
/*
* Save the root priviledge to be restored when trying to unlock
*/
smGD.unLockUID = geteuid();
smGD.secureSystem = True;
SM_SETEUID(smGD.runningUID);
}
#ifdef __hpux
setresgid(-1, smGD.runningGID, -1);
#else /* _AIX or any other system */
#ifndef SVR4
setregid(smGD.conMgmtGID, smGD.runningGID);
#else
setgid(smGD.conMgmtGID);
setegid(smGD.runningGID);
#endif
#endif /* !hpux */
/*
* Set up POSIX sigaction structs
*/
/*
* Must set SIGPIPE to SIG_IGN so the process does not exit
* if a child terminates unexpectedly during an I/O operation
* that raises SIGPIPE. Note that before this process exec's
* any subprocesses, SIGPIPE must be set to SIG_DFL.
*/
sigemptyset(&stopvec.sa_mask);
stopvec.sa_flags = 0;
stopvec.sa_handler = SIG_IGN;
(void) sigaction(SIGPIPE, &stopvec, (struct sigaction *) NULL);
stopvec.sa_handler = StopAll;
sigemptyset(&stopvec.sa_mask);
stopvec.sa_flags = 0;
smGD.childvec.sa_handler = WaitChildDeath;
sigemptyset(&smGD.childvec.sa_mask);
smGD.childvec.sa_flags = 0;
smGD.defvec.sa_handler = SIG_DFL;
sigemptyset(&smGD.defvec.sa_mask);
smGD.defvec.sa_flags = 0;
smGD.appCon = 0;
smGD.display = 0;
/*
* This must be done before XtToolkitInitialize
* to set up the local environment
*/
_DtEnvControl(DT_ENV_SET);
_DtEnvControl(DT_ENV_SET_BIN);
/*
* Set up NLS error messages first
*/
InitNlsStrings();
/*
* Set the paths of where resources are to be restored from
*/
SetRestorePath(argc, argv);
/*
* The first thing that must happen is that resources must be restored
* so that my resources will be correct
*/
if(smGD.compatMode == False)
{
/*
* Load session resources.
*/
RestoreResources(False,
"-load",
"-system",
"-xdefaults",
smGD.resourcePath[0] != '\0' ? "-file" : NULL,
smGD.resourcePath,
NULL);
}
/*
* Set up to catch SIGTERM
*/
stopvec.sa_handler = StopAll;
sigemptyset(&stopvec.sa_mask);
stopvec.sa_flags = 0;
sigaction(SIGTERM, &stopvec, (struct sigaction *) NULL);
/*
* Now set up a communication with the toolkit
*
* Create one display connection for dtsession, and one for
* the color server. We cannot share a display connection since
* motif creates a display object for the color server's display during
* color server initialization. Since the color server is not yet
* operational, any dialogs (ie the dtsession logout confirmation
* dialogs) created on that display do not get the color server colors.
* The dtsession display object is created after color server
* initialization is complete.
*/
if (smGD.appCon == 0) {
/*
* The following code will have been initialized if the
* session creation code posted a dialog.
*/
XtToolkitInitialize();
smGD.appCon = XtCreateApplicationContext();
smGD.display = XtOpenDisplay(smGD.appCon, NULL, argv[0],
SM_RESOURCE_CLASS,
NULL, 0, &argc, argv);
}
srvDisplay = XtOpenDisplay(smGD.appCon, NULL, argv[0], SM_RESOURCE_CLASS,
NULL, 0, &argc, argv);
/*
* Initialize XSMP
*/
if (!InitXSMP (argv[0]))
SM_EXIT(-1);
/* Added the following check to exit in case of error RK 09.08.93 */
if(smGD.display == NULL)
{
PrintError(DtError, GETMESSAGE(4, 1, "Invalid display name - exiting."));
SM_EXIT(-1);
}
/*
* Lock out other session managers from running - if there is one
* running already - exit
*/
if(!_DtGetLock(smGD.display, SM_RUNNING_LOCK))
{
PrintError(DtError, GETMESSAGE(2, 2, "Another dtsession is currently running - exiting."));
SM_EXIT(-1);
}
/*
* Restore preferences
*/
if (smGD.resourcePath[0] != '\0')
{
RestorePreferences(smGD.resourcePath);
}
/*
* Start up the color server
*/
InitializeDtcolor(srvDisplay, smGD.sessionType);
/*
* AFTER the colors are set up - create the top level widget
* Set up a NULL WM_COMMAND property
*/
n = 0;
XtSetArg(args[n], XmNbackground,
XBlackPixel(smGD.display, XDefaultScreen(smGD.display))); n++;
XtSetArg(args[n], XmNmappedWhenManaged, False); n++;
XtSetArg (args[n], XmNwidth, 1); n++;
XtSetArg (args[n], XmNheight, 1); n++;
smGD.topLevelWid = XtAppCreateShell (SM_RESOURCE_NAME, SM_RESOURCE_CLASS,
applicationShellWidgetClass,
smGD.display, args, n);
XtRealizeWidget(smGD.topLevelWid);
/*
* Select to get the lock on timeout if the user requests it
* and if the server supports it. This must be done before
* InitSMGlobals() so smGD.lockOnTimeoutStatus is known.
*/
#if defined (USE_HPSSEXT)
#ifdef USE_HP_SPECIFIC_XLIB
tmp = XHPSSChangeNotify(smGD.display, &XaSmScreenSaveRet, 3);
#else /* USE_HP_SPECIFIC_XLIB */
tmp = -1;
#endif /* USE_HP_SPECIFIC_XLIB */
#elif defined (USE_X11SSEXT)
tmp = RegisterX11ScreenSaver(smGD.display, &smGD.ssEventType);
#else
tmp = -1;
#endif
if(tmp != 0)
{
smGD.lockOnTimeoutStatus = False;
XaSmScreenSaveRet = None;
#if defined (USE_X11SSEXT)
smGD.ssEventType = None;
#endif
}
else
{
smGD.lockOnTimeoutStatus = True;
}
InitSMGlobals();
/*
* Put the program into a wait state
*/
ShowWaitState(True);
InitErrorHandler();
/*
* Restore resources for lang/resolution independence
*/
if((smGD.resourcePath[0] != NULL) || (smGD.compatMode == False))
{
RestoreIndependentResources();
}
/*
* Now restore the rest of the clients and the settings
*/
if((smGD.clientPath[0] != NULL) && (smGD.compatMode == False))
{
if(RestoreState() == -1)
{
StartWM();
}
}
else
{
if(smGD.compatMode == True)
{
/*
* dtstyle needs the DT_SESSION_STATE even in
* compatibility mode
*/
SetCompatState();
}
StartWM();
}
/*
* Run the user's startup script if there is one
*/
if(smGD.compatMode == False)
{
StartEtc(False); /* run sessionetc */
}
InitProtocol ();
/*
* If we are in compatibility mode - kill the parent and leave the
* child running so that the script exits
*/
if(smGD.compatMode == True)
{
KillParent();
}
/*
* Select for property notify on the top level window - so that
* when the style manager changes something - it is known
*/
XGetWindowAttributes(smGD.display, smGD.topLevelWindow, &windAtt);
XSelectInput(smGD.display, smGD.topLevelWindow,
windAtt.your_event_mask | PropertyChangeMask);
ShowWaitState(False);
/*
* Register for events
* - PropertyChange (maskable)
* - ClientMessage (non-maskable)
*/
XtAddEventHandler(smGD.topLevelWid,
PropertyChangeMask,
True, ProcessEvent, NULL);
smGD.smState = READY;
#ifdef __osf__
/* If we've just populated a new .dtprofile into the user's home
* directory, put up a popup dialog explaining the need to edit it
* to allow .login/.profile to work properly
*/
arg = getenv("DTNEWPROFILE");
if (arg)
WarnNewProfile();
#endif
while(1)
{
XtAppNextEvent(smGD.appCon, &next);
if (next.type != 0)
{
#if defined (USE_X11SSEXT)
if (next.type == smGD.ssEventType)
{
/*
* We should simply be calling XtDispatchEvent() but the toolkit
* doesn't seem to know how to dispatch a run-time generated
* event type.
*/
ProcessEvent(smGD.topLevelWid, NULL, &next, NULL);
}
else
{
XtDispatchEvent(&next);
}
#else
XtDispatchEvent(&next);
#endif
}
}
}
/*************************************<->*************************************
*
* StopAll
*
*
* Description:
* -----------
* Signal handler for SIGTERM. Causes dtsession to do a normal shutdown
* procedure without saving any state.
*
*
* Inputs:
* ------
* shutDown (state flag)
*
*
* Outputs:
* -------
*
*
* Comments:
* --------
*
* We want to be careful to ignore the TERM signal if we are already
* shutting down when it occurs.
*
*************************************<->***********************************/
static void
StopAll(int i)
{
ImmediateExit(-1, 0, True);
}
/*************************************<->*************************************
*
* RegisterX11ScreenSaver
*
*
* Description:
* -----------
* Register with X11 screen saver server extension for screen saver events.
*
* Inputs:
* ------
* display - display from XtOpenDisplay()
* pssEventType - pointer to buffer in which to return ss event type
*
* Outputs:
* -------
* pssEventType - (rc=0) screen saver event type, (rc!=0) undefined
*
* Returns:
* -------
* 0 - successfully registered for screen saver events
* other - failed to register for screen saver events
*
* Comments:
* --------
*
*************************************<->***********************************/
#if defined (USE_X11SSEXT)
static int
RegisterX11ScreenSaver(
Display *display,
int *pssEventType)
{
/*
* Register with X11 screen saver server extension.
*/
int result = -1;
int ssErrorBase;
int majorVersion;
int minorVersion;
int screen;
Window root;
XID xid;
XSetWindowAttributes attr;
Atom type;
if (XScreenSaverQueryExtension(display, pssEventType, &ssErrorBase) &&
XScreenSaverQueryVersion(display, &majorVersion, &minorVersion) &&
majorVersion == 1)
{
/*
* Server supports requested version of X11 screen saver extension.
*/
screen = DefaultScreen(display);
root = DefaultRootWindow(display);
XGrabServer(display);
if (!XScreenSaverGetRegistered(display, screen, &xid, &type))
{
/*
* No other clients registered with this server so register this one.
*/
XScreenSaverRegister(display, screen, XtWindow(smGD.topLevelWid), XA_WINDOW);
result = 0;
}
XUngrabServer(display);
if (result == 0)
{
/*
* Registration successful.
*/
XScreenSaverSelectInput(display, root,
ScreenSaverNotifyMask|ScreenSaverCycleMask);
XScreenSaverSetAttributes(display, root, 0, 0, 1, 1, 0, CopyFromParent,
CopyFromParent, CopyFromParent, CWBackPixel, &attr);
}
}
return(result);
}
#endif /* USE_X11SSEXT */

View File

@@ -0,0 +1,695 @@
/* $XConsortium: SmMigResources.c /main/4 1996/05/08 20:11:34 drk $ */
static char sccsid[] = "@(#)48 1.2 src/cde/cde1/dtsession/SmMigResources.c, desktop, cde41J, 9520A_all 5/16/95 08:31:12";
/*
* COMPONENT_NAME: desktop
*
* FUNCTIONS: MigrateResources
*
* ORIGINS: 27
*
* IBM CONFIDENTIAL -- (IBM Confidential Restricted when
* combined with the aggregated modules for this product)
* OBJECT CODE ONLY SOURCE MATERIALS
*
* (C) COPYRIGHT International Business Machines Corp. 1995
* All Rights Reserved
* US Government Users Restricted Rights - Use, duplication or
* disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*/
#include <stdio.h>
#include <string.h>
#include <Dt/DtNlUtils.h>
/* defines for return codes */
#define RC_SUCCESS 0
#define RC_OPEN_ERROR 1
#define RC_END_OF_FILE 2
#define RC_MEMORY_ALLOCATION_ERROR 3
#define RC_LINE_CONTINUED 4
#define RC_PARTIAL_LINE 5
#define RC_WRITE_ERROR_TEMP 6
/* type 1 resources are of the form:
[*.]convert1[i]
Example of a resource specification of this type:
*foreground: Blue
*/
#define NUMBER_OF_CONVERT1 15
static char *convert1[NUMBER_OF_CONVERT1]
= {
"displayResolution",
"systemFont",
"userFont",
"FontList",
"Font",
"FontSet",
"multiClickTime",
"sessionVersion",
"background",
"foreground",
"ColorUse",
"HelpColorUse",
"background",
"foreground",
"enableBtn1Transfer"
}
;
/* type 2 resources are of the form:
CONVERT2_0{* or .}CONVERT2_1{* or .}convert2[i]
Example of a resource specification of this type:
dtsession*extension*cycleTimeout: 10
*/
#define CONVERT2_0 "dtsession"
#define CONVERT2_1 "extension"
#define NUMBER_OF_CONVERT2 5
static char *convert2[NUMBER_OF_CONVERT2]
= {
"cycleTimeout",
"lockTimeout",
"saverTimeout",
"random",
"saverList",
}
;
/* type 3 resources are of the form:
convert31[i]{* or .}convert32[i]
Example of a resource specification of this type:
Dtwm*useIconBox: True
*/
#define NUMBER_OF_CONVERT3 26
static char *convert31[NUMBER_OF_CONVERT3]
= {
"dtsession",
"dtsession",
"dtsession",
"dtsession",
"dtsession",
"dtsession",
"Dtstyle",
"Dtstyle",
"Dtwm",
"Dtwm",
"Dtwm",
"Dtwm",
"wsHelp",
"wsHelp",
"wsHelp",
"wsHelp",
"wsHelp",
"wsHelp",
"wsHelp",
"wsHelp",
"wsHelp",
"wsHelp",
"wsHelp",
"wsHelp",
"wsHelp",
"cachedHelp"
}
;
static char *convert32[NUMBER_OF_CONVERT3]
= {
"displayResolution" ,
"sessionLanguage" ,
"saverTimeout" ,
"cycleTimeout" ,
"lockTimeout" ,
"saverList" ,
"lockoutScale" ,
"timeoutScale" ,
"keyboardFocusPolicy",
"focusAutoRaise" ,
"moveOpaque" ,
"useIconBox" ,
"onScreen" ,
"x" ,
"y" ,
"columns" ,
"rows" ,
"helpType" ,
"vPCount" ,
"tTitle" ,
"helpVolume" ,
"locationId" ,
"stringData" ,
"windowGroup" ,
"wsName" ,
"cachedCount"
}
;
/* type 4 resources are of the form:
{* or .}convert4[i]{* or .}CONVERT4_2
Example of a resource specification of this type:
*XmText*FontList: Big
*/
#define CONVERT4_2 "FontList"
#define NUMBER_OF_CONVERT4 2
static char *convert4[NUMBER_OF_CONVERT4]
= {
"XmText",
"XmTextField"
}
;
/* type 5 resources are of the form:
convert5[i]{* or .}<any value>{* or .}CONVERT5_2
Example of a resource specification of this type:
Dtwm*0*helpResources: xxx
*/
#define CONVERT5_2 "helpResources"
#define NUMBER_OF_CONVERT5 2
/* these are of the form p1*#*helpResources */
static char *convert5[NUMBER_OF_CONVERT5]
= {
"Dtwm",
"Mwm"
}
;
/* type 6 resources are of the form:
CONVERT6_0<any value>{* or .}convert6[i]
Example of a resource specification of this type:
oWsHelp10*x: xxx
*/
#define CONVERT6_0 "oWsHelp"
#define NUMBER_OF_CONVERT6 11
static char *convert6[NUMBER_OF_CONVERT6]
= {
"x",
"y",
"columns",
"rows",
"helpType",
"vPCount",
"tTitle",
"helpVolume",
"locationId",
"stringData",
"workspaces"
}
;
/* type 7 resources are of the form:
CONVERT7_01{* or .}<any value>{* or .}convert7[i]
- or -
CONVERT7_02{* or .}<any value>{* or .}convert7[i]
Examples of resource specifications of this type:
Dtwm*0*initialWorkspace: xxx
Mwm*0*initialWorkspace: xxx
*/
#define CONVERT7_01 "Mwm"
#define CONVERT7_02 "Dtwm"
#define NUMBER_OF_CONVERT7 3
/* these are of the form Mwm|Dtwm*XXX*resource */
static char *convert7[NUMBER_OF_CONVERT7]
= {
"initialWorkspace",
"workspaceList",
"workspaceCount"
}
;
/* type 8 resources are of the form:
CONVERT8_01{* or .}<any value>{* or .}<any value>{* or .}convert8[i]
- or -
CONVERT8_02{* or .}<any value>{* or .}<any value>{* or .}convert8[i]
Examples of resource specifications of this type:
Mwm*0*ws01*title: xxx
Dtwm*1ws02*title: xxx
*/
#define CONVERT8_01 "Mwm"
#define CONVERT8_02 "Dtwm"
#define NUMBER_OF_CONVERT8 3
static char *convert8[NUMBER_OF_CONVERT8]
= {
"title",
"geometry",
"iconBoxGeometry"
}
;
/* type 9 resources are of the form:
CONVERT9_01{* or .}<any value>{* or .}<any value>{* or .}convert91[i] \
{* or .}convert92[i]
- or -
CONVERT9_02{* or .}<any value>{* or .}<any value>{* or .}convert91[i] \
{* or .}convert92[i]
Example of resource specification of this type:
Dtwm*0*ws01*backdrop*image: Drops
*/
#define CONVERT9_01 "Mwm"
#define CONVERT9_02 "Dtwm"
#define NUMBER_OF_CONVERT9 3
static char *convert91[NUMBER_OF_CONVERT9]
= {
"backdrop",
"FrontPanel",
"MyFrontPanel"
}
;
static char *convert92[NUMBER_OF_CONVERT9]
= {
"image" ,
"geometry",
"geometry"
}
;
/* type 10 resources are of the form:
*<any value>{* or .}convert10[i]
Example of a resource specification of this type:
*0*ColorPalette: Default.dp
*/
#define NUMBER_OF_CONVERT10 3
static char *convert10[NUMBER_OF_CONVERT10]
= {
"MonochromePalette",
"ColorUse",
"ColorPalette"
}
;
/* define the maximum fields in a resource specification
(which does not include the value of the resource) that
is required by this routine
*/
#define NUMBER_OF_FIELDS 6
static char * field[NUMBER_OF_FIELDS];
/* this function determines whether a field extracted from the resource
matches a string in the specified array.
Returns:
TRUE = if strings match
FALSE = if string do not match.
*/
int check_match1(char * match[], int noelements, int match1)
{
int i;
int matched = FALSE;
for (i=0;((matched == FALSE) &&
(i<noelements));i++)
{
if (strcmp(field[match1],match[i]) == 0)
{
matched =TRUE;
}
}
return(matched);
}
/* this function determines whether a fields extracted from the resource
match strings in the specified arrays.
Returns:
TRUE = if strings match
FALSE = if string do not match.
*/
int check_match2(char * match1_str[], char * match2_str[],
int noelements, int match1, int match2)
{
int i;
int matched = FALSE;
for (i=0;((matched == FALSE) &&
(i<noelements));i++)
{
if ((strcmp(field[match1],match1_str[i]) == 0) &&
(strcmp(field[match2],match2_str[i]) == 0))
{
matched =TRUE;
}
}
return(matched);
}
/* this function reads all resources from the input file.
If the resource matches those written from within desktop on 4.1.1 and
4.1.2, the resource is written to the output file.
Otherwise, the resource is not written to the output file.
Return codes:
RC_SUCCESS
RC_OPEN_ERROR
RC_MEMORY_ALLOCATION_ERROR
RC_WRITE_ERROR_TEMP
*/
MigrateResources(char * inputfile, char * outputfile)
{
int size_of_buffer = 1024;
int size_of_mbuffer = 1024;
int rc = RC_SUCCESS;
FILE * out_fh;
FILE * in_fh;
int write_line;
int chars_written;
int type_found = FALSE;
char * string;
char * realend;
int done=0;
int new_size = 0;
int number_fields = 0;
char * inputbuffer=NULL;
char * inputbuffer1=NULL;
char * unmodified_buffer=NULL;
char * resource_end;
char * first_space;
char * tmp1;
int i;
int charlen;
/* Initialize for multi-byte */
DtNlInitialize();
done = RC_SUCCESS;
/* open input and output files and exit if not successful */
in_fh = fopen(inputfile,"r");
out_fh = fopen(outputfile,"w");
if ((out_fh != NULL) && (in_fh != NULL))
{
/* allocate buffers for reading lines from the input file */
inputbuffer = malloc ((size_of_buffer + 1) * sizeof(char *));
inputbuffer1 = malloc ((size_of_buffer + 1) * sizeof(char *));
unmodified_buffer = malloc ((size_of_mbuffer + 1)
* sizeof(char *));
if ((inputbuffer != NULL) &&
(inputbuffer1 != NULL) &&
(unmodified_buffer != NULL))
{
do
{
*inputbuffer = '\0';
*inputbuffer1 = '\0';
*unmodified_buffer = '\0';
/* read and process each line from the input file */
do
{
/* read until an line has been read */
rc = RC_SUCCESS;
string = fgets((char *)inputbuffer1, size_of_buffer, in_fh);
/* if read was successful, then ...*/
if (string != NULL)
{
/* determine if a larger unmodified buffer
needs to be allocated
*/
new_size = strlen(unmodified_buffer) +
strlen(inputbuffer1) + 2;
if (new_size > size_of_mbuffer)
{
unmodified_buffer = realloc(unmodified_buffer,
new_size);
size_of_mbuffer = new_size;
}
/* save unmodified data read */
strcat(unmodified_buffer,inputbuffer1);
/* set indicator if entire line was not read */
DtLastChar(inputbuffer1,&realend,&charlen);
if ((charlen == 1) && (*realend != '\n'))
{
rc = RC_PARTIAL_LINE;
}
else
{
/* if entire line was read but it ends
with a continuation character
then, remove the ending continuation character or
spaces preceeded by an ending
continuation character.
*/
realend=DtPrevChar(inputbuffer1,realend);
for (;((DtIsspace(realend) != 0) &&
(realend > inputbuffer1));)
{
realend=DtPrevChar(inputbuffer1,realend);
}
if ((mblen(realend,MB_CUR_MAX) == 1) &&
(*realend == '\\'))
{
*realend = '\0';
rc = RC_LINE_CONTINUED;
}
}
/* allocate larger input buffer if necessary */
new_size = strlen(inputbuffer) +
strlen(inputbuffer1) + 2;
if (new_size > size_of_buffer)
{
inputbuffer = realloc(inputbuffer,new_size);
size_of_buffer = new_size;
}
/* concatenate modified buffer to previously
read buffer
*/
strcat(inputbuffer,inputbuffer1);
}
else
{
rc = RC_END_OF_FILE;
}
} while ((rc == RC_LINE_CONTINUED) || (rc == RC_PARTIAL_LINE));
/* if read was successful, then determine if the resources
read are part of the set that need to be retained.
*/
type_found = FALSE;
number_fields = 0;
type_found=FALSE;
if (rc == RC_SUCCESS)
{
/* process non-comment lines */
if (strncmp(inputbuffer,"!",1) != 0)
{
/* determine the non-value portion of the
resource specification (i.e. the
part to the left of the ":" and to the
left of the first space).
*/
resource_end = DtStrchr(inputbuffer,':');
first_space = DtStrchr(inputbuffer,' ');
if (resource_end != NULL)
{
if ((first_space != NULL) &&
(first_space < resource_end))
{
resource_end = NULL;
}
}
if (resource_end != NULL)
{
*resource_end = '\0';
/* determine the start of each field
in the non-value part of the resource.
It is assumed that the individual fields
are delimited by a "*" or ".".
*/
field[0]=inputbuffer;
for (i=1;((i<NUMBER_OF_FIELDS) &&
(field[i-1] != NULL));
i++)
{
/* determine the location of the next
delimiter - "* or "."
Set field pointer to first one found.
*/
field[i]=DtStrchr(field[i-1],'*');
tmp1=DtStrchr(field[i-1],'.');
if (((tmp1 != NULL) && (tmp1 < resource_end) &&
(tmp1 < field[i])) ||
(field[i] == NULL))
{
field[i]=tmp1;
}
if (field[i] != NULL)
{
/* terminate the previous field */
*field[i] = '\0';
/* move pointer to start of field */
field[i]++;
}
if (field[i] >= resource_end)
{
field[i]=NULL;
}
}
number_fields = i-1;
/* check for each type of resource
that should be retained in the output file.
See comments preceeding the definition
of each array near the start of this file
for a description and example of each type.
*/
if ((strlen(field[0]) == 0) &&
(number_fields == 2) &&
(check_match1(convert1,
NUMBER_OF_CONVERT1,1) == TRUE))
{
type_found=TRUE;
}
if ((type_found == FALSE) &&
(number_fields == 3) &&
(strcmp(field[0],CONVERT2_0) == 0) &&
(strcmp(field[1],CONVERT2_1) == 0) &&
(check_match1(convert2, NUMBER_OF_CONVERT2,2)
== TRUE))
{
type_found=TRUE;
}
if ((type_found == FALSE) &&
(number_fields == 2) &&
(check_match2(convert31,convert32,
NUMBER_OF_CONVERT3,0,1) == TRUE))
{
type_found=TRUE;
}
if ((type_found == FALSE) &&
(number_fields == 3) &&
(strcmp(field[2],CONVERT4_2) == 0) &&
(check_match1(convert4,
NUMBER_OF_CONVERT4,1) == TRUE))
{
type_found=TRUE;
}
if ((type_found == FALSE) &&
(number_fields == 3) &&
(strcmp(field[2],CONVERT5_2) == 0) &&
(check_match1(convert5,
NUMBER_OF_CONVERT5,0) == TRUE))
{
type_found=TRUE;
}
if ((type_found == FALSE) &&
(number_fields == 2) &&
(strlen(field[0]) > strlen(CONVERT6_0)) &&
(strncmp(field[0], CONVERT6_0,
strlen(CONVERT6_0)) == 0) &&
(check_match1(convert6,
NUMBER_OF_CONVERT6,1) == TRUE))
{
type_found=TRUE;
}
if ((type_found == FALSE) &&
(number_fields == 3) &&
((strcmp(field[0],CONVERT7_01) == 0) ||
(strcmp(field[0],CONVERT7_02) == 0)) &&
(check_match1(convert7,
NUMBER_OF_CONVERT7,2) == TRUE))
{
type_found=TRUE;
}
if ((type_found == FALSE) &&
(number_fields == 4) &&
((strcmp(field[0],CONVERT8_01) == 0) ||
(strcmp(field[0],CONVERT8_02) == 0)) &&
(check_match1(convert8,
NUMBER_OF_CONVERT8,3) == TRUE))
{
type_found=TRUE;
}
if ((type_found == FALSE) &&
(number_fields == 5) &&
((strcmp(field[0],CONVERT9_01) == 0) ||
(strcmp(field[0],CONVERT9_02) == 0)) &&
(check_match2(convert91,convert92,
NUMBER_OF_CONVERT9,3,4) == TRUE))
{
type_found=TRUE;
}
if ((type_found == FALSE) &&
(number_fields == 3) &&
(check_match1(convert10,
NUMBER_OF_CONVERT10,2) == TRUE))
{
type_found=TRUE;
}
}
}
/* if resource should be retained then
write resource to output file.
*/
if (type_found == TRUE)
{
chars_written = fputs(unmodified_buffer,out_fh);
if (chars_written != strlen(unmodified_buffer))
{
if (rc == RC_SUCCESS)
{
rc = RC_WRITE_ERROR_TEMP;
}
}
}
}
} while (rc == RC_SUCCESS);
}
else
{
rc = RC_MEMORY_ALLOCATION_ERROR;
}
if (rc == RC_END_OF_FILE)
{
rc = RC_SUCCESS;
}
/* free all allocated buffers */
if (inputbuffer != NULL)
{
free(inputbuffer);
}
if (inputbuffer1 != NULL)
{
free(inputbuffer1);
}
if (unmodified_buffer != NULL)
{
free(unmodified_buffer);
}
}
else
{
rc = RC_OPEN_ERROR;
}
if (in_fh != NULL)
{
fclose(in_fh);
}
if (out_fh != NULL)
{
fclose(out_fh);
}
return(rc);
}

View File

@@ -0,0 +1,19 @@
/* $XConsortium: SmMigResources.h /main/4 1996/05/08 20:11:49 drk $ */
/* @(#)49 1.1 src/cde/cde1/dtsession/SmMigResources.h, desktop, cde41J, 9517B_all 4/25/95 14:06:42 */
/*
* COMPONENT_NAME: desktop
*
* FUNCTIONS: header file for SmMigResources
*
* ORIGINS: 27
*
* IBM CONFIDENTIAL -- (IBM Confidential Restricted when
* combined with the aggregated modules for this product)
* OBJECT CODE ONLY SOURCE MATERIALS
*
* (C) COPYRIGHT International Business Machines Corp. 1995
* All Rights Reserved
* US Government Users Restricted Rights - Use, duplication or
* disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*/
extern int MigrateResources(char *, char *);

View File

@@ -0,0 +1,451 @@
/*
* (c) Copyright 1995 Digital Equipment Corporation.
* (c) Copyright 1993, 1994, 1995 Hewlett-Packard Company
* (c) Copyright 1993, 1994, 1995 International Business Machines Corp.
* (c) Copyright 1993, 1994, 1995 Sun Microsystems, Inc.
* (c) Copyright 1993, 1994, 1995 Novell, Inc.
* (c) Copyright 1995 FUJITSU LIMITED.
* (c) Copyright 1995 Hitachi.
*
* $XConsortium: SmProp.c /main/4 1996/10/07 10:29:51 drk $
*/
#include <stdio.h>
#include <X11/Intrinsic.h>
#include <X11/SM/SMlib.h>
#include "SmXSMP.h"
/*
* Forward declarations
*/
static SmPropValue * CopyPropValues (
int numPropValues,
SmPropValue * thePropValues);
void
SetPropertiesProc (
SmsConn smsConn,
SmPointer managerData,
int numProps,
SmProp **theProps)
{
ClientRecPtr pClient = (ClientRecPtr) managerData;
PropertyRecPtr pProp;
int i, j;
Boolean found;
#ifdef DEBUG
(void) printf ("Received SET PROPERTIES [%p]\n", smsConn);
#endif /* DEBUG */
if (numProps == 0)
return;
for (i = 0; i < numProps; i++) {
found = False;
if (theProps[i]->num_vals == 0)
continue;
for (pProp = pClient->props;
pProp != NULL;
pProp = pProp->next) {
if (!strcmp (theProps[i]->name, pProp->prop.name) &&
!strcmp (theProps[i]->type, pProp->prop.type)) {
/*
* Reuse this property but replace its
* property values
*/
for (j = 0; j < pProp->prop.num_vals; j++) {
XtFree (pProp->prop.vals[j].value);
}
if (pProp->prop.num_vals > 0)
XtFree ((char *) pProp->prop.vals);
pProp->prop.vals = CopyPropValues (
theProps[i]->num_vals,
theProps[i]->vals);
pProp->prop.num_vals = theProps[i]->num_vals;
found = True;
break;
}
}
if (!found) {
/*
* Put it at the end of the list (or the beginning
* if this client has no properties)
*/
PropertyRecPtr trail = pClient->props;
for (pProp = pClient->props;
pProp != NULL;
trail = pProp, pProp = pProp->next);
pProp = (PropertyRecPtr)XtMalloc (sizeof (PropertyRec));
if (!pProp)
return;
if (trail)
trail->next = pProp;
else
pClient->props = pProp;
pProp->prop.name = XtNewString (theProps[i]->name);
pProp->prop.type = XtNewString (theProps[i]->type);
pProp->prop.num_vals = theProps[i]->num_vals;
pProp->next = NULL;
pProp->prop.vals = CopyPropValues (
theProps[i]->num_vals, theProps[i]->vals);
}
SmFreeProperty (theProps[i]);
}
if (theProps)
free ((char *) theProps);
#ifdef DEBUG
for (i = 0, pProp = pClient->props;
pProp != NULL;
i++, pProp = pProp->next) {
(void) printf ("\t[%2d] name = %s\n", i + 1,
pProp->prop.name);
(void) printf ("\t[%2d] type = %s\n", i + 1,
pProp->prop.type);
(void) printf ("\t[%2d] num props = %d\n", i + 1,
pProp->prop.num_vals);
for (j = 0; j < pProp->prop.num_vals; j++) {
(void) printf ("\t\t [%2d] (%3d bytes) = %s\n", j + 1,
pProp->prop.vals[j].length,
pProp->prop.vals[j].value);
}
}
#endif /* DEBUG */
}
void
DeletePropertiesProc (
SmsConn smsConn,
SmPointer managerData,
int numProps,
char **propNames)
{
ClientRecPtr pClient = (ClientRecPtr) managerData;
int i;
#ifdef DEBUG
(void) printf ("Received DELETE PROPERTIES [%p] - %d properties\n",
smsConn, numProps);
for (i = 0; i < numProps; i++)
(void) printf ("\t%s\n", propNames[i]);
#endif /* DEBUG */
if (numProps == 0)
return;
for (i = 0; i < numProps; i++) {
PropertyRecPtr pProp;
PropertyRecPtr tmp;
PropertyRecPtr trail;
for (pProp = pClient->props, trail = pClient->props ;
pProp != NULL;
trail = pProp, pProp = pProp->next) {
if (!strcmp (pProp->prop.name, propNames[i])) {
int j;
XtFree (pProp->prop.name);
XtFree (pProp->prop.type);
for (j = 0; j < pProp->prop.num_vals; j++) {
XtFree (pProp->prop.vals[j].value);
}
if (pProp->prop.num_vals > 0)
XtFree ((char *) pProp->prop.vals);
/*
* Remove the record from the list and then
* free the record
*/
trail->next = pProp->next;
XtFree ((char *) pProp);
pProp = trail;
}
}
free (propNames[i]);
}
free ((char *) propNames);
}
void
GetPropertiesProc (
SmsConn smsConn,
SmPointer managerData)
{
ClientRecPtr pClient = (ClientRecPtr) managerData;
PropertyRecPtr pProp;
PropertyRecPtr trail;
int numProps;
int i, j;
SmProp **pPropsRet;
#ifdef DEBUG
(void) printf ("Received GET PROPERTIES [%p]\n", smsConn);
#endif /* DEBUG */
if (!pClient->props) {
SmsReturnProperties (smsConn, 0, NULL);
return;
}
for (pProp = pClient->props, numProps = 0;
pProp != NULL;
pProp = pProp->next, numProps++);
pPropsRet = (SmProp **) XtMalloc (numProps * sizeof (SmProp *));
if (!pPropsRet) {
SmsReturnProperties (smsConn, 0, NULL);
return;
}
/*
* This function must return an array of pointers to SmProp
* structures and since the properties are actually stored
* in a linked list, a transformation is required.
*/
for (i=0, pProp = pClient->props;
pProp != NULL;
i++, pProp = pProp->next) {
pPropsRet[i] = (SmProp *) XtMalloc (sizeof (SmProp));
if (!pPropsRet[i]) {
SmsReturnProperties (smsConn, 0, NULL);
return;
}
pPropsRet[i]->name = XtNewString (pProp->prop.name);
pPropsRet[i]->type = XtNewString (pProp->prop.type);
pPropsRet[i]->num_vals = pProp->prop.num_vals;
pPropsRet[i]->vals = (SmPropValue *) XtMalloc (
pProp->prop.num_vals * sizeof (SmPropValue));
if (!pPropsRet[i]->vals) {
SmsReturnProperties (smsConn, 0, NULL);
return;
}
for (j = 0; j < pProp->prop.num_vals; j++) {
pPropsRet[i]->vals[j].length =
pProp->prop.vals[j].length;
pPropsRet[i]->vals[j].value = (SmPointer)
XtMalloc (pProp->prop.vals[j].length);
if (!pPropsRet[i]->vals[j].value) {
SmsReturnProperties (smsConn, 0, NULL);
return;
}
memcpy (pPropsRet[i]->vals[j].value,
pProp->prop.vals[j].value,
pProp->prop.vals[j].length);
}
}
SmsReturnProperties (smsConn, numProps, pPropsRet);
#ifdef DEBUG
for (i = 0; i < numProps; i++) {
(void) printf ("\t[%2d] name = %s\n", i + 1,
pPropsRet[i]->name);
(void) printf ("\t[%2d] type = %s\n", i + 1,
pPropsRet[i]->type);
(void) printf ("\t[%2d] num props = %d\n", i + 1,
pPropsRet[i]->num_vals);
for (j = 0; j < pPropsRet[i]->num_vals; j++) {
(void) printf ("\t\t [%2d] (%3d bytes) = %s\n", j + 1,
pPropsRet[i]->vals[j].length,
pPropsRet[i]->vals[j].value);
}
}
#endif /* DEBUG */
for (i = 0; i < numProps; i++)
SmFreeProperty (pPropsRet[i]);
XtFree ((char *) pPropsRet);
}
static SmPropValue *
CopyPropValues (
int numPropValues,
SmPropValue * thePropValues)
{
SmPropValue * pPropValueRet;
int i;
pPropValueRet = (SmPropValue *) XtMalloc (numPropValues *
sizeof (SmPropValue));
if (!pPropValueRet)
return (NULL);
for (i = 0; i < numPropValues; i++) {
pPropValueRet[i].length = thePropValues[i].length;
pPropValueRet[i].value = (SmPointer)
XtMalloc(thePropValues[i].length + 1);
if (!pPropValueRet[i].value)
return (NULL);
memcpy (pPropValueRet[i].value,
thePropValues[i].value,
thePropValues[i].length);
((char *) pPropValueRet[i].value)[pPropValueRet[i].length]='\0';
}
return (pPropValueRet);
}
/*
* Returns a ptr to the property record list for the given
* property.
*/
PropertyRecPtr
GetPropertyRec (
ClientRecPtr pClientRec,
char * propName)
{
PropertyRecPtr pPropRec;
for (pPropRec = pClientRec->props; pPropRec;
pPropRec = pPropRec->next) {
if (!strcmp (propName, pPropRec->prop.name))
return (pPropRec);
}
return (pPropRec);
}
/*
* If the given property exists, it returns a ptr to the first
* value of the property if the type of the property is SmARRAY8
* (char *).
*/
char *
GetArrayPropertyValue (
ClientRecPtr pClientRec,
char * propName)
{
PropertyRecPtr pPropRec;
if ((pPropRec = GetPropertyRec (pClientRec, propName)) == NULL)
return (NULL);
if ((!strcmp (pPropRec->prop.type, SmARRAY8)) &&
(pPropRec->prop.num_vals >= 1))
return (pPropRec->prop.vals[0].value);
return (NULL);
}
/*************************************<->*************************************
*
* GetListOfArrayPropertyValue -
*
* Description: If the specified property exits and its type is
* a LISTofARRAY8, then a NULL-terminated array of pointers
* to the values is returned.
*
* Returns: NULL-terminated array of values or NULL
*
* Comments: caller is responsible for using XtFree to free the returned
* pointer if it is not NULL
*
*************************************<->***********************************/
char **
GetListOfArrayPropertyValue (
ClientRecPtr pClientRec,
char * propName)
{
PropertyRecPtr pPropRec;
char ** ppchar;
int i;
if ((pPropRec = GetPropertyRec (pClientRec, propName)) == NULL)
return (NULL);
if ((strcmp (pPropRec->prop.type, SmLISTofARRAY8)) ||
(pPropRec->prop.num_vals <= 0))
return (NULL);
ppchar = (char **) XtMalloc ((pPropRec->prop.num_vals + 1) *
sizeof (char *));
if (!ppchar)
return (NULL);
for (i = 0; i < pPropRec->prop.num_vals; i++)
ppchar[i] = pPropRec->prop.vals[i].value;
ppchar[pPropRec->prop.num_vals] = NULL;
return (ppchar);
}
/*************************************<->*************************************
*
* GetCardPropertyValue -
*
* Description: If the specified property exits and its type is
* a CARD8, then return its value.
*
* Returns: True if the property is found; False otherwise
*
*************************************<->***********************************/
Boolean
GetCardPropertyValue (
ClientRecPtr pClientRec,
char * propName,
int * propValue) /* MODIFIED */
{
PropertyRecPtr pPropRec;
if ((pPropRec = GetPropertyRec (pClientRec, propName)) == NULL)
return (False);
if ((!strcmp (pPropRec->prop.type, SmCARD8)) &&
(pPropRec->prop.num_vals >= 1)) {
int hint = (int) *((char *) (pPropRec->prop.vals[0].value));
*propValue = hint;
return (True);
}
return (False);
}

View File

@@ -0,0 +1,77 @@
/*
* (c) Copyright 1995 Digital Equipment Corporation.
* (c) Copyright 1993, 1994, 1995 Hewlett-Packard Company
* (c) Copyright 1993, 1994, 1995 International Business Machines Corp.
* (c) Copyright 1993, 1994, 1995 Sun Microsystems, Inc.
* (c) Copyright 1993, 1994, 1995 Novell, Inc.
* (c) Copyright 1995 FUJITSU LIMITED.
* (c) Copyright 1995 Hitachi.
*
* $XConsortium: SmProp.h /main/2 1996/02/02 15:14:26 barstow $
*/
/******************************************************************************
Copyright (c) 1993 X Consortium
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of the X Consortium shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from the X Consortium.
******************************************************************************/
#ifndef _smprop_h
#define _smprop_h
#include <X11/Intrinsic.h>
#include "SmXSMP.h"
extern void SetPropertiesProc (
SmsConn smsConn,
SmPointer managerData,
int numProps,
SmProp **props);
extern void DeletePropertiesProc (
SmsConn smsConn,
SmPointer managerData,
int numProps,
char **propNames);
extern void GetPropertiesProc (
SmsConn smsConn,
SmPointer managerData);
extern PropertyRecPtr GetPropertyRec (
ClientRecPtr pClientRec,
char * propName);
extern char * GetArrayPropertyValue (
ClientRecPtr pClientRec,
char * propName);
extern char ** GetListOfArrayPropertyValue (
ClientRecPtr pClientRec,
char * propName);
extern Boolean GetCardPropertyValue (
ClientRecPtr pClientRec,
char * propName,
int * propValue); /* MODIFIED */
#endif /* _smprop_h */

View File

@@ -0,0 +1,145 @@
/* $XConsortium: SmProperty.c /main/7 1996/02/08 11:27:32 barstow $ */
/* *
* (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. *
*/
/*************************************<+>*************************************
*****************************************************************************
**
** File: SmProperty.c
**
** Project: HP DT Session Manager (dtsession)
**
** Description:
** -----------
** This file contains routines that deal with the properties used by the
** session manager to save and restore client information.
**
**
**
*******************************************************************
** (c) Copyright Hewlett-Packard Company, 1990. All rights are
** reserved. Copying or other reproduction of this program
** except for archival purposes is prohibited without prior
** written consent of Hewlett-Packard Company.
********************************************************************
**
**
**
*****************************************************************************
*************************************<+>*************************************/
#include <stdio.h>
#include <X11/Intrinsic.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
#include "Sm.h"
#include "SmProtocol.h"
#include "SmXSMP.h"
/*************************************<->*************************************
*
* GetStandardProperties -
*
*
* Description: returns information about the specified window
* -----------
*
* Inputs:
* ------
* window = window for which we are getting properties
*
* Outputs:
* -------
* argv = data returned from WM_COMMAND property (to restart client)
* argc = number of arguments returned from WM_COMMAND property
* clientMachine = which machine is client running on
* xsmpClient = True if the client is XSMP and False otherwise
* screen = window's screen number
*
* Comments:
* --------
* All X (except GetWMHints) were not available until R4 and therefore have
* R4 or greater dependencies.
*
* BEWARE OF THESE ROUTINES: The XGetWindowProperty routine returns 0 if
* it succeeds. These routines (which were derived from XGetWindowProperty
* return 0 if they FAIL.
*
*************************************<->***********************************/
Status GetStandardProperties(
Window window,
int screen,
int *argc, /* RETURNED */
char ***argv, /* RETURNED */
char **clientMachine, /* RETURNED */
Boolean *xsmpClient) /* RETURNED */
{
int cc;
long suppliedRet;
XTextProperty sessProp;
Atom actType;
int actFormat;
unsigned long bytesAfter;
unsigned long nitems;
unsigned char *data = NULL;
/*
* If this client is participating in the XSMP, then don't save
* it as a proxy (pre-XSMP) client. However, do cache its
* screen number before returning.
*/
if (XGetWindowProperty(smGD.display, window, XaSmClientId, 0L,
(long) BUFSIZ, False, XA_STRING, &actType,
&actFormat, &nitems, &bytesAfter, &data) == Success)
{
if (data && actType == XA_STRING)
{
ClientRecPtr pClient;
for (pClient = connectedList; pClient != NULL;
pClient = pClient->next) {
if (!strcmp ((char *) data, pClient->clientId)) {
pClient->screenNum = screen;
break;
}
}
*xsmpClient = True;
SM_FREE ((char *) data);
return (0);
}
SM_FREE ((char *) data);
}
*xsmpClient = False;
/*
* Get WM_COMMAND property
*/
if ((cc=XGetCommand(smGD.display,window,argv,argc))==0)
return(cc);
/*
* If there is no argc or argv - don't bother going on. We're not
* going to save anything anyway
*/
if(*argc == 0)
return(0);
/*
* Get WM_CLIENT_MACHINE property
*/
if ((cc=XGetWMClientMachine(smGD.display,window,&sessProp))==0)
{
*clientMachine = NULL;
}
else
{
*clientMachine = (char *) sessProp.value;
}
return(1);
}

View File

@@ -0,0 +1,33 @@
/*
* (c) Copyright 1995 Digital Equipment Corporation.
* (c) Copyright 1993, 1994, 1995 Hewlett-Packard Company
* (c) Copyright 1993, 1994, 1995 International Business Machines Corp.
* (c) Copyright 1993, 1994, 1995 Sun Microsystems, Inc.
* (c) Copyright 1993, 1994, 1995 Novell, Inc.
* (c) Copyright 1995 FUJITSU LIMITED.
* (c) Copyright 1995 Hitachi.
*
* $XConsortium: SmProperty.h /main/2 1996/02/08 11:28:28 barstow $
*/
/*************************************<+>*************************************
*****************************************************************************
**
** File: SmProperty.h
**
** Project: DT Session Manager (dtsession)
**
*****************************************************************************
*************************************<+>*************************************/
#ifndef _smproperty_h
#define _smproperty_h
Status GetStandardProperties(
Window window,
int screen,
int *argc, /* RETURNED */
char ***argv, /* RETURNED */
char **clientMachine, /* RETURNED */
Boolean *xsmpClient); /* RETURNED */
#endif /*_smproperty_h */

View File

@@ -0,0 +1,142 @@
/* $TOG: SmProtocol.c /main/8 1998/08/05 13:38:17 samborn $ */
/*************************************<+>*************************************
*****************************************************************************
**
** File: SmProtocol.c
**
** Project: HP DT Session Manager (dtsession)
**
** Description:
** -----------
** This file contains all modules that handle the initialization and
** interning of all atoms used by the session manager.
**
**
*****************************************************************************
*************************************<+>*************************************/
/*
* (c) Copyright 1996 Digital Equipment Corporation.
* (c) Copyright 1990, 1993, 1994, 1996 Hewlett-Packard Company
* (c) Copyright 1993, 1994, 1996 International Business Machines Corp.
* (c) Copyright 1993, 1994, 1996 Sun Microsystems, Inc.
* (c) Copyright 1993, 1994, 1996 Novell, Inc.
* (c) Copyright 1996 FUJITSU LIMITED.
* (c) Copyright 1996 Hitachi.
*/
#include <stdio.h>
#include <X11/Intrinsic.h>
#include <X11/Xatom.h>
#include <Dt/Wsm.h>
#include <Dt/WsmP.h>
#include <Dt/Connect.h>
#include <Dt/SessionM.h>
#include <Dt/SessionP.h>
#include "Sm.h"
#include "SmProtocol.h"
/*
* Global variable definitions
*/
Atom XaWmProtocols;
Atom XaWmSaveYourself;
Atom XaWmState;
Atom XaWmDtHints;
Atom XaSmSaveMode;
Atom XaSmRestoreMode;
Atom XaSmRestoreDir;
Atom XaSmStartAckWindow;
Atom XaSmStopAckWindow;
Atom XaWmWindowAck;
Atom XaWmExitSession;
Atom XaWmLockDisplay;
Atom XaWmReady;
Atom XaSmWmProtocol;
Atom XaVsmInfo;
Atom XaDtSmStmProtocol;
Atom XaDtSmSaveToHome;
Atom XaDtSmStateChange;
Atom XaDtSmRestoreDefault;
Atom XaDtSmLockChange;
Atom XaDtSmStateInfo;
Atom XaDtSmSaverInfo;
Atom XaDtSmScreenInfo;
Atom XaDtSmAudioInfo;
Atom XaDtSmKeyboardInfo;
Atom XaDtSmFontInfo;
Atom XaDtSmPointerInfo;
Atom XaSmScreenSaveRet;
Atom XaDtSmPreeditInfo;
/*************************************<->*************************************
*
* InitProtocol ()
*
*
* Description:
* -----------
* Handles interning of atoms used by the session manager. All should
* already exist because the session manager is a toolkit application.
* Also handles setting of selection mechanism used by session manager to
* distribute unique file names.
*
*
* Inputs:
* ------
*
*
* Outputs:
* -------
*
*
* Comments:
* --------
*
*************************************<->***********************************/
void
InitProtocol( void )
{
enum { XA_WM_PROTOCOLS, XA_WM_SAVE_YOURSELF,
XA_DT_SAVE_MODE, XA_WM_STATE,
XA_DT_SM_STM_PROTOCOL, XA_DT_SM_SAVE_TO_HOME,
XA_DT_SM_STATE_CHANGE, XA_DT_SM_RESTORE_DEFAULT,
XA_DT_SM_LOCK_CHANGE, XA_DT_SM_SCREEN_INFO,
XA_DT_SM_STATE_INFO, XA_DT_SM_SAVER_INFO,
XA_DT_SM_AUDIO_INFO, XA_DT_SM_KEYBOARD_INFO,
XA_DT_SM_FONT_INFO, XA_DT_SM_POINTER_INFO,
XA_DT_SM_PREEDIT_INFO, NUM_ATOMS };
static char *atom_names[] = { _XA_WM_PROTOCOLS, _XA_WM_SAVE_YOURSELF,
_XA_DT_SAVE_MODE, _XA_WM_STATE,
_XA_DT_SM_STM_PROTOCOL, _XA_DT_SM_SAVE_TO_HOME,
_XA_DT_SM_STATE_CHANGE, _XA_DT_SM_RESTORE_DEFAULT,
_XA_DT_SM_LOCK_CHANGE, _XA_DT_SM_SCREEN_INFO,
_XA_DT_SM_STATE_INFO, _XA_DT_SM_SAVER_INFO,
_XA_DT_SM_AUDIO_INFO, _XA_DT_SM_KEYBOARD_INFO,
_XA_DT_SM_FONT_INFO, _XA_DT_SM_POINTER_INFO,
_XA_DT_SM_PREEDIT_INFO };
Atom atoms[XtNumber(atom_names)];
XInternAtoms(smGD.display, atom_names, XtNumber(atom_names), False, atoms);
XaWmProtocols = atoms[XA_WM_PROTOCOLS];
XaWmSaveYourself = atoms[XA_WM_SAVE_YOURSELF];
XaSmSaveMode = atoms[XA_DT_SAVE_MODE];
XaWmState = atoms[XA_WM_STATE];
XaDtSmStmProtocol = atoms[XA_DT_SM_STM_PROTOCOL];
XaDtSmSaveToHome = atoms[XA_DT_SM_SAVE_TO_HOME];
XaDtSmStateChange = atoms[XA_DT_SM_STATE_CHANGE];
XaDtSmRestoreDefault = atoms[XA_DT_SM_RESTORE_DEFAULT];
XaDtSmLockChange = atoms[XA_DT_SM_LOCK_CHANGE];
XaDtSmScreenInfo = atoms[XA_DT_SM_SCREEN_INFO];
XaDtSmStateInfo = atoms[XA_DT_SM_STATE_INFO];
XaDtSmSaverInfo = atoms[XA_DT_SM_SAVER_INFO];
XaDtSmAudioInfo = atoms[XA_DT_SM_AUDIO_INFO];
XaDtSmKeyboardInfo = atoms[XA_DT_SM_KEYBOARD_INFO];
XaDtSmFontInfo = atoms[XA_DT_SM_FONT_INFO];
XaDtSmPointerInfo = atoms[XA_DT_SM_POINTER_INFO];
XaDtSmPreeditInfo = atoms[XA_DT_SM_PREEDIT_INFO];
}

View File

@@ -0,0 +1,100 @@
/* $TOG: SmProtocol.h /main/7 1998/08/05 13:38:42 samborn $ */
/************************************<+>*************************************
****************************************************************************
**
** File: SmProtocol.h
**
** Project: HP DT
**
** Description
** -----------
** Variables and declarations needed for
** Protocol Handling for the session manager
**
**
****************************************************************************
************************************<+>*************************************/
/*
* (c) Copyright 1996 Digital Equipment Corporation.
* (c) Copyright 1990, 1993, 1994, 1996 Hewlett-Packard Company
* (c) Copyright 1993, 1994, 1996 International Business Machines Corp.
* (c) Copyright 1993, 1994, 1996 Sun Microsystems, Inc.
* (c) Copyright 1993, 1994, 1996 Novell, Inc.
* (c) Copyright 1996 FUJITSU LIMITED.
* (c) Copyright 1996 Hitachi.
*/
#ifndef _smprotocol_h
#define _smprotocol_h
/*
* #include statements
*/
#include <X11/Xlib.h>
/*
* #define statements
*/
/*
* Property types used by the session manager not defined elsewhere
*/
#define _XA_WM_PROTOCOLS "WM_PROTOCOLS"
#define _XA_WM_STATE "WM_STATE"
#define _XA_WM_SAVE_YOURSELF "WM_SAVE_YOURSELF"
/*
* typedef statements
*/
/*
* External variables
*/
/*
* Atoms interned by the session manager in order to communicate with
* the other clients in the session
*/
extern Atom XaWmProtocols;
extern Atom XaWmSaveYourself;
extern Atom XaWmState;
extern Atom XaWmDtHints;
extern Atom XaSmSaveMode;
extern Atom XaSmRestoreMode;
extern Atom XaSmRestoreDir;
extern Atom XaSmStartAckWindow;
extern Atom XaSmStopAckWindow;
extern Atom XaWmWindowAck;
extern Atom XaWmExitSession;
extern Atom XaWmLockDisplay;
extern Atom XaWmReady;
extern Atom XaSmWmProtocol;
extern Atom XaVsmInfo;
extern Atom XaDtSmStateInfo;
extern Atom XaDtSmSaverInfo;
extern Atom XaDtSmStmProtocol;
extern Atom XaDtSmSaveToHome;
extern Atom XaDtSmStateChange;
extern Atom XaDtSmRestoreDefault;
extern Atom XaDtSmLockChange;
extern Atom XaDtSmScreenInfo;
extern Atom XaDtSmAudioInfo;
extern Atom XaDtSmKeyboardInfo;
extern Atom XaDtSmFontInfo;
extern Atom XaDtSmPointerInfo;
extern Atom XaSmScreenSaveRet;
extern Atom XaDtSmPreeditInfo;
/*
* External Interface
*/
extern void InitProtocol(void);
#endif /*_smprotocols_h*/
/* DON'T ADD ANYTHING AFTER THIS #endif */

View File

@@ -0,0 +1,162 @@
/* $XConsortium: SmResource.h /main/5 1996/01/22 20:06:16 barstow $ */
/* *
* (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. *
*/
/*************************************<+>*************************************
*****************************************************************************
**
** File: SmResource.h
**
** Project: HP DT Session Manager (dtsession)
**
** Description:
** -----------
** Contains all resource names and classes for the session manager
**
**
*******************************************************************
** (c) Copyright Hewlett-Packard Company, 1990. All rights are
** reserved. Copying or other reproduction of this program
** except for archival purposes is prohibited without prior
** written consent of Hewlett-Packard Company.
********************************************************************
**
**
**
*****************************************************************************
*************************************<+>*************************************/
#ifndef _smresource_h
#define _smresource_h
/*
* Default resource valuse
*/
#define DEFAULT_NUM_SESSIONS_BACKED_UP 2
/*
* Global resource names
*/
extern char SmNsessionVersion[];
/*
* Session Manager Resource Names
*/
extern char SmNwmStartup[];
extern char SmNquerySettings[];
extern char SmNkeys[];
extern char SmNalarmTime[];
extern char SmNmemThreshold[];
extern char SmNcontManagement[];
extern char SmNwaitClientTimeout[];
extern char SmNwaitWmTimeout[];
extern char SmNuseMessaging[];
extern char SmNcycleTimeout[];
extern char SmNlockTimeout[];
extern char SmNsaverTimeout[];
extern char SmNrandom[];
extern char SmNsaverList[];
extern char SmNsaveYourselfTimeout[];
extern char SmNmergeXdefaults[];
extern char SmNnumSessionsBackedup[];
extern char SmNignoreEnvironment[];
/*
* Resource names for settings information
*/
extern char SmNkeyClick[];
extern char SmNbellPercent[];
extern char SmNbellPitch[];
extern char SmNbellDuration[];
extern char SmNledMask[];
extern char SmNglobalRepeats[];
extern char SmNautoRepeats[];
extern char SmNaccelNum[];
extern char SmNaccelDenom[];
extern char SmNthreshold[];
extern char SmNtimeout[];
extern char SmNinterval[];
extern char SmNpreferBlank[];
extern char SmNallowExp[];
extern char SmNfontPath[];
extern char SmNkeySymsPerKey[];
extern char SmNnumKeyCode[];
extern char SmNkeySyms[];
extern char SmNmaxKeyPerMod[];
extern char SmNmodMap[];
extern char SmNbuttonMap[];
extern char SmNhostState[];
extern char SmNhostNames[];
extern char SmNdidQuerySettings[];
extern char SmNshutDownState[];
extern char SmNshutDownMode[];
extern char SmNdisplayResolution[];
extern char SmNsessionLang[];
extern char SmNsaveFontPath[];
/*
* Global resource classes
*/
extern char SmCsessionVersion[];
/*
* Session Manager Resource Classes
*/
extern char SmCwmStartup[];
extern char SmCquerySettings[];
extern char SmCkeys[];
extern char SmCalarmTime[];
extern char SmCmemThreshold[];
extern char SmCContManagement[];
extern char SmRContManagement[];
extern char SmCWaitClientTimeout[];
extern char SmCWaitWmTimeout[];
extern char SmCUseMessaging[];
extern char SmCcycleTimeout[];
extern char SmClockTimeout[];
extern char SmCsaverTimeout[];
extern char SmCrandom[];
extern char SmCsaverList[];
extern char SmCsaveYourselfTimeout[];
extern char SmCmergeXdefaults[];
extern char SmCnumSessionsBackedup[];
extern char SmCignoreEnvironment[];
/*
* Class names for session settings information
*/
extern char SmCkeyClick[];
extern char SmCbellPercent[];
extern char SmCbellPitch[];
extern char SmCbellDuration[];
extern char SmCledMask[];
extern char SmCglobalRepeats[];
extern char SmCautoRepeats[];
extern char SmCaccelNum[];
extern char SmCaccelDenom[];
extern char SmCthreshold[];
extern char SmCtimeout[];
extern char SmCinterval[];
extern char SmCpreferBlank[];
extern char SmCallowExp[];
extern char SmCfontPath[];
extern char SmCkeySymsPerKey[];
extern char SmCnumKeyCode[];
extern char SmCkeySyms[];
extern char SmCmaxKeyPerMod[];
extern char SmCmodMap[];
extern char SmCbuttonMap[];
extern char SmChostState[];
extern char SmChostNames[];
extern char SmCdidQuerySettings[];
extern char SmCshutDownState[];
extern char SmCshutDownMode[];
extern char SmCdisplayResolution[];
extern char SmCsessionLang[];
extern char SmCsaveFontPath[];
#endif /* _smresource_h */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,100 @@
/* $XConsortium: SmRestore.h /main/10 1996/02/08 11:29:05 barstow $ */
/* *
* (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. *
*/
/************************************<+>*************************************
****************************************************************************
**
** File: SmRestore.h
**
** Project: HP DT
**
** Description
** -----------
** Variables and declarations needed for
** Session Restoration for the session manager
**
**
** (c) Copyright Hewlett-Packard Company, 1990.
**
**
**
****************************************************************************
************************************<+>*************************************/
#ifndef _smrestore_h
#define _smrestore_h
/*
* #include statements
*/
#include "SmXSMP.h"
/*
* #define statements
*/
#define MAX_REMOTE_CLIENTS 200
/*
* typedef statements
*/
/*
* External variables
*/
/*
* External Interface
*/
extern void ReloadResources( void ) ;
extern int RestoreState( void ) ;
extern int SetCompatState( void ) ;
extern int StartWM( void ) ;
extern int RestoreResources(Boolean, ...) ;
extern void RestoreIndependentResources(void) ;
extern void StartEtc( Boolean ) ;
extern void CreateExecString(char *) ;
extern void KillParent( void ) ;
extern void ScanWhitespace( unsigned char **) ;
extern void SystemCmd (char *pchCmd);
extern Boolean StartClient (
char * program,
char ** argv,
char * hostname,
char * cwd,
char ** envp,
Boolean checkCwd,
Boolean useIgnoreEnvResource,
int screen);
extern Boolean StartXSMPSession (
char * databaseName);
extern Boolean StartXSMPClient (
XSMPClientDBRecPtr pDbRec,
char * databaseName);
extern Boolean StartProxyClient (
ProxyClientDBRecPtr pDbRec);
void ExecuteDiscardCommands (
char * db);
extern Boolean ExecuteCommandProperty (
char * propertyName,
ClientRecPtr pClientRec);
PropertyRecPtr GetPropertyRec (
ClientRecPtr pClientRec,
char * propName);
char * GetStringPropertyValue (
ClientRecPtr pClientRec,
char * propName);
#endif /*_smrestore_h*/

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,76 @@
/* $TOG: SmSave.h /main/10 1997/03/07 10:25:36 barstow $ */
/* *
* (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. *
*/
/************************************<+>*************************************
****************************************************************************
**
** File: SmSave.h
**
** Project: HP DT
**
** Description
** -----------
** Variables and declarations needed for
** Session Save for the session manager
**
**
** (c) Copyright Hewlett-Packard Company, 1990.
**
**
**
****************************************************************************
************************************<+>*************************************/
#ifndef _smsave_h
#define _smsave_h
/*
* #include statements
*/
#include "SmDB.h"
#include <Dt/SessionP.h>
#include <Dt/SessionM.h>
/*
* #define statements
*/
/*
* typedef statements
*/
/*
* External variables
*/
extern SmScreenInfo screenSaverVals;
extern SmAudioInfo audioVals;
extern SmKeyboardInfo keyboardVals;
/*
* External Interface
*/
extern void SetupSaveState(
Boolean saveToHome,
int mode);
extern void SaveState(
Boolean saveToHome,
int mode,
int saveType,
Bool shutdown,
int interactStyle,
Bool fast,
Bool global) ;
extern int CompleteSave ( );
extern void NotifyProxyClients ( );
#endif /*_smsave_h*/
/* DON'T ADD ANYTHING AFTER THIS #endif */

View File

@@ -0,0 +1,253 @@
/* $XConsortium: SmScreen.c /main/4 1995/10/30 09:38:03 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. *
*/
/*************************************<+>*************************************
*****************************************************************************
**
** File: SmScreen.c
**
** Project: DT Session Manager (dtsession)
**
** Description:
** -----------
** This file contains all routines needed to manage external
** screen savers.
**
*****************************************************************************
*************************************<+>*************************************/
#include <stdio.h>
#include <signal.h>
#include <X11/Intrinsic.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
#include <Dt/Wsm.h>
#include <Dt/UserMsg.h>
#include <Dt/SaverP.h>
#include "Sm.h"
#include "SmUI.h" /* smDD.* */
#include "SmError.h"
#include "SmWindow.h"
#include "SmProtocol.h"
#include "SmGlobals.h"
#include "SmScreen.h"
/*
* Structures visible to this module only.
*/
typedef struct {
int count;
char *saver[1];
/* variable length saver[] array */
/* saver command strings */
} SmSaverParseStruct;
/*
* Variables global to this module only
*/
static int savernum; /* current screen saver number */
static void *saverstate = NULL; /* current running screen saver state */
static int firsttime = 1; /* first call to StartScreenSaver */
/*
* Local Function declarations
*/
static void ParseSaverList(char *, int *, int *, SmSaverParseStruct *);
/*************************************<->*************************************
*
* StartScreenSaver ()
*
*
* Description:
* -----------
* Start an external screen saver.
*
* Inputs:
* ------
*
*
* Outputs:
* -------
*
* Comments:
* --------
*
*************************************<->***********************************/
void
StartScreenSaver( void )
{
int i;
SmSaverParseStruct *parse;
if (!smGD.saverListParse)
{
/*
* Parse the screen saver list.
*/
smGD.saverListParse = SmSaverParseSaverList(smGD.saverList);
if (!smGD.saverListParse)
{
return;
}
savernum = -1;
}
parse = (SmSaverParseStruct *)smGD.saverListParse;
if (parse->count == 0)
{
return;
}
/*
* Decide which saver number to use.
*/
savernum = (savernum + 1) % parse->count;
if (firsttime)
{
/*
* Load actions database.
*/
ProcessReloadActionsDatabase();
firsttime = 0;
}
/*
* Start screen saver. _DtSaverStop() must be called to terminate the
* screen saver.
*/
saverstate = _DtSaverStart(smGD.display, smDD.coverDrawing,
smGD.numSavedScreens, parse->saver[savernum],
smGD.topLevelWid);
}
/*************************************<->*************************************
*
* StopScreenSaver ()
*
*
* Description:
* -----------
* Stop an external screen saver.
*
* Inputs:
* ------
*
*
* Outputs:
* -------
*
* Comments:
* --------
*
*************************************<->***********************************/
void
StopScreenSaver( void )
{
if (saverstate)
{
/*
* Terminate screen saver.
*/
_DtSaverStop(smGD.display, saverstate);
saverstate = NULL;
}
}
/*************************************<->*************************************
*
* SmSaverParseSaverList()
*
*
* Description:
* -----------
* Parse screen saver list into allocated buffer.
*
* SaverLine = {SaverSpec|WhiteSpace}
* SaverSpec = WhiteSpace Command WhiteSpace
* Command = <valid action name>
* WhiteSpace = {<space>|<horizontal tab>|<line feed>}
*
* For example, a saverList resource might be specified as:
* *saverList: \n \
* StartDtscreenSwarm \n\
* StartDtscreenQix \n\
* StartDtscreenLife
*
* And be represented in memory as:
* "StartDtscreenSwarm \n StartDtscreenQix\n StartDtscreenLife"
*
*
* Inputs:
* ------
* saverList - pointer to screen saver list. This memory is not changed.
*
* Outputs:
* -------
* none
*
* Return:
* -------
* pointer to allocated memory containing parsed saver list
*
* Comments:
* --------
*
*************************************<->***********************************/
void *
SmSaverParseSaverList(
char *saverList)
{
char tokenSep[] = " \n\t";
char * token;
int i = 0;
char * tmpStr;
int len = strlen(saverList);
int bytes = sizeof(int);
char *p;
SmSaverParseStruct *pstruct;
tmpStr = (char *)XtMalloc(len + 1);
memcpy(tmpStr, saverList, len+1);
token = strtok(tmpStr, tokenSep);
while(token != NULL)
{
i++;
bytes += sizeof(char *) + strlen(token) + 1;
token = strtok(NULL, tokenSep);
}
pstruct = (SmSaverParseStruct *)XtMalloc(bytes);
if (pstruct)
{
memcpy(tmpStr, saverList, len+1);
token = strtok(tmpStr, tokenSep);
pstruct->count = 0;
p = (char *)(pstruct->saver + i);
while(token != NULL)
{
pstruct->saver[pstruct->count] = p;
strcpy(pstruct->saver[pstruct->count], token);
p += strlen(token) + 1;
token = strtok(NULL, tokenSep);
pstruct->count++;
}
}
XtFree ((char *) tmpStr);
return((void *)pstruct);
}

View File

@@ -0,0 +1,58 @@
/* $XConsortium: SmScreen.h /main/4 1995/10/30 09:38:16 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. *
*/
/************************************<+>*************************************
****************************************************************************
**
** File: SmScreen.h
**
** Project: HP DT
**
** Description
** -----------
** Variables and declarations needed for
** managing external screen savers
**
**
** (c) Copyright Hewlett-Packard Company, 1990.
**
**
**
****************************************************************************
************************************<+>*************************************/
#ifndef _smscreen_h
#define _smscreen_h
/*
* #include statements
*/
/*
* #define statements
*/
/*
* typedef statements
*/
/*
* External variables
*/
/*
* External Interface
*/
extern void StartScreenSaver(void);
extern void StopScreenSaver(void);
extern void *SmSaverParseSaverList(char *);
#endif /*_smscreen_h*/
/* DON'T ADD ANYTHING AFTER THIS #endif */

View File

@@ -0,0 +1,214 @@
/* $XConsortium: SmStrDefs.c /main/9 1996/02/02 15:14:33 barstow $ */
/* *
* (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. *
*/
/*************************************<+>*************************************
*****************************************************************************
**
** File: SmStrDef.c
**
** Project: HP DT Session Manager (dtsession)
**
** Description:
** -----------
** Contains all resource names and classes for the session manager
**
**
*******************************************************************
** (c) Copyright Hewlett-Packard Company, 1990. All rights are
** reserved. Copying or other reproduction of this program
** except for archival purposes is prohibited without prior
** written consent of Hewlett-Packard Company.
********************************************************************
**
**
**
*****************************************************************************
*************************************<+>*************************************/
/*
* Global Resource Names
*/
char SmNsessionVersion[] = "sessionVersion";
/*
* Session Manager Resource Names
*/
/* Resources names for session manager behavior*/
char SmNwmStartup[] = "wmStartupCommand";
char SmNquerySettings[] = "queryServerSettings";
char SmNkeys[] = "keys";
char SmNalarmTime[] = "passwordTimeout";
char SmNmemThreshold[] = "memThreshold";
char SmNcontManagement[] = "contManagement";
char SmNwaitClientTimeout[] = "waitClientTimeout";
char SmNwaitWmTimeout[] = "waitWmTimeout";
char SmNuseMessaging[] = "useMessaging";
char SmNsaveFontPath[] = "saveFontPath";
char SmNcycleTimeout[] = "cycleTimeout";
char SmNlockTimeout[] = "lockTimeout";
char SmNsaverTimeout[] = "saverTimeout";
char SmNrandom[] = "random";
char SmNsaverList[] = "saverList";
char SmNsaveYourselfTimeout[] = "saveYourselfTimeout";
char SmNmergeXdefaults[] = "mergeXdefaults";
char SmNnumSessionsBackedup[] = "numSessionsBackedup";
char SmNignoreEnvironment[] = "ignoreEnvironment";
/* Resource names for settings information */
char SmNkeyClick[] = "keyClickPercent";
char SmNbellPercent[] = "bellPercent";
char SmNbellPitch[] = "bellPitch";
char SmNbellDuration[] = "bellDuration";
char SmNledMask[] = "ledMask";
char SmNglobalRepeats[] = "globalAutoRepeats";
char SmNautoRepeats[] = "autoRepeats";
char SmNaccelNum[] = "accelNum";
char SmNaccelDenom[] = "accelDenom";
char SmNthreshold[] = "threshold";
char SmNtimeout[] = "timeout";
char SmNinterval[] = "interval";
char SmNpreferBlank[] = "preferBlank";
char SmNallowExp[] = "allowExp";
char SmNfontPath[] = "fontPath";
char SmNkeySymsPerKey[] = "keySymsPerKeyCode";
char SmNnumKeyCode[] = "numKeyCode";
char SmNkeySyms[] = "keySyms";
char SmNmaxKeyPerMod[] = "maxKeyPerMod";
char SmNmodMap[] = "modMap";
char SmNbuttonMap[] = "buttonMap";
char SmNhostState[] = "hostState";
char SmNhostNames[] = "hostName";
char SmNdidQuerySettings[] = "didQuery";
char SmNshutDownState[] = "shutDownState";
char SmNshutDownMode[] = "shutDownMode";
char SmNdisplayResolution[] = "displayResolution";
char SmNsessionLang[] = "sessionLanguage";
/*
* Global resource classes
*/
char SmCsessionVersion[] = "SessionVersion";
/*
* Session Manager Resource Classes
*/
/* Resources classes for session manager behavior*/
char SmCwmStartup[] = "WmStartupCommand";
char SmCquerySettings[] = "QueryServerSettings";
char SmCkeys[] = "Keys";
char SmCalarmTime[] = "PasswordTimeout";
char SmCmemThreshold[] = "MemThreshold";
char SmCContManagement[] = "ContManagement";
char SmCWaitClientTimeout[] = "WaitClientTimeout";
char SmCWaitWmTimeout[] = "WaitWmTimeout";
char SmCUseMessaging[] = "UseMessaging";
char SmCsaveFontPath[] = "SaveFontPath";
char SmCcycleTimeout[] = "CycleTimeout";
char SmClockTimeout[] = "LockTimeout";
char SmCsaverTimeout[] = "SaverTimeout";
char SmCrandom[] = "Random";
char SmCsaverList[] = "SaverList";
char SmCsaveYourselfTimeout[] = "SaveYourselfTimeout";
char SmCmergeXdefaults[] = "MergeXdefaults";
char SmCnumSessionsBackedup[] = "NumSessionsBackedup";
char SmCignoreEnvironment[] = "IgnoreEnvironment";
/*
* Class names for session settings information
*/
char SmCkeyClick[] = "KeyClickPercent";
char SmCbellPercent[] = "BellPercent";
char SmCbellPitch[] = "BellPitch";
char SmCbellDuration[] = "BellDuration";
char SmCledMask[] ="LedMask";
char SmCglobalRepeats[] = "GlobalAutoRepeats";
char SmCautoRepeats[] = "AutoRepeats";
char SmCaccelNum[] = "AccelNum";
char SmCaccelDenom[] = "AccelDenom";
char SmCthreshold[] = "Threshold";
char SmCtimeout[] = "Timeout";
char SmCinterval[] = "Interval";
char SmCpreferBlank[] = "PreferBlank";
char SmCallowExp[] = "AllowExp";
char SmCfontPath[] = "FontPath";
char SmCkeySymsPerKey[] = "KeySymsPerKeyCode";
char SmCnumKeyCode[] = "NumKeyCode";
char SmCkeySyms[] = "KeySyms";
char SmCmaxKeyPerMod[] = "MaxKeyPerMod";
char SmCmodMap[] = "ModMap";
char SmCbuttonMap[] = "ButtonMap";
char SmChostState[] = "HostState";
char SmChostNames[] = "HostName";
char SmCdidQuerySettings[] = "DidQuery";
char SmCshutDownState[] = "ShutDownState";
char SmCshutDownMode[] = "ShutDownMode";
char SmCdisplayResolution[] = "DisplayResolution";
char SmCsessionLang[] = "SessionLanguage";
/*************************************<->*************************************
*
* Session manager resource converter names ...
*
*
* Description:
* -----------
*
*************************************<->***********************************/
char SmRContManagement[] = "ContManagement";
/* from Sm.h */
char SM_CLIENT_FILE[] = "dt.session";
char SM_CLIENT_FILE2[] = "dtsession.db";
char SM_RESOURCE_FILE[] = "dt.resources";
char SM_FONT_FILE[] = "dt.font";
char SM_LOW_RES_EXT[] = "l";
char SM_MED_RES_EXT[] = "m";
char SM_HIGH_RES_EXT[] = "h";
char SM_SETTING_FILE[] = "dt.settings";
char SM_CONVERSION_FILE[] = "*CONVERTED*";
char SM_SYSTEM_CLIENT_FILE[] = "sys.session";
char SM_SYSTEM_RESOURCE_FILE[] = "sys.resources";
char SM_SYSTEM_FONT_FILE[] = "sys.font";
char SM_SYSTEM_PATH[] = CDE_CONFIGURATION_TOP "/config";
char SM_SECURE_PATH[] = "/.secure/etc/passwd";
char SM_CURRENT_DIRECTORY[] = "current";
char SM_CURRENT_FONT_DIRECTORY[] = "current.font";
char SM_HOME_FONT_DIRECTORY[] = "home.font";
char SM_HOME_DIRECTORY[] = "home";
char SM_OLD_EXTENSION[] = "old";
char SM_SYSTEM_DIRECTORY[] = "system";
char smEtcFile[] = "sessionetc";
char smExitFile[] = "sessionexit";
char SM_RESOURCE_CLASS[] = "Dtsession";
char SM_RESOURCE_NAME[] = "dtsession";
char SM_HELP_VOLUME[] = "FPanel";
char SM_RUNNING_LOCK[] = "dtsession_running";
char SM_SCREEN_SAVER_NAME[] = "screensaver";
/*
* Strings for the XSMP
*/
char SM_SESSION_MANAGER[] = "SESSION_MANAGER";
char SM_VENDOR_NAME[] = "DtSession";
char SM_RELEASE_NAME[] = "1.0";
char SM_CLIENT_ID[] = "SM_CLIENT_ID";
/*
* ToolTalk operation names
*/
char SM_DISPLAY_LOCK[] = "Display_Lock";
char SM_XSESSION_EXIT[] = "XSession_Exit";
char SM_RESOURCES_RELOAD[] = "Resources_Reload";
char SM_SAVE_SESSION[] = "Save_Session";

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,115 @@
/* $XConsortium: SmUI.h /main/14 1996/05/31 09:18:17 barstow $ */
/* *
* (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. *
*/
/************************************<+>*************************************
****************************************************************************
**
** File: SmUI.h
**
** Project: HP DT
**
** Description
** -----------
** Variables and declarations needed for
** User Interface for the session manager
**
**
** (c) Copyright Hewlett-Packard Company, 1990.
**
**
**
****************************************************************************
************************************<+>*************************************/
#ifndef _smui_h
#define _smui_h
/*
* #include statements
*/
#include <X11/Xlib.h>
#include <Xm/Xm.h>
#include "SmXSMP.h"
/*
* #define statements
*/
/*
* typedef statements
*/
typedef struct
{
Widget confExit; /* Exit confirmation dialogs*/
Widget qExit;
Widget compatExit;
Widget lockDialog; /* lock-login shell */
Widget lockCoverDialog; /* lock-login shell */
Widget coverDialog[10]; /* Cover shell*/
Widget coverDrawing[10]; /* Cover drawing area */
Widget matte[2]; /* lock dialog pieces */
Widget loginMatte[2];
Widget loginForm[2];
Widget indLabel[2];
Widget deadWid; /* Bms-dead dialog */
Widget clientReasons; /* For client "reasons" */
Widget confirmSession; /* Confirm session selection */
Widget saveSession; /* Error dialog for Save_Session
ToolTalk message */
XmString okString, cancelString, helpString;
XmString okLogoutString, cancelLogoutString;
Widget noStart; /* Cant start dt dialog */
#ifdef __osf__
Widget newProfile; /* new dtprofile dialog */
#endif
Widget smHelpDialog; /* Help dialog for all topics */
} DialogData;
/*
* External variables
*/
extern DialogData smDD;
extern Arg uiArgs[20];
/*
* External Interface
*/
extern Widget CreateLockDialog( void ) ;
extern void ExitSession( Tt_message ) ;
extern int WarnMsgFailure( void ) ;
extern Widget CreateLockDialogWithCover( Widget ) ;
extern Widget CreateCoverDialog( int, Boolean ) ;
extern void ImmediateExit( int, Tt_message, Boolean ) ;
extern void ShowWaitState( Boolean ) ;
extern Boolean InitCursorInfo( void ) ;
extern void UpdatePasswdField( int );
extern int WarnNoStartup( void );
extern void DialogUp( Widget, XtPointer, XtPointer ) ;
#ifdef __osf__
extern int WarnNewProfile( void );
#endif
void PostSaveSessionErrorDialog ( void );
extern int ConfirmExit( Tt_message, Boolean );
extern Boolean ConfirmSessionCreation (
short session_type,
unsigned int argc,
char **argv);
extern void PostXSMPFailureDialog (
XSMPFailure failure_code,
Boolean check_errorlog);
extern void PostReasonsDialog (
char * progName,
int numMsgs,
char ** message,
Boolean waitForResponse);
#endif /*_smui_h*/
/* DON'T ADD ANYTHING AFTER THIS #endif */

View File

@@ -0,0 +1,130 @@
/*
* (c) Copyright 1995 Digital Equipment Corporation.
* (c) Copyright 1993, 1994, 1995 Hewlett-Packard Company
* (c) Copyright 1993, 1994, 1995 International Business Machines Corp.
* (c) Copyright 1993, 1994, 1995 Sun Microsystems, Inc.
* (c) Copyright 1993, 1994, 1995 Novell, Inc.
* (c) Copyright 1995 FUJITSU LIMITED.
* (c) Copyright 1995 Hitachi.
*
* $TOG: SmWatch.c /main/4 1997/03/19 12:21:06 barstow $
*/
/******************************************************************************
Copyright (c) 1993 X Consortium
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of the X Consortium shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from the X Consortium.
******************************************************************************/
#include <X11/Intrinsic.h>
#include <X11/ICE/ICElib.h>
#include "SmXSMP.h"
/*
* Forward declarations
*/
void _XtIceWatchProc ();
void _XtProcessIceMsgProc ();
Status
InitWatchProcs (
XtAppContext appContext)
{
#ifdef DEBUG
printf ("InitWatchProcs\n");
#endif /* DEBUG */
return (IceAddConnectionWatch (_XtIceWatchProc, (IcePointer) appContext));
}
void
_XtIceWatchProc (
IceConn ice_conn,
IcePointer client_data,
Bool opening,
IcePointer *watch_data)
{
#ifdef DEBUG
printf ("_XtIceWatchProc\n");
#endif /* DEBUG */
if (opening)
{
XtAppContext appContext = (XtAppContext) client_data;
*watch_data = (IcePointer) XtAppAddInput (
appContext,
IceConnectionNumber (ice_conn),
(XtPointer) XtInputReadMask,
_XtProcessIceMsgProc,
(XtPointer) ice_conn);
}
else
{
XtRemoveInput ((XtInputId) *watch_data);
}
}
void
_XtProcessIceMsgProc (
XtPointer client_data,
int *source,
XtInputId *id)
{
IceConn ice_conn = (IceConn) client_data;
IceProcessMessagesStatus status;
#ifdef DEBUG
printf ("_XtProcessIceMsgProc\n");
#endif /* DEBUG */
status = IceProcessMessages (ice_conn, NULL, NULL);
if (status == IceProcessMessagesIOError)
{
ClientRecPtr pClientRec;
int found = 0;
#ifdef DEBUG
printf ("IO error on connection (fd = %d)\n",
IceConnectionNumber (ice_conn));
#endif /* DEBUG */
for (pClientRec = connectedList; pClientRec != NULL;
pClientRec = pClientRec->next)
{
if (pClientRec->iceConn == ice_conn)
{
CloseDownClient (pClientRec);
found = 1;
break;
}
}
if (!found) {
IceSetShutdownNegotiation (ice_conn, False);
IceCloseConnection (ice_conn);
}
}
}

View File

@@ -0,0 +1,47 @@
/*
* (c) Copyright 1995 Digital Equipment Corporation.
* (c) Copyright 1993, 1994, 1995 Hewlett-Packard Company
* (c) Copyright 1993, 1994, 1995 International Business Machines Corp.
* (c) Copyright 1993, 1994, 1995 Sun Microsystems, Inc.
* (c) Copyright 1993, 1994, 1995 Novell, Inc.
* (c) Copyright 1995 FUJITSU LIMITED.
* (c) Copyright 1995 Hitachi.
*
* $XConsortium: SmWatch.h /main/1 1995/12/29 20:18:59 barstow $
*/
/******************************************************************************
Copyright (c) 1993 X Consortium
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of the X Consortium shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from the X Consortium.
******************************************************************************/
#ifndef _smwatch_h
#define _smwatch_h
#include <X11/Intrinsic.h>
Status
InitWatchProcs (
XtAppContext appContext);
#endif /* _smwatch_h */

View File

@@ -0,0 +1,487 @@
/* $TOG: SmWindow.c /main/6 1997/03/07 10:25:30 barstow $ */
/* *
* (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. *
*/
/*************************************<+>*************************************
*****************************************************************************
**
** File: SmWindow.c
**
** Project: HP DT Session Manager (dtsession)
**
** Description:
** -----------
** This file contains all routines needed to query the window tree.
** The window tree needs to be queried to find all top level windows.
**
**
*******************************************************************
** (c) Copyright Hewlett-Packard Company, 1990. All rights are
** reserved. Copying or other reproduction of this program
** except for archival purposes is prohibited without prior
** written consent of Hewlett-Packard Company.
********************************************************************
**
**
**
*****************************************************************************
*************************************<+>*************************************/
#include <stdio.h>
#include <X11/Intrinsic.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
#include <Dt/UserMsg.h>
#include "Sm.h"
#include "SmError.h"
#include "SmWindow.h"
#include "SmProtocol.h"
#include "SmGlobals.h"
/*
* Variables global to this module only
*/
static Boolean commandTimeout;
/*
* Local Function declarations
*/
static WindowInfo GetTopLevelWindowInfo(
Window window) ;
static void WaitForCommand(
Window window) ;
static void WaitTimeout( XtPointer , XtIntervalId *) ;
/*************************************<->*************************************
*
* GetTopLevelWindowInfo (window)
*
*
* Description:
* -----------
* Given a child of the root - find the top level window for that child.
*
*
* Inputs:
* ------
* window = the current window that is being queried about
*
*
* Outputs:
* -------
* retInfo = a WindowInfo structure (a window id + state of the window) that
* gives the top level window information.
*
* Comments:
* --------
*
*************************************<->***********************************/
static WindowInfo
GetTopLevelWindowInfo(
Window window )
{
register int i;
Window parent,root,*children;
WindowInfo retInfo;
Atom actualType;
int actualFormat;
unsigned long nitems;
unsigned long leftover;
unsigned int nchildren;
WM_STATE *wmState = NULL;
XWindowAttributes windowAttr;
if ((XGetWindowAttributes(smGD.display, window,&windowAttr)) == 0)
{
retInfo.wid = 0;
retInfo.termState = 0;
return(retInfo);
}
/*
* If WM_STATE could not be interned at the beginning - the window manager
* may have been slow in coming up. Try it again now.
*/
if(XaWmState == None)
{
XaWmState = XInternAtom(smGD.display, _XA_WM_STATE, True);
}
XGetWindowProperty(smGD.display,window,XaWmState,
0L,(long)BUFSIZ,False,
XaWmState,&actualType,&actualFormat,
&nitems,
&leftover,(unsigned char **) &wmState);
if (actualType==XaWmState)
{
retInfo.wid = window;
retInfo.termState = wmState->state;
/*
* This data needs to be freed up!
*/
SM_FREE((char *) wmState);
return(retInfo);
}
else
{
/*
* Be sure to free the window property each time we get it
* if the property exists
*/
if(actualType != None)
{
SM_FREE((char *) wmState);
}
if(XQueryTree(smGD.display,window,&root,
&parent,&children,&nchildren) != 0)
{
if(nchildren > 0)
{
i = 0;
while (nchildren--)
{
retInfo = GetTopLevelWindowInfo(children[i++]);
if(retInfo.wid != 0)
{
SM_FREE((char *) children);
return(retInfo);
}
}
SM_FREE((char *) children);
}
}
retInfo.wid = 0;
retInfo.termState = 0;
return(retInfo);
}
}
/*************************************<->*************************************
*
* WaitForCommand (window)
*
*
* Description:
* -----------
* This routine waits for an update on the WM_COMMAND property of a top
* level window after a WM_SAVE_YOURSELF has been placed on that window.
*
*
* Inputs:
* ------
* window = window id for the
*
*
* Outputs:
* -------
*
* Comments:
* --------
*
*************************************<->***********************************/
static void
WaitForCommand(
Window window )
{
XtInputMask isThere;
XEvent event;
XPropertyEvent *pEvent=(XPropertyEvent *)&event;
XtIntervalId comTimerId;
Boolean commandUpdated;
/*
* Set a configurable timer which stops the block
*/
commandUpdated = False;
commandTimeout = False;
comTimerId = XtAppAddTimeOut(smGD.appCon, smRes.saveYourselfTimeout,
WaitTimeout, (XtPointer) window);
while((commandUpdated == False) && (commandTimeout == False))
{
if((isThere = XtAppPending(smGD.appCon)) != 0)
{
if(isThere & XtIMXEvent)
{
XtAppPeekEvent(smGD.appCon, &event);
if (event.type==PropertyNotify&&pEvent->window==window&&
pEvent->atom==XA_WM_COMMAND)
{
commandUpdated = True;
}
}
if(commandTimeout == False)
{
XtAppProcessEvent(smGD.appCon, XtIMXEvent | XtIMTimer);
}
}
}
XtRemoveTimeOut(comTimerId);
XSelectInput(smGD.display, window,NoEventMask);
return;
}
/*************************************<->*************************************
*
* SaveYourself (windowInfo)
*
*
* Description:
* -----------
* Places the WM_SAVE_YOURSELF property on each top level window. It then
* waits for the window to update its WM_COMMAND property.
*
*
* Inputs:
* ------
* windowInfo = window id for the top level wincow and the state of that
* window.
*
*
* Outputs:
* -------
*
* Comments:
* --------
*
*************************************<->***********************************/
int
SaveYourself(
WindowInfo windowInfo )
{
int i;
Atom *protoRet;
int nitems;
XClientMessageEvent saveYourselfMessage;
/*
* Get the WM_PROTOCOLS property on the clients top-level window.
*/
if(XGetWMProtocols(smGD.display, windowInfo.wid, &protoRet, &nitems) == 0)
{
/*
* If the client doesn't have a WM_PROTOCOLS property,
* it doesn't support any protocols.
*/
return (-1);
}
/* Look for WM_SAVE_YOURSELF atom. */
for (i=0;i<nitems;++i)
{
if (protoRet[i]==XaWmSaveYourself)
break;
}
if (i==nitems)
{
SM_FREE((char *) protoRet);
return(-1); /* doesn't participate in WM_SAVE_YOURSELF */
}
/* Construct the ClientMessage. */
saveYourselfMessage.type=ClientMessage;
saveYourselfMessage.window=windowInfo.wid;
saveYourselfMessage.message_type=XaWmProtocols;
saveYourselfMessage.format=32;
saveYourselfMessage.data.l[0]=XaWmSaveYourself;
saveYourselfMessage.data.l[1]=CurrentTime;
/*
* look for changes in WM_COMMAND property
*/
XSelectInput(smGD.display,windowInfo.wid,PropertyChangeMask);
XFlush(smGD.display);
/*
* Send the ClientMessage to the client. XSendEvent returns a 1 if it
* is successful in converting the event to a wire event.
*/
if (XSendEvent(smGD.display,windowInfo.wid,False,NoEventMask,
(XEvent *) &saveYourselfMessage) != 1)
{
PrintError(DtError, GETMESSAGE(20, 1, "Client message failed. Client information will not be saved."));
return(-1);
}
/* Wait for client to update WM_COMMAND. */
WaitForCommand(windowInfo.wid);
SM_FREE((char *) protoRet);
return (0);
}
/*************************************<->*************************************
*
* GetTopLevelWindows (screen, toplist, toplistlength, containedListLength)
*
*
* Description:
* -----------
* Querys the window tree and constructs a list of all top level windows
*
*
* Inputs:
* ------
* screen = pointer to the screen we're currently querying on
*
*
* Outputs:
* -------
* toplist = a pointer to the list of top level windows
* toplistlength = the length of the list of top level windows
* containedListLength = the length of the list of contained windows
*
* Comments:
* --------
*
*************************************<->***********************************/
int
GetTopLevelWindows(
int screen,
WindowInfo **topList,
unsigned int *topListLength,
unsigned int *containedListLength )
{
Window rootWindow, parentWindow, *tmpChild;
Window *childList, *embeddedList, *tmpList;
WindowInfo topLevelWindowInfo;
int i;
unsigned long numEmbedded;
/*
* Get a list of children of the root window
*/
if (XQueryTree(smGD.display, RootWindow(smGD.display, screen),&rootWindow,
&parentWindow, &childList, topListLength) == 0)
{
PrintError(DtError, GETMESSAGE(20, 2, "Invalid root window. Can not save client information."));
SM_EXIT(-1);
}
/*
* add in the list of top level windows embedded in the front panel
*/
if(_DtGetEmbeddedClients(smGD.display, RootWindow(smGD.display, screen),
&embeddedList, &numEmbedded) != Success)
{
numEmbedded = 0;
}
if (*topListLength)
*topList=(WindowInfo *) SM_MALLOC(sizeof(WindowInfo)*
(*topListLength + numEmbedded));
tmpChild = childList;
/* scan list */
for (i=0 ; i<*topListLength; ++i, tmpChild++)
{
topLevelWindowInfo = GetTopLevelWindowInfo(*tmpChild);
if (!topLevelWindowInfo.wid)
{
topLevelWindowInfo.wid = (*tmpChild);
/*
* Assume if you can't find a state that it is "don't care"
* this could be a faulty assumption CHECK IT OUT
*/
topLevelWindowInfo.termState = 0;
}
(*topList)[i] = topLevelWindowInfo;
}
/*
* Now add in the extra window id's to check
*/
tmpList = embeddedList;
for(i = *topListLength;i < (*topListLength + numEmbedded);i++)
{
(*topList)[i].wid = *tmpList;tmpList++;
(*topList)[i].termState = NormalState;
}
if(numEmbedded > 0)
{
SM_FREE((char *) embeddedList);
}
if(*topListLength)
{
SM_FREE((char *) childList);
}
*containedListLength = numEmbedded;
return(0);
}
/*************************************<->*************************************
*
* WaitTimeout
*
*
* Description:
* -----------
* Timeout procedure the WaitForCommand routine. It stops a loop waiting
* for an update of the WM_COMMAND property from a client.
*
*
* Inputs:
* ------
*
*
* Outputs:
* -------
* commandTimeout = (global) flag that stops the loop
*
* Comments:
* --------
*
*************************************<->***********************************/
static void
WaitTimeout(
XtPointer client_data,
XtIntervalId *id )
{
String tmpString, tmpError;
char *winName;
Status success;
success = XFetchName(smGD.display, (Window) client_data, &winName);
if (success && winName)
{
tmpString = GETMESSAGE(20, 4, "Session restoration information not updated for client %s. Invalid information may be saved.");
tmpError = SM_MALLOC(strlen(winName) + strlen(tmpString) + 5);
if (tmpError)
{
sprintf(tmpError, tmpString, winName);
PrintError(DtError, tmpError);
SM_FREE(tmpError);
}
SM_FREE(winName);
}
commandTimeout = True;
return;
} /* END OF FUNCTION WaitTimeout */

View File

@@ -0,0 +1,80 @@
/* $XConsortium: SmWindow.h /main/4 1995/10/30 09:39:07 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. *
*/
/************************************<+>*************************************
****************************************************************************
**
** File: SmWindow.h
**
** Project: HP DT
**
** Description
** -----------
** Variables and declarations needed for
** Getting Top Level Window Info for the session manager
**
**
** (c) Copyright Hewlett-Packard Company, 1990.
**
**
**
****************************************************************************
************************************<+>*************************************/
#ifndef _smwindow_h
#define _smwindow_h
/*
* #include statements
*/
/*
* #define statements
*/
/*
* typedef statements
*/
/*
* Structure to hold window and state information to be later written
* to the output state file
*/
typedef struct
{
int termState;
Window wid;
} WindowInfo, *WindowInfoPtr;
/*
* Information returned by application in response to WM_STATE message
*/
typedef struct
{
int state;
Window icon;
} WM_STATE;
/*
* External variables
*/
/*
* External Interface
*/
extern int SaveYourself( WindowInfo ) ;
extern int GetTopLevelWindows( int, WindowInfo **, unsigned int *,
unsigned int *) ;
#endif /*_smwindow_h*/
/* DON'T ADD ANYTHING AFTER THIS #endif */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,148 @@
/*
* (c) Copyright 1995 Digital Equipment Corporation.
* (c) Copyright 1993, 1994, 1995 Hewlett-Packard Company
* (c) Copyright 1993, 1994, 1995 International Business Machines Corp.
* (c) Copyright 1993, 1994, 1995 Sun Microsystems, Inc.
* (c) Copyright 1993, 1994, 1995 Novell, Inc.
* (c) Copyright 1995 FUJITSU LIMITED.
* (c) Copyright 1995 Hitachi.
*
* $XConsortium: SmXSMP.h /main/16 1996/02/13 11:02:37 barstow $
*/
/*************************************<+>*************************************
*****************************************************************************
**
** File: SmXSMP.h
**
** Project: DT Session Manager (dtsession)
**
*****************************************************************************
*************************************<+>*************************************/
#ifndef _smxsmp_h
#define _smxsmp_h
#include <X11/Intrinsic.h>
#include <X11/SM/SMlib.h>
#include <X11/ICE/ICEutil.h>
/*
* Constants for the Save_Session ToolTalk message
*/
#define DEFAULT_SAVE_TYPE SmSaveGlobal
#define DEFAULT_SHUTDOWN False
#define DEFAULT_INTERACT_STYLE SmInteractStyleAny
#define DEFAULT_FAST True
#define DEFAULT_GLOBAL True
typedef struct _PropertyRec {
SmProp prop;
struct _PropertyRec *next;
} PropertyRec, *PropertyRecPtr;
typedef struct _ClientRec {
SmsConn smConn;
IceConn iceConn;
char * clientId;
char * clientHost;
int restartHint;
int screenNum;
PropertyRecPtr props;
Boolean active;
Boolean saveYourselfDone;
Boolean saveYourselfP2Requested;
Boolean interactRequested;
struct _ClientRec * next;
} ClientRec, *ClientRecPtr;
typedef struct {
Boolean global;
Boolean shutdown;
Boolean clientInteracting;
Boolean inProgress;
Boolean doneSuccess;
Boolean saveComplete;
Boolean shutdownCanceled;
int interactStyle;
int interactCount;
int numClientIds;
char * clientIds;
int * workspaceNums;
ClientRecPtr interactClient;
} SaveStateRec;
typedef struct _XSMPClientDBRec {
char * clientId;
char * clientHost;
char * program;
char * cwd;
int screenNum;
char ** restartCommand;
char ** cloneCommand;
char ** discardCommand;
char ** environment;
int restartHint;
struct _XSMPClientDBRec * next;
} XSMPClientDBRec, *XSMPClientDBRecPtr;
typedef struct _ProxyClientDBRec {
char * clientHost;
char ** command;
int screenNum;
} ProxyClientDBRec, *ProxyClientDBRecPtr;
typedef struct {
IceListenObj * listenObjs;
int numTransports;
IceAuthDataEntry * authDataEntries;
SaveStateRec saveState;
XSMPClientDBRecPtr xsmpDbList;
char * dbVersion;
char * dbSessionId;
} XSMPSettings, *XSMPSettingPtr;
/*
* Failure modes during the initializatin of XSMP
*/
typedef enum {
XSMP_FAILURE_SMS_INITIALIZE,
XSMP_FAILURE_ICE_LISTEN,
XSMP_FAILURE_AUTHENTICATION,
XSMP_FAILURE_ICE_ADD_WATCH,
XSMP_FAILURE_ICE_COMPOSE_IDS,
XSMP_FAILURE_MALLOC
} XSMPFailure;
/*
* Public variable declarations
*/
extern XSMPSettings smXSMP;
extern ClientRecPtr connectedList;
extern char SM_SESSION_MANAGER[];
extern char SM_VENDOR_NAME[];
extern char SM_RELEASE_NAME[];
extern char SM_CLIENT_ID[];
extern Atom XaSmClientId;
/*
* Public function declarations
*/
extern Boolean InitXSMP ( );
void SaveYourselfReqProc (
SmsConn smsConn,
SmPointer managerData,
int saveType,
Bool shutdown,
int interactStyle,
Bool fast,
Bool global);
void CloseDownClient (
ClientRecPtr client );
void XSMPExit ();
#endif /*_smxsmp_h*/

View File

@@ -0,0 +1,170 @@
/* $XConsortium: SmXdef.c /main/4 1995/10/30 09:39:16 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. *
*/
/*************************************<+>*************************************
*****************************************************************************
**
** File: SmXdef.c
**
** Project: DT Session Manager (dtsession)
**
** Description:
** -----------
** This file contains routines to manage the Xdefaults file.
**
** SmXdefMerge() - merge .Xdefaults file into RESOURCE_MANAGER
** SmXdefSubtract() - subtract .Xdefaults file from given database
**
*****************************************************************************
*************************************<+>*************************************/
#include <stdio.h>
#include <X11/Intrinsic.h>
#include "Sm.h"
#include "SmXrm.h"
/*
* State data
* dbXdefaults - copy of .Xdefaults in Xrm database form
*/
static XrmDatabase dbXdefaults = NULL;
/*
* Note:
*
* The memory for dbXdefaults is freed only upon dtsession termination
*
* This code is currently restricted to handling the .Xdefaults file,
* but can easily be extended to handle other default resource files.
*
*/
/*************************************<->*************************************
*
* SmXdefMerge(display)
*
* Description:
* -----------
* Merge the .Xdefaults file into the RESOURCE_MANAGER database
*
* Inputs:
* ------
* display - display connection
*
* Outputs:
* -------
*
*
* Comments:
* --------
*
*************************************<->***********************************/
void
SmXdefMerge(Display *display)
{
char *xdefaults;
/*
* Load .Xdefaults
*/
if( (xdefaults = (char *)malloc(strlen(getenv("HOME"))+12)) != NULL)
{
sprintf(xdefaults,"%s/%s",getenv("HOME"),".Xdefaults");
if(access(xdefaults,R_OK) == 0)
{
FILE *fp;
char *b = NULL;
int size;
struct stat statinfo;
/*
* Determine size of file.
*/
if (stat(xdefaults, &statinfo) == -1)
{
statinfo.st_size = 0;
}
/*
* Get some memory.
*/
if (statinfo.st_size > 0)
{
b = (char *)SM_MALLOC(statinfo.st_size + 1);
}
if (b != NULL)
{
/*
* Read file into memory.
*/
if ((fp = fopen(xdefaults, "r")) != NULL)
{
size = fread(b, 1, statinfo.st_size, fp);
fclose(fp);
}
if (size == statinfo.st_size)
{
/*
* Merge .Xdefaults string into RESOURCE_MANAGER database, and
* also convert to Xrm database form for later subtraction.
*/
b[size] = '\0';
_DtAddToResource(display, b);
dbXdefaults = XrmGetStringDatabase(b);
SM_FREE(b);
}
}
}
free(xdefaults);
}
}
/*************************************<->*************************************
*
* SmXdefSubtract(db)
*
* Description:
* -----------
* Subract prior merged .Xdefaults file from given database
*
* Inputs:
* ------
* db - Xrm database from which to subtract .Xdefaults
*
* Outputs:
* -------
*
* Return:
* ------
* dbResult - result database
*
* Comments:
* --------
* Caller is responsible for freeing dbResult using XrmDestroyDatabase()
*
*
*************************************<->***********************************/
XrmDatabase
SmXdefSubtract(XrmDatabase db)
{
XrmDatabase dbResult;
if (dbXdefaults)
{
dbResult = SmXrmSubtractDatabase(dbXdefaults, db);
}
else
{
dbResult = NULL;
}
return(dbResult);
}

View File

@@ -0,0 +1,52 @@
/* $XConsortium: SmXdef.h /main/4 1995/10/30 09:39:25 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. *
*/
/************************************<+>*************************************
****************************************************************************
**
** File: SmXdef.h
**
** Project: DT
**
** Description
** -----------
** Variables and declarations needed for
** Lock Handling for the session manager
**
**
****************************************************************************
************************************<+>*************************************/
#ifndef _smxdef_h
#define _smxdef_h
/*
* #include statements
*/
/*
* #define statements
*/
/*
* typedef statements
*/
/*
* External variables
*/
/*
* External Interface
*/
extern void SmXdefMerge(Display *display);
extern XrmDatabase SmXdefSubtract(XrmDatabase db);
#endif /*_smxdef_h*/
/* DON'T ADD ANYTHING AFTER THIS #endif */

View File

@@ -0,0 +1,381 @@
/* $XConsortium: SmXrm.c /main/4 1995/10/30 09:39:33 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. *
*/
/*************************************<+>*************************************
*****************************************************************************
**
** File: SmXrm.c
**
** Project: DT Session Manager (dtsession)
**
** Description:
** -----------
** This file contains routines to manage an Xrm database
**
** SmXrmSubtract() - subtract source_db from target_db and return result_db
**
*****************************************************************************
*************************************<+>*************************************/
#ifdef DEBUG
#include <stdio.h>
#endif
#include <X11/Intrinsic.h>
const XrmQuark empty = NULLQUARK;
struct smSubtractState {
XrmDatabase source_db;
XrmDatabase target_db;
XrmDatabase result_db;
XrmBindingList target_bindings;
XrmQuarkList target_quarks;
};
#ifdef DEBUG
static void _PrintDbEntry(
char *,
XrmBindingList,
XrmQuarkList,
XrmRepresentation *,
XrmValue *);
#endif
static Bool _CompareBindingQuarkList(
XrmBindingList bindings1,
XrmQuarkList quarks1,
XrmBindingList bindings2,
XrmQuarkList quarks2);
static Bool _SmCompareSourceAndTarget(
XrmDatabase *db,
XrmBindingList bindings,
XrmQuarkList quarks,
XrmRepresentation *type,
XrmValue *value,
XPointer closure);
static Bool _SmEnumerateSource(
XrmDatabase *db,
XrmBindingList bindings,
XrmQuarkList quarks,
XrmRepresentation *type,
XrmValue *value,
XPointer closure);
#ifndef DEBUG
#define _PrintDbEntry(a,b,c,d,e)
#endif /* !DEBUG */
/*************************************<->*************************************
*
* _CompareBindingQuarkList()
*
* Description:
* -----------
* Compare two binding quark lists and return True if the same
*
* Inputs:
* ------
* bindings1 - list1 bindings
* quarks1 - list1 bindings
* bindings2 - list2 bindings
* quarks2 - list2 bindings
*
* Outputs:
* -------
*
* Return:
* ------
* same - True if binding quark list is the same, False otherwise
*
* Comments:
* --------
*
*************************************<->***********************************/
static
Bool _CompareBindingQuarkList(
XrmBindingList bindings1,
XrmQuarkList quarks1,
XrmBindingList bindings2,
XrmQuarkList quarks2)
{
int i = 0;
Bool rc = False;
/*
* loop through quarks in list1
*/
while (quarks1[i] != NULLQUARK)
{
/*
* compare quark in list1 to same element in list2 and
* break out of loop if they differ.
*/
if (quarks2[i] == NULLQUARK || quarks2[i] != quarks1[i])
break;
/*
* quarks for this level compare, now compare bindings
*/
if (bindings1[i] != bindings2[i])
break;
i++;
}
if (quarks1[i] == NULLQUARK && quarks2[i] == NULLQUARK)
{
/*
* all quarks and bindings in list1 and list2 compare
*/
rc = True;
}
return(rc);
}
/*************************************<->*************************************
*
* _PrintDbEntry()
*
* Description:
* -----------
* Print an Xrm database entry (DEBUG only)
*
* Inputs:
* ------
* leader - leading string
* bindings - binding list
* quarks - quark list
* type - element type
* value - element value
*
* Outputs:
* -------
*
* Return:
* ------
*
* Comments:
* --------
*
*************************************<->***********************************/
#ifdef DEBUG
static
void _PrintDbEntry(
char *leader,
XrmBindingList bindings,
XrmQuarkList quarks,
XrmRepresentation *type,
XrmValue * value)
{
char * str;
int i;
FILE *fp = fopen ("/tmp/dtsession.xrm", "a");
str = XrmQuarkToString(type);
fprintf(fp, "%8s ", leader);
i = 0;
while ( quarks[i] != NULLQUARK )
{
str = XrmQuarkToString(quarks[i]);
fprintf(fp, "%s", str);
i++;
if (quarks[i] != NULLQUARK)
{
fprintf(fp, bindings[i] == XrmBindLoosely ? "*" : ".");
}
}
fprintf(fp, ": %s\n",value->addr);
fclose(fp);
}
#endif /* DEBUG */
/*************************************<->*************************************
*
* _SmCompareSourceAndTarget()
*
* Description:
* -----------
* Xrm Enum callback that compares the current database element to the
* current target element.
*
* Inputs:
* ------
* db - source database
* bindings - binding list
* quarks - quark list
* type - element type
* value - element value
* closure - pointer to smSubtractState data
*
* Outputs:
* -------
*
* Return:
* ------
* result - True if same, False if different
*
* Comments:
* --------
*
*************************************<->***********************************/
static
Bool _SmCompareSourceAndTarget(
XrmDatabase *db,
XrmBindingList bindings,
XrmQuarkList quarks,
XrmRepresentation *type,
XrmValue *value,
XPointer closure)
{
struct smSubtractState *state = (struct smSubtractState *)closure;
Bool rc = False;
_PrintDbEntry("source", bindings, quarks, type, value);
if (_CompareBindingQuarkList(bindings, quarks,
state->target_bindings, state->target_quarks))
{
rc = True;
}
return rc;
}
/*************************************<->*************************************
*
* _SmEnumerateSource()
*
* Description:
* -----------
* Xrm Enum callback that enumerates the source database for comparison
* against the current target element.
*
* Inputs:
* ------
* db - target database
* bindings - binding list
* quarks - quark list
* type - element type
* value - element value
* closure - pointer to smSubtractState data
*
* Outputs:
* -------
*
* Return:
* ------
* result - always False
*
* Comments:
* --------
*
*************************************<->***********************************/
static
Bool _SmEnumerateSource(
XrmDatabase *db,
XrmBindingList bindings,
XrmQuarkList quarks,
XrmRepresentation *type,
XrmValue *value,
XPointer closure)
{
struct smSubtractState *state = (struct smSubtractState *)closure;
Bool rc;
_PrintDbEntry("target", bindings, quarks, type, value);
/*
* Enumerate source database and compare each element to current
* target bindings and quarks.
*/
state->target_bindings = bindings;
state->target_quarks = quarks;
if (XrmEnumerateDatabase(state->source_db, &empty, &empty, XrmEnumAllLevels,
_SmCompareSourceAndTarget, closure) == False)
{
/*
* Target bindings and quarks don't match any element in source database,
* so copy target element to result db.
*/
_PrintDbEntry("nomatch", bindings, quarks, type, value);
XrmQPutResource(&state->result_db, bindings, quarks, *type, value);
}
return False;
}
/*************************************<->*************************************
*
* SmXrmSubtractDatabase()
*
* Description:
* -----------
* Subtracts source database from target database and returns
* the result database.
*
* Inputs:
* ------
* source_db - source database
* target_db - target database
*
* Outputs:
* -------
*
* Return:
* ------
* result_db - result database
*
* Comments:
* --------
*
*************************************<->***********************************/
/*
* Subtracts source database from target database and returns
* the result database.
*/
XrmDatabase
SmXrmSubtractDatabase(
XrmDatabase source_db,
XrmDatabase target_db)
{
struct smSubtractState state;
/*
* return if source or target db not specified
*/
if (source_db == NULL || target_db == NULL)
return NULL;
/*
* set up state
*/
state.source_db = source_db;
state.target_db = target_db;
state.result_db = NULL;
/*
* populate result db by looping through target and
* copying elements that don't also exist in source db
*/
XrmEnumerateDatabase(state.target_db, &empty, &empty, XrmEnumAllLevels,
_SmEnumerateSource, (XPointer)&state);
return(state.result_db);
}

View File

@@ -0,0 +1,53 @@
/* $XConsortium: SmXrm.h /main/4 1995/10/30 09:39:43 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. *
*/
/************************************<+>*************************************
****************************************************************************
**
** File: SmXrm.h
**
** Project: DT
**
** Description
** -----------
** Variables and declarations needed for
** Xrm database management
**
**
****************************************************************************
************************************<+>*************************************/
#ifndef _smxrm_h
#define _smxrm_h
/*
* #include statements
*/
/*
* #define statements
*/
/*
* typedef statements
*/
/*
* External variables
*/
/*
* External Interface
*/
XrmDatabase SmXrmSubtractDatabase(
XrmDatabase source_db,
XrmDatabase target_db);
#endif /*_smxrm_h*/
/* DON'T ADD ANYTHING AFTER THIS #endif */

View File

@@ -0,0 +1,148 @@
/* $XConsortium: Srv.h /main/6 1996/09/25 08:32:34 barstow $ */
/* *
* (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. *
*/
/*************************************<+>*************************************
*****************************************************************************
**
** File: Srv.h
**
** Project: HP DT Style Manager (part of the session manager)
**
** Description:
** -----------
**
**
*******************************************************************
** (c) Copyright Hewlett-Packard Company, 1990. All rights are
** reserved. Copying or other reproduction of this program
** except for archival purposes is prohibited without prior
** written consent of Hewlett-Packard Company.
********************************************************************
**
**
**
*****************************************************************************
*************************************<+>*************************************/
/* Standard C headers */
#include <stdio.h>
#ifdef _AIX
#include <sys/types.h>
#include <sys/dir.h>
#else
#include <dirent.h>
#include <limits.h>
#endif /* _AIX */
/* Dt header */
#include <Dt/UserMsg.h>
/* Xm headers */
#include <Xm/ColorObjP.h>
/* #defines */
#define NUM_OF_COLORS 8
#define MAX_NUM_SCREENS 6
/* defines for foreground colors */
#define DYNAMIC 0
#define BLACK 1
#define WHITE 2
#define PALETTE_SUFFIX ".dp"
#define B_O_W "BlackWhite"
#define W_ONLY "White"
#define W_O_B "WhiteBlack"
#define B_ONLY "Black"
/*
* macro to get message catalog strings
*/
#ifndef NO_MESSAGE_CATALOG
# ifdef __ultrix
# define _CLIENT_CAT_NAME "dtsession.cat"
# else /* __ultrix */
# define _CLIENT_CAT_NAME "dtsession"
# endif /* __ultrix */
extern char *_DtGetMessage(char *filename, int set, int n, char *s);
# define GETMESSAGE(set, number, string)\
(_DtGetMessage(_CLIENT_CAT_NAME, set, number, string))
#else
# define GETMESSAGE(set, number, string)\
string
#endif
/*******************************************************************************
* Color Palette data structures
*
******************************************************************************/
/*
** Define a colorset as foreground, background, topshadow, bottomshadow
** and selectcolor (also known as arm color).
*/
typedef struct _colorset {
XColor fg;
XColor bg;
XColor ts;
XColor bs;
XColor sc;
} ColorSet;
typedef struct _hsv {
int hue;
int saturation;
int value;
} HSVset;
/*
** Structure which stores the palettes for the customizer
*/
typedef struct _palette {
char *name;
char *directory;
int num_of_colors;
ColorSet color[XmCO_MAX_NUM_COLORS];
short defaultActive;
short defaultInactive;
short defaultPrimary;
short defaultSecondary;
short defaultRoot;
char *converted;
unsigned long converted_len;
struct _palette *prev;
struct _palette *next;
} palettes;
/****** Global Variables ********/
typedef struct {
int TypeOfMonitor[MAX_NUM_SCREENS];
int FgColor[MAX_NUM_SCREENS];
Bool UsePixmaps[MAX_NUM_SCREENS];
Bool DynamicColor[MAX_NUM_SCREENS];
int NumOfScreens;
Atom XA_CUSTOMIZE[MAX_NUM_SCREENS];
Atom XA_PIXEL_SET;
Atom XA_PALETTE_NAME;
Atom XA_TYPE_MONITOR;
Atom XA_UPDATE;
struct _palette *pCurrentPalette[MAX_NUM_SCREENS];
} ColorSrv;
extern ColorSrv colorSrv; /* defined in SrvPalette.c */
#define MAX_STR_LEN 128
/*
* Wrappers for system calls
*/
#define SRV_MALLOC(SIZE) XtMalloc(SIZE)
#define SRV_REALLOC(PTR, SIZE) XtRealloc(PTR, SIZE)
#define SRV_FREE(PTR) XtFree(PTR)
#define SRV_EXIT(STATUS) exit(status)

View File

@@ -0,0 +1,599 @@
/*
static char rcsid[] =
"$XConsortium: SrvFile_io.c /main/8 1996/09/25 09:41:53 barstow $";
*/
/* *
* (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. *
*/
/*****************************************************************************
*****************************************************************************
**
** File: SrvFile_io.c
**
** Project: HP DT Style Manager (integrated into dtsession)
**
** Description:
** -----------
** This file initializes the user specified ( or default) palette
** for this session.
**
*******************************************************************
** (c) Copyright Hewlett-Packard Company, 1990. All rights are
** reserved. Copying or other reproduction of this program
** except for archival purposes is prohibited without prior
** written consent of Hewlett-Packard Company.
********************************************************************
**
**
**
*****************************************************************************
*************************************<+>*************************************/
/* #includes */
#include <fcntl.h>
#include "Srv.h"
#include "SrvFile_io.h"
/* #defines */
#define BUFSIZE 1024
#define MSG2 ((char *)GETMESSAGE(28, 3, "Color Server Warning, the size of file is invalid: "))
#define MSG3 ((char *)GETMESSAGE(28, 4, "Color Server Warning, invalid information in '"))
#define MSG3a ((char *)GETMESSAGE(28, 5, "' removing file and starting again.\n"))
/* Static Function Declarations */
static Boolean FindPalette(
char *palette,
char *directory) ;
static struct _palette* ReadPaletteFile(
Display *dpy,
int screen_number,
char *palettePath,
char *palette) ;
static int ParsePaletteInfo(
Display *dpy,
int numDisplay,
char *buf,
int nbytes,
struct _palette *new_palette) ;
static void InitializeBW(
unsigned long color,
int num_of_colors,
struct _palette *new_palette) ;
/* static variables */
static int error_value;
#define HOME "HOME"
#define USER_PALETTE_DIR "/.dt/palettes"
#define SYSTEM_PALETTE_DIR CDE_INSTALLATION_TOP "/palettes"
#define CONFIG_PALETTE_DIR CDE_CONFIGURATION_TOP "/palettes"
#define DEFAULT_PALETTE "Default.dp"
/************************************************************************
**
** GetPaletteDefinition -
** Query the database for the Dtstyle.paletteDirectories resource
** Use Dtstyle default (Default) if not specified.
** Search the directories for the palette in reverse order
**
************************************************************************/
struct _palette *
GetPaletteDefinition(
Display *dpy,
int screen_number,
char *palette)
{
struct _palette *paletteDef;
char *str_type_return;
XrmValue value_return;
XrmDatabase db;
Boolean match = False;
char *palettePath;
char *path;
char *p, *d;
char *home;
char dir[256];
if (FindPalette (palette, SYSTEM_PALETTE_DIR))
{
/*
* First look for palette in the system location
*/
palettePath = (char *) SRV_MALLOC (strlen(SYSTEM_PALETTE_DIR) + 1 );
strcpy(palettePath, SYSTEM_PALETTE_DIR);
match = True;
}
else if (FindPalette (palette, CONFIG_PALETTE_DIR))
{
/*
* Next check the local config location
*/
palettePath = (char *) SRV_MALLOC (strlen(CONFIG_PALETTE_DIR) + 1 );
strcpy(palettePath, CONFIG_PALETTE_DIR);
match = True;
}
else
{
palettePath = NULL;
}
/* Get Dtstyle.paletteDirectories value */
db = XtDatabase(dpy);
if (XrmGetResource (db, "dtstyle.paletteDirectories",
"Dtstyle.PaletteDirectories",
&str_type_return, &value_return))
{
/* Make Local Copy of string */
path = (char *) SRV_MALLOC( value_return.size + 1 );
strcpy (path, value_return.addr);
}
else
{
path = NULL;
}
/* Look for palette in paletteDirectories */
if (path != NULL)
{
/* Loop through paletteDirectories looking in each directory
* till we find the palette file. Take first occurrance.
* Copy directory name into dir. Look for NULL or space
*/
p = path;
while (*p != '\0')
{
d = dir;
while (*p != ' ' && *p != '\0')
*d++ = *p++;
*d = '\0';
if (FindPalette (palette, dir))
{
palettePath = (char *)SRV_REALLOC(palettePath,
strlen(SYSTEM_PALETTE_DIR) + 1);
strcpy(palettePath, dir);
match = True;
break;
}
}
}
/* Look for palette in $HOME/.dt/palettes */
/* If there is a duplicate, take it */
if ((home=getenv(HOME)) == NULL)
home="";
path = (char *) SRV_REALLOC (path,
strlen(home) + strlen(USER_PALETTE_DIR) + 1);
strcpy(path, home);
strcat(path, USER_PALETTE_DIR);
if (FindPalette (palette, path))
{
palettePath = (char *) SRV_REALLOC (palettePath, strlen(path) + 1 );
strcpy(palettePath, path);
match = True;
}
if (match)
{
/* Parse the data from the palette file */
paletteDef = (struct _palette *) ReadPaletteFile(dpy,
screen_number,
palettePath,
palette);
}
else /* default to system Default */
{
palettePath = (char *) SRV_REALLOC (palettePath,
strlen(SYSTEM_PALETTE_DIR) + 1);
strcpy(palettePath, SYSTEM_PALETTE_DIR);
paletteDef = (struct _palette *)ReadPaletteFile(dpy,
screen_number,
palettePath,
DEFAULT_PALETTE);
}
if (path != NULL)
SRV_FREE(path);
if (palettePath != NULL)
SRV_FREE(palettePath);
return (paletteDef);
}
/************************************************************************
**
** FindPalette -
** Open the directory and look for the palette file.
** If found, read in data and return true.
** If not found, return false
**
************************************************************************/
static Boolean
FindPalette(
char *palette,
char *directory)
{
DIR *dirp;
struct dirent *file_descpt;
/* Open the directory */
if( (dirp = opendir(directory)) == NULL)
{
return(False);
}
else
{
file_descpt = readdir(dirp);
}
/* cycle through the files in the directory until found a match */
while( file_descpt != NULL)
{
/* check for a palette filename match */
if (strcmp(palette, file_descpt->d_name) == 0)
{
closedir(dirp);
return(True);
}
else
{
/* read the next file */
file_descpt = readdir(dirp);
}
} /* while( file_descpt != NULL) */
closedir(dirp);
return (False);
}
/***************************************************************************
*
* ReadPaletteFile - this routines reads and parses the palette file.
* It fills in the pCurrentPalette structure for the screen_number
* that was passed in.
*
*************************************************************************/
static struct _palette *
ReadPaletteFile(
Display *dpy,
int screen_number,
char *palettePath,
char *palette )
{
struct _palette *new_palette;
int fd, nbytes;
char buf[BUFSIZE];
char tmpPalette[BUFSIZE];
char *token1;
char *tmpStr2;
char *tmpStr;
char *fullPath;
/*
* create full path, don't forget to add 1 for the NULL byte
* and 1 for the slash in the format string for sprintf.
*/
fullPath = (char *) SRV_MALLOC (strlen(palettePath) + strlen(palette) + 2);
sprintf(fullPath,"%s/%s", palettePath, palette);
if( (fd = open( fullPath, O_RDONLY)) == -1)
{ /* open failed */
printf("error opening %s\n",fullPath);
SRV_FREE(fullPath);
return((struct _palette *) NULL);
}
/*
** Read a buffer of data ... BUFSIZE == 1024, as long as
** screen < MAX_NUM_SCREENS (5) then we should never need more.
*/
nbytes = read(fd, buf, BUFSIZE);
if(nbytes == 0 || nbytes == BUFSIZE) /* A bogus number of bytes */
{ /* read failed */
/*
* Don't forget to add 1 for the NULL byte and 2 for the
* period and the newline in the format string for sprintf
*/
tmpStr = (char *)SRV_MALLOC(strlen(MSG2) + strlen(fullPath) + 3);
sprintf(tmpStr,"%s%s.\n", MSG2, palettePath);
_DtSimpleError(XmSCOLOR_SRV_NAME, DtWarning, NULL, tmpStr, NULL);
SRV_FREE(tmpStr);
SRV_FREE(fullPath);
close(fd);
return((struct _palette *) NULL);
}
else
{ /* read suceeded */
/* Allocate space for this new palette. */
new_palette = (palettes *)SRV_MALLOC( sizeof(struct _palette) + 1 );
/* allocate enough space for the name */
strcpy(tmpPalette, palette);
for (token1=tmpPalette; *token1; token1++);
while (token1!=tmpPalette && *token1!='.') token1--;
if (!strcmp(token1,PALETTE_SUFFIX)) *token1 = '\0';
new_palette->name = (char *)SRV_MALLOC(strlen(tmpPalette) + 1);
strcpy(new_palette->name, (char *) tmpPalette);
new_palette->converted = NULL;
new_palette->converted_len = 0L;
/* set the next pointer to NULL*/
new_palette->next = NULL;
if (ParsePaletteInfo(dpy, screen_number, buf, nbytes, new_palette) == -1)
{
/* palette file is bad */
tmpStr = (char *)SRV_MALLOC(strlen(MSG3) + strlen(MSG3a) + strlen(palettePath) +1);
tmpStr2 = (char *)SRV_MALLOC(strlen(MSG3)+1);
sprintf(tmpStr2,"%s", MSG3);
sprintf(tmpStr,"%s%s%s", tmpStr2, palettePath, MSG3a);
_DtSimpleError(XmSCOLOR_SRV_NAME, DtWarning, NULL, tmpStr, NULL);
SRV_FREE(tmpStr);
SRV_FREE(tmpStr2);
error_value = 1;
unlink(palettePath);
SRV_FREE(fullPath);
return((struct _palette *) NULL);
}
}
/* close the file */
close(fd);
SRV_FREE(fullPath);
return(new_palette);
}
/***********************************************************************
*
* ParsePaletteInfo - This routine reads from the buffer(buf) the
* actual data into the new_palette. It reads in the bg colors
* then uses the XmCalculateColorRGB to generate the ts, bs, and sc
* colors. This routine doesn't allocate any pixel numbers but
* does generate the RGB values for each color in a palette.
*
***********************************************************************/
static int
ParsePaletteInfo(
Display *dpy,
int screen_num,
char *buf,
int nbytes,
struct _palette *new_palette )
{
char tmpbuf[BUFSIZE];
int count;
int num_of_colors;
int result;
XColor tmp_color;
int buf_count;
static XmColorProc calcRGB = NULL;
num_of_colors = new_palette->num_of_colors = 0;
if(colorSrv.TypeOfMonitor[screen_num] != XmCO_BLACK_WHITE)
if((strcmp(new_palette->name, W_O_B)) == 0 ||
(strcmp(new_palette->name, B_O_W)) == 0 ||
(strcmp(new_palette->name, W_ONLY)) == 0 ||
(strcmp(new_palette->name, B_ONLY)) == 0)
return(-1);
buf_count = 0;
/* read in background colors until end of file */
while(buf_count < nbytes && buf[buf_count] != '!')
{
count = 0;
/* read in a BG color */
while(buf[buf_count] != '\012')
tmpbuf[count++] = buf[buf_count++];
tmpbuf[count++] = '\0';
buf_count++;
/* get the RGB value (XColor) of the background */
result = XParseColor(dpy, DefaultColormap(dpy, screen_num),
tmpbuf, &tmp_color);
/* there was an error */
if(result == 0)
return(-1);
new_palette->color[num_of_colors].bg.red = tmp_color.red;
new_palette->color[num_of_colors].bg.blue = tmp_color.blue;
new_palette->color[num_of_colors].bg.green = tmp_color.green;
/*
** Now lets generate all the colors which go along with this bg i.e. ts,
** fg, bs, and sc.
*/
if (calcRGB == NULL) calcRGB = XmGetColorCalculation();
(*calcRGB)(&tmp_color,
&(new_palette->color[num_of_colors].fg),
&(new_palette->color[num_of_colors].sc),
&(new_palette->color[num_of_colors].ts),
&(new_palette->color[num_of_colors].bs));
if(colorSrv.TypeOfMonitor[screen_num] == XmCO_BLACK_WHITE)
InitializeBW(tmp_color.red, num_of_colors, new_palette);
else /* Not Black and White */
{
if(colorSrv.UsePixmaps[screen_num] == TRUE)
{
/* the values generated by XmCalculateColorRBG are invalid */
new_palette->color[num_of_colors].ts.red = 65535;
new_palette->color[num_of_colors].ts.blue = 65535;
new_palette->color[num_of_colors].ts.green = 65535;
new_palette->color[num_of_colors].bs.red = 0;
new_palette->color[num_of_colors].bs.blue = 0;
new_palette->color[num_of_colors].bs.green = 0;
}
if(colorSrv.FgColor[screen_num] != DYNAMIC)
{
if(colorSrv.FgColor[screen_num] == BLACK)
{
new_palette->color[num_of_colors].fg.red = 0;
new_palette->color[num_of_colors].fg.blue = 0;
new_palette->color[num_of_colors].fg.green = 0;
}
else /* colorSrv.FgColor[screen_num] == WHITE */
{
new_palette->color[num_of_colors].fg.red = 65535;
new_palette->color[num_of_colors].fg.blue = 65535;
new_palette->color[num_of_colors].fg.green = 65535;
}
}
} /* else Not Black and White */
num_of_colors++;
new_palette->num_of_colors++;
if(colorSrv.TypeOfMonitor[screen_num] == XmCO_BLACK_WHITE)
if( new_palette->num_of_colors == 2)
break;
if(colorSrv.TypeOfMonitor[screen_num] == XmCO_LOW_COLOR ||
colorSrv.TypeOfMonitor[screen_num] == XmCO_MEDIUM_COLOR)
if( new_palette->num_of_colors == 4)
break;
} /* while */
if(colorSrv.TypeOfMonitor[screen_num] == XmCO_LOW_COLOR)
{
new_palette->num_of_colors = 2;
SwitchAItoPS(new_palette);
}
return(0);
}
/***********************************************************************
*
* InitializeBW - the type of monitor is a black and white, so
* initialize the colors to black and white. If the color passed
* in is 0 (black) set everything to 65535 (white). Otherwise
* set everything to 0 (black).
*
***********************************************************************/
static void
InitializeBW(
unsigned long color,
int num_of_colors,
struct _palette *new_palette )
{
if(color == 0L)
{
new_palette->color[num_of_colors].fg.red = 65535;
new_palette->color[num_of_colors].fg.blue = 65535;
new_palette->color[num_of_colors].fg.green = 65535;
new_palette->color[num_of_colors].ts.red = 65535;
new_palette->color[num_of_colors].ts.blue = 65535;
new_palette->color[num_of_colors].ts.green = 65535;
new_palette->color[num_of_colors].bs.red = 65535;
new_palette->color[num_of_colors].bs.blue = 65535;
new_palette->color[num_of_colors].bs.green = 65535;
new_palette->color[num_of_colors].sc.red = 0;
new_palette->color[num_of_colors].sc.blue = 0;
new_palette->color[num_of_colors].sc.green = 0;
}
else
{
new_palette->color[num_of_colors].fg.red = 0;
new_palette->color[num_of_colors].fg.blue = 0;
new_palette->color[num_of_colors].fg.green = 0;
new_palette->color[num_of_colors].ts.red = 0;
new_palette->color[num_of_colors].ts.blue = 0;
new_palette->color[num_of_colors].ts.green = 0;
new_palette->color[num_of_colors].bs.red = 0;
new_palette->color[num_of_colors].bs.blue = 0;
new_palette->color[num_of_colors].bs.green = 0;
new_palette->color[num_of_colors].sc.red = 65535;
new_palette->color[num_of_colors].sc.blue = 65535;
new_palette->color[num_of_colors].sc.green = 65535;
}
}
void
SwitchAItoPS(
struct _palette *new_palette )
{
new_palette->color[0].bg.red = new_palette->color[3].bg.red;
new_palette->color[0].bg.green = new_palette->color[3].bg.green;
new_palette->color[0].bg.blue = new_palette->color[3].bg.blue;
new_palette->color[0].fg.red = new_palette->color[3].fg.red;
new_palette->color[0].fg.green = new_palette->color[3].fg.green;
new_palette->color[0].fg.blue = new_palette->color[3].fg.blue;
new_palette->color[0].ts.red = new_palette->color[3].ts.red;
new_palette->color[0].ts.green = new_palette->color[3].ts.green;
new_palette->color[0].ts.blue = new_palette->color[3].ts.blue;
new_palette->color[0].bs.red = new_palette->color[3].bs.red;
new_palette->color[0].bs.green = new_palette->color[3].bs.green;
new_palette->color[0].bs.blue = new_palette->color[3].bs.blue;
new_palette->color[0].sc.red = new_palette->color[3].sc.red;
new_palette->color[0].sc.green = new_palette->color[3].sc.green;
new_palette->color[0].sc.blue = new_palette->color[3].sc.blue;
new_palette->color[1].bg.red = new_palette->color[2].bg.red;
new_palette->color[1].bg.green = new_palette->color[2].bg.green;
new_palette->color[1].bg.blue = new_palette->color[2].bg.blue;
new_palette->color[1].fg.red = new_palette->color[2].fg.red;
new_palette->color[1].fg.green = new_palette->color[2].fg.green;
new_palette->color[1].fg.blue = new_palette->color[2].fg.blue;
new_palette->color[1].ts.red = new_palette->color[2].ts.red;
new_palette->color[1].ts.green = new_palette->color[2].ts.green;
new_palette->color[1].ts.blue = new_palette->color[2].ts.blue;
new_palette->color[1].bs.red = new_palette->color[2].bs.red;
new_palette->color[1].bs.green = new_palette->color[2].bs.green;
new_palette->color[1].bs.blue = new_palette->color[2].bs.blue;
new_palette->color[1].sc.red = new_palette->color[2].sc.red;
new_palette->color[1].sc.green = new_palette->color[2].sc.green;
new_palette->color[1].sc.blue = new_palette->color[2].sc.blue;
}
/***********************************************************************
*
* SaveDefaultPalette - used to save the palette.dt file to
* either $HOME/.dt/$DISPLAY/current or $HOME/.dt/$DISPLAY/home.
* The parameter mode determines whether it is home or
* current.
*
***********************************************************************/
void
SaveDefaultPalette(
Display *dpy,
char *dtPath,
int mode )
{
}

View File

@@ -0,0 +1,62 @@
/* $XConsortium: SrvFile_io.h /main/4 1995/10/30 09:40:10 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. *
*/
/************************************<+>*************************************
****************************************************************************
**
** File: SrvFile_io.h
**
** Project: HP DT
**
** Description
** -----------
** Variables and declarations needed for
** File I/O for the color server
**
**
** (c) Copyright Hewlett-Packard Company, 1990.
**
**
**
****************************************************************************
************************************<+>*************************************/
#ifndef _srvfile_h
#define _srvfile_h
/*
* #include statements
*/
/*
* #define statements
*/
/*
* typedef statements
*/
/*
* External variables
*/
/*
* External Interface
*/
extern void SwitchAItoPS(
struct _palette *) ;
extern struct _palette * GetPaletteDefinition(
Display *dpy,
int screen_number,
char *palette) ;
#endif /*_srvfile_h*/
/* DON'T ADD ANYTHING AFTER THIS #endif */

View File

@@ -0,0 +1,138 @@
static char rcsid[] =
"$XConsortium: SrvMain.c /main/4 1995/10/30 09:40:18 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. *
*/
/*
$Log$
* Revision 1.10 95/02/24 13:47:53 13:47:53 mcnichol_ibm_austin
* 7602 - code needs 4 line CDE partner copyright notices
*
* Revision 1.9 94/07/25 15:52:01 15:52:01 mcbill_hp_cv
* remove call to DtSetUserMessageHandler (obsolete)
*
*
* Revision 1.8 94/05/05 16:13:58 16:13:58 arg_sun
* DevEnv_cleanup
*
* Revision 1.7 93/08/12 20:25:17 20:25:17 xbuild (See Marc Ayotte)
* additional CoeToDt check-in
*
* Revision 1.6 93/08/12 20:17:58 20:17:58 xbuild (See Marc Ayotte)
* CoeToDt check-in
*
* Revision 1.5 93/03/08 14:39:58 14:39:58 xbuild (See Marc Ayotte)
* "duplicate rev for sending to ibm"
*
* Revision 1.4 93/03/05 11:19:52 11:19:52 ronv (Ronald Voll)
* ========= Changed strings: =============
* vue --> dt
* Vue --> Dt
* VuE --> CoE
* VUE --> DT
*
* Revision 1.3 93/01/28 15:47:47 15:47:47 xbuild (See Marc Ayotte)
* XmpToDt check-in
*
* Revision 1.2 93/01/27 19:50:39 19:50:39 xbuild (See Marc Ayotte)
* XueToDt check-in
*
* Revision 1.1 93/01/12 10:42:51 10:42:51 xbuild (See Marc Ayotte)
* Initial revision
*
* Revision 1.1 93/01/07 16:40:10 16:40:10 xbuild (See Marc Ayotte)
* Initial revision
*
* Revision 1.1 91/10/31 16:26:30 16:26:30 keith (Keith Taylor)
* Initial revision
*
* Revision 3.3 91/05/22 14:02:22 14:02:22 julie (Julie Skeen)
* protos and domain fixes
*
* Revision 3.2 90/09/24 17:20:33 17:20:33 fredh (Fred Handloser)
* change to static message catalogs
*
* Revision 3.1 90/07/27 11:37:34 11:37:34 ted (Ted Ransom)
* added the new parameter for InitializeCoecolor
*
* Revision 3.0 90/07/10 12:08:42 12:08:42 kimd (Kim Drongesen)
* first release after strider/tw
* useAsyncGeometry and font changes for topcat added
*
* Revision 2.6 90/04/26 14:00:03 14:00:03 ted
* bullet proofing
*
* Revision 2.5 90/03/29 08:08:46 08:08:46 ted (Ted Ransom)
* now calls InitializeCoecolor .. does CheckMonitor, InitializePalettes, and
* AllocateColors
*
* Revision 2.4 90/03/26 14:34:45 14:34:45 ted (Ted Ransom)
* registered error message handler .. registered XeProgName
*
* Revision 2.3 90/03/14 17:23:40 17:23:40 ted (Ted Ransom)
* no change
*
* Revision 2.2 90/03/14 11:25:43 11:25:43 jenny (Jennefer Wood)
* added appContext to XtOpenDisplay and XtAppMainLoop
*
* Revision 2.1 90/03/13 09:04:30 09:04:30 ted (Ted Ransom)
* added support for Selections .. use -DSELECTION
*
* Revision 2.0 90/03/12 09:17:25 09:17:25 jenny (Jennefer Wood)
* NCGA
*
* Revision 1.5 90/02/28 11:27:02 11:27:02 ted (Ted Ransom)
* updated to support multiple screens
*
* Revision 1.4 90/02/26 17:25:02 17:25:02 ted (Ted Ransom)
* no changes ... sorry
*
* Revision 1.3 90/02/21 13:41:08 13:41:08 root ()
* added malloc_check and malloc_trace under ifdef for USERHELP
*
* Revision 1.2 90/02/12 16:04:09 16:04:09 ted (Ted Ransom)
* changed c_server.h Srv.h
*
* Revision 1.1 90/02/12 15:20:45 15:20:45 ted (Ted Ransom)
* Initial revision
*
*/
#include "Srv.h"
#include "Sm.h"
void
main(
int argc,
char **argv )
{
Display *display;
int result;
#ifdef USERHELP
malloc_check(1);
malloc_trace(0);
#endif
XtAppContext app;
/* Initialize the toolkit and open the display */
XtToolkitInitialize();
app = XtCreateApplicationContext();
display = XtOpenDisplay(app, NULL, argv[0], "Customize", NULL, 0,
&argc, argv);
/* Go register the DT error handler */
XeProgName = argv[0];
result = InitializeDtcolor(display, DEFAULT_SESSION);
if(result != 0)
exit(0);
XtAppMainLoop(app);
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,57 @@
/* $XConsortium: SrvPalette.h /main/4 1995/10/30 09:40:38 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. *
*/
/************************************<+>*************************************
****************************************************************************
**
** File: SrvPalette.h
**
** Project: HP DT
**
** Description
** -----------
** Variables and declarations needed for
** Session Restoration for the session manager
**
**
** (c) Copyright Hewlett-Packard Company, 1990.
**
**
**
****************************************************************************
************************************<+>*************************************/
#ifndef _srvpalette_h
#define _srvpalette_h
/*
* #include statements
*/
/*
* #define statements
*/
/*
* typedef statements
*/
/*
* External variables
*/
/*
* External Interface
*/
extern int InitializeDtcolor( Display *, short ) ;
extern int CheckMonitor( Display *) ;
#endif /*_srvpalette_h*/
/* DON'T ADD ANYTHING AFTER THIS #endif */

View File

@@ -0,0 +1,73 @@
#!/bin/sh
# * *
# * (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. *
# *
#######################################################################
#
# convertVS.sh
#
# The shell-script which converts a DT 2.0 dt.session file
# to a DT 3.0 dt.session file. This file is intended to
# only be executed by dtsession.
#
# Hewlett-Packard Visual User Environment
#
# Copyright (c) 1991, 1992 Hewlett-Packard Company
#
# @(#) $XConsortium: convertVS.sh /main/3 1995/10/30 09:40:46 rswiston $
#
######################################################################
# Usage: convertVS.sh <session_file>
if [ $# -eq 1 ]
then
if [ -r $1 ]
then
# ---- get the local clients
grep -v host $1 >$1T1
# ---- get the remote clients ----
grep host $1 >$1T2
# ---- change /usr/bin/X11/<client> to /usr/dt/bin/<client> ----
# for local clients $1T1 ----
sed 's/\/usr\/bin\/X11\/hpterm/\/usr\/dt\/bin\/hpterm/g
s/\/usr\/bin\/X11\/xload/\/usr\/dt\/bin\/xload/g' $1T1 > $1T3
# ---- preserve old dt.session file ----
cp $1 $1.20
# ---- put local clients first in file ----
cat $1T3 $1T2 >$1TMP
# ---- remove the temporary files ----
rm -f $1T1 $1T2 $1T3
# ---- make this our new dt.session ----
mv -f $1TMP $1
exit 0
else
exit 1
fi
else
exit 1
fi

View File

@@ -0,0 +1,169 @@
XCOMM!/bin/ksh
XCOMM $XConsortium: dtloadresources.src /main/6 1996/04/23 18:51:41 drk $
XCOMM (c) Copyright 1996 Digital Equipment Corporation.
XCOMM (c) Copyright 1993,1994,1996 Hewlett-Packard Company.
XCOMM (c) Copyright 1993,1994,1996 International Business Machines Corp.
XCOMM (c) Copyright 1993,1994,1996 Sun Microsystems, Inc.
XCOMM (c) Copyright 1993,1994,1996 Novell, Inc.
XCOMM (c) Copyright 1996 FUJITSU LIMITED.
XCOMM (c) Copyright 1996 Hitachi.
#define HASH #
XCOMM ##########################################################################
XCOMM #
XCOMM # File: dtsession_res
XCOMM #
XCOMM # Default Location: /usr/dt/bin/dtsession_res
XCOMM #
XCOMM # Purpose: Load the RESOURCE_MANAGER with desktop resources
XCOMM #
XCOMM # Description: This script is invoked to load or reload the
XCOMM # RESOURCE_MANAGER from the desktop resource files.
XCOMM #
XCOMM # Invoked by: The desktop Session Manager at session startup,
XCOMM # or user by means of 'dtaction LoadResources'.
XCOMM # This script should not be invoked directly.
XCOMM #
XCOMM # Product: @(#)Common Desktop Environment 1.0
XCOMM #
XCOMM # (c) Copyright 1993, 1994 Hewlett-Packard Company
XCOMM # (c) Copyright 1993, 1994 International Business
XCOMM # Machines Corp.
XCOMM # (c) Copyright 1993, 1994 Sun Microsystems, Inc.
XCOMM # (c) Copyright 1993, 1994 Unix System Labs, Inc.,
XCOMM # a subsidiary of Novell, Inc.
XCOMM #
XCOMM # Note: Please do not modify this file.
XCOMM # Later product updates will overwrite this file.
XCOMM #
XCOMM ##########################################################################
Msg()
{
HASH
HASH $1 - message catalog number
HASH $2 - fallback message text
HASH
echo "$2"
HASH dspmsg dtsession_res.cat -s 1 $1 "$2"
}
Usage()
{
HASH
HASH $1 - message catalog number
HASH
Msg 1 "dtsession_res -load|-merge [-system] [-xdefaults] [-file <name>]"
case $1 in
needArgs) Msg 2 "Option -load or -merge must be specified";;
xrdbOptDone) Msg 3 "Option -load or -merge already specified";;
needFile) Msg 4 "Missing <filename> after -file option";;
unknownArg) Msg 5 "Unknown option specified";;
HASH needOption);; # this is the Usage statement above
esac
exit 1
}
XCOMM
XCOMM Parse options
XCOMM
if [ $# -eq 0 ]; then
Usage needArgs
fi
#ifdef sun
rOWsystem=$OPENWINHOME/lib/Xdefaults
rOWdefaults=$HOME/.OWdefaults
#endif
rFactory=CDE_INSTALLATION_TOP/config/$LANG/sys.resources
rFactoryC=CDE_INSTALLATION_TOP/config/C/sys.resources
rCustom=CDE_CONFIGURATION_TOP/config/$LANG/sys.resources
rXdefaults=$HOME/.Xdefaults
xrdbOption=""
resourceFiles=""
while [ $# -gt 0 ]; do
case $1 in
-load|-merge)
HASH
HASH xrdb option specified
HASH
if [ ! -z "$xrdbOption" ]; then
Usage xrdbOptDone
fi
xrdbOption=$1
;;
-system)
HASH
HASH locate system resources
HASH
#ifdef sun
if [ -r "$rOWsystem" ]; then
resourceFiles="$resourceFiles $rOWsystem"
fi
#endif
if [ -r "$rFactory" ]; then
resourceFiles="$resourceFiles $rFactory"
elif [ -r "$rFactoryC" ]; then
resourceFiles="$resourceFiles $rFactoryC"
fi
HASH
HASH Locate customized system resources
HASH
if [ -r "$rCustom" ]; then
resourceFiles="$resourceFiles $rCustom"
fi
;;
-xdefaults)
HASH
HASH Locate .Xdefaults
HASH
if [ -r "$rXdefaults" ]; then
resourceFiles="$resourceFiles $rXdefaults"
fi
#ifdef sun
if [ -r "$rOWdefaults" ]; then
resourceFiles="$resourceFiles $rOWdefaults"
fi
#endif
;;
-file)
HASH
HASH Locate specified file
HASH
shift
if [ -z "$1" ]; then
Usage needFile
fi
if [ -r "$1" ]; then
resourceFiles="$resourceFiles $1"
fi
;;
*) Usage unknownArg;;
esac
shift
done
if [ -z "$xrdbOption" ]; then
Usage needOption
fi
XCOMM converts ":0" to "0", but leaves "pablo:0" as is
display=${DISPLAY##:}
XCOMM converts "blanco.flexicat.com:0.0" to "blanco_flexicat_com_0"
display=$(echo ${display%.*} | /usr/bin/tr ".:" "__")
(
echo "dtsession_res*files: $resourceFiles"
if [ ! -z "$resourceFiles" ]; then
cat $resourceFiles
fi
) | XBINDIR/xrdb -quiet $xrdbOption -DDISPLAY_$display

View File

@@ -0,0 +1,293 @@
.\" $XConsortium: dtsession.man /main/2 1995/07/17 10:51:34 drk $
.\" * *
.\" * (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. *
.\" *
.TH DTSESSION 1X
.ds ]W HP DT 3.0
.SH NAME
\fBdtsession \(em The HP DT Session Manager.\fP
.sp 1
.SH SYNOPSIS
.B dtsession
[options]
.sp 1
.SH DESCRIPTION
\fIDtsession\fP provides session management functionality during an HP DT
session, the time from login to logout. It allows for saving a session,
restoring a session, locking a session, and allocating colors for HP DT
compatible clients.
.P
When a session is saved, client information, server settings, and
resources are retained. Client information consists of
all clients currently active in the session. Server settings consist of
settings (such as the beeper or keyboard) that are modified by a call to
the server. Resources consist of all resources currently stored on the
\fBRESOURCE_MANAGER\fP property on the root window of the default screen.
.P
The session is locked by pressing the "lock" button on the workspace manager
(front panel).
When the display is locked, no further input is accepted until a correct
password is entered. Correct passwords include the user who locked the
display, the root password for the system, and any users specified in
the \fBkeys\fP resource.
.P
Color allocation provides each client with a set of colors which are used
in creating visual components. These colors can then be dynamically
changed by using the HP DT Style Manager (\fIdtstyle(1X)\fP).
.P
\fIDtsession\fP is automatically invoked by the HP DT Login Manager
(\fIdtlogin(1X)\fP). If the
HP DT Login Manager is not currently being used, \fIdtsession\fP can
be invoked by putting the following command in an .xsession or .x11start
file:
.P
/usr/dt/bin/dtsession -norestore
.P
WARNING: This command must be the first X11 client in the file (other
than xrdb). It must be run in the foreground. When using this command,
no save and restore functionality is available. Any calls that start
up window managers must be removed from the startup file. The default
window manager can only be changed by setting the \fBwmStartupCommand\fP
resource.
.sp 1
.SH OPTIONS
.TP 8
.BI \-norestore
This option allows users to use \fIdtsession\fP in a limited way. The
advantage of using this option is that \fIdtsession\fP can be started
directly from an .x11start or .xsession script. See use and warning above.
.SH CUSTOMIZATION
\fIDtsession's\fP behavior can be customized through the use of the HP DT
Style Manager's startup dialog. The following is the behavior that can be
customized.
.sp 1
.TS
center;
cB s
lB lB
l l.
HP DT Session Manager Customization Options
Name Default
Display Logout Confirmation On
Set Home Session N/A
Startup Behavior Resume Current Session
.TE
.sp 1
.TP 8
.BR "Display Logout Confirmation"
"Display Logout Confirmation" allows you to toggle the appearance of the logout
confirmation box that appears after you click on the logout button
located in the workspace manager, or choose the "Log out..." option available in
the \fIdtwm\fP root menu. Setting the button displays the logout dialog.
Clearing the button causes immediate exit with no
confirmation. The default behavior is that the logout confirmation
dialog will be displayed.
.TP 8
.BR "Set Home Session"
The "Set Home Session" button allows you to save a home session for use
later. The home session is a "snapshot" session that you can return to
by changing logout options.
.TP 8
.BR "Startup Behavior"
The startup behavior allows you to specify which state the HP DT Session
Manager will restore upon startup (login). The default is that it
automatically restarts the state you were in at logout (Resume Current
Session). The other
states available are "Return to Home Session" and "Ask Me at Logout." "Return
to Home Session" returns you to the last saved home session at next
startup. "Ask Me at Logout" allows you to choose which behavior you would
prefer at logout time. If "Return to Home Session" is chosen, a home
session has to have been previously saved. Otherwise the default system
session will appear at next login. Note that "Ask Me at Logout" cannot be
active while "Display Logout Confirmation" is turned off.
.SH RESOURCES
\fIDtsession\fP uses the following resources.
.sp 1
.TS
center;
cB sss
lB lB lB lB
l l l l.
HP DT Session Manager Resource Set
Name Class Type Default
_
alarmTime AlarmTime unsigned int 10
colorUse ColorUse int dynamic*
coverScreen CoverScreen Boolean False
dynamicColor DynamicColor Boolean True
foregroundColor ForegroundColor int dynamic*
lockOnTimeout LockOnTimeout Boolean False
keys Keys unsigned char NULL
queryServerSettings QueryServerSettings Boolean False
shadowPixmaps ShadowPixmaps int dynamic*
wmStartupCommand WmStartupCommand executable path NULL
writeXrdbColors writeXrdbColors Boolean True
.TE
.ps 7
\h'30p'*The display type determines default.
.ps
.sp 1
.IP "\fBalarmTime\fP"
This resource specifies (in seconds) the amount of time before the lock
dialog is removed from the screen. When the display is locked, the
pointer shows a lock cursor, and a dialog appears which asks for the
user password. If no activity from the pointer or keyboard is detected
for \fBalarmTime\fP seconds, the dialog is removed from the screen. The lock
dialog is redisplayed as soon as a pointer or keyboard event is
detected. An
\fBalarmTime\fP of 0 leaves the lock dialog in place for the entire time the
display is locked. The default value is 10 seconds.
.IP "\fBcolorUse\fP"
This resource specifies the number of colors to use for the user interface.
Valid types are:
.RS
.IP \(bu 3
\fBB_W\fP \(em Specifies a black and white system.
The color palettes will use two color cells for the user interface.
In this configuration only two color palettes are available:
BlackWhite and WhiteBlack.
These palettes cannot dynamically change. To change a palette,
all applications using that color palette must be restarted.
This resource value forces \fBShadowPixmaps\fP to True, and
\fBForegroundColor\fP to either black or white depending on the palette chosen.
.IP \(bu 3
\fBLOW_COLOR\fP \(em Specifies a low color system.
The color palettes will have two color sets and use a maximum of 12 color
cells for the user interface, including black and white (color cells 0 and 1).
The number of color cells can be reduced by using the resources
\fBShadowPixmaps\fP and \fBForegroundColor\fP.
.IP \(bu 3
\fBMEDIUM_COLOR\fP \(em Specifies a medium color system.
The color palettes will have 4 color sets and use a maximum of 22 color cells
for the user interface, including black and white (color cells 0 and 1).
The number of color cells can be reduced by using the resources
\fBShadowPixmaps\fP and \fBForegroundColor\fP.
.IP \(bu 3
\fBHIGH_COLOR\fP \(em Specifies a high color system.
The color palettes will have 8 color sets and use a maximum of 42 color cells
for the user interface, including black and white (color cells 0 and 1).
The number of color cells can be reduced by using the resources
\fBShadowPixmaps\fP
and \fBForegroundColor\fP.
The default value for this resource will be determined by querying
the X server for the number of color cells on the system.
.RE
.sp 1
.TS
center;
cb cb
l | l.
planes ColorUse
_
2-3 B_W
4 LOW_COLOR
6 MEDIUM_COLOR
8+ HIGH_COLOR
.TE
.sp 1
.IP "\fBcoverScreen\fP"
This resource specifies whether or not the screens of the display will
be covered when the display is locked. The default value is True,
which means that the screens will be covered.
.IP "\fBdynamicColor\fP"
This resource can have values of True or False. \fBdynamicColor\fP is
used to reduce the number of color cells being used. Once a palette has
been selected and it is not likely to be changed, \fBdynamicColor\fP can
be set to False.
If set to False colors cannot be dynamically changed using the DT
style manager. A selected
palette will take effect the next session.
The next time the session comes up, the color server uses Read Only
color cells that can be shared by all clients, thus reducing
the number of color cells used.
.IP "\fBforegroundColor\fP"
This resource can have values of White, Black or Dynamic.
\fBForegroundColor\fP causes all text (foreground) to use either pixel 0
or 1 (Black
or White) or to have a color cell dedicated to foreground and changes in
response to the background color (Dynamic) for each ColorSet.
If set to White or Black, the number of color cells used per ColorSet is
reduced by 1.
.IP "\fBkeys\ \ \ \ \ \fP"
This resource is a list of "keyholders" who have the ability to unlock
the screen any time it is locked by the user. The list is a list of user
id's separated by commas. For example if user kim has the following
resource active during a session:
.sp 1
\fBDtsession*keys: fred,keith\fP
.sp 1
Users fred and keith have the ability to unlock the display when kim
locks it.
.IP "\fBlockOnTimeout\fP"
This resource specifies whether or not dtsession will lock the screen
when there has been a period of time without pointer or keyboard activity.
The default value is False,
which means that the screen will not be locked automatically. This
resource only applies when using a server that has the ability to
notify dtsession when the period of inactivity has occurred.
.IP "\fBqueryServerSettings\fP"
This resource specifies whether \fIdtsession\fP queries the server at
logout for all its settings or saves only those settings set by using
the HP DT Style Manager. Querying the server ensures that all settings are
saved; however, there is a degradation in performance when a full query
is done. The default value is False, which means that the server
will not be queried.
.IP "\fBshadowPixmaps\fP"
For color systems, this resource can have a value of True or False.
If True, \fBtopShadowColor\fP and \fBbottomShadowColor\fP use the same
pixel as background and \fBtopShadowPixmap\fP and
\fBbottomShadowPixmap\fP are specified
instead of solid color to create the 3D look.
This reduces the number of color cells per ColorSet by 2.
\fBShadowPixmaps\fP defaults to True for systems with 4 or less color planes
(16 or less color cells),
and False for systems with more than 4 color planes.
.IP "\fBwmStartupCommand\fP"
This resource allows for an alternate window manager to be started at
login. If this resource is NULL, dtsession starts /usr/dt/bin/dtwm. An
alternate startup might look like:
.sp 1
\fBDtsession*wmStartupCommand: /usr/bin/X11/mwm\fP
.sp 1
Note that the command should not have any commands to a shell in it, and
that it should not be surrounded by quotes. Also, if any
other window manager other than \fIdtwm\fP is used, clients will be restored,
but may not be restored to the correct position. By default, this resource
contains a NULL value.
.IP "\fBwriteXrdbColors\fP"
This resource should only be used if you are running non HP Motif 1.1 clients
that have color schemes that conflict with HP DT colors. This has no
impact on clients linked with the Motif 1.1 library. This resource
specifies whether color resource information should be written out.
If set to False, \fBbackground\fP and \fBforeground\fP resources will not
be written out with the values of the current palette. This means that
non HP Motif 1.1 clients will not get HP DT colors when they are started.
The default value is True.
.sp 1
.SH COPYRIGHT
Copyright 1990, 1991, 1992 Hewlett-Packard Company.
.br
(c) Copyright 1993, 1994 Hewlett-Packard Company
.br
(c) Copyright 1993, 1994 International Business Machines Corp.
.br
(c) Copyright 1993, 1994 Sun Microsystems, Inc.
.br
(c) Copyright 1993, 1994 Novell, Inc.
.sp 1
.SH ORIGIN
Hewlett-Packard Comany UTD-CV.
.br
International Business Machines Corp.
.br
Sun Microsystems, Inc.
.br
Novell, Inc.
.sp 1
.SH SEE ALSO
\fBX(1)\fP, \fBdtstyle(1X)\fP, \fBdtwm(1X)\fP, \fBdtlogin(1X)\fP.

View File

@@ -0,0 +1,555 @@
$ "$TOG: dtsession.msg.src /main/25 1999/09/20 13:47:55 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. *
$ *
$ *************************************<+>*************************************
$ *****************************************************************************
$ **
$ ** File: dtsession.msg
$ **
$ ** Project: HP DT Session Manager (dtsession)
$ **
$ ** Description:
$ ** -----------
$ ** This file is the source for the message catalog for dtsession
$ **
$ **
$ *****************************************************************************
$ **
$ ** (c) Copyright 1990 Hewlett-Packard Company
$ ** All Rights reserved
$ **
$ **
$ *****************************************************************************
$ *************************************<L>*************************************
$ ** -----------------GENERAL LOCALIZATION NOTES SECTION---------------------
$ * Comment lines begin with a $ except $set which indicates the start of a
$ * new set.
$ *
$ * Do not delete any comments; you may add comments for your use.
$ *
$ * Do not localize sets 2, 4, 6, 8, 10, 12, 14, 16.
$ * Do not localize sets 20, 22, 24, 26, 28, 99.
$ * They only appear in the errorlog.
$ *
$ * DO localize sets 18 and 29.
$ ** ----------------GENERAL LOCALIZATION NOTES SECTION END------------------
$ *************************************<L>*************************************
$set 2
$ THIS COMMENT FOR DTSESSION TEAM ONLY -- SmMain.c --
$ These are errorlog messages
$ DO NOT TRANSLATE THIS SET.
2 Another dtsession is currently running - exiting.
3 Screen lock when the screen saver is turned on is not available on this server. Your screen will not be locked when the screen saver is turned on.
$set 4
$ THIS COMMENT FOR DTSESSION TEAM ONLY -- SmGlobals.c --
$ This entire set is for the errorlog.
$ DO NOT TRANSLATE THIS SET.
1 Invalid display name - exiting.
2 No defaults files exist. No applications will be restarted.
3 No defaults files exist. No applications will be restarted.
4 Unable to remove session directory. Make sure write permissions exist \
on $HOME/.dt directory. Invalid session files will not be removed.
5 Unable to malloc memory for operation.
6 Unable to lock display. Another application may have the pointer or \
keyboard grabbed.
7 Unable to open session file. No clients will be restarted.
8 Unable to fork client process.
9 Unable to create DT directories. Check permissions on home directory.
10 Unable to lock display due to security restrictions.
11 Unable to create the temporary file: %s. \
Make sure write permissions exist for this file. \
Exiting from Session Manager.
$ This message is added to the error log if a required temporary
$ file can not be created by the session manager.
$ The insert is the name of the temporary file.
$set 6
$ THIS COMMENT FOR DTSESSION TEAM ONLY -- SmMsgSrv.c --
$ This entire set is for the errorlog.
$ DO NOT TRANSLATE THIS SET.
1 "Could not connect to ToolTalk message server:\n%sExiting ...\n"
2 The DT message server has exited.
$set 8
$ THIS COMMENT FOR DTSESSION TEAM ONLY -- SmError.c --
$ This entire set is for the errorlog.
$ DO NOT TRANSLATE THIS SET.
1 Connection to server lost - exiting.
$set 10
$ THIS COMMENT FOR DTSESSION TEAM ONLY -- SmProperty.c --
$set 12
$ THIS COMMENT FOR DTSESSION TEAM ONLY -- SmProtocol.c --
$set 14
$ THIS COMMENT FOR DTSESSION TEAM ONLY -- SmSave.c --
$set 16
$ THIS COMMENT FOR DTSESSION TEAM ONLY -- SmRestore.c --
$ This entire set is for the errorlog.
$ DO NOT TRANSLATE THIS SET.
1 Unable to exec process /usr/bin/X11/xrdb. No session resources will be \
restored.
2 Invalid client settings file. No settings restored.
3 Unable to exec %s.
4 Unable to exec process CDE_INSTALLATION_TOP/bin/dtwm. No window manager will be started.
5 You have reached the maximum allowed number of remote clients. No further remote clients will be restored.
6 Invalid display/language independent resource file. No display/language independent resources will be restored.
7 The wmStartupCommand resource is set to:\n\n\
%s\n\n\
This file does not exist or is not executable.\n\
CDE_INSTALLATION_TOP/bin/dtwm will be started instead.\n
8 An attempt to restore the following\n\
command (using the DT remote execution process)\n\
on host "%s" failed:\n\n\
%s\n\n\
The following execution string will be tried:\n\n\
%s\n\n
9 The following window manager did not start:\n\n\
%s\n\n\
This message indicates you tried to start a\n\
window manager that is built into an X terminal.\n\
This will only work with X terminals that support this protocol.\n\
CDE_INSTALLATION_TOP/bin/dtwm will be started instead.\n
$set 18
$ THIS COMMENT FOR DTSESSION TEAM ONLY -- SmUI.c --
$ LOCALIZE Set 18
$ Deleted Messages: 13, 14, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
$ 29, 30, 31, 32, 33
$ Message 1 tells the user who currently has the display locked.
1 Display locked by user %s.
$ Message 2 tells the user to enter the password for the above user to unlock
$ the display.
2 Enter password to unlock.
$ Message 3 is a prompt for the user to enter a password.
3 Password:
$ Message 4 is the logout message that appears when dtsession is going
$ to save the Current session information.
$ Access this message by pressing the logout button.
$ 4 Exiting the desktop session...\n\n\
$ Application updates you have not saved may be lost.\n\n\
$ Your Current session will be saved and returned to \n\
$ upon your next login. For more detail, select Help.\n\n\
$ Items in the Trash Can will be permanently shredded.\n\n\
$ Continue Logout?
$ 4 NEW-
4 Exiting the desktop session...\n\n\
Your Current session will be restored upon login.\n\n\
Application updates you have not saved will be lost.\n\n\
Continue Logout?
$ Message 5,6 is the logout message that appears when dtsession is not going
$ to save the Current session information - but return to the Home session info
$ 5 Exiting the desktop session...\n\n\
$ Application updates you have not saved may be lost.\n\n\
$ Your Home session will be restored upon login. Your current\n\
$ session will not be saved. For more detail, select Help.\n\n\
$ Items in the Trash Can will be permanently shredded.\n\n\
$ Continue Logout?
$ 5 NEW-
5 Exiting the desktop session...\n\n\
Your Home session will be restored upon login.\n\
Your Current session will not be saved.\n\n\
Application updates you have not saved will be lost.\n\n\
Continue Logout?
$ Message 6 is the title of the logout dialog box.
6 Logout Confirmation
$ Messages 7,8,9,10 have been obsoleted.
$ Do NOT translate messages 7, 8, 9 and 10
$ the user has requested to have the choice
$ to either save the Current session or return to the Home session.
$ 7 OBS- Exiting the desktop session...\n\n\
$ Application updates you have not saved may be lost.\n\n\
$ You can either save your Current session and return to it upon login,\n\
$ or return to your Home session upon login. For more detail, select Help.\n\n\
$ Items in the Trash Can will be permanently shredded.\n\n\
$ Continue Logout?
$ 8 OBS- OK\nSave Current
$ 9 OBS- OK\nReturn Home
$ Message 10 is the title of the logout dialog box.
$ 10 OBS- Logout Confirmation
$ Message 11,12 are part of the error dialog that appears when the DT
$ messaging system dies.
$ These messages are generated when you kill the Message
$ Server, which is /usr/dt/bin/ttsession.
$ Message 11 is obsolete. Message 38 replaces message 11
$ 11 DT Messaging System Inoperative\n\n\
$ To restart:\n\n\
$ 1) Save all open data files.\n\
$ 2) Press the reset key sequence to return to the login screen.\n\
$ 3) Log in again.\n\n\
$ Note: The Current session will not be saved.\n\n\
$ When you are ready to begin the restart process, click [OK] and\n\
$ proceed to save your files.
12 Message Failure
$ Messages 15, 16, 17 are used for identical purpose as messages 1, 2,3
$ in this set.
15 Display locked by user %s.
16 Enter password to unlock.
17 Password:
$ Message 34, 35 are messages that appear when the user started up in
$ compatibility mode, and tries to log out. You can only exit out of
$ compatibility mode by using the reset key sequence.
$ To generate this message, start in x11 (not DT) and then run dtsession.
$ Refer to the dtsession manpage. Then try to log out.
34 This session was started from an X Window System startup script.\n\n\
No session information will be saved.\n\nUse the reset key sequence to log out.
35 Logout Message
$ Messages 36,37 are part of the error dialog that appears when dtsession is
$ unable to start the DT messaging system, and therefore not able to bring
$ up the system at all.
$ To generate this, move the message server from
$ /usr/softbench/bin/softmsgsrv to some other directory, then start Dt.
$ 36 The DT messaging system could not be started.\n\n\
$ To correct the problem:\n\n\
$ 1. Choose [OK] to return to the login screen.\n\n\
$ 2. Select Failsafe Session from the login screen's option\n\
$ menu and log in.\n\n\
$ 3. Check to see that the hostname is correct in these locations:\n\
$ /etc/src.sh\n\
$ /etc/hosts\n\
$ /usr/adm/inetd.sec\n\n\
$ For additional information, see the DT User's Guide.
$ 36 NEW-
36 The desktop messaging system could not be started.\n\n\
To correct the problem:\n\n\
1. Choose [OK] to return to the login screen.\n\n\
2. Select Failsafe Session from the login screen's option\n\
menu and log in.\n\n\
3. Check to see that the desktop is properly installed,\n\
the hostname is correct (/etc/hosts) and that the\n\
network is properly configured.\n\n\
For additional information, see the CDE User's Guide.
37 Action Required
$ Message 38 is part of the error dialog that appears when the DT
$ messaging system dies.
$ This messages are generated when you kill the Message
$ Server), which is /usr/dt/bin/ttsession.
38 Messaging System Inoperative\n\n\
To restart:\n\n\
1) Save all open data files.\n\
2) Logout.\n\
3) Log in again.\n\n\
Note: The Current session will not be saved.\n\n\
When you are ready to begin the restart process, click [OK] and\n\
proceed to save your files.
$
$ Messages 39-41 are displayed on the logout and/or session selection
$ confirmation dialogs. These message are for dialog buttons
$
39 OK
40 Cancel
41 Help
$
$ Messages 50-53 are for the display-specific session confirmation dialog
$
50 Home
51 Current
$
$ The first '%s' in message 52 will be replace with message 50 or 51.
$ The second '%'s in message 52 will be replace with the value of
$ $DISPLAY (e.g. hostname:0).
52 A display-specific '%s' session was selected\n\
for display '%s' but one does not exist.\n\n\
If you continue, a new display-specific session will\n\
be created.
53 Warning
$
$ Message 55-56 are for the Session Save error dialog
$ 55 is the dialog title
$ 56 is the message in the dialog - do NOT localize 'save_state'
$
55 Save Session Failure
56 The session cannot be saved because the required\n\
'save_type' parameter was not in the message.\n\n\
The session will not be saved.
$
$ Messages 70-71 refer to the name of the System Administration manual
$
70 See the following for more information:
71 CDE Advanced Users and System's Administration Guide
$
$ Message 75 is used during logout if the user started a Current
$ session but used the Style Manager to return to a Home session.
$
75 Exiting the desktop session...\n\n\
Your Current session will be saved but your Home\n\
session will be restored upon login.\n\n\
Application updates you have not saved will be lost.\n\n\
Continue Logout?
$
$ Message 76 is used at the same time message 36 is used except that
$ message 76 is for Digital/OSF only and is slightly different than
$ message 36.
$
76 The DT messaging system could not be started.\n\n\
To correct the problem:\n\n\
1. Choose [OK] to return to the login screen.\n\n\
2. Select Failsafe Session from the login screen's option\n\
menu and log in.\n\n\
3. Check to see that your hostname exists correctly in /etc/hosts if your\n\
network has already been configured.\n\
4. If your network has not yet been configured, make sure that /etc/hosts\n\
has the following entry in it:\n\
127.0.0.1 localhost \n\n\
For additional information, see the CDE User's Guide.
$ Message 99 is displayed when a user logs in for the first time
99 The new file '.dtprofile' has been added to your home directory.\n\
\n\
Follow the instructions in this file to ensure that when you log in \n\
again your '.login' or '.profile' file will be activated and \n\
that it will interact correctly with CDE. \n\
\n\
For additional information, see the CDE Advanced User's and System \n\
Administrator's Guide.
$set 20
$ THIS COMMENT FOR DTSESSION TEAM ONLY -- SmWindow.c --
$ This entire set is for the errorlog.
$ DO NOT TRANSLATE THIS SET.
1 Client message failed. Client information will not be saved.
2 Invalid root window. Can not save client information.
3 Session restoration information not updated for client . Invalid \
information may be saved.
4 Session restoration information not updated for client %s. Invalid \
information may be saved.
$set 22
$ THIS COMMENT FOR DTSESSION TEAM ONLY -- SmLock.c --
$set 24
$ THIS COMMENT FOR DTSESSION TEAM ONLY -- version.c --
$set 26
$ THIS COMMENT FOR DTSESSION TEAM ONLY -- SrvPalette.c --
$ This entire set is for the errorlog.
$ DO NOT TRANSLATE THIS SET.
1 Color Server Warning: couldn't get ownership of the selection:
2 Color Server Warning, losing ownership of the selection:
3 Should never lose the selection.
4 Warning, found more pixels then are available.
5 Warning, can't allocate enough pixels.
$set 28
$ THIS COMMENT FOR DTSESSION TEAM ONLY -- SrvFile_io.c --
$ This entire set is for the errorlog.
$ DO NOT TRANSLATE THIS SET.
$ Messages 1,2,6,7,8,9 are obsolete
$ 1 Color Server Warning, the size of file '
$ 2 ' is invalid\nremoving file and trying again.
$ 6 Color Server FatalError, could not make directory
$ 7 Color Server FatalError: couldn't open or create
$ 8 Color Server FatalError, couldn't open file
$ 9 Color Server FatalError, couldn't open system file
3 Color Server Warning, the size of file is invalid:
4 Color Server Warning, invalid information in '
5 ' removing file and starting again.\n
10 Color Server FatalError, not enough memory to create the structure for \
a palette.\n
11 Warning: Color Server system default file is corrupt\n
12 Color Server Warning, could not read file %s\n
$set 29
$ THIS COMMENT FOR DTSESSION TEAM ONLY -- SmHelp.c --
$ LOCALIZE Set 29
1 Session Manager Help
$ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$
$ Set 40 is for messages related to the X11R6 Session Management Protocol
$
$ o Do NOT localize the string '%s' in any of the messages in this set.
$
$set 40
$ Messages 1-7 are used when a session cannot be started.
$ Message 1 - this message will preface messages 2-7
1 A session cannot be started because of the\n\
following error:
2 SmsInitialize failed.
3 IceListenForConnections failed.
$
$ Do not remove the whitespace at the beginning of lines 2 and 3
$ for message number 4
$
4 The authentication file ~/.ICEauthority could not be created.\n\
If the files ~/.ICEauthority-c and ~/.ICEauthority-l exist,\n\
they must be removed before your session can be started.
5 IceAddConnectionWatch failed.
6 IceComposeNetworkIds failed.
$ Message 7 - Do NOT translate "SESSION_MANAGER".
7 Could not create the SESSION_MANAGER environment variable.
$
$ Messages 8-9 occur when a session database cannot be opened.
$
$ Message 8 - Do NOT remove the whitespace before the last '%s'.
8 The following session database could not be opened:\n\n\
'%s'
$ Message 9 - Do NOT remove the whitespace before the last '%s'.
9 The following session database does not contain\n\
the required resource '%s':\n\n\
%s
$
$ Messages 10-11 are used to report errors when reading a session database
$
$ Message 10 - Do NOT remove the whitespace before the last '%s'.
10 The required property '%s' is missing for client\n\n\
%s\n\n\
in the file '%s'.
11 The required resource '%s' is missing for client '%d'\n\
in the file '%s'.
$
$ Messages 12-14 used if errors occur when a session is restarted
$
$ Message 12 - Do NOT remove the whitespace before the last '%s'.
12 The directory '%s'\n\
is not available for application '%s'.\n\n\
The following directory will be used:\n\n\
%s
$ Message 13 - Do NOT remove the whitespace before the last '%s'.
13 The following application cannot be started on host '%s'\n\
because this host cannot be reached from host '%s':\n\n\
%s
$ Message 14 - Do NOT remove the whitespace before the third '%s'.
$ Message 14 - "cannonical form" in this context means an internal
$ format.
14 An attempt to start application '%s'\n\
on host '%s' failed because the following directory\n\
could not be translated into cannonical form:\n\n\
%s\n\n\
[%s]
$
$ Message 15 - used if the -session command line option has no value
$
15 No session name was provided for the -session command line option.
$
$ Message 16 - used if the Save_Session message contains an unrecognized
$ argument
$
16 The Save_Session message contains the unrecognized argument '%s'.
17 An attempt to get a client list from the 'Window Manager' failed.
$
$ Message 18 - the client database cannot be opened for writing.
$ Do NOT remove the whitespace before the last '%s'.
$
18 The following database file cannot be opened for writing:\n\n\
%s\n\n\
The session will not be saved.
$
$ Message 19 - used if an application cannot be saved
$
19 Application '%s' cannot be saved.
$
$ Message 20 - used if the IceAcceptConnection function fails:
$
20 IceAcceptConnection failed.
$
$ Message 21 - used if a Save Session is requested and one is already
$ in progress
21 The session will not be saved because a Save Session is in progress.
22 A session shutdown was cancelled by the application '%s'.
$
$ Messages 23-25 are used when a session is saved and an application
$ has not set its required properties
$
$ Message 23 - Do NOT remove the whitespace before the last '%s'.
23 The following application did not set the required\n\
property '%s':\n\n\
%s\n\n\
This application will not be saved.
24 Application '%s' will not be saved because it did not set\n\
the required property '%s'.
25 Application '%s' did not set the required property '%s'.
$
$ Messages 26-27 are used when the DiscardCommand properties are
$ invoked - before an old session directory is removed.
$ Message 26 - do NOT remove the whitespace before the '%s'.
$ Message 26 - do NOT translate the word 'DiscardCommand' in
$ this message
26 The following client database cannot be opened:\n\n\
%s\n\n\
The 'DiscardCommand' properties cannot be run.
$
$ Message 27 - do NOT translate the word 'DiscardCommand' in
$ this message
27 An attempt to execute the 'DiscardCommand' property for\n\
application '%s' failed.
$
$ Messages 28-29 - used when an application exists and it wants the
$ Session Manager to post a dialog with a message that describes
$ the reason the client exited.
$ Message 29 is the title for the dialog
$
28 Application '%s' exited for the following reason:\n\n\
%s
29 Application Close Reasons
$set 99
$ DO NOT TRANSLATE THESE MESSAGES
$ DO NOT CHANGE THESE MESSAGES
$ DO NOT LOCALIZE THESE MESSAGES
$ These messages are used for the version information.
1 @(#)version_goes_here
2 \n@(#)Message catalog source $TOG: dtsession.msg.src /main/25 1999/09/20 13:47:55 mgreess $

View File

@@ -0,0 +1,77 @@
# $XConsortium: nlsMsgChk.txt /main/2 1996/11/11 11:31:15 drk $
* *
* (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. *
*
Dtsession
==========
1) To display figure 1
a) press style manager button in front panel
b) press "start up" button in style manager
c) choose "Resume current session"
d) press OK
e) press logout button in front panel
f) press "Cancel" on logout dialog
2) To display figure 2
a) do 1a and 1b
b) choose "Return to Home session"
c) press OK
d) press logout button in front panel
e) press "Cancel" on logout dialog
3) To display figure 3
a) do 1a and 1b
b) choose "Ask me at logout"
c) press OK
d) press logout button in front panel
e) press "Cancel" on logout dialog
4) To display figure 4
a) Enter HP DT via compatibility mode (see man page or
system administration manual -norestore option)
b) press the logout button on the front panel
After the system is back up and you are logged back in
5) To display figure 5
a) kill -9 on the BMS process (softmsgsrv)
b) read the instructions in the dialog and then press OK
c) follow the instructions in the dialog
After the system is back up and you are logged back in
6) To display figure 6
a) logout
b) login in "no windows" mode
c) move /usr/softbench/bin/softmsgsrv to /usr/softbench/bin/softmsgsrv_
d) exit
e) login
f) login in "no windows" mode
g) move /usr/softbench/bin/softmsgsrv_ to /usr/softbench/bin/softmsgsrv
h) exit
After the system is back up and you are logged back in
Figure 7 and 8 are nearly identical, one covers
the screen and one only displays a large dialog.
7) To display figure 7.
a) press style manager button in front panel
b) press "screen" button in style manager
c) choose "Full Screen Cover: On"
d) press OK
e) press lock button in front panel
f) enter the password to dismiss lock
8) To display figure dtsession-2 .
a) press style manager button in front panel
b) press "screen" button in style manager
c) choose "Full Screen Cover: Off"
d) press OK
e) press lock button in front panel
f) enter the password to dismiss lock

View File

@@ -0,0 +1,77 @@
# $XConsortium: nlsREADME.txt /main/2 1996/11/11 11:31:32 drk $
# * *
# * (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. *
# *
#############################################################################
#
# Component: /usr/dt/bin/dtsession
#
############################################################################
_DtMessage catalog source:
File name: dtsession.msg
Target: /usr/dt/nls/%L/dtsession.cat
---------------------------------------------------------------------------
App-defaults file:
File name: Dtsession
Target: /usr/dt/app-defaults/%L/Dtsession
---------------------------------------------------------------------------
Configuration files:
File Name: sys.session
Target: /usr/dt/config/%L/sys.session
In this file is the startup command for the Console terminal window.
One of the options for this command is -T Console. This name needs to
be localized.
This file starts up the clients in a default HP DT session.
---------------------------------------------------------------------------
File Name: sys.resources
Target: /usr/dt/config/%L/sys.resources
There is an include line near the top of this file that looks like:
#include "/usr/dt/config/sys.font"
This line needs to be changed to include the language specific
location. For example:
#include "/usr/dt/config/japanese/sys.font"
This file restores resources in a default HP DT session.
---------------------------------------------------------------------------
File Name: sys.font
Target: /usr/dt/config/%L/sys.font
This file contains the specification for the fonts to be used in an
HP DT session. If you wish to have different fonts for the default
session, they need to be changed here. Included are fonts for small,
medium and high resolution displays.
Font resource values must specify all 14 field delimiters.
Scalable font - must specify point size field
Bitmap font - must specify pixel size field
Font resource values must match exactly the default font resources
specified in /usr/dt/app-defaults/%L/Dtstyle.
This file restores font resources in a default HP DT session, or in
a session where the language has been newly changed.

View File

@@ -0,0 +1,49 @@
!#################################################################
!#
!# sys.font.iso: Used for accessing ISO-Latin1 fonts in the
!# user interface
!#
!# (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.
!#################################################################
#if Y_RESOLUTION > 3582
!###
!# High Resolution Displays ( > 91 dpi )
!# 91 dpi = 3582 pixels/meter
!###
*Font: -bitstream-prestige-medium-r-normal--19-160-72-72-m-110-iso8859-1
*FontList: -bitstream-swiss*742-medium-r-normal--19-140-85-85-p-110-iso8859-1
*XmText*FontList: -bitstream-prestige-medium-r-normal--19-160-72-72-m-110-iso8859-1
*XmTextField*FontList: -bitstream-prestige-medium-r-normal--19-160-72-72-m-110-iso8859-1
*systemFont: -bitstream-swiss*742-medium-r-normal--19-140-85-85-p-110-iso8859-1
*userFont: -bitstream-prestige-medium-r-normal--19-160-72-72-m-110-iso8859-1
#else
!###
!# Medium Resolution Displays ( < 91 dpi and > 80 dpi )
!###
*Font: -bitstream-prestige-medium-r-normal--16-120-72-72-m-80-iso8859-1
*FontList: -bitstream-swiss*742-bold-r-normal--16-120-72-72-p-94-iso8859-1
*XmText*FontList: -bitstream-prestige-medium-r-normal--16-120-72-72-m-80-iso8859-1
*XmTextField*FontList: -bitstream-prestige-medium-r-normal--16-120-72-72-m-80-iso8859-1
*systemFont: -bitstream-swiss*742-bold-r-normal--16-120-72-72-p-94-iso8859-1
*userFont: -bitstream-prestige-medium-r-normal--16-120-72-72-m-80-iso8859-1
#endif
#if Y_RESOLUTION < 3150
!###
!# Low Resolution Displays ( > 80 dpi )
!# 90 dpi = 3150 pixels/meter
!###
*Font: -bitstream-prestige-medium-r-normal--13-100-72-72-p-75-iso8859-1
*FontList: -bitstream-swiss*742-medium-r-normal--13-100-72-72-p-75-iso8859-1
*XmText*FontList: -bitstream-prestige-medium-r-normal--13-100-72-72-p-75-iso8859-1
*XmTextField*FontList: -bitstream-prestige-medium-r-normal--13-100-72-72-p-75-iso8859-1
*systemFont: -bitstream-swiss*742-medium-r-normal--13-100-72-72-p-75-iso8859-1
*userFont: -bitstream-prestige-medium-r-normal--13-100-72-72-p-75-iso8859-1
#endif

View File

@@ -0,0 +1,73 @@
! $XConsortium: sys.font.src /main/4 1996/04/21 19:51:16 drk $
!#################################################################
!#
!# sys.font: The default session font resource file
!#
!# placed in: CDE_INSTALLATION_TOP/config/C/sys.fonts
!#
!# (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.
!#################################################################
!###
!#
!# Font Resource Specifications
!#
!# Font resource values must be a valid font alias name.
!#
!# Font resource values must match exactly the default font resources
!# specified in CDE_INSTALLATION_TOP/app-defaults/%L/Dtstyle
!###
XCOMM if WIDTH > 1175
!###
!# High Resolution Displays
!#
!###
*FontList: %|nls-1-dt-interface system-medium-r-normal-m*-*-*-*-*-*-*-*-*:^*FontList|
*buttonFontList: %|nls-1-dt-interface system-medium-r-normal-m*-*-*-*-*-*-*-*-*:^*FontList|
*labelFontList: %|nls-1-dt-interface system-medium-r-normal-m*-*-*-*-*-*-*-*-*:^*FontList|
*textFontList: %|nls-2-dt-interface user-medium-r-normal-m*-*-*-*-*-*-*-*-*:^*XmText*FontList|
*XmText*FontList: %|nls-2-dt-interface user-medium-r-normal-m*-*-*-*-*-*-*-*-*:^*XmText*FontList|
*XmTextField*FontList: %|nls-3-dt-interface user-medium-r-normal-m*-*-*-*-*-*-*-*-*:^*XmText*FontList|
*systemFont: %|nls-4-dt-interface system-medium-r-normal-m*-*-*-*-*-*-*-*-*:^*FontList|
*userFont: %|nls-5-dt-interface user-medium-r-normal-m*-*-*-*-*-*-*-*-*:^*XmText*FontList|
*DtEditor*textFontList: %|nls-6-dt-interface user-medium-r-normal-m*-*-*-*-*-*-*-*-*:^*DtEditor*textFontList|
*Font: %|nls-7-dt-interface user-medium-r-normal-m*-*-*-*-*-*-*-*-*^*Font|
*FontSet: %|nls-8-dt-interface user-medium-r-normal-m*-*-*-*-*-*-*-*-*^*FontSet|
XCOMM else
XCOMM if WIDTH > 850
!###
!# Medium Resolution Displays
!###
*FontList: %|nls-9-dt-interface system-medium-r-normal-s*-*-*-*-*-*-*-*-*:^*FontList|
*buttonFontList: %|nls-9-dt-interface system-medium-r-normal-s*-*-*-*-*-*-*-*-*:^*FontList|
*labelFontList: %|nls-9-dt-interface system-medium-r-normal-s*-*-*-*-*-*-*-*-*:^*FontList|
*textFontList: %|nls-10-dt-interface user-medium-r-normal-s*-*-*-*-*-*-*-*-*:^*XmText*FontList|
*XmText*FontList: %|nls-10-dt-interface user-medium-r-normal-s*-*-*-*-*-*-*-*-*:^*XmText*FontList|
*XmTextField*FontList: %|nls-11-dt-interface user-medium-r-normal-s*-*-*-*-*-*-*-*-*:^*XmText*FontList|
*systemFont: %|nls-12-dt-interface system-medium-r-normal-s*-*-*-*-*-*-*-*-*:^*FontList|
*userFont: %|nls-13-dt-interface user-medium-r-normal-s*-*-*-*-*-*-*-*-*:^*XmText*FontList|
*DtEditor*textFontList: %|nls-14-dt-interface user-medium-r-normal-s*-*-*-*-*-*-*-*-*:^*DtEditor*textFontList|
*Font: %|nls-15-dt-interface user-medium-r-normal-s*-*-*-*-*-*-*-*-*^*Font|
*FontSet: %|nls-16-dt-interface user-medium-r-normal-xs*-*-*-*-*-*-*-*-*^*FontSet|
XCOMM else
!###
!# Low Resolution Displays
!###
*FontList: %|nls-17-dt-interface system-medium-r-normal-xs*-*-*-*-*-*-*-*-*:^*FontList|
*buttonFontList: %|nls-17-dt-interface system-medium-r-normal-xs*-*-*-*-*-*-*-*-*:^*FontList|
*labelFontList: %|nls-17-dt-interface system-medium-r-normal-xs*-*-*-*-*-*-*-*-*:^*FontList|
*textFontList: %|nls-18-dt-interface user-medium-r-normal-xs*-*-*-*-*-*-*-*-*:^*XmText*FontList|
*XmText*FontList: %|nls-18-dt-interface user-medium-r-normal-xs*-*-*-*-*-*-*-*-*:^*XmText*FontList|
*XmTextField*FontList: %|nls-19-dt-interface user-medium-r-normal-xs*-*-*-*-*-*-*-*-*:^*XmText*FontList|
*systemFont: %|nls-20-dt-interface system-medium-r-normal-xs*-*-*-*-*-*-*-*-*:^*FontList|
*userFont: %|nls-21-dt-interface user-medium-r-normal-xs*-*-*-*-*-*-*-*-*:^*XmText*FontList|
*DtEditor*textFontList: %|nls-22-dt-interface user-medium-r-normal-xs*-*-*-*-*-*-*-*-*:^*DtEditor*textFontList|
*Font: %|nls-23-dt-interface user-medium-r-normal-xs*-*-*-*-*-*-*-*-*^*Font|
*FontSet: %|nls-24-dt-interface user-medium-r-normal-xs*-*-*-*-*-*-*-*-*^*FontSet|
XCOMM endif
XCOMM endif

View File

@@ -0,0 +1,229 @@
! $TOG: sys.resources.src /main/7 1999/01/28 13:27:29 mgreess $
!##################################################################
!#
!# Common Desktop Environment (CDE)
!#
!# sys.resources: The Default Session Resource File
!#
!# Placed In: CDE_INSTALLATION_TOP/config/<LANG>/sys.resources
!#
!# (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.
!#
!###################################################################
!###
!#
!# Font Resource Specifications
!#
!# Font resource values must be a valid font alias name.
!#
!# Font resource values must match exactly the default font resources
!# specified in /usr/dt/app-defaults/%L/Dtstyle
!###
XCOMM if WIDTH > 1175
!###
!# High Resolution Displays
!#
!###
*FontList: -dt-interface system-medium-r-normal-m*-*-*-*-*-*-*-*-*:
*buttonFontList: -dt-interface system-medium-r-normal-m*-*-*-*-*-*-*-*-*:
*labelFontList: -dt-interface system-medium-r-normal-m*-*-*-*-*-*-*-*-*:
*textFontList: -dt-interface user-medium-r-normal-m*-*-*-*-*-*-*-*-*:
*XmText*FontList: -dt-interface user-medium-r-normal-m*-*-*-*-*-*-*-*-*:
*XmTextField*FontList: -dt-interface user-medium-r-normal-m*-*-*-*-*-*-*-*-*:
*systemFont: -dt-interface system-medium-r-normal-m*-*-*-*-*-*-*-*-*:
*userFont: -dt-interface user-medium-r-normal-m*-*-*-*-*-*-*-*-*:
*DtEditor*textFontList: -dt-interface user-medium-r-normal-m*-*-*-*-*-*-*-*-*:
*Font: -dt-interface user-medium-r-normal-m*-*-*-*-*-*-*-*-*
*FontSet: -dt-interface user-medium-r-normal-m*-*-*-*-*-*-*-*-*
XCOMM else
XCOMM if WIDTH < 851
!###
!# Low Resolution Displays
!###
*FontList: -dt-interface system-medium-r-normal-xs*-*-*-*-*-*-*-*-*:
*buttonFontList: -dt-interface system-medium-r-normal-xs*-*-*-*-*-*-*-*-*:
*labelFontList: -dt-interface system-medium-r-normal-xs*-*-*-*-*-*-*-*-*:
*textFontList: -dt-interface user-medium-r-normal-xs*-*-*-*-*-*-*-*-*:
*XmText*FontList: -dt-interface user-medium-r-normal-xs*-*-*-*-*-*-*-*-*:
*XmTextField*FontList: -dt-interface user-medium-r-normal-xs*-*-*-*-*-*-*-*-*:
*systemFont: -dt-interface system-medium-r-normal-xs*-*-*-*-*-*-*-*-*:
*userFont: -dt-interface user-medium-r-normal-xs*-*-*-*-*-*-*-*-*:
*DtEditor*textFontList: -dt-interface user-medium-r-normal-xs*-*-*-*-*-*-*-*-*:
*Font: -dt-interface user-medium-r-normal-xs*-*-*-*-*-*-*-*-*
*FontSet: -dt-interface user-medium-r-normal-xs*-*-*-*-*-*-*-*-*
XCOMM else
!###
!# Medium Resolution Displays (always default if no cpp present on system)
!###
*FontList: -dt-interface system-medium-r-normal-s*-*-*-*-*-*-*-*-*:
*buttonFontList: -dt-interface system-medium-r-normal-s*-*-*-*-*-*-*-*-*:
*labelFontList: -dt-interface system-medium-r-normal-s*-*-*-*-*-*-*-*-*:
*textFontList: -dt-interface user-medium-r-normal-s*-*-*-*-*-*-*-*-*:
*XmText*FontList: -dt-interface user-medium-r-normal-s*-*-*-*-*-*-*-*-*:
*XmTextField*FontList: -dt-interface user-medium-r-normal-s*-*-*-*-*-*-*-*-*:
*systemFont: -dt-interface system-medium-r-normal-s*-*-*-*-*-*-*-*-*:
*userFont: -dt-interface user-medium-r-normal-s*-*-*-*-*-*-*-*-*:
*DtEditor*textFontList: -dt-interface user-medium-r-normal-s*-*-*-*-*-*-*-*-*:
*Font: -dt-interface user-medium-r-normal-s*-*-*-*-*-*-*-*-*
*FontSet: -dt-interface user-medium-r-normal-s*-*-*-*-*-*-*-*-*
XCOMM endif
XCOMM endif
*sessionVersion: 3.0
*multiClickTime: 500
#ifdef __osf__
*ttyModes: erase ^? intr ^C kill ^U start ^Q stop ^S swtch ^@ susp ^Z
#else
*ttyModes: erase ^H intr ^C kill ^U start ^Q stop ^S swtch ^@ susp ^Z
#endif
*promptDialog.bboard.frame.form.text.columns: %|nls-3-#45#|
#ifdef __hpux
Hpterm*backgroundIsSelect: True
Hpterm*makeColors: shadow
#endif
dtsession*saverTimeout: 10
dtsession*lockTimeout: 30
dtsession*cycleTimeout: 3
dtsession*saverList: StartDtscreenBlank
!#################################################################
!#
!# display dependent resources
!#
!#################################################################
XCOMM if WIDTH > 1175
XCOMM else
XCOMM if WIDTH < 851
Dtwm*resizeBorderWidth: 5
Dtfile*view: small_icon
Dtfile*desktopIcon: small
Dtfile*dirWidth: 400
Dtfile*dirHeight: 300
XCOMM else
Dtwm*resizeBorderWidth: 5
Dtfile*view: large_icon
Dtfile*desktopIcon: large
Dtfile*dirWidth: 555
Dtfile*dirHeight: 400
XCOMM endif
XCOMM endif
!#################################################################
!#
!# Motif resources
!#
!# These resources are provided as an example of how get
!# Motif 1.1 clients and Motif 1.2 clients linked with an
!# archived Motif 1.2 library to display with the CDE enhanced
!# visuals. Just put the client name in and uncomment the
!# resources and the non-CDE client will get the enhanced
!# CDE visual effect.
!#
!#################################################################
!#
!# <client_name>*XmCascadeButton*shadowThickness: 1
!# <client_name>*XmCascadeButtonGadget*shadowThickness: 1
!# <client_name>*XmDrawnButton*shadowThickness: 1
!# <client_name>*XmList*shadowThickness: 1
!# <client_name>*XmPanedWindow*sashShadowThickness: 1
!# <client_name>*XmPushButton*shadowThickness: 1
!# <client_name>*XmPushButtonGadget*shadowThickness: 1
!# <client_name>*XmScale*shadowThickness: 1
!# <client_name>*XmScrollBar*shadowThickness: 1
!# <client_name>*XmSelectionBox*shadowThickness: 1
!# <client_name>*XmText*shadowThickness: 1
!# <client_name>*XmTextField*shadowThickness: 1
!# <client_name>*highlightThickness: 1
*DtTerm*shadowThickness: 1
*enableThinThickness: True
*enableBtn1Transfer: button2_transfer
*enableButtonTab: True
*enableDefaultButton: True
*enableEtchedInMenu: True
*enableMenuInCascade: True
*enableMultiKeyBindings: True
*enableToggleColor: True
*enableToggleVisual: True
*enableDragIcon: True
*enableCDEColorFactors: True
#ifdef __hpux
!#################################################################
!#
!# CDE translations for the text widget and text field widget
!#
!# - provides more intuitive "clear line", "insert line" and
!# "delete line" behavior
!# - provides basic EMACS editor functionality
!#
!#################################################################
*XmText*Translations:#override\n\
<Key>hpClearLine: delete-to-end-of-line()\n\
~m ~a <Key>osfPrimaryPaste:beginning-of-line()\
newline-and-backup()\n\
<Key>osfQuickPaste: beginning-of-line()\
insert-string(\" \")\
beginning-of-line()\
delete-to-end-of-line()\
delete-next-character()\n\
Ctrl<Key>u:delete-to-start-of-line()\n\
Ctrl<Key>k:delete-to-end-of-line()\n\
Ctrl<Key>a:beginning-of-line()\n\
Ctrl<Key>e:end-of-line()\n\
Ctrl<Key>p:process-up()\n\
Ctrl<Key>b:backward-character()\n\
Ctrl<Key>n:process-down()\n\
Ctrl<Key>f:forward-character()
*XmTextField*Translations:#override\n\
<Key>hpClearLine: delete-to-end-of-line()\n\
<Key>osfQuickPaste: beginning-of-line()\
delete-to-end-of-line()\n\
Ctrl<Key>u:delete-to-start-of-line()\n\
Ctrl<Key>k:delete-to-end-of-line()\n\
Ctrl<Key>a:beginning-of-line()\n\
Ctrl<Key>e:end-of-line()\n\
Ctrl<Key>b:backward-character()\n\
Ctrl<Key>f:forward-character()
#else
!#################################################################
!#
!# CDE translations for the text widget and text field widget
!#
!# - provides basic EMACS editor functionality
!#
!#################################################################
*XmText*Translations:#override\n\
Ctrl<Key>u:delete-to-start-of-line()\n\
Ctrl<Key>k:delete-to-end-of-line()\n\
Ctrl<Key>a:beginning-of-line()\n\
Ctrl<Key>e:end-of-line()\n\
Ctrl<Key>p:process-up()\n\
Ctrl<Key>b:backward-character()\n\
Ctrl<Key>n:process-down()\n\
Ctrl<Key>f:forward-character()
*XmTextField*Translations:#override\n\
Ctrl<Key>u:delete-to-start-of-line()\n\
Ctrl<Key>k:delete-to-end-of-line()\n\
Ctrl<Key>a:beginning-of-line()\n\
Ctrl<Key>e:end-of-line()\n\
Ctrl<Key>b:backward-character()\n\
Ctrl<Key>f:forward-character()
#endif
!#################################################################
!#
!# CDE environment variable mapping for remote COMMAND actions
!#
!#################################################################
*dtEnvMapForRemote: DTAPPSEARCHPATH:DTHELPSEARCHPATH:DTDATABASESEARCHPATH:XMICONSEARCHPATH:XMICONBMSEARCHPATH
!################ eof #######################

View File

@@ -0,0 +1,55 @@
XCOMM ###############################################################
XCOMM
XCOMM Common Desktop Environment (CDE)
XCOMM
XCOMM sys.session: Default session initiation file for CDE DT
XCOMM
XCOMM (c) Copyright 1996 Digital Equipment Corporation.
XCOMM (c) Copyright 1993,1994,1996 Hewlett-Packard Company.
XCOMM (c) Copyright 1993,1994,1996 International Business Machines Corp.
XCOMM (c) Copyright 1993,1994,1996 Sun Microsystems, Inc.
XCOMM (c) Copyright 1993,1994,1996 Novell, Inc.
XCOMM (c) Copyright 1996 FUJITSU LIMITED.
XCOMM (c) Copyright 1996 Hitachi.
XCOMM
XCOMM This file is processed once for new CDE DT users
XCOMM
XCOMM placed in: CDE_CONFIGURATION_TOP/sys.session
XCOMM
#ifdef IVE
XCOMM Modified for HP MPower.
XCOMM
#endif /* IVE */
XCOMM
XCOMM $XConsortium: sys.session.src /main/5 1996/04/23 18:49:46 drk $
XCOMM
XCOMM ###############################################################
#ifdef IVE
XCOMM
XCOMM Start up File Manager...
XCOMM
dtsmcmd -cmd DTSM_CMD1
#else /* IVE */
XCOMM
XCOMM Start up the File Manager...
XCOMM
dtsmcmd -cmd DTSM_CMD2
#endif /* IVE */
#ifdef COMMENTS
/*
* If you change this command line for helpview, also change the
* define in Sm.h to be the same.
*/
#endif /* COMMENTS */
XCOMM
XCOMM Start up the Introduction Manager...
XCOMM
dtsmcmd -cmd DTSM_CMD4
XCOMM
XCOMM Initialize the help browser
XCOMM
dtsmcmd -cmd DTSM_CMD5
XCOMM ################## End of the sys.session File #############

View File

@@ -0,0 +1,44 @@
/* $XConsortium: version.c /main/5 1996/08/30 15:34:51 drk $
*
* (c) Copyright 1996 Digital Equipment Corporation.
* (c) Copyright 1993,1994,1996 Hewlett-Packard Company.
* (c) Copyright 1993,1994,1996 International Business Machines Corp.
* (c) Copyright 1993,1994,1996 Sun Microsystems, Inc.
* (c) Copyright 1993,1994,1996 Novell, Inc.
* (c) Copyright 1996 FUJITSU LIMITED.
* (c) Copyright 1996 Hitachi.
*/
/********************************************************
Copyright (c) 1988, 1990 by Hewlett-Packard Company
Copyright (c) 1988 by the Massachusetts Institute of Technology
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, and that the names of
Hewlett-Packard or M.I.T. not be used in advertising or publicity
pertaining to distribution of the software without specific, written
prior permission.
********************************************************/
#include <include/hpversion.h>
#ifndef lint
version_tag("dtsession: $XConsortium: version.c /main/5 1996/08/30 15:34:51 drk $")
#ifdef __PASSWD_ETC
static char _rgy_version[] = "@(#)Passwd Etc. - Domain Registry Authentication";
#endif
#endif /* lint */