kent@ssbell.IMD.Sterling.COM (Kent Landfield) (01/15/90)
Submitted-by: wsl.dec.com!mikey (Mike Yang) Posting-number: Volume 5, Issue 53 Archive-name: xrooms/part03 #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh <file", e.g.. If this archive is complete, you # will see the following message at the end: # "End of archive 3 (of 14)." # Contents: ./lib/nameprof.c ./lib/names.h ./utils/storage.c # ./xrooms/xrActions.c ./xrooms/xrDoProto.c ./xrooms/xrGen.h # ./xrooms/xrNames.c ./xrooms/xrProfile.c # Wrapped by kent@ssbell on Sun Jan 14 21:57:37 1990 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f './lib/nameprof.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'./lib/nameprof.c'\" else echo shar: Extracting \"'./lib/nameprof.c'\" \(5279 characters\) sed "s/^X//" >'./lib/nameprof.c' <<'END_OF_FILE' X X /*\ X * $Header: nameprof.c,v 5.0 90/01/10 06:53:30 erik Exp $ X * X * COPYRIGHT 1990 X * DIGITAL EQUIPMENT CORPORATION X * MAYNARD, MASSACHUSETTS X * ALL RIGHTS RESERVED. X * X * THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE AND X * SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT CORPORATION. X * DIGITAL MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THIS SOFTWARE X * FOR ANY PURPOSE. IT IS SUPPLIED "AS IS" WITHOUT EXPRESS OR IMPLIED X * WARRANTY. X * X * IF THE SOFTWARE IS MODIFIED IN A MANNER CREATING DERIVATIVE COPYRIGHT X * RIGHTS, APPROPRIATE LEGENDS MAY BE PLACED ON THE DERIVATIVE WORK IN X * ADDITION TO THAT SET FORTH ABOVE. X * X * Permission to use, copy, modify, and distribute this software and its X * documentation for any purpose and without fee is hereby granted, provided X * that the above copyright notice appear in all copies and that both that X * copyright notice and this permission notice appear in supporting X * documentation, and that the name of Digital Equipment Corporation not be X * used in advertising or publicity pertaining to distribution of the X * software without specific, written prior permission. X \*/ X X#define DEBUG_VAR nameprofDebug X#include "utils.h" X#include "strtbl.h" X#include "list.h" X#include "nameprof.h" X X/***====================================================================***/ X X StringToken nprDefaultName= NullStringToken; X Xstatic ListPtr nprFunctions= NullList; Xstatic NameResolveFunc nprResolver= NullNameResolveFunc; Xstatic ChangeNamedFunc nprChanger= NullChangeNamedFunc; X X/***====================================================================***/ X Xvoid XnprSetResolver(pFunc) XNameResolveFunc pFunc; X{ X uFLAG_ENTRY1(LOW_ENTRY_BIT,"nprSetResolver(0x%x)\n",pFunc); X nprResolver= pFunc; X uFLAG_VOIDRETURN; X} X X/***====================================================================***/ X Xvoid XnprSetChanger(pFunc) XChangeNamedFunc pFunc; X{ X uFLAG_ENTRY1(LOW_ENTRY_BIT,"nprSetChanger(0x%x)\n",pFunc); X nprChanger= pFunc; X uFLAG_VOIDRETURN; X} X X/***====================================================================***/ X XBoolean XnprGetName(funcName,osPriv,ppName,ppClass) XStringToken funcName; XOpaque osPriv; Xchar **ppName; Xchar **ppClass; X{ Xchar *name= NullString; Xchar *class= NullString; XNPStatementPtr pStmt; X X uENTRY4("profileGetName(%s,0x%x,0x%x,0x%x)\n",stText(funcName),osPriv, X ppName,ppClass); X if (ppName!=(char **)NULL) *ppName= (char *)NULL; X if (ppClass!=(char **)NULL) *ppClass= (char *)NULL; X if (funcName==NullStringToken) funcName= nprDefaultName; X X if (funcName==NullStringToken) { X uRETURN(False); X } X X pStmt= nprLookupFunction(funcName); X if (pStmt!=NullNPStatement) { X if (npEvaluate(pStmt,&name,&class,nprResolver,nprChanger,osPriv)) { X if (ppName!=(char **)NULL) *ppName= name; X else if (name!=NullString) (void)uFree((Opaque)name); X X if (ppClass!=(char **)NULL) *ppClass= class; X else if (class!=NullString) (void)uFree((Opaque)class); X uRETURN(True); X } X } X uRETURN(False); X} X X/***====================================================================***/ X XBoolean XnprAddFunction(name, pStmt, merge) XStringToken name; XNPStatementPtr pStmt; XBoolean merge; X{ XNPStatementPtr pOld; XBoolean found; X X uENTRY3("nprAddFunction(%s,0x%x,%s)\n",stText(name),pStmt, X booleanText(merge)); X if (name==NullStringToken) name= nprDefaultName; X if ((name==NullStringToken)||(pStmt==NullNPStatement)) { X uRETURN(False); X } X if (nprFunctions==NullList) { X nprFunctions= lCreate((unsigned)7,NullListSortFunc,genIntegerKeyType, X genPointerDataType); X if (nprFunctions==NullList) { X uInternalError("allocation failure in nprAddFunction\n"); X uRETURN(False); X } X } X X found= (lLookup(nprFunctions,(GenKey)name,(GenData *)&pOld)&& X (pOld!=NullNPStatement)); X merge= merge&&found; X if (merge) npAppendStatement(pOld,pStmt); X else { X lStore(nprFunctions,(GenKey)name,(GenData)pStmt); X if (found) X npDestroyStatement(pOld); X } X uRETURN(True); X} X X/***====================================================================***/ X XNPStatementPtr XnprRemoveFunction(name, destroy) XStringToken name; XBoolean destroy; X{ XNPStatementPtr pOld; X X uENTRY2("nprRemoveFunction(%s,%s)\n",stText(name),booleanText(destroy)); X if ((nprFunctions==NullList)||(name==NullStringToken)) { X uRETURN(NullNPStatement); X } X if (lLookup(nprFunctions,(GenKey)name,(GenData *)&pOld)&& X (pOld!=NullNPStatement)) { X lRemove(nprFunctions,(GenKey)name); X if (destroy) { X npDestroyStatement(pOld); X pOld= NullNPStatement; X } X } X else pOld= NullNPStatement; X uRETURN(pOld); X} X X/***====================================================================***/ X XNPStatementPtr XnprLookupFunction(name) XStringToken name; X{ XNPStatementPtr pStmt; X X uENTRY1("nprLookupFunction(%s)\n",stText(name)); X if (name==NullStringToken) name= nprDefaultName; X if ((nprFunctions==NullList)||(name==NullStringToken)) { X uRETURN(NullNPStatement); X } X if (lLookup(nprFunctions,(GenKey)name,(GenData *)&pStmt)) { X uRETURN(pStmt); X } X uRETURN(NullNPStatement); X} END_OF_FILE if test 5279 -ne `wc -c <'./lib/nameprof.c'`; then echo shar: \"'./lib/nameprof.c'\" unpacked with wrong size! fi # end of './lib/nameprof.c' fi if test -f './lib/names.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'./lib/names.h'\" else echo shar: Extracting \"'./lib/names.h'\" \(4148 characters\) sed "s/^X//" >'./lib/names.h' <<'END_OF_FILE' X#ifndef NAMES_H X#define NAMES_H X X /*\ X * $Header: names.h,v 5.0 90/01/10 06:53:42 erik Exp $ X * X * COPYRIGHT 1990 X * DIGITAL EQUIPMENT CORPORATION X * MAYNARD, MASSACHUSETTS X * ALL RIGHTS RESERVED. X * X * THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE AND X * SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT CORPORATION. X * DIGITAL MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THIS SOFTWARE X * FOR ANY PURPOSE. IT IS SUPPLIED "AS IS" WITHOUT EXPRESS OR IMPLIED X * WARRANTY. X * X * IF THE SOFTWARE IS MODIFIED IN A MANNER CREATING DERIVATIVE COPYRIGHT X * RIGHTS, APPROPRIATE LEGENDS MAY BE PLACED ON THE DERIVATIVE WORK IN X * ADDITION TO THAT SET FORTH ABOVE. X * X * Permission to use, copy, modify, and distribute this software and its X * documentation for any purpose and without fee is hereby granted, provided X * that the above copyright notice appear in all copies and that both that X * copyright notice and this permission notice appear in supporting X * documentation, and that the name of Digital Equipment Corporation not be X * used in advertising or publicity pertaining to distribution of the X * software without specific, written prior permission. X \*/ X X /*\ X X \*/ X X /*\ X * This package implements an interpreter for a small language X * that is used in xrooms to determine a unique name for a structure X * (a window in xrooms). This language assumes that there is a list X * of named properties associated with the structure we are using, X * but doesn't know anything about reading those properties directly. X * Instead, it calls a PropLookup function to find the value of a X * property on a window. X \*/ Xtypedef struct _NPStateRec *NPStatePtr; Xtypedef struct _NPBoolExprRec *NPBoolExprPtr; Xtypedef struct _NPStringExprRec *NPStringExprPtr; Xtypedef struct _NPCaseRec *NPCasePtr; Xtypedef struct _NPStatementRec *NPStatementPtr; X X#define NullNPState ((NPStatePtr)NULL) X#define NullNPBoolExpr ((NPBoolExprPtr)NULL) X#define NullNPStringExpr ((NPStringExprPtr)NULL) X#define NullNPCase ((NPCasePtr)NULL) X#define NullNPStatement ((NPStatementPtr)NULL) X X /*\ X * Legal types of string expression X \*/ X#define NPStringConstant ((unsigned)1) X#define NPPropertyName ((unsigned)2) X#define NPIdentifier ((unsigned)3) X#define NPStringConcat ((unsigned)4) X#define NPStringConditional ((unsigned)5) X X /*\ X * Functions to resolve and change string values provided X * by the OS layer X \*/ Xtypedef Boolean (*NameResolveFunc)(/*osPriv,what,name,pRtrn*/); Xtypedef Boolean (*ChangeNamedFunc)(/*osPriv,what,name,value,append*/); X#define NullNameResolveFunc ((NameResolveFunc)NULL) X#define NullChangeNamedFunc ((ChangeNamedFunc)NULL) X Xextern unsigned namesDebug; Xextern char *npJoinText; X Xextern void npDestroyStatement(/* pStmt */); X Xextern void npWriteStatement(/* file, indent, pStatement*/); X Xextern NPStringExprPtr npStringTerminal(/*type,strValue*/); Xextern NPStringExprPtr npStringConcat(/* pLeft, pRight */); Xextern NPStringExprPtr npStringConditional(/* pCond, pTrue, pFalse */); X Xextern NPBoolExprPtr npUnaryExpr(/* invert, strExpr */); Xextern NPBoolExprPtr npEquals(/* pLeft, pRight */); X Xextern NPStatementPtr npIfStatement(/* cond, then, else */); Xextern NPCasePtr npCase(/* pattern, statement */); Xextern NPStatementPtr npSwitchStatement(/* str, choices, dfltCase */); Xextern NPStatementPtr npUseStatement(/* name */); Xextern NPStatementPtr npClassStatement(/* class */); Xextern NPStatementPtr npAssignStatement(/* lhsExpr, valueExpr, append */); Xextern NPStatementPtr npIgnoreStatement(); Xextern NPStatementPtr npComment(/* str */); Xextern void npInsertStatement(/* after, added */); Xextern void npAppendStatement(/* onto, added */); Xextern void npAppendCase(/* onto, added */); X Xextern Boolean npEvalStringExpr(/*pExpr,ppRtrn,LookupFunc,ChangeFunc,priv*/); Xextern Boolean npEvalBoolExpr(/*pStmt,ppMatch,LookupFunc,ChangeFunc,priv*/); Xextern Boolean npEvaluate(/*pStmt,ppName,ppClass,LookupFunc,ChangeFunc,priv*/); X X#define MAX_NAME_LEN 1024 X X#endif /* NAMES_H */ END_OF_FILE if test 4148 -ne `wc -c <'./lib/names.h'`; then echo shar: \"'./lib/names.h'\" unpacked with wrong size! fi # end of './lib/names.h' fi if test -f './utils/storage.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'./utils/storage.c'\" else echo shar: Extracting \"'./utils/storage.c'\" \(4932 characters\) sed "s/^X//" >'./utils/storage.c' <<'END_OF_FILE' X X /*\ X * $Header: storage.c,v 5.0 90/01/10 06:51:14 erik Exp $ X * X * COPYRIGHT 1990 X * DIGITAL EQUIPMENT CORPORATION X * MAYNARD, MASSACHUSETTS X * ALL RIGHTS RESERVED. X * X * THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE AND X * SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT CORPORATION. X * DIGITAL MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THIS SOFTWARE X * FOR ANY PURPOSE. IT IS SUPPLIED "AS IS" WITHOUT EXPRESS OR IMPLIED X * WARRANTY. X * X * IF THE SOFTWARE IS MODIFIED IN A MANNER CREATING DERIVATIVE COPYRIGHT X * RIGHTS, APPROPRIATE LEGENDS MAY BE PLACED ON THE DERIVATIVE WORK IN X * ADDITION TO THAT SET FORTH ABOVE. X * X * Permission to use, copy, modify, and distribute this software and its X * documentation for any purpose and without fee is hereby granted, provided X * that the above copyright notice appear in all copies and that both that X * copyright notice and this permission notice appear in supporting X * documentation, and that the name of Digital Equipment Corporation not be X * used in advertising or publicity pertaining to distribution of the X * software without specific, written prior permission. X \*/ X X#define DEBUG_VAR genDebug X#include "utils.h" X#include "storagestr.h" X X/***====================================================================***/ X Xint XgenHashString(inKey) XGenKey inKey; X{ Xchar *key= (char *)inKey; Xint total; X X uENTRY1("genHashString(%s)\n",key); X X total= *key++; X if (*key) total|= ((*key++)<<16)&0x00ff0000; X if (*key) total|= ((*key++)<<8)&0x0000ff00; X if (*key) total|= ((*key++)<<24)&0xff000000; X uRETURN(total); X} X XGenData XgenReplaceFreedStringData( newDataIn, ppOldDataIn ) XGenData newDataIn; XGenData *ppOldDataIn; X{ Xchar *newData= (char *)newDataIn; Xchar **ppOldData= (char **)ppOldDataIn; X X uENTRY3("genReplaceStringData(%s,0x%x(%s))\n",newData,ppOldData, X *ppOldData); X if ((ppOldData)&&(*ppOldData)) { X uFree((Opaque)*ppOldData); X *ppOldData= NULL; X } X uRETURN((GenData)uStringDup(newData)); X} X XGenData XgenReplaceFreedPointerData( newDataIn, ppOldDataIn ) XGenData newDataIn; XGenData *ppOldDataIn; X{ Xchar *newData= (char *)newDataIn; Xchar **ppOldData= (char **)ppOldDataIn; X X uENTRY2("genReplacePointerData(%s,0x%x)\n",newData,ppOldData); X if ((ppOldData)&&(*ppOldData)) { X uFree((Opaque)*ppOldData); X *ppOldData= NULL; X } X uRETURN((GenData)newData); X} X XComparison XgenCompareStringKey( key1, key2 ) XGenKey key1,key2; X{ Xchar *str1= (char *)key1; Xchar *str2= (char *)key2; X uENTRY2("genCompareStringKey(%s,%s)\n",uStringText(str1),uStringText(str2)); X uRETURN(uStringCompare(str1,str2)); X} X XGenData XgenDupStringData( data ) XGenData data; X{ Xchar *str= (char *)data; X uENTRY1("genDupStringData(%s)\n",uStringText(str)); X str= uStringDup(str); X uRETURN((GenData)str); X} X Xvoid XgenFreeKey( key ) XGenKey key; X{ X uENTRY1("genFreeKey(0x%x)\n",key); X uFree((Opaque)key); X uVOIDRETURN; X} X Xvoid XgenFreeData( data ) XGenData data; X{ X uENTRY1("genFreeData(0x%x)\n",data); X uFree((Opaque)data); X uVOIDRETURN; X} X X/***====================================================================***/ X Xstatic GenKeyDescRec genFreedStringKeyTypeRec= { X (HashFunc)genHashString, X (CompareKeyFunc)genCompareStringKey, X (StoreKeyFunc)genDupStringData, X (RemoveKeyFunc)genFreeKey, X (GenKey)NULL X}; X Xstatic GenKeyDescRec genStringKeyTypeRec= { X (HashFunc)genHashString, X (CompareKeyFunc)genCompareStringKey, X (StoreKeyFunc)NULL, X (RemoveKeyFunc)NULL, X (GenKey)NULL X}; X Xstatic GenKeyDescRec genIntegerKeyTypeRec= { X (HashFunc)NULL, X (CompareKeyFunc)NULL, X (StoreKeyFunc)NULL, X (RemoveKeyFunc)NULL, X (GenKey)-1 X}; X XGenKeyDescPtr genStringKeyType= &genStringKeyTypeRec; XGenKeyDescPtr genFreedStringKeyType= &genFreedStringKeyTypeRec; XGenKeyDescPtr genIntegerKeyType= &genIntegerKeyTypeRec; XGenKeyDescPtr genDefaultKeyType= &genFreedStringKeyTypeRec; X Xstatic GenDataDescRec genFreedStringDataTypeRec= { X (StoreDataFunc)genDupStringData, X (ReplaceDataFunc)genReplaceFreedStringData, X (RemoveDataFunc)genFreeData, X (GenData)NULL, X}; X Xstatic GenDataDescRec genPointerDataTypeRec= { X (StoreDataFunc)NULL, X (ReplaceDataFunc)NULL, X (RemoveDataFunc)NULL, X (GenData)NULL, X}; X Xstatic GenDataDescRec genFreedPointerDataTypeRec= { X (StoreDataFunc)NULL, X (ReplaceDataFunc)genReplaceFreedPointerData, X (RemoveDataFunc)genFreeData, X (GenData)NULL, X}; X X Xstatic GenDataDescRec genIntegerDataTypeRec= { X (StoreDataFunc)NULL, X (ReplaceDataFunc)NULL, X (RemoveDataFunc)NULL, X (GenData)-1, X}; X XGenDataDescPtr genFreedStringDataType= &genFreedStringDataTypeRec; XGenDataDescPtr genPointerDataType= &genPointerDataTypeRec; XGenDataDescPtr genFreedPointerDataType= &genFreedPointerDataTypeRec; XGenDataDescPtr genIntegerDataType= &genIntegerDataTypeRec; XGenDataDescPtr genDefaultDataType= &genPointerDataTypeRec; X END_OF_FILE if test 4932 -ne `wc -c <'./utils/storage.c'`; then echo shar: \"'./utils/storage.c'\" unpacked with wrong size! fi # end of './utils/storage.c' fi if test -f './xrooms/xrActions.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'./xrooms/xrActions.c'\" else echo shar: Extracting \"'./xrooms/xrActions.c'\" \(6229 characters\) sed "s/^X//" >'./xrooms/xrActions.c' <<'END_OF_FILE' X X /*\ X * $Header: xrActions.c,v 5.3 90/01/11 14:10:25 erik Exp $ X * X * COPYRIGHT 1990 X * DIGITAL EQUIPMENT CORPORATION X * MAYNARD, MASSACHUSETTS X * ALL RIGHTS RESERVED. X * X * THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE AND X * SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT CORPORATION. X * DIGITAL MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THIS SOFTWARE X * FOR ANY PURPOSE. IT IS SUPPLIED "AS IS" WITHOUT EXPRESS OR IMPLIED X * WARRANTY. X * X * IF THE SOFTWARE IS MODIFIED IN A MANNER CREATING DERIVATIVE COPYRIGHT X * RIGHTS, APPROPRIATE LEGENDS MAY BE PLACED ON THE DERIVATIVE WORK IN X * ADDITION TO THAT SET FORTH ABOVE. X * X * Permission to use, copy, modify, and distribute this software and its X * documentation for any purpose and without fee is hereby granted, provided X * that the above copyright notice appear in all copies and that both that X * copyright notice and this permission notice appear in supporting X * documentation, and that the name of Digital Equipment Corporation not be X * used in advertising or publicity pertaining to distribution of the X * software without specific, written prior permission. X \*/ X X#include <X11/Xlib.h> X#include <X11/cursorfont.h> X#include <X11/Xutil.h> X X#define DEBUG_VAR xractDebug X#include "utils.h" X#include "hash.h" X X#include "appstate.h" X#include "apps.h" X#include "rooms.h" X X#include "xrDebug.h" X#include "xrXUtils.h" X#include "xrApp.h" X#include "xrGen.h" X#include "xrProtoArgs.h" X#include "xrProtoIter.h" X#include "xrActions.h" X#include "xrooms.h" X Xextern void xruiPopDownWinMenu(); X X/***====================================================================***/ X Xvoid XxractDoSetAll() X{ XxrSetStateArgsRec args; X xruiPopDownWinMenu(); X args.doWhat= 'S'; /* set */ X args.toWhat= 'P'; /* parts */ X args.whichPart= XR_QUERY_PARTS; /* let the user decide */ X args.whichState= XR_ALL_STATES; /* clobber everything */ X if (xroomsSetupMode) X args.whichApp= XR_QUERY_MULT_APPS; /* pick a bunch */ X else args.whichApp= XR_QUERY_APP; /* let the user decide */ X args.appName= NULL; /* no name needed */ X args.whichRoom= XR_CURRENT_ROOM;/* take current room */ X args.roomName= NULL; /* no name needed */ X xrdpDoSetState(&args); X return; X} X X/***====================================================================***/ X Xvoid XxractDoSetLocalOnly() X{ XAppPtr pApp; XAppStatePtr pState; XRoomPtr pRoom; XOpaque ristate; X X xruiPopDownWinMenu(); X xractDoSetAll(); X pApp= xrpaGetLastApp(); X pRoom= GetCurrentRoom(); X if ((pApp!=NullApp)&&(pRoom!=NullRoom)) { X pState= appGetDefault(pApp); X appSetRoomState(pApp,roomName(pRoom),pState,False); X asChangeSelected(pState,asWinStateValue,asIconic,0,0,(unsigned)0, X (unsigned)0); X RoomsIterator(pRoom,ristate) { X roomCheckAppStates(pRoom,pApp); X } X RoomsEndIterator(ristate); X } X return; X} X X/***====================================================================***/ X Xstatic xrRememberArgsRec remArgs = { X True, XR_QUERY_APP, 0 X}; X Xvoid XxractDoMakePermanent() X{ X xruiPopDownWinMenu(); X remArgs.remember= True; X xrdpDoRemember(&remArgs); X return; X} X X/***====================================================================***/ X Xvoid XxractDoMakeTransient() X{ X xruiPopDownWinMenu(); X remArgs.remember= False; X xrdpDoRemember(&remArgs); X return; X} X X/***====================================================================***/ X Xvoid XxractDoBoltGeom() X{ XxrSetStateArgsRec args; X X xruiPopDownWinMenu(); X args.doWhat= 'S'; /* set */ X args.toWhat= 'B'; /* bolts */ X args.whichPart= XR_QUERY_PARTS; /* let the user decide */ X args.whichState= XR_VISIBLE_STATE; /* take visible state */ X if (xroomsSetupMode) X args.whichApp= XR_QUERY_MULT_APPS; /* pick a bunch */ X else args.whichApp= XR_QUERY_APP; /* let the user decide */ X args.appName= NULL; /* no name needed */ X args.whichRoom= XR_CURRENT_ROOM; /* take current room */ X args.roomName= NULL; /* no name needed */ X xrdpDoBolt(&args); X return; X} X X/***====================================================================***/ X Xvoid XxractDoUnboltGeom() X{ XxrSetStateArgsRec args; X xruiPopDownWinMenu(); X args.doWhat= 'C'; /* clear */ X args.toWhat= 'B'; /* bolts */ X args.whichPart= XR_QUERY_PARTS; /* let the user decide */ X args.whichState= XR_VISIBLE_STATE; /* visible state */ X if (xroomsSetupMode) X args.whichApp= XR_QUERY_MULT_APPS; /* pick a bunch */ X else args.whichApp= XR_QUERY_APP; /* let the user decide */ X args.appName= NULL; /* no name needed */ X args.whichRoom= XR_CURRENT_ROOM; /* in current room */ X args.roomName= NULL; /* no name needed */ X xrdpDoBolt(&args); X return; X} X X/***====================================================================***/ X Xvoid XxractDoBoltState() X{ XxrSetStateArgsRec args; X xruiPopDownWinMenu(); X args.doWhat= 'M'; /* merge */ X args.toWhat= 'B'; /* bolts */ X args.whichPart= XR_WINSTATE_PART; /* window state only */ X args.whichState= XR_VISIBLE_STATE; /* visible state */ X if (xroomsSetupMode) X args.whichApp= XR_QUERY_MULT_APPS; /* pick a bunch */ X else args.whichApp= XR_QUERY_APP; /* let the user decide */ X args.appName= NULL; /* no name needed */ X args.whichRoom= XR_CURRENT_ROOM; /* in current room */ X args.roomName= NULL; /* no name needed */ X xrdpDoBolt(&args); X return; X} X X/***====================================================================***/ X Xvoid XxractDoUnboltState() X{ XxrSetStateArgsRec args; X xruiPopDownWinMenu(); X args.doWhat= 'C'; /* clear */ X args.toWhat= 'B'; /* bolts */ X args.whichPart= XR_WINSTATE_PART; /* window state only */ X args.whichState= XR_VISIBLE_STATE; /* whichever state is visible */ X if (xroomsSetupMode) X args.whichApp= XR_QUERY_MULT_APPS; /* pick a bunch */ X else args.whichApp= XR_QUERY_APP; /* let the user decide */ X args.appName= NULL; /* no name needed */ X args.whichRoom= XR_CURRENT_ROOM; /* in this room */ X args.roomName= NULL; /* no name needed */ X xrdpDoBolt(&args); X return; X} X END_OF_FILE if test 6229 -ne `wc -c <'./xrooms/xrActions.c'`; then echo shar: \"'./xrooms/xrActions.c'\" unpacked with wrong size! fi # end of './xrooms/xrActions.c' fi if test -f './xrooms/xrDoProto.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'./xrooms/xrDoProto.c'\" else echo shar: Extracting \"'./xrooms/xrDoProto.c'\" \(6489 characters\) sed "s/^X//" >'./xrooms/xrDoProto.c' <<'END_OF_FILE' X X /*\ X * $Header: xrDoProto.c,v 5.2 90/01/11 14:11:26 erik Exp $ X * X * COPYRIGHT 1990 X * DIGITAL EQUIPMENT CORPORATION X * MAYNARD, MASSACHUSETTS X * ALL RIGHTS RESERVED. X * X * THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE AND X * SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT CORPORATION. X * DIGITAL MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THIS SOFTWARE X * FOR ANY PURPOSE. IT IS SUPPLIED "AS IS" WITHOUT EXPRESS OR IMPLIED X * WARRANTY. X * X * IF THE SOFTWARE IS MODIFIED IN A MANNER CREATING DERIVATIVE COPYRIGHT X * RIGHTS, APPROPRIATE LEGENDS MAY BE PLACED ON THE DERIVATIVE WORK IN X * ADDITION TO THAT SET FORTH ABOVE. X * X * Permission to use, copy, modify, and distribute this software and its X * documentation for any purpose and without fee is hereby granted, provided X * that the above copyright notice appear in all copies and that both that X * copyright notice and this permission notice appear in supporting X * documentation, and that the name of Digital Equipment Corporation not be X * used in advertising or publicity pertaining to distribution of the X * software without specific, written prior permission. X \*/ X X#include <X11/Xlib.h> X#include <X11/cursorfont.h> X#include <X11/Xutil.h> X X#define DEBUG_VAR xrdpDebug X#include "utils.h" X#include "hash.h" X X#include "appstate.h" X#include "apps.h" X#include "rooms.h" X X#include "xrDebug.h" X#include "xrXUtils.h" X#include "xrApp.h" X#include "xrGen.h" X#include "xrProtoArgs.h" X#include "xrProtoIter.h" X#include "xrooms.h" X X X/***====================================================================***/ X Xchar * XxrdpDoGetAppName(which,appName) Xunsigned which; Xchar *appName; X{ XAppPtr pApp; Xchar *name; X X uENTRY2("xrdpDoGetAppName(0x%x,%s)\n",which,uStringText(appName)); X pApp= xrpaGetApp(which,appName); X if (pApp!=NullApp) { X name= appText(pApp); X } X else name= NullString; X uRETURN(name); X} X X/***====================================================================***/ X XBoolean XxrdpDoRemember(pArgs) XxrRememberArgsPtr pArgs; X{ XAppPtr pApp; XBoolean ok= True; X X uENTRY1("xrdpDoRemember(0x%x)\n",pArgs); X pApp= xrpaGetApp(pArgs->whichApp,pArgs->appName); X if (pApp!=NullApp) X ok= SetAppPermanence(pApp,pArgs->remember); X else ok= False; X X if (!ok) { X uWarning("REMEMBER request failed\n"); X } X uRETURN(ok); X} X X/***====================================================================***/ X XBoolean XxrdpDoSetState(pArgs) XxrSetStateArgsPtr pArgs; X{ XAppStatePtr pState,pRealState; XAppPtr pApp; XRoomPtr pRoom; XOpaque riState,aiState,asiState; XBoolean ok= True; XBoolean checkAllRooms= False; Xunsigned parts; X X uENTRY1("xrdpDoSetState(0x%x)\n",pArgs); X X if (pArgs->whichState&XR_DFLT_STATE) { X pArgs->whichRoom= XR_CURRENT_ROOM; X } X if (pArgs->whichState==XR_LOCAL_STATE) { X pArgs->whichState|= XR_CREATE_LOCAL_STATES; X } X if (pArgs->whichState&(XR_ALL_STATES)) { X checkAllRooms= True; X if (pArgs->whichRoom&(XR_ALL_ROOMS|XR_VISIBLE_ROOMS)) { X pArgs->whichRoom= XR_CURRENT_ROOM; X } X pArgs->whichState|= XR_DESTROY_LOCAL_STATES; X } X X xrpiAppsIterator(pArgs->whichApp,pApp,pArgs->appName,aiState) { X pRealState= appGetCurrent(pApp); X if (pArgs->whichPart&XR_QUERY_PARTS) X parts= xrpaLastParts()|XR_WINSTATE_PART; X else parts= pArgs->whichPart; X xrpiRoomsIterator(pArgs->whichRoom,pRoom,pArgs->roomName,riState) { X xrpiAppStatesIterator(pApp,pRoom,pArgs->whichState,pState,asiState){ X switch (pArgs->doWhat) { X case 'M': parts|= asFlags(pState); X break; X case 'C': parts= asFlags(pState)&(~parts); X default: break; X } X asChangeProfileFlags(pRealState,pState,parts); X } X xrpiEndAppStatesIterator(pApp,asiState); X if (!checkAllRooms) X roomCheckAppStates(pRoom,pApp); X } X xrpiEndRoomsIterator(riState); X if (checkAllRooms) { X RoomsIterator(pRoom,riState) { X roomCheckAppStates(pRoom,pApp); X } X RoomsEndIterator(riState); X } X } X xrpiEndAppsIterator(aiState); X if (!ok) { X uWarning("SET STATE request failed\n"); X } X uRETURN(ok); X} X X/***====================================================================***/ X XBoolean XxrdpDoBolt(pArgs) XxrSetStateArgsPtr pArgs; X{ XAppStatePtr pState; XAppPtr pApp; XRoomPtr pRoom; XOpaque riState,aiState,asiState; XBoolean ok= True; XBoolean checkRoom= False; XBoolean (*changeFunc)(/* pState, parts */); Xunsigned parts; X X uENTRY1("xrdpDoBolt(0x%x)\n",pArgs); X X if (pArgs->whichState&(XR_ALL_STATES|XR_DFLT_STATE)) { X pArgs->whichRoom= XR_CURRENT_ROOM; X } X if (pArgs->whichState==XR_LOCAL_STATE) { X checkRoom= True; X pArgs->whichState|= XR_CREATE_LOCAL_STATES; X } X X if (pArgs->toWhat=='B') { X switch (pArgs->doWhat) { X case 'S': changeFunc= asSetBolts; break; X case 'M': changeFunc= asBolt; break; X case 'C': changeFunc= asUnbolt; break; X } X } X else { X switch (pArgs->doWhat) { X case 'S': changeFunc= asSetLooseBolts; break; X case 'M': changeFunc= asLoosenBolts; break; X case 'C': changeFunc= asTightenBolts; break; X } X } X X xrpiAppsIterator(pArgs->whichApp,pApp,pArgs->appName,aiState) { X if (pArgs->whichPart&XR_QUERY_PARTS) X parts= xrpaLastParts(); X else parts= pArgs->whichPart; X xrpiRoomsIterator(pArgs->whichRoom,pRoom,pArgs->roomName,riState) { X xrpiAppStatesIterator(pApp,pRoom,pArgs->whichState,pState,asiState){ X if (pArgs->whichPart&XR_QUERY_PARTS) X parts|= (asBolts(pState)&asWinStateValue); X (*changeFunc)(pState,parts); X } X xrpiEndAppStatesIterator(pApp,asiState); X if (checkRoom) X roomCheckAppStates(pRoom,pApp); X } X xrpiEndRoomsIterator(riState); X } X xrpiEndAppsIterator(aiState); X if (!ok) { X uWarning("BOLT request failed\n"); X } X uRETURN(ok); X} X X/***====================================================================***/ X XBoolean XxrdpDoSetVisibility(pArgs) XxrVisibilityArgsPtr pArgs; X{ XBoolean ok= True; XRoomPtr pRoom; XOpaque riState; X X uENTRY1("xrdpDoSetVisibility(0x%x)\n",pArgs); X if (pArgs==(xrVisibilityArgsPtr)NULL) { X uRETURN(False); X } X X if (pArgs->createRoom) { X pArgs->whichRoom|= XR_CREATE_ROOM; X } X xrpiRoomsIterator(pArgs->whichRoom,pRoom,pArgs->roomName,riState) { X ok= roomSetVisibility(pRoom,pArgs->visibility,pArgs->checkAuto)&&ok; X } X xrpiEndRoomsIterator(riState); X X if (!ok) { X uWarning("VISIBILITY request failed\n"); X } X uRETURN(ok); X} END_OF_FILE if test 6489 -ne `wc -c <'./xrooms/xrDoProto.c'`; then echo shar: \"'./xrooms/xrDoProto.c'\" unpacked with wrong size! fi # end of './xrooms/xrDoProto.c' fi if test -f './xrooms/xrGen.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'./xrooms/xrGen.h'\" else echo shar: Extracting \"'./xrooms/xrGen.h'\" \(5699 characters\) sed "s/^X//" >'./xrooms/xrGen.h' <<'END_OF_FILE' X#ifndef XRGEN_H X#define XRGEN_H 1 X X /*\ X * $Header: xrGen.h,v 5.0 90/01/10 07:00:53 erik Exp $ X * X * COPYRIGHT 1990 X * DIGITAL EQUIPMENT CORPORATION X * MAYNARD, MASSACHUSETTS X * ALL RIGHTS RESERVED. X * X * THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE AND X * SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT CORPORATION. X * DIGITAL MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THIS SOFTWARE X * FOR ANY PURPOSE. IT IS SUPPLIED "AS IS" WITHOUT EXPRESS OR IMPLIED X * WARRANTY. X * X * IF THE SOFTWARE IS MODIFIED IN A MANNER CREATING DERIVATIVE COPYRIGHT X * RIGHTS, APPROPRIATE LEGENDS MAY BE PLACED ON THE DERIVATIVE WORK IN X * ADDITION TO THAT SET FORTH ABOVE. X * X * Permission to use, copy, modify, and distribute this software and its X * documentation for any purpose and without fee is hereby granted, provided X * that the above copyright notice appear in all copies and that both that X * copyright notice and this permission notice appear in supporting X * documentation, and that the name of Digital Equipment Corporation not be X * used in advertising or publicity pertaining to distribution of the X * software without specific, written prior permission. X \*/ X X#include <X11/Xlib.h> X#include <X11/Xatom.h> X Xtypedef struct _xrRequestRec { X unsigned request; X unsigned size; X Window win; X} xrRequestRec,*xrRequestPtr; X X#define XR_RQ_NOOP 0 X#define XR_RQ_SET_STATE 1 X#define XR_RQ_REMEMBER 2 X#define XR_RQ_SET_VISIBILITY 3 X#define XR_RQ_LOAD_PROFILE 4 X#define XR_RQ_APP_NAME 9 X#define XR_RQ_DEBUG 10 X X /* X * these should correspond to values in appstate.h X */ X#define XR_X_PART ((unsigned)(1<<0)) X#define XR_Y_PART ((unsigned)(1<<1)) X#define XR_POSITION_PART (XR_X_PART|XR_Y_PART) X#define XR_WIDTH_PART ((unsigned)(1<<2)) X#define XR_HEIGHT_PART ((unsigned)(1<<3)) X#define XR_SIZE_PART (XR_WIDTH_PART|XR_HEIGHT_PART) X#define XR_X_NEGATIVE ((unsigned)(1<<4)) X#define XR_Y_NEGATIVE ((unsigned)(1<<5)) X#define XR_GEOM_PARTS (XR_POSITION_PART|XR_SIZE_PART) X#define XR_WINSTATE_PART ((unsigned)(1<<8)) X#define XR_QUERY_PARTS ((unsigned)(1<<10)) X#define XR_ALL_PARTS (XR_GEOM_PARTS|XR_WINSTATE_PART) X X#define XR_QUERY_STATE ((unsigned)(1<<0)) X#define XR_VISIBLE_STATE ((unsigned)(1<<1)) X#define XR_LOCAL_STATE ((unsigned)(1<<2)) X#define XR_DFLT_STATE ((unsigned)(1<<3)) X#define XR_ALL_STATES ((unsigned)(1<<4)) X#define XR_WHICH_MASK ((unsigned)0x1f) X#define XR_CREATE_LOCAL_STATES ((unsigned)(1<<9)) X#define XR_DESTROY_LOCAL_STATES ((unsigned)(1<<10)) X X#define XR_QUERY_APP ((unsigned)(1<<0)) X#define XR_QUERY_MULT_APPS ((unsigned)(1<<1)) X#define XR_NAMED_APP ((unsigned)(1<<2)) X#define XR_WINDOW_APP ((unsigned)(1<<3)) X#define XR_LAST_APP ((unsigned)(1<<4)) X#define XR_ALL_APPS ((unsigned)(1<<5)) X#define XR_ACTIVE_APPS ((unsigned)(1<<6)) X#define XR_NO_APP ((unsigned)(1<<7)) X X /* X * these should correspond to values from room.h X */ X#define XR_ROOM_HIDDEN ((unsigned)0) X#define XR_ROOM_VISIBLE ((unsigned)1<<0) X#define XR_ROOM_WHEN_NON_EMPTY ((unsigned)1<<1) X#define XR_ROOM_WHEN_ACTIVE ((unsigned)1<<2) X#define XR_ROOM_ALWAYS ((unsigned)1<<3) X X#define XR_QUERY_ROOM ((unsigned)(1<<0)) X#define XR_QUERY_MULT_ROOMS ((unsigned)(1<<1)) X#define XR_NAMED_ROOM ((unsigned)(1<<2)) X#define XR_CURRENT_ROOM ((unsigned)(1<<3)) X#define XR_LAST_ROOM ((unsigned)(1<<4)) X#define XR_ALL_ROOMS ((unsigned)(1<<5)) X#define XR_VISIBLE_ROOMS ((unsigned)(1<<6)) X#define XR_NO_ROOM ((unsigned)(1<<7)) X#define XR_CREATE_ROOM ((unsigned)(1<<9)) X Xtypedef struct _xrSetStateArgsRec { X char doWhat; X char toWhat; X unsigned whichPart; X unsigned whichState; X unsigned whichApp; X char *appName; X unsigned whichRoom; X char *roomName; X} xrSetStateArgsRec,*xrSetStateArgsPtr; X Xtypedef struct _xrRememberArgsRec { X Boolean remember; X unsigned whichApp; X char *appName; X} xrRememberArgsRec,*xrRememberArgsPtr; X Xtypedef struct _xrVisibilityArgsRec { X unsigned visibility; X unsigned whichRoom; X char *roomName; X Boolean checkAuto; X Boolean createRoom; X} xrVisibilityArgsRec,*xrVisibilityArgsPtr; X X/* TYPE SYNTAX */ /* <StatePart> [+!][+-!?][+-!?][+!?][+!?] */ X/* ^use State/don't use State */ X/* ^use positive X, negative X, don't */ X/* use X, query whether to use X */ X/* ^use positive Y, negative Y, don't */ X/* use Y, query whether to use Y */ X/* ^ use Width, don't use Width, */ X/* query whether to use Width */ X/* ^ use Height, don't use */ X/* Height, query whether */ X/* to use Height */ X/* <States> [ADLV?] */ X/* All|Default|Local|Visible|Query State */ X/* <Apps> [AVL(N<name>)(W<id>)?*] */ X/* All|actiVe|Last used|Named|Window id|Query */ X/* * = Query Multiple */ X/* <Rooms> [ALC(N<name>)V?] */ X/* All|Last used|Current|Named|all Visible|Query */ X X/* REQUEST ARGUMENTS */ X/* NOOP string (ignored) */ X/* SET_STATE [SMC][PBL]<StatePart><States><Apps><Rooms> */ X/* Set|Merge|Clear Parts|Bolts|Loose bolts */ X/* REMEMBER [RF]<Apps> */ X/* Remember|Forget */ X/* SET_VISIBILITY [Aa][Nn][Aa][VH][+-][Cc]<Rooms> */ X/* Always/not always Non-empty/not non-empty */ X/* when Active/not when active Visible|Hidden */ X/* + = check automatic visibility, - = don't check */ X/* Create/don't create room if necessary */ X/* LOAD string -- format of an xrooms profile */ X/* DEBUG string (passed to xrDebugSettings) */ X Xextern Atom ROOMS_CURRENT, ROOMS_ALL; Xextern Atom ROOMS_REQUEST, ROOMS_ARGUMENT, ROOMS_RETURN; X Xextern void xrgenInit(/* dpy */); Xextern void xrgenCleanUp(/* dpy, root */); X X#endif /* XRGEN_H */ END_OF_FILE if test 5699 -ne `wc -c <'./xrooms/xrGen.h'`; then echo shar: \"'./xrooms/xrGen.h'\" unpacked with wrong size! fi # end of './xrooms/xrGen.h' fi if test -f './xrooms/xrNames.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'./xrooms/xrNames.c'\" else echo shar: Extracting \"'./xrooms/xrNames.c'\" \(6268 characters\) sed "s/^X//" >'./xrooms/xrNames.c' <<'END_OF_FILE' X X /*\ X * $Header: xrNames.c,v 5.1 90/01/11 14:12:56 erik Exp $ X * X * COPYRIGHT 1990 X * DIGITAL EQUIPMENT CORPORATION X * MAYNARD, MASSACHUSETTS X * ALL RIGHTS RESERVED. X * X * THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE AND X * SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT CORPORATION. X * DIGITAL MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THIS SOFTWARE X * FOR ANY PURPOSE. IT IS SUPPLIED "AS IS" WITHOUT EXPRESS OR IMPLIED X * WARRANTY. X * X * IF THE SOFTWARE IS MODIFIED IN A MANNER CREATING DERIVATIVE COPYRIGHT X * RIGHTS, APPROPRIATE LEGENDS MAY BE PLACED ON THE DERIVATIVE WORK IN X * ADDITION TO THAT SET FORTH ABOVE. X * X * Permission to use, copy, modify, and distribute this software and its X * documentation for any purpose and without fee is hereby granted, provided X * that the above copyright notice appear in all copies and that both that X * copyright notice and this permission notice appear in supporting X * documentation, and that the name of Digital Equipment Corporation not be X * used in advertising or publicity pertaining to distribution of the X * software without specific, written prior permission. X \*/ X X#include <X11/Xlib.h> X#include <X11/Xatom.h> X X#define DEBUG_VAR xrNamesDebug X#include "utils.h" X#include "strtbl.h" X#include "nameprof.h" X#include "rooms.h" X X#include "xrDebug.h" X#include "xrXUtils.h" X#include "xrNames.h" X#include "xrooms.h" X X/***====================================================================***/ X XBoolean xrnUseAppNames; XBoolean xrnUseWindowNames; XStringToken xrnNameLookup; XAtom xrnAppNameAtom= None; X X/***====================================================================***/ X Xstatic Boolean XxrnResolveNames(clientIn,what,name,ppOutValue) XOpaque clientIn; Xchar *name; Xchar **ppOutValue; X{ XAtom nameAtom; XWindow client= (Window)clientIn; XBoolean ok; X X uENTRY4("XResolveNames(0x%x,0x%x,%s,0x%x,)\n",client,what,uStringText(name), X ppOutValue); X if (what==NPPropertyName) { X nameAtom= (Atom)XInternAtom(xroomsDpy,name,True); X if (nameAtom==None) { X ok= False; X *ppOutValue= NullString; X } X else { X ok= xruGetPropertyString(xroomsDpy,client,nameAtom,ppOutValue); X uDEBUG2(WATCH_APPS,"PropFinder, ok= %s, string= %s\n", X booleanText(ok), X uStringText((ppOutValue?*ppOutValue:NullString))); X } X } X else if (what==NPIdentifier) { X StringToken nameToken; X if (stGetTokenIfExists(name,&nameToken)) { X ok= nprGetName(nameToken,clientIn,ppOutValue,(char **)NULL); X } X else ok= False; X if (!ok) { X if (uStringEqual(name,"currentroom")) { X RoomPtr pRoom= GetCurrentRoom(); X if (pRoom!=NullRoom) { X *ppOutValue= uStringDup(roomText(pRoom)); X ok= True; X } X } X } X } X uRETURN(ok); X} X X/***====================================================================***/ X Xstatic Boolean XxrnChangeNamed(clientIn,what,name,value,append) XOpaque clientIn; Xunsigned what; Xchar *name; Xchar *value; XBoolean append; X{ XWindow client= (Window)clientIn; X X uENTRY5("XRChangeNamed(0x%x,0x%x,%s,%s,0x%x)\n",client,what, X uStringText(name),uStringText(value), X booleanText(append)); X if ((name==NullString)||(strlen(name)<1)) { X uRETURN(False); X } X if (what==NPPropertyName) { X Atom nameAtom; X unsigned mode; X X if (append) mode= PropModeAppend; X else mode= PropModeReplace; X X nameAtom= (Atom)XInternAtom(xroomsDpy,name,False); X if ((nameAtom!=None)&&(value!=NullString)&&(strlen(value)>0)) { X XChangeProperty(xroomsDpy,client,nameAtom,XA_STRING,8,mode, X value,strlen(value)); X XFlush(xroomsDpy); X uDEBUG3(WATCH_APPS,"PropChange, setting <%s> to \"%s\" on 0x%x\n", X uStringText(name),uStringText(value),client); X } X else if (nameAtom!=None) { X if (!append) X XDeleteProperty(xroomsDpy,client,nameAtom); X } X else { X uWarning("Error interning atom for \"%s\"\n",uStringText(name)); X } X uRETURN(True); X } X else if (what==NPIdentifier) { X if (uStringEqual(name,"currentroom")) { X StringToken nameToken= stGetToken(value); X RoomPtr pRoom= LookupRoom(nameToken); X X if (pRoom==NullRoom) pRoom= CreateRoom(nameToken); X if (pRoom!=NullRoom) { X SwitchToRoom(pRoom); X uRETURN(True); X } X } X uRETURN(False); X } X uRETURN(False); X} X X X/***====================================================================***/ X XBoolean XxrnGetName(win,ppName,ppClass) XWindow win; Xchar **ppName; Xchar **ppClass; X{ XBoolean found; X X uENTRY3("xrnGetName(0x%x,0x%x,0x%x)\n",win,ppName,ppClass); X *ppName= NullString; X *ppClass= NullString; X found= nprGetName(xrnNameLookup,(Opaque)win,ppName,ppClass); X if (!found) { X if (xrnUseAppNames&&(xrnAppNameAtom!=None)) { X if (!xruGetPropertyString(xroomsDpy,win,xrnAppNameAtom,ppName)) X *ppName= NullString; X } X if (*ppName==NullString) { X if (xrnUseWindowNames) { X XFetchName(xroomsDpy, win, ppName); X if (*ppName==NullString) X XGetIconName(xroomsDpy,win,ppName); X } X else { X XGetIconName(xroomsDpy, win, ppName); X if (*ppName==NullString) X XFetchName(xroomsDpy, win, ppName); X } X } X if (*ppName!=NullString) X found= True; X } X uRETURN(found); X} X X/***====================================================================***/ X Xvoid XxrnNoteAppName(win,name) XWindow win; Xchar *name; X{ X uENTRY2("xrnNoteAppName(0x%x,%s)\n",win,uStringText(name)); X X if (xrnAppNameAtom!=None) { X XChangeProperty(xroomsDpy,win,xrnAppNameAtom,XA_STRING,8, X PropModeReplace, X name,strlen(name)); X XFlush(xroomsDpy); X } X uVOIDRETURN; X} X X/***====================================================================***/ X XBoolean XxrnHaveProfile() X{ X uENTRY("xrnHaveProfile()\n"); X if (nprLookupFunction(xrnNameLookup)!=NullNPStatement) { X uRETURN(True); X } X uRETURN(False); X} X X/***====================================================================***/ X Xvoid XxrnInit() X{ X uENTRY("xrnInit()\n"); X nprSetResolver(xrnResolveNames); X nprSetChanger(xrnChangeNamed); X uVOIDRETURN; X} END_OF_FILE if test 6268 -ne `wc -c <'./xrooms/xrNames.c'`; then echo shar: \"'./xrooms/xrNames.c'\" unpacked with wrong size! fi # end of './xrooms/xrNames.c' fi if test -f './xrooms/xrProfile.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'./xrooms/xrProfile.c'\" else echo shar: Extracting \"'./xrooms/xrProfile.c'\" \(5999 characters\) sed "s/^X//" >'./xrooms/xrProfile.c' <<'END_OF_FILE' X X /*\ X * $Header: xrProfile.c,v 5.0 90/01/10 07:01:06 erik Exp $ X * X * COPYRIGHT 1990 X * DIGITAL EQUIPMENT CORPORATION X * MAYNARD, MASSACHUSETTS X * ALL RIGHTS RESERVED. X * X * THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE AND X * SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT CORPORATION. X * DIGITAL MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THIS SOFTWARE X * FOR ANY PURPOSE. IT IS SUPPLIED "AS IS" WITHOUT EXPRESS OR IMPLIED X * WARRANTY. X * X * IF THE SOFTWARE IS MODIFIED IN A MANNER CREATING DERIVATIVE COPYRIGHT X * RIGHTS, APPROPRIATE LEGENDS MAY BE PLACED ON THE DERIVATIVE WORK IN X * ADDITION TO THAT SET FORTH ABOVE. X * X * Permission to use, copy, modify, and distribute this software and its X * documentation for any purpose and without fee is hereby granted, provided X * that the above copyright notice appear in all copies and that both that X * copyright notice and this permission notice appear in supporting X * documentation, and that the name of Digital Equipment Corporation not be X * used in advertising or publicity pertaining to distribution of the X * software without specific, written prior permission. X \*/ X X#include <X11/Xlib.h> X#include <X11/cursorfont.h> X#include <X11/Xutil.h> X X#define DEBUG_VAR xrProfileDebug X#include "utils.h" X#include "hash.h" X#include "appstate.h" X#include "profscan.h" X X#include "xrDebug.h" X#include "xrooms.h" X#include "xrProfile.h" X X/***====================================================================***/ X XBoolean xrpfAutoSaveNew= True; XBoolean xrpfSaveRoomProfiles= False; XBoolean xrpfBackupConfig= False; Xchar *xrpfConfigFile= NULL; X X/***====================================================================***/ X Xstatic FILE * XxrpfFindFileToRead() X{ XFILE *file= NULL; Xchar *home; Xchar buf[256]; X X uENTRY("xrpfFindFileToRead()\n"); X if (xrpfConfigFile!=NullString) { X file= fopen(xrpfConfigFile,"r"); X if (file==NULL) { X uWarning("Can't open \"%s\" to read defaults\n",xrpfConfigFile); X } X uRETURN(file); X } X if ((file==NULL)&&((home=(char *)getenv("HOME"))!=NULL)) { X sprintf(buf,"%s/.xroomsrc",home); X file= fopen(buf,"r"); X if (file==NULL) { X sprintf(buf,"%s/.xrooms.init",home); X file= fopen(buf,"r"); X if (file!=NULL) { X uWarning("Intializing from .xrooms.init, which is obsolete\n"); X uAction("defaults will be saved to your .xroomsrc\n"); X } X } X } X if (file==NULL) { X file= fopen("/usr/lib/X11/system.xroomsrc","r"); X if (file!=NULL) { X uWarning("Loading from /usr/lib/X11/system.xroomsrc\n"); X uAction("defaults will be saved to your .xroomsrc\n"); X } X } X if (file==NULL) { X file= fopen("/usr/local/lib/X11/system.xroomsrc","r"); X if (file!=NULL) { X uWarning("Loading from /usr/local/lib/X11/system.xroomsrc\n"); X uAction("defaults will be saved to your .xroomsrc\n"); X } X } X if (file==NULL) { X uWarning("Couldn't find a config file anywhere\n"); X if (xroomsSetupMode) X uAction("Trying some heuristics for defaults\n"); X else uAction("No defaults\n"); X } X uRETURN(file); X} X X/***====================================================================***/ X XBoolean XxrpfLoadString(str) Xchar *str; X{ XBoolean ok= True; X X uENTRY1("xrpfLoadString(%20s)\n",uStringText(str)); X if (str!=NullString) { X ScannablePtr pScan; X X pScan= scannableOpen(scannableString,(Opaque)str); X if (pScan!=NullScannable) { X if (!profileRead(pScan)) { X uWarning("Error reading config file\n"); X ok= False; X } X scannableClose(pScan); X } X uRETURN(ok); X } X uRETURN(False); X} X X/***====================================================================***/ X XBoolean XxrpfLoadFile(fileName) Xchar *fileName; X{ XFILE *file= NULL; XBoolean ok= False; X X uENTRY1("xrpfLoadFile(%s)\n",uStringText(fileName)); X if (fileName==NullString) { X file= xrpfFindFileToRead(); X } X else { X file= fopen(fileName,"r"); X if (file==NULL) { X uWarning("Couldn't load config file %s\n",fileName); X uAction("profile not loaded\n"); X } X } X if (file!=NULL) { X ScannablePtr pScan; X X pScan= scannableOpen(scannableFile,(Opaque)file); X if (pScan!=NullScannable) { X if (!profileRead(pScan)) { X uWarning("Error reading config file\n"); X } X else ok= True; X scannableClose(pScan); X } X fclose(file); X } X uRETURN(ok); X} X X/***====================================================================***/ X Xstatic FILE * XxrpfFindFileToWrite() X{ XFILE *file; Xchar *home; Xchar buf[256]; X X uENTRY("xrpfFindFileToWrite()\n"); X if (xrpfConfigFile==NullString) { X home= (char *)getenv("HOME"); X sprintf(buf,"%s/.xroomsrc",home); X xrpfConfigFile= uStringDup(buf); X } X if (xrpfConfigFile!=NullString) { X if (xrpfBackupConfig) { X sprintf(buf,"%s.bak",xrpfConfigFile); X unlink(buf); X rename(xrpfConfigFile,buf); X } X file= fopen(xrpfConfigFile,"w"); X if (xrpfBackupConfig) { X if (file==(FILE *)NULL) { X rename(buf,xrpfConfigFile); X } X xrpfBackupConfig= False; X } X } X if (file==NULL) { X char *user= (char *)getenv("USER"); X if (user!=NULL) sprintf(buf,"/usr/tmp/xroomsrc.%s",user); X else sprintf(buf,"/usr/tmp/xroomsrc.tmp"); X uWarning("Couldn't write to config file\n"); X file= fopen(buf,"w"); X if (file!=NULL) uAction("saving profile to %s\n",buf); X else uAction("profile not saved\n"); X } X uRETURN(file); X} X X/***====================================================================***/ X Xvoid XxrpfSaveProfiles(fileName) Xchar *fileName; X{ XFILE *file; X X uENTRY1("xrpfSaveProfiles(%s)\n",uStringText(fileName)); X if (fileName==NULL) { X file= xrpfFindFileToWrite(); X } X else { X file= fopen(fileName,"w"); X if (file==NULL) { X uWarning("Couldn't open %s to save profiles\n",fileName); X uAction("profiles not saved\n"); X } X } X if (file!=NULL) { X (void)profileWrite(file,xrpfSaveRoomProfiles); X fclose(file); X xroomsSetupMode= False; X } X uVOIDRETURN; X} X END_OF_FILE if test 5999 -ne `wc -c <'./xrooms/xrProfile.c'`; then echo shar: \"'./xrooms/xrProfile.c'\" unpacked with wrong size! fi # end of './xrooms/xrProfile.c' fi echo shar: End of archive 3 \(of 14\). cp /dev/null ark3isdone MISSING="" for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 ; do if test ! -f ark${I}isdone ; then MISSING="${MISSING} ${I}" fi done if test "${MISSING}" = "" ; then echo You have unpacked all 14 archives. rm -f ark[1-9]isdone ark[1-9][0-9]isdone else echo You still need to unpack the following archives: echo " " ${MISSING} fi ## End of shell archive. exit 0