From 1f15c3f81d512361c56561700d5c83858027b1f6 Mon Sep 17 00:00:00 2001 From: Packit Service Date: Dec 15 2020 08:51:45 +0000 Subject: Prepare for a new update Reverting patches so we can apply the latest update and changes can be seen in the spec file and sources. --- diff --git a/Makefile.am b/Makefile.am index d6c3f16..31bedc1 100644 --- a/Makefile.am +++ b/Makefile.am @@ -28,7 +28,7 @@ SUBDIRS = bindings bitmaps \ include \ tools \ clients \ - doc - + doc \ + demos AUTOMAKE_OPTIONS = 1.4 ACLOCAL_AMFLAGS = -I . diff --git a/Makefile.am.no_demos b/Makefile.am.no_demos deleted file mode 100644 index 31bedc1..0000000 --- a/Makefile.am.no_demos +++ /dev/null @@ -1,34 +0,0 @@ -datadir = ${prefix}/share/Xm/doc - -#data_DATA = BUGREPORT COPYRIGHT.MOTIF COPYING \ -# README RELEASE RELNOTES - -EXTRA_DIST = BUGREPORT \ - COPYING \ - Imakefile \ - README RELEASE RELNOTES \ - INSTALL.configure Makefile.imake-pure - -MAINTAINERCLEANFILES = Makefile.in \ - configure libtool \ - config.guess \ - config.sub \ - config.log \ - ltconfig ltmain.sh \ - aclocal.m4 \ - config.h.in \ - install-sh \ - missing mkinstalldirs \ - compile - -SUBDIRS = bindings bitmaps \ - config \ - localized \ - lib \ - include \ - tools \ - clients \ - doc \ - demos -AUTOMAKE_OPTIONS = 1.4 -ACLOCAL_AMFLAGS = -I . diff --git a/clients/mwm/WmResParse.c b/clients/mwm/WmResParse.c index 465f5b4..f64207c 100644 --- a/clients/mwm/WmResParse.c +++ b/clients/mwm/WmResParse.c @@ -2392,7 +2392,7 @@ FILE *FopenConfigFile (void) #endif /* PANELIST */ #ifndef MWMRCDIR -#define MWMRCDIR "/etc/X11/mwm" +#define MWMRCDIR "/usr/lib/X11" #endif if (LANG != NULL) { diff --git a/clients/mwm/WmResParse.c.mwmrc_dir b/clients/mwm/WmResParse.c.mwmrc_dir deleted file mode 100644 index f64207c..0000000 --- a/clients/mwm/WmResParse.c.mwmrc_dir +++ /dev/null @@ -1,8395 +0,0 @@ -/* - * Motif - * - * Copyright (c) 1987-2012, The Open Group. All rights reserved. - * - * These libraries and programs are free software; you can - * redistribute them and/or modify them under the terms of the GNU - * Lesser General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) - * any later version. - * - * These libraries and programs are distributed in the hope that - * they will be useful, but WITHOUT ANY WARRANTY; without even the - * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU Lesser General Public License for more - * details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with these librararies and programs; if not, write - * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth - * Floor, Boston, MA 02110-1301 USA -*/ -/* - * Motif Release 1.2.4 -*/ -#ifdef HAVE_CONFIG_H -#include -#endif - - -#ifdef REV_INFO -#ifndef lint -static char rcsid[] = "$XConsortium: WmResParse.c /main/9 1996/11/01 10:17:34 drk $" -#endif -#endif -/* - * (c) Copyright 1987, 1988, 1989, 1990, 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. - */ -/* - * (c) Copyright 1987, 1988 DIGITAL EQUIPMENT CORPORATION */ -/* - * (c) Copyright 1988 MASSACHUSETTS INSTITUTE OF TECHNOLOGY */ - -/* - * Included Files: - */ - -#include "WmGlobal.h" -#include "WmResNames.h" -#ifdef WSM -#include
-#include
-#include -#endif /* WSM */ -#ifdef PANELIST -#include "WmParse.h" -#include "WmParseP.h" -#include "WmPanelP.h" -#endif /* PANELIST */ -#include "WmResource.h" - -#include - -#include -#include -#include -#include - -#include - -#ifndef NO_MULTIBYTE -#include -#endif - -#ifdef MOTIF_ONE_DOT_ONE -#include -#include -#else -#include /* for XmeGetHomeDirName */ -#endif -#ifdef WSM -#include -#endif /* WSM */ - -#define FIX_1127 - -/* maximum string lengths */ - -#define MAX_KEYSYM_STRLEN 100 -#define MAX_EVENTTYPE_STRLEN 20 -#define MAX_MODIFIER_STRLEN 20 -#define MAX_CONTEXT_STRLEN 20 -#define MAX_GROUP_STRLEN 20 - -#ifdef min -#undef min -#endif -#define min(a,b) ((a)>(b) ? (b) : (a)) - -#define MAXLINE (MAXWMPATH+1) - -#define MBBSIZ 4096 - -#if ((!defined(WSM)) || defined(MWM_QATS_PROTOCOL)) -# define PARSE_MENU_ITEMS(pSD, mSpec) ParseMenuItems(pSD, mSpec) -#else -# define PARSE_MENU_ITEMS(pSD, mSpec) ParseMenuItems(pSD) -#endif /* !defined(WSM) || defined(MWM_QATS_PROTOCOL) */ - -/* - * include extern functions - */ -#include "WmResParse.h" -#ifdef WSM -#include "WmWrkspace.h" -#endif /* WSM */ -#include "WmError.h" -#include "WmFunction.h" -#include "WmImage.h" -#include "WmXSMP.h" - -#ifdef MOTIF_ONE_DOT_ONE -extern char *getenv (); -#endif -#ifdef PANELIST -# include -# ifdef X_NOT_STDC_ENV -extern int errno; -# endif -# define HOME_DT_WMRC "/.dt/dtwmrc" -# define LANG_DT_WMRC "/dtwmrc" -# define SYS_DT_WMRC CDE_CONFIGURATION_TOP "/sys.dtwmrc" -#endif /* PANELIST */ - -/* - * Global Variables And Tables: - */ -static char cfileName[MAXWMPATH+1]; -#ifdef WSM -#ifndef NO_MESSAGE_CATALOG -char * pWarningStringFile; -char * pWarningStringLine; -#else -char pWarningStringFile[] = "%s: %s on line %d of configuration file %s\n"; -char pWarningStringLine[] = "%s: %s on line %d of specification string\n"; -#endif -#define cfileP (wmGD.pWmPB->pFile) -#define parseP (wmGD.pWmPB->pchNext) -#define line (wmGD.pWmPB->pchLine) -#define linec (wmGD.pWmPB->lineNumber) -#else /* WSM */ -static FILE *cfileP = NULL; /* fopen'ed configuration file or NULL */ -static unsigned char line[MAXLINE+1]; /* line buffer */ -static int linec = 0; /* line counter for parser */ -static unsigned char *parseP = NULL; /* pointer to parse string */ -#endif /* WSM */ - - -typedef struct { - char *name; - unsigned int mask; -} MaskTableEntry; - -static MaskTableEntry modifierStrings[] = { - - {"none", None}, - {"ctrl", ControlMask}, - {"shift", ShiftMask}, - {"alt", Mod1Mask}, - {"meta", Mod1Mask}, - {"lock", LockMask}, - {"mod1", Mod1Mask}, - {"mod2", Mod2Mask}, - {"mod3", Mod3Mask}, - {"mod4", Mod4Mask}, - {"mod5", Mod5Mask}, - {NULL, (unsigned int)NULL}, -}; - -#define ALT_INDEX 3 -#define META_INDEX 4 - -typedef struct { - char *event; - unsigned int eventType; - Boolean (*parseProc)(); - unsigned int closure; - Boolean fClick; -} EventTableEntry; - -#if ((!defined(WSM)) || defined(MWM_QATS_PROTOCOL)) - -# define CCI_USE_DEFAULT_NAME_TAG "DEFAULT_NAME" - -String CCIEntryModifierNames[] = { - "none", - "inline", - "cascade", - "delimit", - "delimit_inline", - "delimit_cascade", - "exclude" -}; - -typedef enum { - NONE, /* internal only. */ - INLINE, /* not supported. */ - CASCADE, - DELIMIT, - DELIMIT_INLINE, /* not supported. */ - DELIMIT_CASCADE, - EXCLUDE -} CCIEntryModifier; - -typedef struct _CCIFuncArg { - CCIEntryModifier mod; - String cciEntry; -} CCIFuncArg; -#endif /* !defined(WSM) || defined(MWM_QATS_PROTOCOL) */ - -#ifdef MOTIF_ONE_DOT_ONE -void GetHomeDirName(String fileName); -#endif -#ifdef WSM -static String GetNetworkFileName (char *pchFile); -#endif /* WSM */ -#if ((!defined(WSM)) || defined(MWM_QATS_PROTOCOL)) -static MenuItem *MakeSeparatorTemplate (int); -static void ParseMenuItemName (unsigned char **linePP, MenuItem *menuItem); -static Boolean ParseClientCommand (unsigned char **linePP, MenuSpec *menuSpec, - MenuItem *menuItem, unsigned char *string, - Boolean *use_separators); -static void FixMenuItem (MenuSpec *menuSpec, MenuItem *menuItem); -static Boolean GetCCIModifier (String modString, CCIEntryModifier *mod); -static Boolean ParseWmFuncCCIArgs (unsigned char **linePP, - WmFunction wmFunction, String *pArgs); -#endif /* !defined(WSM) || defined(MWM_QATS_PROTOCOL) */ -FILE *FopenConfigFile (void); -void SaveMenuAccelerators (WmScreenData *pSD, MenuSpec *newMenuSpec); -static void ParseMenuSet (WmScreenData *pSD, unsigned char *lineP); -MenuItem *ParseMwmMenuStr (WmScreenData *pSD, unsigned char *menuStr); -static MenuItem *ParseMenuItems (WmScreenData *pSD -#if ((!defined(WSM)) || defined(MWM_QATS_PROTOCOL)) - , MenuSpec *menuSpec -#endif /* !defined(WSM) || defined(MWM_QATS_PROTOCOL) */ - ); -static Boolean ParseWmLabel (WmScreenData *pSD, MenuItem *menuItem, - unsigned char *string); -static void ParseWmMnemonic (unsigned char **linePP, MenuItem *menuItem); -static Boolean ParseWmAccelerator (unsigned char **linePP, MenuItem *menuItem); -int ParseWmFunction (unsigned char **linePP, unsigned int res_spec, - WmFunction *pWmFunction); -#ifndef PANELIST -static Boolean ParseWmFuncMaybeStrArg (unsigned char **linePP, - WmFunction wmFunction, String *pArgs); -#endif /* PANELIST */ -static Boolean ParseWmFuncNoArg (unsigned char **linePP, WmFunction wmFunction, - String *pArgs); -#ifndef PANELIST -static Boolean ParseWmFuncStrArg (unsigned char **linePP, - WmFunction wmFunction, String *pArgs); -#endif /* PANELIST */ -void FreeMenuItem (MenuItem *menuItem); -static Boolean ParseWmFuncGrpArg (unsigned char **linePP, - WmFunction wmFunction, GroupArg *pGroup); -static Boolean ParseWmFuncNbrArg (unsigned char **linePP, - WmFunction wmFunction, - unsigned long *pNumber); -void ParseButtonStr (WmScreenData *pSD, unsigned char *buttonStr); -static void ParseButtonSet (WmScreenData *pSD, unsigned char *lineP); -static Boolean ParseContext (unsigned char **linePP, Context *context, - Context *subContext); -void -ParseKeyStr (WmScreenData *pSD, unsigned char *keyStr); -static void ParseKeySet (WmScreenData *pSD, unsigned char *lineP); -Boolean ParseBtnEvent (unsigned char **linePP, - unsigned int *eventType, - unsigned int *button, - unsigned int *state, - Boolean *fClick); -Boolean ParseKeyEvent (unsigned char **linePP, unsigned int *eventType, - KeyCode *keyCode, unsigned int *state); -static Boolean ParseEvent (unsigned char **linePP, EventTableEntry *table, - unsigned int *eventType, unsigned int *detail, - unsigned int *state, Boolean *fClick); -static Boolean ParseModifiers(unsigned char **linePP, unsigned int *state); -static Boolean LookupModifier (unsigned char *name, unsigned int *valueP); -static Boolean ParseEventType (unsigned char **linePP, EventTableEntry *table, - unsigned int *eventType, Cardinal *ix); -static Boolean ParseImmed (unsigned char **linePP, unsigned int closure, - unsigned int *detail); -static Boolean ParseKeySym (unsigned char **linePP, unsigned int closure, - unsigned int *detail); -static unsigned int StrToNum(unsigned char *str); -static unsigned int StrToHex(unsigned char *str); -static unsigned int StrToOct(unsigned char *str); -void ScanAlphanumeric (unsigned char **linePP); -void ScanWhitespace(unsigned char **linePP); -void ToLower (unsigned char *string); -void -PWarning (char *message); -static void ProcessAccelText (unsigned char *startP, unsigned char *endP, - unsigned char *destP); -void ProcessCommandLine (int argc, char *argv[]); -static void ParseScreensArgument (int argc, char *argv[], int *pArgnum, - unsigned char *lineP); -void ProcessMotifBindings (void); -#ifdef PANELIST -static void ParseIncludeSet (WmScreenData *pSD, unsigned char *lineP); -static void ConfigStackInit (char *pchFileName); -static FILE *ConfigStackPush (unsigned char *pchFileName); -static void ConfigStackPop (void); -Boolean ParseWmFuncActionArg (unsigned char **linePP, - WmFunction wmFunction, String *pArgs); -static void PreprocessConfigFile (void); -#endif /* PANELIST */ - -static EventTableEntry buttonEvents[] = { - - {"btn1down", ButtonPress, ParseImmed, SELECT_BUTTON, FALSE}, - {"btn1up", ButtonRelease, ParseImmed, SELECT_BUTTON, FALSE}, - {"btn1click", ButtonRelease, ParseImmed, SELECT_BUTTON, TRUE}, - {"btn1click2", ButtonPress, ParseImmed, SELECT_BUTTON, TRUE}, - {"btn2down", ButtonPress, ParseImmed, DMANIP_BUTTON, FALSE}, - {"btn2up", ButtonRelease, ParseImmed, DMANIP_BUTTON, FALSE}, - {"btn2click", ButtonRelease, ParseImmed, DMANIP_BUTTON, TRUE}, - {"btn2click2", ButtonPress, ParseImmed, DMANIP_BUTTON, TRUE}, - {"btn3down", ButtonPress, ParseImmed, BMENU_BUTTON, FALSE}, - {"btn3up", ButtonRelease, ParseImmed, BMENU_BUTTON, FALSE}, - {"btn3click", ButtonRelease, ParseImmed, BMENU_BUTTON, TRUE}, - {"btn3click2", ButtonPress, ParseImmed, BMENU_BUTTON, TRUE}, - {"btn4down", ButtonPress, ParseImmed, Button4, FALSE}, - {"btn4up", ButtonRelease, ParseImmed, Button4, FALSE}, - {"btn4click", ButtonRelease, ParseImmed, Button4, TRUE}, - {"btn4click2", ButtonPress, ParseImmed, Button4, TRUE}, - {"btn5down", ButtonPress, ParseImmed, Button5, FALSE}, - {"btn5up", ButtonRelease, ParseImmed, Button5, FALSE}, - {"btn5click", ButtonRelease, ParseImmed, Button5, TRUE}, - {"btn5click2", ButtonPress, ParseImmed, Button5, TRUE}, - { NULL, (unsigned int)NULL, (Boolean(*)())NULL, (unsigned int)NULL, (Boolean)NULL} -}; - - -static EventTableEntry keyEvents[] = { - - {"key", KeyPress, ParseKeySym, 0, FALSE}, - { NULL, (unsigned int)NULL, (Boolean(*)())NULL, (unsigned int)NULL, (Boolean)NULL} -}; - -#ifdef PANELIST -typedef struct _ConfigFileStackEntry { - char *fileName; - char *tempName; - char *cppName; - char *wmgdConfigFile; - long offset; - DtWmpParseBuf *pWmPB; - struct _ConfigFileStackEntry *pIncluder; - -} ConfigFileStackEntry; - -static ConfigFileStackEntry *pConfigStack = NULL; -static ConfigFileStackEntry *pConfigStackTop = NULL; - -#endif /* PANELIST */ - -unsigned int buttonModifierMasks[] = { - 0, - SELECT_BUTTON_MASK, - DMANIP_BUTTON_MASK, - BMENU_BUTTON_MASK, - Button4Mask, - Button5Mask -}; - -/* - * FUNCTION PARSER TABLE (function names must be in alphabetic order) - */ - -typedef struct { - char * funcName; - Context greyedContext; - unsigned int resource; - long mgtMask; - WmFunction wmFunction; - Boolean (*parseProc)(); -} FunctionTableEntry; - - -/* - * NOTE: New functions MUST be added in ALPHABETICAL order. A binary search - * is used to find the correct function name. - */ - -FunctionTableEntry functionTable[] = { -#ifdef WSM -#ifdef PANELIST - {"f.action", 0, - CRS_ANY, - 0, - F_Action, - ParseWmFuncActionArg}, -#else /* PANELIST */ - {"f.action", 0, - CRS_ANY, - 0, - F_Action, - ParseWmFuncStrArg}, -#endif /* PANELIST */ -#endif /* WSM */ - {"f.beep", 0, - CRS_ANY, - 0, - F_Beep, - ParseWmFuncNoArg}, -#if ((!defined(WSM)) || defined(MWM_QATS_PROTOCOL)) - {"f.cci", 0, - CRS_ANY, - 0, - F_Nop, - ParseWmFuncCCIArgs}, -#endif /* !defined(WSM) || defined(MWM_QATS_PROTOCOL) */ - {"f.circle_down", F_SUBCONTEXT_IB_IICON|F_SUBCONTEXT_IB_WICON, - CRS_ANY, - 0, - F_Circle_Down, - ParseWmFuncGrpArg}, - {"f.circle_up", F_SUBCONTEXT_IB_IICON|F_SUBCONTEXT_IB_WICON, - CRS_ANY, - 0, - F_Circle_Up, - ParseWmFuncGrpArg}, -#ifdef WSM - {"f.create_workspace", 0, - CRS_ANY, - 0, - F_CreateWorkspace, - ParseWmFuncNoArg}, - {"f.delete_workspace", 0, - CRS_ANY, - 0, - F_DeleteWorkspace, - ParseWmFuncNoArg}, -#endif /* WSM */ - {"f.exec", 0, - CRS_ANY, - 0, - F_Exec, - ParseWmFuncStrArg}, - {"f.focus_color", F_SUBCONTEXT_IB_IICON|F_SUBCONTEXT_IB_WICON, - CRS_ANY, - 0, - F_Focus_Color, - ParseWmFuncNoArg}, - {"f.focus_key", F_SUBCONTEXT_IB_IICON|F_SUBCONTEXT_IB_WICON, - CRS_ANY, - 0, - F_Focus_Key, - ParseWmFuncNoArg}, -#ifdef WSM - {"f.goto_workspace", 0, - CRS_ANY, - 0, - F_Goto_Workspace, - ParseWmFuncStrArg}, -#endif /* WSM */ -#ifdef WSM - {"f.help", 0, - CRS_ANY, - 0, - F_Help, - ParseWmFuncStrArg}, /* [helpvolume && helptopic] */ - {"f.help_mode", 0, - CRS_ANY, - 0, - F_Help_Mode, - ParseWmFuncNoArg}, /* for now */ -#endif /* WSM */ -#if ((!defined(WSM)) || defined(MWM_QATS_PROTOCOL)) - {"f.invoke_command", - 0, CRS_ANY, - 0, - F_InvokeCommand, - ParseWmFuncStrArg}, -#endif /* !defined(WSM) || defined(MWM_QATS_PROTOCOL) */ - {"f.kill", F_CONTEXT_ROOT, - CRS_ANY, - MWM_FUNC_CLOSE, - F_Kill, - ParseWmFuncNoArg}, - {"f.lower", F_SUBCONTEXT_IB_IICON|F_SUBCONTEXT_IB_WICON, - CRS_ANY, - 0, - F_Lower, - ParseWmFuncMaybeStrArg}, -#ifdef WSM - {"f.marquee_selection", - F_CONTEXT_WINDOW|F_CONTEXT_ICON|F_SUBCONTEXT_IB_IICON, - CRS_ANY, - 0, - F_Marquee_Selection, - ParseWmFuncNoArg}, -#endif /* WSM */ - {"f.maximize", F_CONTEXT_ROOT|F_CONTEXT_MAXIMIZE| - F_SUBCONTEXT_IB_WICON, - CRS_ANY, - MWM_FUNC_MAXIMIZE, - F_Maximize, - ParseWmFuncNoArg}, - {"f.menu", 0, - CRS_ANY, - 0, - F_Menu, - ParseWmFuncStrArg}, - {"f.minimize", F_CONTEXT_ICON|F_CONTEXT_ROOT|F_SUBCONTEXT_IB_IICON, - CRS_ANY, - MWM_FUNC_MINIMIZE, - F_Minimize, - ParseWmFuncNoArg}, - {"f.move", F_CONTEXT_ROOT, - CRS_ANY, - MWM_FUNC_MOVE, - F_Move, - ParseWmFuncNoArg}, - {"f.next_cmap", 0, - CRS_ANY, - 0, - F_Next_Cmap, - ParseWmFuncNoArg}, - {"f.next_key", 0, - CRS_ANY, - 0, - F_Next_Key, - ParseWmFuncGrpArg}, -#ifdef WSM - {"f.next_workspace", 0, - CRS_ANY, - 0, - F_Next_Workspace, - ParseWmFuncNoArg}, -#endif /* WSM */ - {"f.nop", F_CONTEXT_ROOT|F_CONTEXT_ICON|F_CONTEXT_WINDOW| - F_SUBCONTEXT_IB_WICON | F_SUBCONTEXT_IB_IICON, - CRS_ANY, - 0, - F_Nop, - ParseWmFuncNoArg}, - {"f.normalize", F_CONTEXT_ROOT|F_CONTEXT_NORMAL|F_SUBCONTEXT_IB_WICON, - CRS_ANY, - 0, - F_Normalize, - ParseWmFuncNoArg}, -#ifdef PANELIST - {"f.normalize_and_raise", - F_CONTEXT_ROOT|F_CONTEXT_NORMAL, - CRS_ANY, - 0, - F_Normalize_And_Raise, - ParseWmFuncMaybeStrArg}, -#else /* PANELIST */ - {"f.normalize_and_raise", - F_CONTEXT_ROOT|F_CONTEXT_NORMAL, - CRS_ANY, - 0, - F_Normalize_And_Raise, - ParseWmFuncNoArg}, -#endif /* PANELIST */ -#ifdef WSM - {"f.occupy_all", F_CONTEXT_ICONBOX|F_CONTEXT_ROOT, - CRS_ANY, - DtWM_FUNC_OCCUPY_WS, - F_AddToAllWorkspaces, - ParseWmFuncNoArg}, -#endif /* WSM */ - {"f.pack_icons", 0, - CRS_ANY, - 0, - F_Pack_Icons, - ParseWmFuncNoArg}, - {"f.pass_keys", 0, - CRS_ANY, - 0, - F_Pass_Key, - ParseWmFuncNoArg}, -#if ((!defined(WSM)) || defined(MWM_QATS_PROTOCOL)) - {"f.post_rmenu", 0, - CRS_KEY, - 0, - F_Post_RMenu, - ParseWmFuncNoArg}, -#endif /* !defined(WSM) || defined(MWM_QATS_PROTOCOL) */ - {"f.post_wmenu", 0, - CRS_BUTTON|CRS_KEY, - 0, - F_Post_SMenu, - ParseWmFuncNoArg}, - {"f.prev_cmap", 0, - CRS_ANY, - 0, - F_Prev_Cmap, - ParseWmFuncNoArg}, - {"f.prev_key", 0, - CRS_ANY, - 0, - F_Prev_Key, - ParseWmFuncGrpArg}, -#ifdef WSM - {"f.prev_workspace", 0, - CRS_ANY, - 0, - F_Prev_Workspace, - ParseWmFuncNoArg}, -#endif /* WSM */ - {"f.quit_mwm", F_CONTEXT_ICON|F_CONTEXT_WINDOW, - CRS_ANY, - 0, - F_Quit_Mwm, - ParseWmFuncNoArg}, - {"f.raise", F_SUBCONTEXT_IB_IICON|F_SUBCONTEXT_IB_WICON, - CRS_ANY, - 0, - F_Raise, - ParseWmFuncMaybeStrArg}, - {"f.raise_lower", F_CONTEXT_ROOT | - F_SUBCONTEXT_IB_IICON|F_SUBCONTEXT_IB_WICON, - CRS_ANY, - 0, - F_Raise_Lower, - ParseWmFuncNoArg}, - {"f.refresh", 0, - CRS_ANY, - 0, - F_Refresh, - ParseWmFuncNoArg}, - {"f.refresh_win", F_CONTEXT_ICON|F_CONTEXT_ROOT, - CRS_ANY, - 0, - F_Refresh_Win, - ParseWmFuncNoArg}, -#ifdef WSM - {"f.remove", F_CONTEXT_ROOT, - CRS_ANY, - DtWM_FUNC_OCCUPY_WS, - F_Remove, - ParseWmFuncNoArg}, -#endif /* WSM */ - {"f.resize", F_CONTEXT_ICON|F_CONTEXT_ROOT| - F_SUBCONTEXT_IB_IICON|F_SUBCONTEXT_IB_WICON, - CRS_ANY, - MWM_FUNC_RESIZE, - F_Resize, - ParseWmFuncNoArg}, -#ifdef WSM - {"f.restart", F_CONTEXT_ICON|F_CONTEXT_WINDOW, - CRS_ANY, - 0, - F_Restart, - ParseWmFuncStrArg}, -#else /* WSM */ - {"f.restart", F_CONTEXT_ICON|F_CONTEXT_WINDOW, - CRS_ANY, - 0, - F_Restart, - ParseWmFuncNoArg}, -#endif /* WSM */ - {"f.restore", F_CONTEXT_ROOT|F_CONTEXT_NORMAL|F_SUBCONTEXT_IB_WICON, - CRS_ANY, - 0, - F_Restore, - ParseWmFuncNoArg}, - {"f.restore_and_raise", - F_CONTEXT_ROOT|F_CONTEXT_NORMAL, - CRS_ANY, - 0, - F_Restore_And_Raise, - ParseWmFuncNoArg}, - {"f.screen", 0, - CRS_ANY, - 0, - F_Screen, - ParseWmFuncStrArg}, - {"f.send_msg", F_CONTEXT_ROOT, - CRS_ANY, - 0, - F_Send_Msg, - ParseWmFuncNbrArg}, - {"f.separator", 0, - CRS_MENU, - 0, - F_Separator, - ParseWmFuncNoArg}, - {"f.set_behavior", 0, - CRS_ANY, - 0, - F_Set_Behavior, - ParseWmFuncNoArg}, -#ifdef WSM - {"f.set_context", 0, - CRS_ANY, - 0, - F_Set_Context, - ParseWmFuncNbrArg}, -#endif /* WSM */ - {"f.title", 0, - CRS_MENU, - 0, - F_Title, - ParseWmFuncNoArg}, -#if defined(PANELIST) - {"f.toggle_frontpanel", 0, - CRS_ANY, - 0, - F_Toggle_Front_Panel, - ParseWmFuncNoArg}, - - {"f.version", 0, - CRS_ANY, - 0, - F_Version, - ParseWmFuncNoArg}, -#endif /* PANELIST */ -#ifdef WSM - -#ifdef OLD - {"f.workspace_presence",F_CONTEXT_ICON|F_CONTEXT_ROOT|F_CONTEXT_ICONBOX| - F_SUBCONTEXT_IB_IICON|F_SUBCONTEXT_IB_WICON, -#endif /* OLD */ - {"f.workspace_presence", F_CONTEXT_ROOT|F_CONTEXT_ICONBOX| - F_SUBCONTEXT_IB_WICON, - CRS_ANY, - DtWM_FUNC_OCCUPY_WS, - F_Workspace_Presence, - ParseWmFuncNoArg}, -#endif /* WSM */ -#if defined(DEBUG) && defined(WSM) - {"f.zz_debug", 0, - CRS_ANY, - 0, - F_ZZ_Debug, - ParseWmFuncStrArg}, -#endif /* DEBUG */ -}; - -/* - * NOTE: New functions MUST be added in ALPHABETICAL order. A binary search - * is used to find the correct function name. - */ - -#define WMFUNCTIONTABLESIZE (sizeof(functionTable)/sizeof(functionTable[0])) - -/* - * Be sure to update these define, whenever adding/deleting a function. - */ -#ifdef WSM -# if ((!defined(WSM)) || defined(MWM_QATS_PROTOCOL)) -# define F_CCI_INDEX 2 -# endif /* !defined(WSM) || defined(MWM_QATS_PROTOCOL) */ -int F_ACTION_INDEX; -int F_EXEC_INDEX; -int F_NOP_INDEX; -#else /* WSM */ -# if ((!defined(WSM)) || defined(MWM_QATS_PROTOCOL)) -# define F_CCI_INDEX 1 -# define F_EXEC_INDEX 4 -# define F_NOP_INDEX 16 -# else -# define F_EXEC_INDEX 3 -# define F_NOP_INDEX 14 -# endif /* !defined(WSM) || defined(MWM_QATS_PROTOCOL) */ -#endif /* WSM */ -#ifdef WSM - -/******************************<->************************************* - * - * void GetFunctionTableValues (int *execIndex, int *nopIndex, - * int *actionIndex) - * - * Description: - * ----------- - * This routine dynamically computes the size of the functionTable[], - * and the indices for key functions, such as f.exec, f.action, and - * f.nop - * - * Inputs: - * ------ - * We are setting the values of F_EXEC_INDEX, F_ACTION_INDEX, - * and F_NOP_INDEX on a global level. The addresses - * for same are passed in. - * - * Outputs: - * ------- - * - * Comments: - * -------- - * This routine calls smaller routines for efficiency sake. - * - ******************************<->***********************************/ -void -GetFunctionTableValues (int *execIndex, int *nopIndex, - int *actionIndex) -{ - - GetExecIndex (WMFUNCTIONTABLESIZE, execIndex); - - GetActionIndex (WMFUNCTIONTABLESIZE, actionIndex); - - GetNopIndex (WMFUNCTIONTABLESIZE, nopIndex); - -} /* END OF FUNCTION GetFunctionTableValues */ - - - -/******************************<->************************************* - * - - * - * Description: - * ----------- - - * - * Inputs: - * ------ - - * Outputs: - * ------- - * - * Comments: - * -------- - * - ******************************<->***********************************/ - -void -GetExecIndex (int tableSize, int *execIndex) -{ - int i; - - for (i = 0; i < (tableSize); i++) - { - if (!(strcmp ("f.exec", functionTable[i].funcName))) - { - *execIndex = i; - return; - } - else - { - *execIndex = 0; - } - } -} /* END OF FUNCTION GetExecIndex */ - - -/******************************<->************************************* - * - - * - * Description: - * ----------- - - * - * Inputs: - * ------ - - * Outputs: - * ------- - * - * Comments: - * -------- - * - ******************************<->***********************************/ - - -void -GetActionIndex (int tableSize, int *actionIndex) -{ - int i; - - for (i = 0; i < (tableSize); i++) - { - if (!(strcmp ("f.action", functionTable[i].funcName))) - { - *actionIndex = i; - return; - } - else - { - *actionIndex = 0; - } - } -} /* END OF FUNCTION GetActionIndex */ - - - -/******************************<->************************************* - * - - * - * Description: - * ----------- - - * - * Inputs: - * ------ - - * Outputs: - * ------- - * - * Comments: - * -------- - * - ******************************<->***********************************/ -void -GetNopIndex (int tableSize, int *nopIndex) -{ - int i; - - for (i = 0; i < (tableSize); i++) - { - if (!(strcmp ("f.nop", functionTable[i].funcName))) - { - *nopIndex = i; - return; - } - else - { - *nopIndex = 0; - } - } -} /* END OF FUNCTION GetNopIndex */ - - - - -/*************************************<->************************************* - * - * void - * WmDtGetHelpArgs () - * - * - * Description: - * ----------- - * Get Help Args - - * - * Inputs: - * ------ - - * - * Outputs: - * ------- - * - * - * Comments: - * -------- - * None. - * - *************************************<->***********************************/ -void -WmDtGetHelpArgs(char *args, - unsigned char* volume, - unsigned char* topic, - int *argsCount) -{ - unsigned char *string; - unsigned char *lineP; - - cfileP = NULL; - linec = 0; - parseP = (unsigned char*) args; - - if(GetNextLine () != NULL) - { - *argsCount = 0; - lineP = line; - if ((string = GetSmartSMString (&lineP)) != NULL) - { - *argsCount = *argsCount + 1; - strcpy ((char*)topic, (char*)string); - } - - if ((string = GetSmartSMString (&lineP)) != NULL) - { - *argsCount = *argsCount + 1; - strcpy ((char*)volume, (char *)string); - } - } - -} /* END OF FUNCTION WmDtGetHelpArgs */ - - - - - -/******************************<->************************************* - * - * void - * ParseDtSessionHints (pSD, property) - * - * - * Description: - * ----------- - * This function parses a DtSessionHints string and returns a list of - * DtSessionItems array. The string should have the syntax: - * - - * - * - * Inputs: - * ------ - * line = (global) line buffer - * pSD->rootWindow = default root window of display - * - * - * Outputs: - * ------- - * Return = - * - * - * Comments: - * -------- - * None. - * - *************************************<->***********************************/ - -void -ParseDtSessionHints (WmScreenData *pSD, unsigned char *property) -{ - - cfileP = NULL; - linec = 0; - parseP = property; - - ParseSessionItems (pSD); - -} /* END OF FUNCTION ParseDtSessionHints */ - - -/*************************************<->************************************* - * - * FindDtSessionMatch(commandArgc, commandArgv, pCD, pSD, pWorkSpaceList, - * clientMachine) - * - * Description: - * ----------- - * Try to find a match for this client in the session hints. - * Set up client-session data. - * - * - * Inputs: - * ------ - * commandArgc - argument count - * commandArgv - WM_COMMAND argument vector - * pCD - pointer to client data - * pSD - pointer to screen data - * pWorkspaceList - pointer to a list of workspaces (to be returned) - * clientMachine - string for -host option in session hints - * - * Outputs: - * ------- - * *pCD - client data (may be modified) - * FindDtSessionMatch - returns True if a match for this client - * was found in the session hints. - * *pWorkspaceList - list of workspaces this client should be put - * into. (needs to be freed) - * - * - * Comments: - * -------- - * Various pieces of client state (in pCD) are reset when a match - * is found. - * - * The caller must free *pWorkspaceList when done. - * - *************************************<->***********************************/ -Boolean FindDtSessionMatch(int commandArgc, char **commandArgv, - ClientData *pCD, WmScreenData *pSD, - char **pWorkSpaceList, char *clientMachine) - -{ - int count, item; - int relCount; - int argNum; - SessionGeom *sessionGeom; - - - for (count = 0; count < pSD->totalSessionItems; count++) - { - if (!pSD->pDtSessionItems[count].processed && - pSD->pDtSessionItems[count].commandArgc == commandArgc) - { - if ((clientMachine) && - (pSD->pDtSessionItems[count].clientMachine) && - (strcmp(clientMachine, - pSD->pDtSessionItems[count].clientMachine))) - { - /* - * This item has clientMachine string but the - * clientMachine does not match. - */ - continue; - } - for (argNum = 0; argNum < commandArgc ; argNum++) - { - if(strcmp(commandArgv[argNum], - pSD->pDtSessionItems[count].commandArgv[argNum])) - - { - /* - * One mismatch and we quit looking at this item. - * Decrement argNum so a mismatch on the last item - * will not look like a match below when comparing - * argNum == commandArgc - */ - argNum--; - break; - } - } - if (argNum == commandArgc) - { - /* - * Made it through all strings so this is a match - */ - - pSD->pDtSessionItems[count].processed = True; - pSD->remainingSessionItems --; - pCD->clientFlags |= SM_LAUNCHED; - - /* - * Free strings malloc'd for commandArgv for this item - */ - - for (relCount = 0; relCount < commandArgc; relCount++) - { - XtFree(pSD->pDtSessionItems[count].commandArgv[relCount]); - } - XtFree((char *)pSD->pDtSessionItems[count].commandArgv); - - if(pSD->pDtSessionItems[count].clientState) - { - pCD->clientState = - pSD->pDtSessionItems[count].clientState; - pCD->clientFlags |= SM_CLIENT_STATE; - } - - if(pSD->pDtSessionItems[count].sessionGeom) - { - sessionGeom = pSD->pDtSessionItems[count].sessionGeom; - if (sessionGeom->flags & XValue) - { - pCD->clientX = sessionGeom->clientX; - pCD->clientFlags |= SM_X; - } - if (sessionGeom->flags & YValue) - { - pCD->clientY = sessionGeom->clientY; - pCD->clientFlags |= SM_Y; - } - if (sessionGeom->flags & WidthValue) - { - pCD->clientWidth = sessionGeom->clientWidth; - pCD->clientFlags |= SM_WIDTH; - } - if (sessionGeom->flags & HeightValue) - { - pCD->clientHeight = sessionGeom->clientHeight; - pCD->clientFlags |= SM_HEIGHT; - } - - /* - * Free SessionGeom malloc'd space for this item - */ - - XtFree((char *)pSD->pDtSessionItems[count].sessionGeom); - } - - if(pSD->pDtSessionItems[count].clientMachine) - { - /* - * Free clientMachine malloc'd space for this item - */ - - XtFree((char *) - pSD->pDtSessionItems[count].clientMachine); - pSD->pDtSessionItems[count].clientMachine = NULL; - } - - - if(pSD->pDtSessionItems[count].workspaces) - { - /* - * The caller is responsible for freeing this - * data. - */ - *pWorkSpaceList = pSD->pDtSessionItems[count].workspaces; - } - - - if(pSD->remainingSessionItems == 0) - { - /* - * Free the whole pSD->pDtSessionHints structure - */ - XtFree((char *)pSD->pDtSessionItems); - } - - return (True); - } - - } /* not processed and argc's are the same */ - - } /* for */ - - return (False); - -} /* END OF FUNCTION FindDtSessionMatch */ - - - - - -/*************************************<->************************************* - * - * void - * ParseSessionItems (pSD) - * - * - * Description: - * ----------- - * Parse session items - - * - * Inputs: - * ------ - * pSD = pointer to screen data - * cfileP = (global) file pointer to NULL - * line = (global) line buffer - * linec = (global) line count - * parseP = (global) parse string pointer if cfileP == NULL - * pSD->rootWindow = default root window of display - - * - * Outputs: - * ------- - * linec = (global) line count incremented - * parseP = (global) parse string pointer if cfileP == NULL - * - * - * Comments: - * -------- - * None. - * - *************************************<->***********************************/ - -void -ParseSessionItems (WmScreenData *pSD) -{ - unsigned char *string; - unsigned char *lineP; - int count; - - - /* - * Parse property string - */ - - - - if(GetNextLine () != NULL) - { - pSD->totalSessionItems = atoi((char *)line); - pSD->remainingSessionItems = pSD->totalSessionItems; - } - - - if((pSD->totalSessionItems < 1) || - !GetSessionHintsInfo(pSD, pSD->totalSessionItems)) - { - /* - * No items or couldn't allocate space - */ - return; - } - - count = 0; - - while ((count < pSD->totalSessionItems) && (GetNextLine () != NULL)) - { - - lineP = line; - while ((string = GetSmartSMString (&lineP)) != NULL) - { - if (!strcmp((char *)string, "-geometry")) - { - /* - * Parse geometry if it is present - */ - string = GetSmartSMString(&lineP); - ParseSessionGeometry (pSD, count, string); - } - - else if (!strcmp((char *)string, "-state")) - { - /* - * Parse the state if it is present - */ - string = GetSmartSMString(&lineP); - ParseSessionClientState (pSD, count, string); - } - - else if (!strcmp((char *)string, "-workspaces")) - { - /* - * Parse the workspaces string if it is present - */ - string = GetSmartSMString(&lineP); - ParseSessionWorkspaces (pSD, count, string); - } - - else if (!strcmp((char *)string, "-cmd")) - { - /* - * Parse the command string if it is present - */ - string = GetSmartSMString(&lineP); - ParseSessionCommand (pSD, count, &string); - } - - else if (!strcmp((char *)string, "-host")) - { - /* - * Parse the host string if it is present - */ - string = GetSmartSMString(&lineP); - ParseSessionHost (pSD, count, string); - } - - } /* while GetSmartSMString */ - - count++; - - } /* while GetNextLine */ - - - -} /* END OF FUNCTION ParseSessionItems */ - - - -/*************************************<->************************************* - * - * ParseSessionClientState (pSD, count, string); - * - * Description: - * ----------- - * Inputs: - * ------ - * Outputs: - * ------- - * Comments: - * -------- - * - *************************************<->***********************************/ -void ParseSessionClientState (WmScreenData *pSD, int count, - unsigned char *string) - - - -{ - - if(!strcmp((char *)string, "NormalState")) - { - pSD->pDtSessionItems[count].clientState = NORMAL_STATE; - } - else if(!strcmp((char *)string, "IconicState")) - { - pSD->pDtSessionItems[count].clientState = MINIMIZED_STATE; - } - - -} /* END OF FUNCTION ParseSessionClientState */ - - -/*************************************<->************************************* - * - * ParseSessionGeometry (pSD, count, string) - * - * Description: - * ----------- - * Inputs: - * ------ - * Outputs: - * ------- - * Comments: - * -------- - * - *************************************<->***********************************/ -void ParseSessionGeometry (WmScreenData *pSD, int count, - unsigned char *string) - -{ - SessionGeom *pTmpSessionGeom; - int mask /* = 0 */; - int X, Y, width, height; - X = Y = width = height = 0; - - /* - * XParseGeometry - */ - - mask = XParseGeometry((char *)string, &X, &Y, (unsigned int *)&width, - (unsigned int *)&height); - if (mask) - { - /* - * Allocate space for the geometry structure - */ - - if ((pTmpSessionGeom = - (SessionGeom *)XtMalloc (sizeof (SessionGeom))) == NULL) - { - Warning (((char *)GETMESSAGE(60, 1, "Insufficient memory for session geometry item"))); - return; - - } - - pTmpSessionGeom->flags = mask; - pTmpSessionGeom->clientX = X; - pTmpSessionGeom->clientY = Y; - pTmpSessionGeom->clientWidth = width; - pTmpSessionGeom->clientHeight = height; - - pSD->pDtSessionItems[count].sessionGeom = pTmpSessionGeom; - } - -} /* END OF FUNCTION ParseSessionGeometry */ - - -/*************************************<->************************************* - * - * void - * ParseSessionWorkspaces (pSD, count, string) - * - * Description: - * ----------- - * Inputs: - * ------ - * Outputs: - * ------- - * Comments: - * -------- - * - *************************************<->***********************************/ -void ParseSessionWorkspaces (WmScreenData *pSD, int count, - unsigned char *string) - -{ - - /* - * Allocate space for the workspaces string - */ - - if ((pSD->pDtSessionItems[count].workspaces = - (String)XtMalloc ((unsigned int) (strlen((char *)string) + 1))) == NULL) - { - Warning (((char *)GETMESSAGE(60, 2, "Insufficient memory for workspaces list in sesssion item"))); - return; - - } - - strcpy(pSD->pDtSessionItems[count].workspaces, (char *)string); - -} /* END OF FUNCTION ParseSessionWorkspaces */ - - - -/*************************************<->************************************* - * - * void - * ParseSessionCommand (pSD, count, string) - * - * Description: - * ----------- - * Inputs: - * ------ - * Outputs: - * ------- - * Comments: - * -------- - * - *************************************<->***********************************/ -void ParseSessionCommand (WmScreenData *pSD, int count, - unsigned char **commandString) -{ -#define ARG_AMT 100 - int xindex; - unsigned char **argv; - int argc = 0; - int iSizeArgv; - - unsigned char *string; - - argv = (unsigned char **) XtMalloc (ARG_AMT * sizeof(char *)); - iSizeArgv = ARG_AMT; - - while ((string = GetSmartSMString (commandString)) != NULL) - { - /* - * Get pointers to strings in command line and count them - */ - argv[argc] = string; - argc ++; - - if (argc >= iSizeArgv) - { - iSizeArgv += ARG_AMT; - argv = (unsigned char **) - XtRealloc ((char *)argv, (iSizeArgv * sizeof(char *))); - } - } - if ((pSD->pDtSessionItems[count].commandArgv = - (char **)XtMalloc ((argc) * sizeof(char * ))) == NULL) - { - /* - * Allocate space for saved argv - */ - - Warning (((char *)GETMESSAGE(60, 3, "Insufficient memory for commandArgv array"))); - } - else - { - pSD->pDtSessionItems[count].commandArgc = argc; - for (xindex = 0; xindex < argc ; xindex++) - { - if ((pSD->pDtSessionItems[count].commandArgv[xindex] = - (String) XtMalloc - ((unsigned int) (strlen((char *)argv[xindex]) + 1))) == NULL) - { - /* - * Allocate space for the next command segment. - */ - Warning (((char *)GETMESSAGE(60, 4, "Insufficient memory for commandArgv item"))); - } - else - { - strcpy(pSD->pDtSessionItems[count].commandArgv[xindex], - (char *)argv[xindex]); - } - } - } - - XtFree ((char *) argv); - -} /* END OF FUNCTION ParseSessionCommand */ - - - -/*************************************<->************************************* - * - * void - * ParseSessionHost (pSD, count, string) - * - * Description: - * ----------- - * Inputs: - * ------ - * Outputs: - * ------- - * Comments: - * -------- - * - *************************************<->***********************************/ -void ParseSessionHost (WmScreenData *pSD, int count, - unsigned char *string) - -{ - - /* - * Allocate space for the workspaces string - */ - - if ((pSD->pDtSessionItems[count].clientMachine = - (String)XtMalloc ((unsigned int) (strlen((char *)string) + 1))) == - NULL) - { - Warning (((char *)GETMESSAGE(60, 38, - "Insufficient memory for host name in sesssion item"))); - return; - } - - strcpy(pSD->pDtSessionItems[count].clientMachine, (char *)string); - -} /* END OF FUNCTION ParseSessionHost */ - - - -/*************************************<->************************************* - * - * GetSessionHintsInfo (pSD, numItems) - * - * Description: - * ----------- - * Inputs: - * ------ - * Outputs: - * ------- - * Comments: - * -------- - * - *************************************<->***********************************/ -Boolean GetSessionHintsInfo (WmScreenData *pSD, long numItems) - -{ - - if ((pSD->pDtSessionItems = - (DtSessionItem *)XtMalloc (numItems * sizeof (DtSessionItem))) - == NULL) - { - Warning (((char *)GETMESSAGE(60, 5, "Insufficient memory for Dt Session Hints"))); - return(False); - } - - memset ((char *)pSD->pDtSessionItems, NULL, - numItems * sizeof (DtSessionItem)); - - return(True); - - -} /* END OF FUNCTION GetSessionHintsInfo */ - - - - -/*************************************<->************************************* - * - * PeekAhead (currentChar, currentLev) - * - * - * Description: - * ----------- - * Returns a new level value if this is a new nesting level of quoted string - * Otherwise it returns a zero - * - * - * Inputs: - * ------ - * currentChar = current position in the string - * currentLev = current level of nesting - * - * - * Outputs: - * ------- - * Returns either a new level of nesting or zero if the character is copied in - * - * - * Comments: - * -------- - * - *************************************<->***********************************/ -unsigned int PeekAhead(unsigned char *currentChar, - unsigned int currentLev) - - -{ - Boolean done = False; - unsigned int tmpLev = 1; -#ifndef NO_MULTIBYTE - unsigned int chlen; - - while (((chlen = mblen ((char *)currentChar, MB_CUR_MAX)) > 0) && - (chlen == 1) && ((*currentChar == '"') || (*currentChar == '\\')) - && (done == False)) - { - currentChar++; - - if(((chlen = mblen ((char *)currentChar, MB_CUR_MAX)) > 0) && (chlen == 1) && - ((*currentChar == '"') || (*currentChar == '\\'))) - { - tmpLev++; - if(*currentChar == '"') - { - done = True; - } - else - { - currentChar++; - } - } - } -#else - while((*currentChar != NULL) && (done == False) && - ((*currentChar == '"') || (*currentChar == '\\'))) - { - currentChar++; - if((*currentChar != NULL) && - ((*currentChar == '"') || (*currentChar == '\\'))) - { - tmpLev++; - if(*currentChar == '"') - { - done = True; - } - else - { - currentChar++; - } - } - } -#endif /*NO_MULTIBYTE*/ - - /* - * Figure out if this is truly a new level of nesting - else ignore it - * This section probably could do some error checking and return -1 - * If so, change type of routine from unsigned int to int - */ - if(done == True) - { - return(tmpLev); - } - else - { - return(0); - } -} /* END OF FUNCTION PeekAhead */ - - -#endif /* WSM */ - - - -#ifdef MOTIF_ONE_DOT_ONE -/*************************************<->************************************* - * - * GetHomeDirName (fileName) - * - * Description: - * ----------- - * This function finds the "HOME" directory - * - * - * Inputs: - * ------ - * fileName - * - * Outputs: - * ------- - * fileName - * - * Comments: - * -------- - * - *************************************<->***********************************/ -void GetHomeDirName(String fileName) -{ - int uid; - struct passwd *pw; - char *ptr = NULL; - - if((ptr = getenv("HOME")) == NULL) - { - if((ptr = getenv("USER")) != NULL) - { - pw = getpwnam(ptr); - } - else - { - uid = getuid(); - pw = getpwuid(uid); - } - - if (pw) - { - ptr = pw->pw_dir; - } - else - { - ptr = ""; - } - } - strcpy(fileName, ptr); -} -#endif - - -/*************************************<->************************************* - * - * SyncModifierStrings (fileName) - * - * Description: - * ----------- - * This function updates modifierStrings table so that Mwm uses the correct - * modifier to keysym mapping. Specifically, fix up the Alt and Meta bindings. - * - * Inputs: - * ------ - * fileName - * - * Outputs: - * ------- - * fileName - * - * Comments: - * -------- - * - *************************************<->***********************************/ -void SyncModifierStrings(void) -{ - XModifierKeymap *map; - int i, j, k = 0; - - map = XGetModifierMapping (DISPLAY); - - for (i = 0; i < 8; i++) - { - for (j = 0; j < map->max_keypermod; j++) - { - if (map->modifiermap[k]) - { - KeySym ks = XKeycodeToKeysym(DISPLAY, map->modifiermap[k], 0); - char *nm = XKeysymToString(ks); - - /* Compare, ignoring the trailing '_L' or '_R' in keysym */ - if (nm && !strncmp("Alt", nm, 3)) - { - modifierStrings[ALT_INDEX].mask = (1<************************************* - * - * ProcessWmFile () - * - * - * Description: - * ----------- - * This function reads the mwm resource description file and processes the - * resources that are described. - * - * - * Inputs: - * ------ - * wmGD.bitmapDirectory = bitmapDirectory resource value - * pSD->buttonBindings = buttonBindings resource value - * wmGD.configFile = configuration file resource value - * pSD->keyBindings = keyBindings resource value - * wmGD.rootWindow = default root window of display - * HOME = environment variable for home directory - * functionTable = window manager function parse table - * - * - * Outputs: - * ------- - * wmGD.buttonSpecs = list of button binding specifications - * wmGD.keySpecs = list of key binding specification - * wmGD.menuSpecs = list of menu specifications - * *wmGD.acceleratorMenuSpecs = initialized array of (MenuSpec *) - * wmGD.acceleratorMenuCount = 0 - * - * - * Comments: - * -------- - * If there are more than MAXLINE characters on a line the excess characters - * are truncated. - * - *************************************<->***********************************/ -#define MENU_SPEC "menu" -#define BUTTON_SPEC "buttons" -#define KEY_SPEC "keys" -#ifdef PANELIST -#define FRONT_PANEL_SPEC DTWM_FP_PANEL_OLD -#define DROP_EFFECTS_SPEC DTWM_FP_DROP_EFFECTS -#define PANEL_SPEC DTWM_FP_PANEL -#define BOX_SPEC DTWM_FP_BOX -#define CONTROL_SPEC DTWM_FP_CONTROL -#define INCLUDE_SPEC DTWM_FP_INCLUDE -#define ANIMATION_SPEC DTWM_FP_ANIMATION -#define SWITCH_SPEC DTWM_FP_SWITCH - -void ProcessWmFile (WmScreenData *pSD, Boolean bNested) - -#else /* PANELIST */ -void ProcessWmFile (WmScreenData *pSD) -#endif /* PANELIST */ -{ - unsigned char *lineP; - unsigned char *string; - unsigned int n; - MenuSpec *menuSpec; -#ifdef PANELIST - static Boolean conversionInProgress = False; - Arg args[10]; - int argnum; - - if (!bNested) - { -#endif /* PANELIST */ - - /* - * Initialize global data values that are set based on data in - * the mwm resource description file. - */ - - pSD->buttonSpecs = NULL; - pSD->keySpecs = NULL; - pSD->menuSpecs = NULL; - -#ifdef WSM - /**** hhhhhhhhhhhh ******/ - GetFunctionTableValues (&F_EXEC_INDEX, &F_NOP_INDEX, &F_ACTION_INDEX); -#endif /* WSM */ - /* - * Find and parse the default system menu string, if it exists. - */ - - cfileP = NULL; - linec = 0; - if (((parseP = (unsigned char *) builtinSystemMenu) != NULL) && - (GetNextLine () != NULL)) - { - lineP = line; - ParseMenuSet (pSD, lineP); - } - - linec = 0; - if (((parseP = (unsigned char *) builtinRootMenu) != NULL) && - (GetNextLine () != NULL)) - { - lineP = line; - ParseMenuSet (pSD, lineP); - } -#ifdef PANELIST - if (wmGD.useFrontPanel && !wmGD.dtSD && - (XDefaultScreen (wmGD.display) == pSD->screen)) - { - wmGD.dtSD = pSD; /* only one per display */ - } -#endif /* PANELIST */ - - /* - * Find and associate a stream with the window manager resource - * description file. - */ - - if ((cfileP = FopenConfigFile ()) == NULL) - { - if (!wmGD.useStandardBehavior) - Warning (((char *)GETMESSAGE(60, 6, "Cannot open configuration file"))); - return; - } - -#ifdef PANELIST - } /* end if (!bNested) */ -#endif /* PANELIST */ - /* - * Parse the information in the configuration file. - * If there are more than MAXLINE characters on a line the excess are - * truncated. - */ - - linec = 0; - while ((GetNextLine () != NULL)) /* not EOF nor read error */ - { - lineP = line; - if ((*line == '!') || (string = GetString (&lineP)) == NULL) - /* empty or comment line */ - { - continue; - } - - ToLower (string); - if (!strcmp ((char *)string, MENU_SPEC)) - { - ParseMenuSet (pSD, lineP); - } - else if (!strcmp ((char *) string, BUTTON_SPEC)) - { - ParseButtonSet (pSD, lineP); - } - else if (!strcmp ((char *) string, KEY_SPEC)) - { - ParseKeySet (pSD, lineP); - } -#ifdef PANELIST - else if (!strcmp ((char *)string, INCLUDE_SPEC)) - { - ParseIncludeSet (pSD, lineP); - } -#endif /* PANELIST */ - } - - fclose (cfileP); - - /* - * Create and initialize the pSD->acceleratorMenuSpecs array. - * This assumes we create pointers to MenuSpecs within ProcessWmFile(). - * Set pSD->acceleratorMenuCount to 0. - */ - - /* count the number of menu specifications */ - n = 0; - menuSpec = pSD->menuSpecs; - while (menuSpec) - { - n++; - menuSpec = menuSpec->nextMenuSpec; - } - - /* allocate the array and initialize to zeros */ - pSD->acceleratorMenuSpecs = NULL; - if (n) - { - pSD->acceleratorMenuSpecs = - (MenuSpec **) XtCalloc (n, sizeof (MenuSpec *)); - if (pSD->acceleratorMenuSpecs == NULL) - { - Warning (((char *)GETMESSAGE(60, 7, "Insufficient memory for menu accelerators"))); - } - } - pSD->acceleratorMenuCount = 0; -} /* END OF FUNCTION ProcessWmFile */ - -/**** This function stolen from Xt/Intrinsic.c ****/ -/* The implementation of this routine is operating system dependent */ - -static char *ExtractLocaleName(lang) - String lang; -{ - -#ifdef hpux /* hpux-specific parsing of the locale string */ -#define MAXLOCALE 64 /* buffer size of locale name */ - - char *start; - char *end; - int len; - static char buf[MAXLOCALE]; - - /* If lang has a substring ":;", extract - * from the first such occurrence as the locale name. - */ - - start = lang; - if (start = strchr (lang, ':')) { - start++; - if (end = strchr (start, ';')) { - len = end - start; - strncpy(buf, start, len); - *(buf + len) = '\0'; - lang = buf; - } - } -#endif /* hpux */ - - return lang; -} - -#ifdef WSM -#define RC_CONFIG_SUBDIR "/config/" -#define RC_DEFAULT_CONFIG_SUBDIR "/config/C" -#endif /* WSM */ - -/*************************************<->************************************* - * - * FopenConfigFile () - * - * - * Description: - * ----------- - * This function searches for, opens, and associates a stream with the mwm - * resource description file, - * - * - * Inputs: - * ------ - * wmGD.configFile = configuration file resource value. - * HOME = environment variable for home directory - * - * - * Outputs: - * ------- - * Return = If successful, a pointer to the FILE structure associated with - * the configuration file. Otherwise, NULL. - * - * - * Comments: - * -------- - * None. - * - *************************************<->***********************************/ -FILE *FopenConfigFile (void) -{ - - char *LANG, *LANGp; - FILE *fileP; - -#ifndef MOTIF_ONE_DOT_ONE - char *homeDir = XmeGetHomeDirName(); -#endif -#ifdef PANELIST - Boolean stackPushed; -#endif /* PANELIST */ - - /* - * Get the LANG environment variable - * make copy since another call to getenv will blast the value. - */ - LANGp = setlocale(LC_CTYPE, NULL); - - /* - * setlocale not guaranteed to return $LANG -- extract - * something usable. - */ - LANGp = ExtractLocaleName (LANGp); - - if ((LANGp == NULL) || (strlen(LANGp) == 0)) - { - LANG = NULL; - } - else - { - if ((LANG = (char *) XtMalloc(strlen(LANGp) +1)) == NULL) - { - PWarning (((char *)GETMESSAGE(60, 41, "Insufficient memory to get LANG environment variable."))); - return(NULL); - } - - strcpy(LANG, LANGp); - } - - - /* - * To get a name for the file first look at the value of the configFile - * resource. Interpret "~/.." as relative to the user's home directory. - * Use the LANG variable if set and .mwmrc is in $HOME/$LANG/.mwmrc - */ - -#ifdef PANELIST - if (pConfigStackTop && pConfigStackTop->tempName) - { - fileP = fopen (pConfigStackTop->tempName, "r"); - return (fileP); - } - stackPushed = (pConfigStackTop && (pConfigStackTop != pConfigStack)); - fileP = NULL; - cfileName[0] = '\0'; -#endif /* PANELIST */ - if ((wmGD.configFile != NULL) && (wmGD.configFile[0] != '\0')) - /* pointer to nonNULL string */ - { - if ((wmGD.configFile[0] == '~') && (wmGD.configFile[1] == '/')) - /* handle "~/..." */ - { -#ifdef MOTIF_ONE_DOT_ONE - GetHomeDirName(cfileName); -#else - strcpy (cfileName, homeDir); -#endif - if (LANG != NULL) - { - strncat(cfileName, "/", MAXWMPATH-strlen(cfileName)); - strncat(cfileName, LANG, MAXWMPATH-strlen(cfileName)); - } - strncat(cfileName, &(wmGD.configFile[1]), MAXWMPATH-strlen(cfileName)); - if ((fileP = fopen (cfileName, "r")) != NULL) - { - if (LANG != NULL) { - XtFree(LANG); - LANG = NULL; - } -#ifndef PANELIST - return (fileP); -#endif /* PANELIST */ - } - else - { - /* - * Just try $HOME/.mwmrc - */ -#ifdef MOTIF_ONE_DOT_ONE - GetHomeDirName(cfileName); -#else - strcpy (cfileName, homeDir); -#endif - strncat(cfileName, &(wmGD.configFile[1]), - MAXWMPATH-strlen(cfileName)); - if ((fileP = fopen (cfileName, "r")) != NULL) - { - if (LANG != NULL) { - XtFree(LANG); - LANG = NULL; - } -#ifndef PANELIST - return (fileP); -#endif /* PANELIST */ - } - } - - - } - else - /* relative to current directory or absolute */ - { -#ifdef PANELIST - char *pch; - - pch = (char *) GetNetworkFileName (wmGD.configFile); - - if ((fileP = fopen (pch, "r")) != NULL) - { - strncpy (cfileName, pch, MAXWMPATH); - } - XtFree (pch); - - if ((fileP == NULL) && !stackPushed) - { -#endif /* PANELIST */ - if ((fileP = fopen (wmGD.configFile, "r")) != NULL) - { - if (LANG != NULL) { - XtFree(LANG); - LANG = NULL; - } - return(fileP); - } -#ifdef PANELIST - } - else if ((fileP == NULL) && stackPushed) - { - strcpy (cfileName, wmGD.configFile); - } -#endif /* PANELIST */ - } - } -#ifdef PANELIST - if ((fileP == NULL) && !stackPushed) - { -#endif /* PANELIST */ - - /* - * The configFile resource didn't do it for us. - * First try HOME_MWMRC, then try SYS_MWMRC . - */ - -#define HOME_MWMRC "/.mwmrc" -#define SLASH_MWMRC "/system.mwmrc" - -#ifdef MOTIF_ONE_DOT_ONE - GetHomeDirName(cfileName); -#else - strcpy (cfileName, homeDir); -#endif - -#ifdef WSM - if (MwmBehavior) - { - /* - * - * Looking for $HOME/$LANG/.mwmrc - * --or--if $LANG is NULL - * Looking for $HOME/.mwmrc - * - */ - if (LANG != NULL) - { - strncat(cfileName, "/", MAXWMPATH-strlen(cfileName)); - strncat(cfileName, LANG, MAXWMPATH-strlen(cfileName)); - } - strncat(cfileName, HOME_MWMRC, MAXWMPATH - strlen(cfileName)); - } - else - { - /* - * - * Looking for $HOME/.dt/$LANG/dtwmrc - * - * --or--if $LANG is NULL-- - * - * Looking for $HOME/.dt/dtwmrc - * - */ - strncat(cfileName, "/.dt/", MAXWMPATH-strlen(cfileName)); - - if (LANG != NULL) - { - strncat(cfileName, LANG, MAXWMPATH-strlen(cfileName)); - } - strncat(cfileName, LANG_DT_WMRC, MAXWMPATH - strlen(cfileName)); - } -#else /* WSM */ - if (LANG != NULL) - { - strncat(cfileName, "/", MAXWMPATH-strlen(cfileName)); - strncat(cfileName, LANG, MAXWMPATH-strlen(cfileName)); - } - strncat(cfileName, HOME_MWMRC, MAXWMPATH - strlen(cfileName)); -#endif /* WSM */ - if ((fileP = fopen (cfileName, "r")) != NULL) - { - if (LANG != NULL) { - XtFree(LANG); - LANG = NULL; - } -#ifndef PANELIST - return (fileP); -#endif /* PANELIST */ - } - else - { - /* - * Just try $HOME/.mwmrc - */ -#ifdef MOTIF_ONE_DOT_ONE - GetHomeDirName(cfileName); -#else - strcpy (cfileName, homeDir); -#endif -#ifdef WSM - if (MwmBehavior) - { - /* - * Just try $HOME/.mwmrc - */ - strncat(cfileName, HOME_MWMRC, MAXWMPATH - strlen(cfileName)); - } - else - { - /* - * Just try $HOME/.dt/dtwmrc - */ - strncat(cfileName, HOME_DT_WMRC, MAXWMPATH - strlen(cfileName)); - } -#else /* WSM */ - strncat(cfileName, HOME_MWMRC, MAXWMPATH - strlen(cfileName)); -#endif /* WSM */ - if ((fileP = fopen (cfileName, "r")) != NULL) - { - if (LANG != NULL) { - XtFree(LANG); - LANG = NULL; - } -#ifndef PANELIST - return (fileP); -#endif /* PANELIST */ - } - } -#ifdef PANELIST - } - -#define DTLIBDIR CDE_INSTALLATION_TOP -#define DTADMINDIR CDE_CONFIGURATION_TOP -#define SLASH_DT_WMRC "/sys.dtwmrc" - - if ((fileP == NULL) && !stackPushed) - { - /* - * No home-based config file. Try the admin directory. - */ - strcpy(cfileName, DTADMINDIR); - strncat(cfileName, RC_CONFIG_SUBDIR, MAXWMPATH-strlen(cfileName)); - strncat(cfileName, LANG, MAXWMPATH-strlen(cfileName)); - strncat(cfileName, SLASH_DT_WMRC, MAXWMPATH - strlen(cfileName)); - - if (((fileP = fopen (cfileName, "r")) == NULL) && LANG && *LANG) - { - /* Try it with no LANG */ - strcpy(cfileName, DTADMINDIR); - strncat(cfileName, RC_CONFIG_SUBDIR, MAXWMPATH-strlen(cfileName)); - strncat(cfileName, SLASH_DT_WMRC, MAXWMPATH - strlen(cfileName)); - } - - if ((fileP = fopen (cfileName, "r")) != NULL) - { - XtFree(LANG); - LANG = NULL; - } - } - - if ((fileP == NULL) && !stackPushed) - { -#endif /* PANELIST */ - -#ifndef MWMRCDIR -#define MWMRCDIR "/usr/lib/X11" -#endif - if (LANG != NULL) - { -#ifdef WSM - if (MwmBehavior) - { - strcpy(cfileName, MWMRCDIR); - strncat(cfileName, "/", MAXWMPATH-strlen(cfileName)); - strncat(cfileName, LANG, MAXWMPATH-strlen(cfileName)); - strncat(cfileName, SLASH_MWMRC, MAXWMPATH - strlen(cfileName)); - } - else - { - strcpy(cfileName, DTLIBDIR); - strncat(cfileName, RC_CONFIG_SUBDIR, MAXWMPATH-strlen(cfileName)); - strncat(cfileName, LANG, MAXWMPATH-strlen(cfileName)); - strncat(cfileName, SLASH_DT_WMRC, MAXWMPATH - strlen(cfileName)); - } -#else /* WSM */ - /* - * Try /$LANG/system.mwmrc within the install tree - */ - strcpy(cfileName, MWMRCDIR); - strncat(cfileName, "/", MAXWMPATH-strlen(cfileName)); - strncat(cfileName, LANG, MAXWMPATH-strlen(cfileName)); - strncat(cfileName, SLASH_MWMRC, MAXWMPATH - strlen(cfileName)); -#endif /* WSM */ - if ((fileP = fopen (cfileName, "r")) != NULL) - { - XtFree(LANG); - LANG = NULL; -#ifndef PANELIST - return (fileP); -#endif /* PANELIST */ - } - } - -#ifdef PANELIST - if ((fileP == NULL) && !stackPushed) - { -#endif /* PANELIST */ -#ifdef WSM - if (MwmBehavior) - { - strcpy(cfileName, MWMRCDIR); - strncat(cfileName, SLASH_MWMRC, MAXWMPATH - strlen(cfileName)); -#ifdef PANELIST - fileP = fopen (cfileName, "r"); -#else /* PANELIST */ - return (fopen (cfileName, "r")); -#endif /* PANELIST */ - } - else - { - strcpy(cfileName, DTLIBDIR); - strncat(cfileName, RC_DEFAULT_CONFIG_SUBDIR, - MAXWMPATH - strlen(cfileName)); - strncat(cfileName, SLASH_DT_WMRC, MAXWMPATH - strlen(cfileName)); -#ifdef PANELIST - fileP = fopen (cfileName, "r"); -#else /* PANELIST */ - return (fopen (cfileName, "r")); -#endif /* PANELIST */ - } -#else /* WSM */ - /* - * Try /system.mwmrc within the install tree - */ - strcpy(cfileName, MWMRCDIR); - strncat(cfileName, SLASH_MWMRC, MAXWMPATH - strlen(cfileName)); - - if (LANG != NULL) - { - XtFree(LANG); - LANG = NULL; - } -#ifdef PANELIST - strcpy(cfileName, cfileName); - fileP = fopen (cfileName, "r"); -#else /* PANELIST */ - return (fopen (cfileName, "r")); -#endif /* PANELIST */ -#endif /* WSM */ -#ifdef PANELIST - } - } - - if (!fileP) - { - char *pch; - - /* - * handle ":" form of file name - */ - pch = (char *) GetNetworkFileName (cfileName); - if ((fileP = fopen (cfileName, "r")) != NULL) - { - strncpy (cfileName, pch, MAXWMPATH); - XtFree (pch); - } - - /* - * Either not ":" form or there was a - * problem up above. This is the last attempt to - * open something. - */ - if (!fileP) - { - fileP = fopen (cfileName, "r"); - } - } - - if (!pConfigStack) - { - ConfigStackInit (cfileName); - } - - if (wmGD.cppCommand && *wmGD.cppCommand) - { - /* - * Run the file through the C-preprocessor - */ - PreprocessConfigFile (); - if (pConfigStackTop->cppName) - { - /* open the result */ - fileP = fopen (pConfigStackTop->cppName, "r"); - } - } - - if (LANG != NULL) - { - XtFree(LANG); - LANG = NULL; - } - return (fileP); -#endif /* PANELIST */ - -} /* END OF FUNCTION FopenConfigFile */ - - -/*************************************<->************************************* - * - * SaveMenuAccelerators (pSD, newMenuSpec) - * - * - * Description: - * ----------- - * This function saves the MenuSpec pointer in pSD->acceleratorMenuSpecs. - * - * - * Inputs: - * ------ - * newMenuSpec = pointer to MenuSpec to be saved. - * pSD->acceleratorMenuSpecs = - * pSD->acceleratorMenuCount = - * - * - * Outputs: - * ------- - * pSD->acceleratorMenuSpecs = possibly updated - * pSD->acceleratorMenuCount = possibly updated - * - * - * Comments: - * -------- - * We assume only MenuSpecs created within ProcessWmFile() are to be saved. - * Otherwise, we may cause override the limits of pSD->acceleratorMenuSpecs. - * - *************************************<->***********************************/ - -void SaveMenuAccelerators (WmScreenData *pSD, MenuSpec *newMenuSpec) -{ - MenuSpec **pMenuSpec; - - pMenuSpec = pSD->acceleratorMenuSpecs; - - if (pMenuSpec == NULL) - return; - - while ((*pMenuSpec != NULL) && (*pMenuSpec != newMenuSpec)) - { - pMenuSpec++; - } - - if (*pMenuSpec == NULL) - { - *pMenuSpec = newMenuSpec; - pSD->acceleratorMenuCount++; - } - -} /* END OF FUNCTION SaveMenuAccelerators */ - - -/*************************************<->************************************* - * - * ParseMenuSet (pSD, lineP) - * - * - * Description: - * ----------- - * Menu pane specification found. Parse the following syntax: - * - * v - * Menu menu_pane_name - * { - * label [mnemonic] [accelerator] function - * label [mnemonic] [accelerator] function - * ... - * label [mnemonic] [accelerator] function - * } - * - * - * Inputs: - * ------ - * cfileP = (global) file pointer to fopened configuration file or NULL - * lineP = pointer to menu name in line buffer - * line = (global) line buffer - * linec = (global) line count - * parseP = (global) parse string pointer if cfileP == NULL - * pSD->rootWindow = default root window of display - * wmGD.bitmapDirectory = bitmapDirectory resource value - * HOME = environment variable for home directory - * - * - * Outputs: - * ------- - * linec = (global) line count incremented - * parseP = (global) parse string pointer if cfileP == NULL - * pSD->menuSpecs = list of menu specifications - * - * - * Comments: - * -------- - * Skips unnamed menu specifications. - * This means custom menu specifications can be distinguished by NULL name. - * - *************************************<->***********************************/ - -static void ParseMenuSet (WmScreenData *pSD, unsigned char *lineP) -{ - unsigned char *string; - MenuSpec *menuSpec; - - /* - * If menu name is NULL then skip this pane specification. - */ - - if ((string = GetString (&lineP)) == NULL) - { - return; - } - - /* - * Allocate space for the menu specification structure. - */ - - if ((menuSpec = (MenuSpec *)XtMalloc (sizeof (MenuSpec))) == NULL) - { - PWarning (((char *)GETMESSAGE(60, 9, "Insufficient memory for menu"))); - return; - } - menuSpec->currentContext = 0; - menuSpec->menuWidget = NULL; - menuSpec->whichButton = SELECT_BUTTON; /* Button1 selection default */ - menuSpec->menuItems = NULL; - menuSpec->accelContext = 0; - menuSpec->accelKeySpecs = NULL; -#if ((!defined(WSM)) || defined(MWM_QATS_PROTOCOL)) - menuSpec->exclusions = NULL; - menuSpec->clientLocal = FALSE; - menuSpec->commandID = 0; -#endif /* !defined(WSM) || defined(MWM_QATS_PROTOCOL) */ - menuSpec->nextMenuSpec = NULL; - - /* - * Allocate and fill space for the menu name. - */ - - if ((menuSpec->name = - (String)XtMalloc ((unsigned int) (strlen ((char *)string) + 1))) - == NULL) - { - PWarning (((char *)GETMESSAGE(60, 10, "Insufficient memory for menu"))); - XtFree ((char *)menuSpec); - return; - } - strcpy (menuSpec->name, (char *)string); - - /* - * Add the empty structure to the head of the menu specification list. - */ - - menuSpec->nextMenuSpec = pSD->menuSpecs; - pSD->menuSpecs = menuSpec; - - /* - * Require leading '{' on the next line. - */ - - while ((GetNextLine () != NULL)) /* not EOF nor read error */ - { - lineP = line; - ScanWhitespace(&lineP); - - if ((lineP == NULL) || (*line == '!') || (*lineP == '\0') || (*lineP == '#')) - /* ignore empty or comment line */ - { - continue; - } - - if (*lineP == '{') - /* found '{' */ - { - break; - } - - /* not a '{' */ - PWarning (((char *)GETMESSAGE(60, 11, "Expected '{' after menu name"))); - return; - } - - /* - * Found leading "{" or EOF. - * Parse menu item specifications until "}" or EOF found. - */ - - menuSpec->menuItems = PARSE_MENU_ITEMS (pSD, menuSpec); - -} /* END OF FUNCTION ParseMenuSet */ - - -/*************************************<->************************************* - * - * MenuItem * - * ParseMwmMenuStr (pSD, menuStr) - * - * - * Description: - * ----------- - * This function parses a WMW_MENU string and returns a list of - * MenuItems structures. The string should have the syntax: - * - * label [mnemonic] [accelerator] function - * label [mnemonic] [accelerator] function - * ... - * label [mnemonic] [accelerator] function - * - * - * Inputs: - * ------ - * line = (global) line buffer - * pSD->rootWindow = default root window of display - * wmGD.bitmapDirectory = bitmapDirectory resource value - * HOME = environment variable for home directory - * functionTable = window manager function parse table - * - * - * Outputs: - * ------- - * Return = list of MenuItem structures or NULL - * - * - * Comments: - * -------- - * None. - * - *************************************<->***********************************/ - -MenuItem *ParseMwmMenuStr (WmScreenData *pSD, unsigned char *menuStr) -{ - - cfileP = NULL; - linec = 0; - parseP = menuStr; - - return (PARSE_MENU_ITEMS (pSD, NULL)); - -} /* END OF FUNCTION ParseMwmMenuStr */ - - -/*************************************<->************************************* - * - * static MenuItem * - * ParseMenuItems (pSD, menuSpec) - * - * - * Description: - * ----------- - * Parse menu item specifications: - * - * label [mnemonic] [accelerator] function - * label [mnemonic] [accelerator] function - * ... - * label [mnemonic] [accelerator] function - * [}] - * - * - * Inputs: - * ------ - * pSD = pointer to screen data - * cfileP = (global) file pointer to fopened configuration file or NULL - * line = (global) line buffer - * linec = (global) line count - * parseP = (global) parse string pointer if cfileP == NULL - * pSD->rootWindow = default root window of display - * wmGD.bitmapDirectory = bitmapDirectory resource value - * HOME = environment variable for home directory - * - * - * Outputs: - * ------- - * linec = (global) line count incremented - * parseP = (global) parse string pointer if cfileP == NULL - * Return = list of MenuItem structures or NULL - * - * - * Comments: - * -------- - * None. - * - *************************************<->***********************************/ - -static MenuItem *ParseMenuItems (WmScreenData *pSD -#if ((!defined(WSM)) || defined(MWM_QATS_PROTOCOL)) - , MenuSpec *menuSpec -#endif /* !defined(WSM) || defined(MWM_QATS_PROTOCOL) */ - ) -{ - unsigned char *string; - unsigned char *lineP; - MenuItem *firstMenuItem; - MenuItem *lastMenuItem; - MenuItem *menuItem; - register int ix; -#if ((!defined(WSM)) || defined(MWM_QATS_PROTOCOL)) - Boolean use_separators = False; -#endif /* !defined(WSM) || defined(MWM_QATS_PROTOCOL) */ - - /* - * Parse "label [mnemonic] [accelerator] function" or - * "[.]*" - * lines until "}" or EOF found. - */ - - firstMenuItem = lastMenuItem = NULL; - while ((GetNextLine () != NULL)) - { - lineP = line; - if ((*line == '!') || (*line == '#') || (string = GetString (&lineP)) == NULL) - /* ignore empty or comment lines */ - { - continue; - } - if (*string == '}') /* finished with menu set. */ - { - break; - } - - /* - * Allocate space for the menu item structure. - */ - - if ((menuItem = (MenuItem *)XtMalloc (sizeof (MenuItem))) == NULL) - { - PWarning (((char *)GETMESSAGE(60, 12, "Insufficient memory for menu item"))); - continue; - } - menuItem->nextMenuItem = NULL; - menuItem->wmFunction = (WmFunction)NULL; - menuItem->wmFuncArgs = NULL; -#if ((!defined(WSM)) || defined(MWM_QATS_PROTOCOL)) - menuItem->clientCommandName = NULL; - menuItem->clientCommandID = 0; -#endif /* !defined(WSM) || defined(MWM_QATS_PROTOCOL) */ - -#if ((!defined(WSM)) || defined(MWM_QATS_PROTOCOL)) - /* - * Is this a simple menu item label or is it a - * client command specification. - */ - - if (IsClientCommand((String) string)) - { - if (!ParseClientCommand(&lineP, menuSpec, menuItem, string, - &use_separators)) - { - XtFree ((char *)menuItem); - continue; - } - - for (ix = 0; ix < WMFUNCTIONTABLESIZE - 1; ++ix) - if (functionTable[ix].wmFunction == F_InvokeCommand) - break; - - if (ix == WMFUNCTIONTABLESIZE - 1) - { - ix = F_NOP_INDEX; - menuItem->wmFunction = F_Nop; - } - else menuItem->wmFunction = F_InvokeCommand; - } - else /* It must be a menu item label */ -#endif /* !defined(WSM) || defined(MWM_QATS_PROTOCOL) */ - { - /* - * Parse the menu item label. - */ - if (!ParseWmLabel (pSD, menuItem, string)) - { - XtFree ((char *)menuItem); - continue; - } - } - - /* - * Parse any menu function mnemonic. - */ - - ParseWmMnemonic (&lineP, menuItem); - - /* - * Parse any menu function accelerator. - */ - - if (!ParseWmAccelerator (&lineP, menuItem)) - { - FreeMenuItem (menuItem); - continue; - } - /* - * Parse the menu function name if this is not a client - * command. If it is a client command, then the wmFunction - * field should already be set, as well as the ix variable, - * but we do want to search for a menu item name that occupies - * the same place as the function does for normal menu items. - */ -#if ((!defined(WSM)) || defined(MWM_QATS_PROTOCOL)) - if (menuItem->wmFunction != NULL) - ParseMenuItemName(&lineP, menuItem); - else -#endif /* !defined(WSM) || defined(MWM_QATS_PROTOCOL) */ - ix = ParseWmFunction (&lineP, CRS_MENU, &menuItem->wmFunction); - - /* - * Determine context sensitivity and applicability mask. - */ - - menuItem->greyedContext = functionTable[ix].greyedContext; - menuItem->mgtMask = functionTable[ix].mgtMask; -#ifdef PANELIST - if ((menuItem->wmFunction == F_Toggle_Front_Panel) && - ((wmGD.useFrontPanel == False) || - (wmGD.dtSD != pSD))) - { - /* - * disallow this function if there's no front - * panel on this screen. - */ - menuItem->greyedContext |= (F_CONTEXT_ALL | - F_SUBCONTEXT_IB_WICON | - F_SUBCONTEXT_IB_IICON); - } -#endif /* PANELIST */ - - /* - * Apply the function argument parser. - */ - if (!(*(functionTable [ix].parseProc)) - (&lineP, menuItem->wmFunction, &menuItem->wmFuncArgs)) - { - FreeMenuItem (menuItem); - continue; /* skip this menu item */ - } - -#if ((!defined(WSM)) || defined(MWM_QATS_PROTOCOL)) - /* - * If we're working on the f.cci function, this will fix-up - * the menuItem entries so that it appears that we read-in - * an old-style client-command entry. Eventually, the cci - * handling should be changed to make use of the wmFuncArgs. - * Note that if DEFAULT_NAME was specified as the label, it - * is first set to NULL. - * FixMenuItem needs menuSpec since this is when the EXCLUDE - * items are stored. - */ - if (ix == F_CCI_INDEX) - { - CCIEntryModifier mod = ((CCIFuncArg *)menuItem->wmFuncArgs)->mod; - - /* first fix the label if needed. */ - if (!strcmp(menuItem->label, CCI_USE_DEFAULT_NAME_TAG)) - { - XtFree(menuItem->label); - menuItem->label = NULL; - } - - FixMenuItem(menuSpec, menuItem); - - if (mod == DELIMIT || mod == DELIMIT_CASCADE || mod == DELIMIT_INLINE) - use_separators = True; - } - - /* - * If this menu item is supposed to be wrapped in separators, - * then create a separator template before the menu item - */ - if (use_separators) - { - MenuItem *separator = MakeSeparatorTemplate(TOP_SEPARATOR); - if (lastMenuItem != NULL) lastMenuItem->nextMenuItem = separator; - else firstMenuItem = separator; - lastMenuItem = separator; - } -#endif /* !defined(WSM) || defined(MWM_QATS_PROTOCOL) */ - - /* - * Add this item to the menu specification. - */ - - if (lastMenuItem != NULL) /* not first */ - { - lastMenuItem->nextMenuItem = menuItem; - } - else - { - firstMenuItem = menuItem; - } - lastMenuItem = menuItem; - -#if ((!defined(WSM)) || defined(MWM_QATS_PROTOCOL)) - /* If this menu item is supposed to be wrapped in separators - * then create a separator template after the menu item - */ - if (use_separators) - { - MenuItem *separator = MakeSeparatorTemplate(BOTTOM_SEPARATOR); - if (lastMenuItem != NULL) lastMenuItem->nextMenuItem = separator; - else firstMenuItem = separator; - lastMenuItem = separator; - } - - use_separators = FALSE; -#endif /* !defined(WSM) || defined(MWM_QATS_PROTOCOL) */ - } - - return (firstMenuItem); - -} /* END OF FUNCTION ParseMenuItems */ - - - -#if ((!defined(WSM)) || defined(MWM_QATS_PROTOCOL)) -/*************************************<->************************************* - * - * StoreExclusion (menuSpec, string) - * - * - * Description: - * ----------- - * Store the exclusion string in the menuspec. The list of exclusion - * strings are used to determine whether an insertion should be disallowed. - * - * - * Inputs: - * ------ - * menuSpec = the menu specification structure - * string = exclusion client command string - * - * - * Outputs: - * ------- - * Return = nothing - * - * Comments: - * -------- - * - *************************************<->***********************************/ - -static void StoreExclusion (MenuSpec *menuSpec, String string) -{ - MenuExclusion *exclusion; - - exclusion = (MenuExclusion *)XtMalloc(sizeof(MenuExclusion)); - exclusion->command_string = XtNewString(string); - - /* We don't care what order the exclusions are in so stick it - at the head of the list because it is easier. */ - exclusion->nextExclusion = menuSpec->exclusions; - menuSpec->exclusions = exclusion; -} - - -/*************************************<->************************************* - * - * IsClientCommand (string) - * - * - * Description: - * ----------- - * Determine whether the string is a client command by the prefix - * characters. - * - * - * Inputs: - * ------ - * string = possible client command string - * - * - * Outputs: - * ------- - * Return = (Boolean) TRUE iff the string is a client command. - * Otherwise, FALSE is returned. - * - * - * Comments: - * -------- - * This function simply checks what the first two or three characters of - * the string are. If they match the beginning of a client command - * specification, then TRUE is returned. This function does no go on to - * parse the rest of the specification. The legal client command beginning - * characters are: - * - * characters: meaning: - * ----------------------------------------------- - * < simple client command beginning - * ->< forced cascade menu - * =< client command with separators - * ~< exclusion operator - * - * Assumes: - * -------- - * There is no leading whitespace on the string - * - *************************************<->***********************************/ - -Boolean IsClientCommand (String string) -{ - if (( -#ifndef NO_MULTIBYTE - mblen ((char *)string, MB_CUR_MAX) == 1 && -#endif - *string == '<') || - (strncmp(string, "-><", 3) == 0) || - (strncmp(string, "=<", 2) == 0) || - (strncmp(string, "=><", 3) == 0) || - (strncmp(string, "~<", 2) == 0)) - return(TRUE); - - return(FALSE); -} - - -/*************************************<->************************************* - * - * ParseClientCommand (linePP, menuSpec, menuitem, string, use_separators) - * - * - * Description: - * ----------- - * Parse the string and whatever is left of the line to verify whether - * correct syntax was used for a client command. Store the client command - * string in the menuitem, unless it is an exclusion. If it is an - * exclusion, then store the exclusion string in the menuSpec and return - * FALSE to indicate that the menuitem is no longer needed. - * - * - * Inputs: - * ------ - * linePP = pointer to current line buffer pointer. - * menuItem = pointer to MenuItem structure - * string = first token of client command - * - * - * Outputs: - * ------- - * Return = (Boolean) TRUE iff the line is a valid client command - * that can used to match insertions. - * Otherwise, FALSE is returned meaning that the client - * command had incorrect syntax or it was an exclusion, in - * which case any useful information was stored in the - * menuSpec. - * - * - * Comments: - * -------- - * This function parses the entire line to determine if correct - * syntax was used for the client command. We assume at this point - * that the line is a client command. We are just syntax checking. - * If the syntax is correct, the client command is stored in the - * menuitem structure, in the "label" field. - * - * Valid syntax for a client command (single quoted characters are - * literals): - * - * modifier = { '->' | '=' | '~' } - * reference = '<' { name | '*' } '>' - * command = [ modifier ] reference [ { modifier | '.' } reference ]* - * name = alpha-numeric string, white space allowed - * - * Assumes: - * -------- - * There is no leading whitespace on the string argument - * - *************************************<->***********************************/ - -enum { PRS_NO_STATE, PRS_BEGIN, PRS_MODIFIER, PRS_REFERENCE, - PRS_SEPARATOR, PRS_END, PRS_ERROR, PRS_MAX_STATES }; - -/* This table lists for each parse state, the legal states that can - be moved to. Each list must end with a PRS_NO_STATE value to - terminate the list. */ -static int cmd_parse_table[PRS_END][PRS_END] = -{ - /* PRS_NO_STATE */ { PRS_NO_STATE }, - /* PRS_BEGIN */ { PRS_MODIFIER, PRS_REFERENCE, PRS_NO_STATE }, - /* PRS_MODIFIER */ { PRS_REFERENCE, PRS_NO_STATE }, - /* PRS_REFERENCE */ { PRS_SEPARATOR, PRS_END, PRS_NO_STATE }, - /* PRS_SEPARATOR */ { PRS_REFERENCE, PRS_NO_STATE }, -}; - -static Boolean ParseClientCommand (unsigned char **linePP, MenuSpec *menuSpec, - MenuItem *menuItem, unsigned char *string, - Boolean *use_separators) -{ - int token, linelen, i; - int state = PRS_BEGIN; - String stream, unchanged_stream, exclusion_text; - Boolean return_val = FALSE; - Boolean exclusion = FALSE; /* this will be set to TRUE if the client - command was parsed to be an exclusion - command. */ - - /* Construct one input stream out of the string and the linePP that - we were given. */ - linelen = strlen((char *)string) + strlen((char *)*linePP) + 1; - if ((unchanged_stream = stream = (String) - XtMalloc((unsigned int)(sizeof(unsigned char) * linelen))) == NULL) - { - PWarning (((char *)GETMESSAGE(60, 42, - "Insufficient memory for menu item label"))); - return (FALSE); - } - strcpy(stream, (char *) string); - strcat(stream, " "); - strcat(stream, (char *) *linePP); - - for (;;) - { - token = PRS_NO_STATE; - while (token == PRS_NO_STATE) - { -#ifndef NO_MULTIBYTE - if (mblen ((char *)stream, MB_CUR_MAX) > 1) { - token = PRS_ERROR; - continue; - } -#endif - - switch (*stream) - { - case '\0': - case '\n': - /* We've reached the end of the stream. Return the - PRS_END token. */ - token = PRS_END; - break; - case '-': - /* This should be a cascade-force modifier */ - ++stream; -#ifndef NO_MULTIBYTE - if (mblen ((char *)stream, MB_CUR_MAX) > 1) { - token = PRS_ERROR; - continue; - } -#endif - if (*stream == '>') - { - ++stream; token = PRS_MODIFIER; - } - else token = PRS_ERROR; - break; - case '=': - /* This is either a separators modifier or - a combination separators and cascade-force - modifier */ - ++stream; -#ifndef NO_MULTIBYTE - if (mblen ((char *)stream, MB_CUR_MAX) > 1) { - token = PRS_ERROR; - continue; - } -#endif - if (*stream == '>') ++stream; - token = PRS_MODIFIER; - *use_separators = TRUE; - break; - case '~': - /* This is a exclude-command modifier */ - ++stream; token = PRS_MODIFIER; - exclusion = TRUE; - /* Setup a pointer to the text following the ~ so - we can do matching later for exclusions. */ - exclusion_text = stream; - break; - case '<': - /* Skip the open bracket */ - ++stream; - - /* This should be the beginning of a reference. First - skip any leading whitespace. */ -#ifndef NO_MULTIBYTE - if (mblen ((char *)stream, MB_CUR_MAX) > 1) { - token = PRS_ERROR; - continue; - } -#endif - while ( -#ifndef NO_MULTIBYTE - mblen ((char *)stream, MB_CUR_MAX) == 1 && -#endif - (*stream == ' ' || *stream == '\t')) - ++stream; - -#ifndef NO_MULTIBYTE - if (mblen ((char *)stream, MB_CUR_MAX) > 1) { - token = PRS_ERROR; - continue; - } -#endif - /* Now check for a reference name wild card or a - full reference name */ - if (*stream == '*') - ++stream; - else - { - while ( -#ifndef NO_MULTIBYTE - mblen ((char *)stream, MB_CUR_MAX) == 1 && -#endif - (isalnum(*stream) || *stream == ' ' || - *stream == '\t' || *stream == '_' )) - ++stream; - } - -#ifndef NO_MULTIBYTE - if (mblen ((char *)stream, MB_CUR_MAX) > 1) { - token = PRS_ERROR; - continue; - } -#endif - - /* Now skip past any trailing white space */ - while ( -#ifndef NO_MULTIBYTE - mblen ((char *)stream, MB_CUR_MAX) == 1 && -#endif - (*stream == ' ' || *stream == '\t')) - ++stream; - -#ifndef NO_MULTIBYTE - if (mblen ((char *)stream, MB_CUR_MAX) > 1) { - token = PRS_ERROR; - continue; - } -#endif - /* At this point, we should be looking at the close - of the reference */ - if (*stream == '>') - { - token = PRS_REFERENCE; - ++stream; - } - else token = PRS_ERROR; - break; - case '.': - /* This is a reference separator */ - ++stream; token = PRS_SEPARATOR; - break; - case ' ': - case '\t': - /* The only place white space is allowed as at the - beginning of the line, after all the client command - text and within the delimiters of a REFERENCE. We - are guaranteed not to have whitespace at the - beginning of the line by the time this function is - called. Also, the REFERENCE parsing above handles - all white space internal to the client command. Therefore, - since we are seeing white space, we must be at the - end of the client command. */ - token = PRS_END; - break; - default: - token = PRS_ERROR; - - } /* end switch (*stream) */ - } /* end while (token == PRS_NO_STATE) */ - - /* If we got an error then just return an error */ - if (token == PRS_ERROR) - { - return_val = FALSE; break; - } - - /* Check whether the token we got is a valid transition */ - for (i = 0; cmd_parse_table[state][i] != PRS_NO_STATE; ++i) - { - if (token == cmd_parse_table[state][i]) - { - /* It is a valid transition, so break out of the loop */ - break; - } - } - - /* If i is not indexing the NO_STATE value in the parse_table, - then the parse succeeded. Check if the new state is PRS_END. - If so then we are done. If the state isn't the same as the - current token, then we hit a parse error. */ - if (cmd_parse_table[state][i] != PRS_NO_STATE) - { - if (token == PRS_END) - { - return_val = TRUE; - break; - } - } - else - { - /* parse error */ - return_val = FALSE; - break; - } - - /* The transition was valid so make the transition by - setting the state to be the current token. */ - state = token; - - } /* end for (;;) */ - - /* If the return_val is TRUE, then the parse succeeded and we - want to save the string we parsed into the label field of - the menu item. */ - if (return_val == TRUE) - { - /* NULL terminate the string */ - *stream = '\0'; - - /* Check whether this client command was an exclusion. If not, - then store the client command string in the menu item. */ - if (exclusion == TRUE) - { - /* Since the command was an exclusion, store the command - string in the menuSpec and change the return value to - FALSE. */ - StoreExclusion(menuSpec, exclusion_text); - return_val = FALSE; - } - else - { - menuItem->label = XtNewString(unchanged_stream); - menuItem->labelType = XmSTRING; - } - } - - /* Free the string we allocated and return. */ - XtFree((char *)unchanged_stream); - - return(return_val); -} -#endif /* !defined(WSM) || defined(MWM_QATS_PROTOCOL) */ - - -/*************************************<->************************************* - * - * ParseWmLabel (pSD, menuItem, string) - * - * - * Description: - * ----------- - * Parse a menu label string. - * - * - * Inputs: - * ------ - * pSD = pointer to screen data - * menuItem = pointer to MenuItem structure - * string = label string - * - * - * Outputs: - * ------- - * menuItem->label - * menuItem->labelType - * menuItem->labelBitmapCache - * Return = boolean, FALSE iff insufficient memory - * - * - * Comments: - * -------- - * We have two label types: XmSTRING and XmPIXMAP - * We allocate and fill the label field with string and set the type to - * XmSTRING. If string = "@", and contains a - * with which to build a label image we save the bitmap in the MenuItem - * structure and set the type to XmPIXMAP. - * - *************************************<->***********************************/ - -static Boolean ParseWmLabel (WmScreenData *pSD, MenuItem *menuItem, - unsigned char *string) -{ - - /* - * Allocate the label field and copy string. - */ - - if ((menuItem->label = (String) - XtMalloc ((unsigned int)(strlen ((char *)string) + 1))) == NULL) - { - PWarning (((char *)GETMESSAGE(60, 13, "Insufficient memory for menu item"))); - return (FALSE); - } - - strcpy (menuItem->label, (char *)string); - menuItem->labelType = XmSTRING; - - if (*string == '@') - /* - * Here: string = "@" - * Try to find the label bitmap in the bitmap cache or read the label - * bitmap file. - */ - { - string++; /* skip "@" */ -#ifdef WSM - if ((menuItem->labelBitmapIndex = GetBitmapIndex (pSD, - (char *)string, True)) >= 0) -#else /* WSM */ - if ((menuItem->labelBitmapIndex = GetBitmapIndex (pSD, - (char *)string)) >= 0) -#endif /* WSM */ - { - menuItem->labelType = XmPIXMAP; - } - } - return (TRUE); - -} /* END OF FUNCTION ParseWmLabel */ - - - -/*************************************<->************************************* - * - * ParseWmMnemonic (linePP, menuItem) - * - * - * Description: - * ----------- - * Parse an optional menu function mnemonic. - * - * - * Inputs: - * ------ - * linePP = pointer to current line buffer pointer. - * menuItem = pointer to MenuItem structure - * - * - * Outputs: - * ------- - * linePP = pointer to revised line buffer pointer. - * menuItem->mnemonic = valid mnemonic character or NULL. - * - * - * Comments: - * -------- - * None. - * - *************************************<->***********************************/ - -static void ParseWmMnemonic (unsigned char **linePP, MenuItem *menuItem) -{ - unsigned char *lineP = *linePP; - unsigned char *mnemonic; - - /* - * Skip leading white space. - */ - ScanWhitespace (&lineP); - menuItem->mnemonic = (KeySym)NULL; - - if (*lineP == '_') - /* - * We have a mnemonic specification. - * Get the next string (we only use the first character). - * If no string exists, the labelType is not XmSTRING, or does not contain - * the first character, then skip the string and return. - * Otherwise, accept the first character as a mnemonic. - */ - { - KeySym ks; - lineP++; - mnemonic = GetString(&lineP); - -#ifndef NO_MULTIBYTE - if (menuItem->labelType == XmSTRING && - mnemonic != NULL && - (ks = XStringToKeysym((char *)mnemonic)) != NoSymbol && - strchr(menuItem->label, (char)(ks & 0xff)) != NULL) - { - menuItem->mnemonic = ks; - } -#else - if ((mnemonic != NULL) && - (*mnemonic != '\0') && - (menuItem->labelType == XmSTRING) && - (strchr (menuItem->label, *mnemonic) != NULL)) - /* valid mnemonic */ - { - menuItem->mnemonic = *mnemonic; - } -#endif - else - { - PWarning (((char *)GETMESSAGE(60, 14, "Invalid mnemonic specification"))); - } - } - - *linePP = lineP; /* consume any string */ - -} /* END OF FUNCTION ParseWmMnemonic */ - - -/*************************************<->************************************* - * - * ParseWmAccelerator (linePP, menuItem) - * - * - * Description: - * ----------- - * Parse an optional menu function accelerator. - * - * - * Inputs: - * ------ - * linePP = pointer to current line buffer pointer. - * menuItem = pointer to MenuItem structure - * - * - * Outputs: - * ------- - * linePP = pointer to revised line buffer pointer. - * menuItem->accelText = pointer to an accelerator string or NULL. - * - * - * Comments: - * -------- - * None. - * - *************************************<->***********************************/ - -static Boolean ParseWmAccelerator (unsigned char **linePP, MenuItem *menuItem) -{ - unsigned char *lineP; - String string; - unsigned int eventType; - unsigned int state; - KeyCode keycode; - Boolean status; - - menuItem->accelState = 0; - menuItem->accelKeyCode = 0; - menuItem->accelText = NULL; - status = TRUE; - - /* - * If linePP contains NULL, then abort. - */ - if (*linePP == (unsigned char *) NULL) return(FALSE); - - /* - * Skip leading white space. - */ - ScanWhitespace (linePP); - lineP = *linePP; - - /* - * If the second character is not ".", and an accelerator specification - * exists, then process and save the specification string. - */ - - if ((*lineP != '\0') && /* something follows */ - (*lineP != '!') && /* skip if we have the ! WmFunction */ -#if ((!defined(WSM)) || defined(MWM_QATS_PROTOCOL)) - /* skip label name for client command */ - ((*lineP != '"') || (menuItem->wmFunction != F_InvokeCommand)) && -#endif /* !defined(WSM) || defined(MWM_QATS_PROTOCOL) */ - (*lineP != 'f') && - (*(lineP+1) != '.')) /* skip if we have f.xxx WmFunction */ - { - if (ParseKeyEvent(&lineP, &eventType, &keycode, &state)) - { - if ((string = (String) XtMalloc - ((unsigned int) (lineP - *linePP + 1))) == NULL) - { - PWarning (((char *)GETMESSAGE(60, 15, "Insufficient memory for accelerator specification"))); - status = FALSE; - } - else - /* - * Save the accelerator state and keycode. - * Process and save the accelerator text. - */ - { - ProcessAccelText (*linePP, lineP, (unsigned char *) string); - menuItem->accelState = state; - menuItem->accelKeyCode = keycode; - menuItem->accelText = string; - } - } - else - { - PWarning (((char *)GETMESSAGE(60, 16, "Invalid accelerator specification"))); - status = FALSE; - } - - *linePP = lineP; /* consume the specification */ - } - - return (status); - -} /* END OF FUNCTION ParseWmAccelerator */ - - -#if ((!defined(WSM)) || defined(MWM_QATS_PROTOCOL)) -/*************************************<->************************************* - * - * ParseMenuItemName (linePP, menuItem) - * - * - * Description: - * ----------- - * Parse a user defined client command menu item - * - * - * Inputs: - * ------ - * linePP = pointer to current line buffer pointer. - * menuItem = pointer to MenuItem structure - * - * - * Outputs: - * ------- - * menuItem->label will have menu item name appended to it - * - * Comments: - * -------- - * This function attempts to find a menu item label string at the end - * of the client command specification line. A menu item label string - * must be delimited by double quotes. If found, the label string is - * appended to the menuItem->label field, after being reallocated to - * accommodate the new space requirement. - * - *************************************<->***********************************/ - -static void ParseMenuItemName (unsigned char **linePP, MenuItem *menuItem) -{ - unsigned char *lineP, *endquote; -#ifndef NO_MULTIBYTE - int chlen; -#endif - - /* Skip past any whitespace */ - ScanWhitespace (linePP); - lineP = *linePP; - - /* Look for a double quote */ - if ( -#ifndef NO_MULTIBYTE - mblen ((char *)lineP, MB_CUR_MAX) == 1 && -#endif - *lineP == '"') - { - /* Move past the first quote. */ - ++lineP; - - endquote = lineP; - - /* Search for closing quote */ -#ifndef NO_MULTIBYTE - while (*endquote != '\0' && - (chlen = mblen ((char *)endquote, MB_CUR_MAX)) > 0 && - (chlen > 1 || *endquote != '"')) - { - /* If we ran off the end of the line, then just abort. Bad - syntax. */ - if ((chlen == 1 && *endquote == '\n') || *endquote == '\0') return; - endquote += chlen; - } - if (chlen < 0) return; /* invalid character */ -#else - while (*endquote != '\0' && *endquote != '"') { - if (*endquote == '\n' || *endquote == '\0') return; - endquote++; - } -#endif - - /* Well, we have a valid menu item name. Store it in the - client command name field. Don't include the double quotes. */ - menuItem->clientCommandName = - XtMalloc(sizeof(char) * (endquote - lineP) + 1); - strncpy(menuItem->clientCommandName, (char *) lineP, - endquote - lineP); - menuItem->clientCommandName[strlen(menuItem->clientCommandName)+1] = '\0'; - } - else - { - /* If there was no double quote, then just advance to the end - of the line. */ -#ifndef NO_MULTIBYTE - while (*lineP != '\0' && - ((chlen = mblen ((char *)lineP, MB_CUR_MAX)) > 1 || - *lineP != '\n')) - lineP += chlen > 0 ? chlen : 1; -#else - while (*lineP != '\0' && *lineP != '\n') - lineP++; -#endif - *linePP = lineP; - } -} -#endif /* !defined(WSM) || defined(MWM_QATS_PROTOCOL) */ - - -/*************************************<->************************************* - * - * int - * ParseWmFunction (linePP, res_spec, pWmFunction) - * - * - * Description: - * ----------- - * Parse a button, key, or menu function name and return its function table - * index. - * - * - * Inputs: - * ------ - * linePP = pointer to current line buffer pointer. - * res_spec = resource specification type (key, button, or menu). - * pWmFunction = pointer to window manager function destination. - * functionTable = window manager function parse table - * - * - * Outputs: - * ------- - * linePP = pointer to revised line buffer pointer. - * pWmFunction = pointer to parsed window manager function. - * Return = function table index of parsed function. - * - * - * Comments: - * -------- - * Uses F_Nop if the function name or resource type is invalid. - * - *************************************<->***********************************/ - -int ParseWmFunction (unsigned char **linePP, unsigned int res_spec, - WmFunction *pWmFunction) -{ - unsigned char *lineP = *linePP; - unsigned char *string; - register int low, mid, high, cmp; - - /* - * Skip leading white space. - */ - ScanWhitespace (&lineP); - - /* - * Have function string (may be NULL or a comment). - * Handle the special case of '!' - */ - - if (*lineP == '!') - { - *linePP = ++lineP; - *pWmFunction = F_Exec; - return (F_EXEC_INDEX); - } - - /* - * Identify the function corresponding to the specified name. - * Try binary search of the window manager function parse table. - * Assume f.nop if the function and resource type cannot be matched. - * This handles NULL and comment strings, bad function names, and functions - * in inappropriate resource sets. - */ - string = GetString (&lineP); - *linePP = lineP; - - if (string != NULL) - { - ToLower (string); - low = 0; - high = WMFUNCTIONTABLESIZE - 1; - - while (low <= high) - { - mid = (low + high)/2; - cmp = strcmp (functionTable[mid].funcName, (char *)string); - - if (!cmp) - /* - * Function name match - * Require proper resource type for the function. - */ - { - if (res_spec & functionTable[mid].resource) - { - *pWmFunction = functionTable[mid].wmFunction; - return (mid); - } - - /* invalid resource: use F_Nop */ - break; - } - - /* - * Function name mismatch - */ - if (cmp > 0) - { - high = mid - 1; - } - else - { - low = mid + 1; - } - } - } - - /* - * Not found: assume f.nop - */ - *pWmFunction = F_Nop; - return (F_NOP_INDEX); - -} /* END OF FUNCTION ParseWmFunction */ - - -/*************************************<->************************************* - * - * ParseWmFuncMaybeStrArg (linePP, wmFunction, pArgs) - * - * - * Description: - * ----------- - * Parses a window manager function with a null or string argument. - * - * - * Inputs: - * ------ - * linePP = pointer to current line buffer pointer. - * wmFunction = function (not used). - * pArgs = pointer to argument destination. - * - * - * Outputs: - * ------- - * linePP = pointer to revised line buffer pointer. - * pArgs = pointer to parsed argument string. - * Return = FALSE iff insufficient memory - * - * - * Comments: - * -------- - * Only used to parse arguments for F_Lower, F_Raise, and F_Raise_Lower. - * If it is used for any other function, be sure to change FreeMenuItem () - * accordingly. - * - *************************************<->***********************************/ - -#ifndef PANELIST -static -#endif -Boolean ParseWmFuncMaybeStrArg (unsigned char **linePP, - WmFunction wmFunction, String *pArgs) -{ - unsigned char *string = *linePP; - unsigned int len; - - ScanWhitespace (&string); -/* - if (*lineP == '-') - { - *linePP = ++lineP; - return (ParseWmFuncStrArg (linePP, wmFunction, pArgs)); - } -*/ -#ifdef PANELIST -#if 0 - else if (*lineP == '"' && *(lineP+1) == '-') - { - /* kill off '-' */ - strcpy ((char *) (lineP+1), (char *) (lineP+2)); - return (ParseWmFuncStrArg (linePP, wmFunction, pArgs)); - } -#endif -#endif /* PANELIST */ - if ((len = strlen ((char *)string)) != 0) - { - if ((*pArgs = (String)XtMalloc (len + 1)) == NULL) - { - PWarning (((char *)GETMESSAGE(60, 17, "Insufficient memory"))); - return (FALSE); - } - strcpy (*pArgs, (char *)string); - return (TRUE); - } - else - /* Do ParseWmFuncNoArg () */ - { - *pArgs = NULL; - return (TRUE); - } - -} /* END OF FUNCTION ParseWmFuncMaybeStrArg */ - - -/*************************************<->************************************* - * - * ParseWmFuncNoArg (linePP, wmFunction, pArgs) - * - * - * Description: - * ----------- - * Parses a window manager function null argument. - * - * - * Inputs: - * ------ - * linePP = pointer to current line buffer pointer. - * wmFunction = function (not used). - * pArgs = pointer to argument destination. - * - * - * Outputs: - * ------- - * linePP = unchanged - * pArgs = NULL - * Return = TRUE - * - * - * Comments: - * -------- - * None. - * - *************************************<->***********************************/ - -static Boolean ParseWmFuncNoArg (unsigned char **linePP, WmFunction wmFunction, - String *pArgs) -{ - - *pArgs = NULL; - return (TRUE); - -} /* END OF FUNCTION ParseWmFuncNoArg */ - - -/*************************************<->************************************* - * - * ParseWmFuncStrArg (linePP, wmFunction, pArgs) - * - * - * Description: - * ----------- - * Parses a window manager function string argument. - * - * - * Inputs: - * ------ - * linePP = pointer to current line buffer pointer. - * wmFunction = function for which the argument string is intended. - * pArgs = pointer to argument string destination. - * - * - * Outputs: - * ------- - * linePP = pointer to revised line buffer pointer. - * pArgs = pointer to parsed argument string. - * Return = FALSE iff insufficient memory - * - * - * Comments: - * -------- - * Insures that an argument for F_Exec() ends in '&' . - * Only used to parse arguments for F_Exec, F_Menu, F_Lower, F_Raise, - * F_Raise_Lower, and F_Screen. If it is used for any other function, be - * sure to change FreeMenuItem () accordingly. - * - *************************************<->***********************************/ - -#ifndef PANELIST -static -#endif -Boolean ParseWmFuncStrArg (unsigned char **linePP, - WmFunction wmFunction, String *pArgs) -{ - unsigned char *string; - unsigned int len; -#ifndef NO_MULTIBYTE - char *p; - wchar_t last; - char delim; - wchar_t wdelim; - int lastlen; -#endif - - if ((string = GetString (linePP)) != NULL) - /* nonNULL string argument */ - { - len = strlen ((char *)string); - if ((*pArgs = (String)XtMalloc (len + 2)) == NULL) - { - PWarning (((char *)GETMESSAGE(60, 17, "Insufficient memory"))); - return (FALSE); - } - strcpy (*pArgs, (char *)string); - - /* - * Insure that an argument for F_Exec ends in '&' . - */ - -#ifndef NO_MULTIBYTE - if ((wmFunction == F_Exec)) - { - lastlen = 0; - p = *pArgs; - while (*p && - ((len = mblen(p, MB_CUR_MAX)) > 0)) - { - mbtowc(&last, p, MB_CUR_MAX); - lastlen = len; - p += len; - } - delim = '&'; - mbtowc(&wdelim, &delim, MB_CUR_MAX); - if (lastlen == 1 && last != wdelim) - { - *p++ = '&'; - *p = '\0'; - } - } -#else - if ((wmFunction == F_Exec) && ((*pArgs)[len - 1] != '&')) - { - (*pArgs)[len] = '&'; - (*pArgs)[len + 1] = '\0'; - } -#endif - } - else - /* NULL string argument */ - { - *pArgs = NULL; - } - - return (TRUE); - -} /* END OF FUNCTION ParseWmFuncStrArg */ - - -/*************************************<->************************************* - * - * FreeMenuItem (menuItem) - * - * - * Description: - * ----------- - * This procedure destroys a MenuItem structure. - * - * - * Inputs: - * ------ - * menuItem = to be destroyed. - * - * - * Outputs: - * ------- - * None. - * - * - * Comments: - * -------- - * Assumes that ParseWmFuncStrArg () has parsed a menu item's function - * argument only for F_Exec, F_Menu, F_Lower, F_Raise, F_Raise_Lower, and - * F_Screen. If it is used for other functions, be sure to include them here! - * - *************************************<->***********************************/ - -void FreeMenuItem (MenuItem *menuItem) -{ - if (menuItem->label != NULL) - { - XtFree ((char *)menuItem->label); - } - - if (menuItem->accelText != NULL) - { - XtFree ((char *)menuItem->accelText); - } - - /* - * If menuItem->wmFuncArgs is nonNULL, we assume that it is a string that - * was malloc'ed in ParseWmFuncStrArg () and we free it now. - */ - if ((menuItem->wmFuncArgs != NULL) && - ((menuItem->wmFunction == F_Exec) || - (menuItem->wmFunction == F_Menu) || - (menuItem->wmFunction == F_Lower) || - (menuItem->wmFunction == F_Raise) || - (menuItem->wmFunction == F_Raise_Lower) || - (menuItem->wmFunction == F_Screen))) - { - XtFree ((char *)menuItem->wmFuncArgs); - } - - if (menuItem->clientCommandName != NULL) - { - XtFree ((char *) menuItem->clientCommandName); - } - - XtFree ((char *)menuItem); - -} /* END OF FUNCTION FreeMenuItem */ - - - -/*************************************<->************************************* - * - * ParseWmFuncGrpArg (linePP, wmFunction, pGroup) - * - * - * Description: - * ----------- - * Parses a window manager function group argument. - * - * - * Inputs: - * ------ - * linePP = pointer to current line buffer pointer. - * wmFunction = function for which the group argument is intended. - * pGroup = pointer to group argument destination. - * - * - * Outputs: - * ------- - * linePP = pointer to revised line buffer pointer. - * pGroup = pointer to parsed group argument. - * Return = FALSE iff invalid group argument. - * - * - * Comments: - * -------- - * The only valid nonNULL arguments are "icon", "window", and "transient". - * - *************************************<->***********************************/ - -static Boolean ParseWmFuncGrpArg (unsigned char **linePP, - WmFunction wmFunction, GroupArg *pGroup) -{ - unsigned char *lineP = *linePP; - unsigned char *startP; - unsigned char grpStr[MAX_GROUP_STRLEN+1]; - int len; - - - /* - * Parse groups while each is followed by "|". - */ - - *pGroup = 0; - while (1) - { - /* - * Skip whitespace and find next group string. - */ - - ScanWhitespace (&lineP); - startP = lineP; - ScanAlphanumeric (&lineP); - if (startP == lineP) - /* Group missing => use default or complain */ - { - if (*pGroup) - { - PWarning (((char *)GETMESSAGE(60, 18, "Missing group specification"))); - return (FALSE); - } - else - { - *pGroup = F_GROUP_DEFAULT; - break; - } - } - - /* - * Found a group string; compare it with valid groups. - */ - - len = min (lineP - startP, MAX_GROUP_STRLEN); - (void) strncpy ((char *)grpStr, (char *)startP, len); - grpStr[len] = '\0'; - ToLower (grpStr); - - if (!strcmp ("icon", (char *)grpStr)) - { - *pGroup |= F_GROUP_ICON; - } - else if (!strcmp ("window", (char *)grpStr)) - { - *pGroup |= F_GROUP_WINDOW; - } - else if (!strcmp ("transient", (char *)grpStr)) - { - *pGroup |= F_GROUP_TRANSIENT; - } - else - /* Unknown group name */ - { - PWarning (((char *)GETMESSAGE(60, 19, "Invalid group specification"))); - return (FALSE); - } - - /* - * Continue processing until the line is exhausted. - * Skip any '|' . - */ - - ScanWhitespace (&lineP); - - if (lineP == NULL || *lineP == '\0') - { - break; - } - else if (*lineP == '|') - { - lineP++; - } - } - - *linePP = lineP; - return (TRUE); - -} /* END OF FUNCTION ParseWmFuncGrpArg */ - - - -/*************************************<->************************************* - * - * ParseWmFuncNbrArg (linePP, wmFunction, pNumber) - * - * - * Description: - * ----------- - * Parses a window manager function number argument. - * - * - * Inputs: - * ------ - * linePP = pointer to current line buffer pointer. - * wmFunction = function - * pNumber = pointer to number argument destination. - * - * - * Outputs: - * ------- - * linePP = pointer to revised line buffer pointer. - * pNumber = pointer to parsed number argument. - * Return = FALSE iff invalid number argument. - * - * - * Comments: - * -------- - * None. - * - *************************************<->***********************************/ - -static Boolean ParseWmFuncNbrArg (unsigned char **linePP, - WmFunction wmFunction, - unsigned long *pNumber) -{ - int val; - - val = StrToNum (GetString (linePP)); - if (val == -1) - { - PWarning (((char *)GETMESSAGE(60, 20, "Invalid number specification"))); - *pNumber = 0; - return (FALSE); - } - - *pNumber = val; - return (TRUE); - -} /* END OF FUNCTION ParseWmFuncNbrArg */ - - -#if ((!defined(WSM)) || defined(MWM_QATS_PROTOCOL)) -/*************************************<->************************************* - * - * ParseWmFuncCCIArgs (linePP, wmFunction, pArgs) - * - * - * Description: - * ----------- - * Parses a Client-Command entry's arguments. - * - * - * Inputs: - * ------ - * linePP = pointer to current line buffer pointer. - * wmFunction = function for which the argument string is intended. - * pArgs = pointer to argument string destination. - * - * - * Outputs: - * ------- - * linePP = pointer to revised line buffer pointer. - * pArgs = pointer to parsed argument string. - * Return = FALSE iff insufficient memory - * - * - * Comments: - * -------- - * None. - * - *************************************<->***********************************/ - -static Boolean ParseWmFuncCCIArgs (unsigned char **linePP, - WmFunction wmFunction, String *pArgs) -{ - /* - * Format: - * cci_func_args: - * cci_entry - * modifier cci_entry_list - * - * cci_entry_list: - * cci_entry - * cci_entry . cci_entry - * - * cci_entry: - * '<' cci_label '>' - * - * cci_label: - * any combination of alpha and '_' - */ - - CCIEntryModifier mod; - CCIFuncArg *cciArg; - unsigned char *string; - - - cciArg = XtNew(CCIFuncArg); - - if ((string = GetString(linePP)) == NULL) - { - /* Error - no data for f.cci command. cci_entry_list is required. */ - fprintf(stderr, "Incorrect format for f.cci command.\n"); - return (FALSE); - } - else - { - /* check if no modifier was specified. */ - if (string[0] == '<') - { - cciArg->mod = NONE; - cciArg->cciEntry = XtNewString((char*)string); - } - else - { - if (! GetCCIModifier((String)string, &mod)) - { - cciArg->mod = NONE; - cciArg->cciEntry = XtNewString(""); - } - else - { - cciArg->mod = mod; - - if ((string = GetString(linePP)) == NULL) - { - /* Found a modifier, but there's no cci_entry_list. */ - fprintf(stderr, "Incorrect format for f.cci command.\n"); - return(FALSE); - } - else - { - cciArg->cciEntry = XtNewString((char*)string); - } - } - } - - *pArgs = (String)cciArg; - } - - return(TRUE); -} /* END OF FUNCTION ParseWmFuncCCIArgs */ -#endif /* !defined(WSM) || defined(MWM_QATS_PROTOCOL) */ - - -/*************************************<->************************************* - * - * ParseButtonStr () - * - * - * Description: - * ----------- - * This function parses a button set specification string: - * - * bindings_name - * { - * button context function - * button context function - * ... - * button context function - * } - * - * - * - * Inputs: - * ------ - * pSD->buttonBindings = buttonBindings resource value - * functionTable = window manager function parse table - * - * - * Outputs: - * ------- - * pSD->buttonSpecs = list of button binding specifications. - * - * - * Comments: - * -------- - * The button set specification name must match pSD->buttonBindings. - * - *************************************<->***********************************/ - -void ParseButtonStr (WmScreenData *pSD, unsigned char *buttonStr) -{ - unsigned char *lineP; - - cfileP = NULL; - linec = 0; - if (((parseP = buttonStr) != NULL) && (GetNextLine () != NULL)) - { - lineP = line; - ParseButtonSet (pSD, lineP); - } - -} /* END OF FUNCTION ParseButtonStr */ - - -/*************************************<->************************************* - * - * ParseButtonSet (pSD, lineP) - * - * - * Description: - * ----------- - * Button set specification found. Parse the following syntax: - * - * v - * Buttons bindings_name - * { - * button context function - * button context function - * ... - * button context function - * } - * - * - * Inputs: - * ------ - * cfileP = (global) file pointer to fopened configuration file or NULL - * line = (global) line buffer - * lineP = pointer to current character in line buffer - * pSD->buttonBindings = buttonBindings resource value - * - * - * Outputs: - * ------- - * lineP = pointer to current character in line buffer - * pSD->buttonSpecs = list of button binding specifications. - * - * - * Comments: - * -------- - * Skips unnamed button binding set and sets with names that don't match - * the buttonBindings resource. - * Skips bad button binding specifications. - * - *************************************<->***********************************/ - -static void ParseButtonSet (WmScreenData *pSD, unsigned char *lineP) -{ - unsigned char *string; - ButtonSpec *buttonSpec; - ButtonSpec *lastButtonSpec; - int ix; - - /* - * Parse the button set bindings from the configuration file. - * If either the button set name or buttonBindings resource is NULL or - * they don't match, then skip this button specification. - */ - - if (((string = GetString (&lineP)) == NULL) || - (pSD->buttonBindings == NULL) || - strcmp ((char *)string, pSD->buttonBindings)) - { - return; - } - - /* - * Require leading '{' on the next line. - */ - while ((GetNextLine () != NULL)) /* not EOF nor read error */ - { - lineP = line; - ScanWhitespace(&lineP); - - if ((lineP == NULL) || (*line == '!') || (*lineP == '\0') || (*lineP == '#')) - /* ignore empty or comment line */ - { - continue; - } - - if (*lineP == '{') - /* found '{' */ - { - break; - } - - /* not a '{' */ - PWarning (((char *)GETMESSAGE(60, 21, "Expected '{' after button set name"))); - return; - } - - /* - * Found leading "{" or EOF. - * Prepare to accumulate button bindings by finding the end of - * the button specification list. - * lastButtonSpec will be NULL only if no prior bindings exist. - */ - - lastButtonSpec = pSD->buttonSpecs; - if (lastButtonSpec != NULL) - { - while (lastButtonSpec->nextButtonSpec != NULL) - { - lastButtonSpec = (lastButtonSpec->nextButtonSpec); - } - } - - /* - * Parse "button context function" until "}" or EOF found. - * Skips bad button binding specifications. - */ - - while ((GetNextLine () != NULL)) /* not EOF nor read error */ - { - lineP = line; - ScanWhitespace(&lineP); - if ((lineP == NULL) || (*line == '!') || (*lineP == '\0') || (*lineP == '#')) - /* ignore empty or comment lines */ - { - continue; - } - if (*lineP == '}') /* finished with button set */ - { - break; - } - - /* - * Allocate space for the button binding specification. - */ - if ((buttonSpec = (ButtonSpec *)XtMalloc (sizeof (ButtonSpec))) == NULL) - { - PWarning (((char *)GETMESSAGE(60, 22, "Insufficient memory for button specification"))); - continue; - } - buttonSpec->wmFunction = (WmFunction)NULL; - buttonSpec->wmFuncArgs = NULL; - buttonSpec->nextButtonSpec = NULL; - - /* - * Parse the button specification "button". - */ - lineP = line; - if (!ParseBtnEvent(&lineP, - &buttonSpec->eventType, - &buttonSpec->button, - &buttonSpec->state, - &buttonSpec->click)) - { - PWarning (((char *)GETMESSAGE(60, 23, "Invalid button specification"))); - XtFree ((char *)buttonSpec); - continue; /* skip this button specification */ - } - - - /* - * Parse the button context. - */ - if (!ParseContext(&lineP, &buttonSpec->context, - &buttonSpec->subContext)) - { - PWarning (((char *)GETMESSAGE(60, 24, "Invalid button context"))); - XtFree ((char *)buttonSpec); - continue; /* skip this button specification */ - } - - /* - * Parse the button function and any arguments. - */ - - ix = ParseWmFunction (&lineP, CRS_BUTTON, &buttonSpec->wmFunction); - - /* - * remove any subContexts that don't apply to this function - */ - - if ((functionTable[ix].greyedContext & F_SUBCONTEXT_IB_IICON) && - (buttonSpec->subContext & F_SUBCONTEXT_IB_IICON)) - { - buttonSpec->subContext &= ~F_SUBCONTEXT_IB_IICON; - } - - if ((functionTable[ix].greyedContext & F_SUBCONTEXT_IB_WICON) && - (buttonSpec->subContext & F_SUBCONTEXT_IB_WICON)) - { - buttonSpec->subContext &= ~F_SUBCONTEXT_IB_WICON; - } - - /* - * Map Button3 menus to BMenu virtual button - */ - if (buttonSpec->button == Button3 && - (buttonSpec->wmFunction == F_Menu || - buttonSpec->wmFunction == F_Post_SMenu)) { - - buttonSpec->button = wmGD.bMenuButton; - } - - /* - * Apply the function argument parser. - */ - if (!(*(functionTable [ix].parseProc)) - (&lineP, buttonSpec->wmFunction, &buttonSpec->wmFuncArgs)) - { - XtFree ((char *)buttonSpec); - continue; /* skip this button specification */ - } - - /* - * Add the button specification to the button specification list. - */ - if (lastButtonSpec != NULL) - /* a prior specification exists */ - { - lastButtonSpec->nextButtonSpec = buttonSpec; - } - else - { - pSD->buttonSpecs = buttonSpec; - } - lastButtonSpec = buttonSpec; - } - -} /* END OF FUNCTION ParseButtonSet */ - - - -/*************************************<->************************************* - * - * ParseContext (linePP, context, subContext) - * - * - * Description: - * ----------- - * Parses a general context string. - * - * - * Inputs: - * ------ - * linePP = pointer to current line buffer pointer. - * - * Outputs: - * ------- - * linePP = pointer to revised line buffer pointer. - * context = context field value - * subContext = subContext field value - * Return = (Boolean) true iff valid context string - * - * - * Comments: - * -------- - * None. - * - *************************************<->***********************************/ - -static Boolean ParseContext (unsigned char **linePP, Context *context, - Context *subContext) -{ - unsigned char *lineP = *linePP; - unsigned char *startP; - unsigned char ctxStr[MAX_CONTEXT_STRLEN+1]; - int len; - - /* - * Parse contexts while each is followed by "|". - */ - - *context = 0; - *subContext = 0; - while (1) { - - /* - * Skip whitespace and find next context string. - */ - ScanWhitespace (&lineP); - startP = lineP; - ScanAlphanumeric (&lineP); - if (startP == lineP) - /* ERROR: Context missing */ - { - return (FALSE); - } - - /* - * Found nonNULL string; compare it with valid contexts. - */ - - len = min(lineP - startP, MAX_CONTEXT_STRLEN); - (void) strncpy ((char *)ctxStr, (char *)startP, len); - ctxStr[len] = '\0'; - ToLower (ctxStr); - - if (!strcmp ("root", (char *)ctxStr)) - { - *context |= F_CONTEXT_ROOT; - *subContext |= F_SUBCONTEXT_R_ALL; - } - else if (!strcmp ("icon", (char *)ctxStr)) - { - *context |= (F_CONTEXT_ICON | - F_CONTEXT_ICONBOX | - F_SUBCONTEXT_IB_IICON | - F_SUBCONTEXT_IB_WICON ); - *subContext |= (F_SUBCONTEXT_I_ALL | - F_SUBCONTEXT_IB_IICON | - F_SUBCONTEXT_IB_WICON ); - } - else if (!strcmp ("window", (char *)ctxStr)) - { - *context |= F_CONTEXT_WINDOW; - *subContext |= F_SUBCONTEXT_W_ALL; - } - else if (!strcmp ("frame", (char *)ctxStr)) - { - *context |= F_CONTEXT_WINDOW; - *subContext |= F_SUBCONTEXT_W_FRAME; - } - else if (!strcmp ("title", (char *)ctxStr)) - { - *context |= F_CONTEXT_WINDOW; - *subContext |= F_SUBCONTEXT_W_TITLE; - } - else if (!strcmp ("border", (char *)ctxStr)) - { - *context |= F_CONTEXT_WINDOW; - *subContext |= F_SUBCONTEXT_W_BORDER; - } - else if (!strcmp ("app", (char *)ctxStr)) - { - *context |= F_CONTEXT_WINDOW; - *subContext |= F_SUBCONTEXT_W_APP; - } -#ifdef WSM - else if (!strcmp ("ifkey", (char *)ctxStr)) - { - *context |= F_CONTEXT_IFKEY; - } -#endif /* WSM */ - else - /* Unknown context name */ - { - return (FALSE); - } - - /* continue only if followed by '|' */ - ScanWhitespace (&lineP); - if (*lineP != '|') - { - break; - } - lineP++; - } - - *linePP = lineP; - return (TRUE); - -} /* END OF FUNCTION ParseContext */ - - -/*************************************<->************************************* - * - * ParseKeyStr () - * - * - * Description: - * ----------- - * This function parses a key set specification string: - * - * bindings_name - * { - * key context function - * key context function - * ... - * key context function - * } - * - * - * Inputs: - * ------ - * pSD->keyBindings = keyBindings resource value - * functionTable = window manager function parse table - * - * - * Outputs: - * ------- - * pSD->keySpecs = list of key binding specification - * - * - * Comments: - * -------- - * The key set specification name must match pSD->keyBindings. - * - *************************************<->***********************************/ - -void -ParseKeyStr (WmScreenData *pSD, unsigned char *keyStr) -{ - unsigned char *lineP; - - cfileP = NULL; - linec = 0; - if (((parseP = keyStr) != NULL) && (GetNextLine () != NULL)) - { - lineP = line; - ParseKeySet (pSD, lineP); - } - -} /* END OF FUNCTION ParseKeyStr */ - - - -/*************************************<->************************************* - * - * ParseKeySet (pSD, lineP) - * - * - * Description: - * ----------- - * Key set specification found. Parse the following syntax: - * - * v - * Keys bindings_name - * { - * key context function - * key context function - * ... - * key context function - * } - * - * - * Inputs: - * ------ - * cfileP = (global) file pointer to fopened configuration file or NULL - * line = (global) line buffer - * lineP = pointer to current character in line buffer - * pSD->keyBindings = keyBindings resource value - * - * - * Outputs: - * ------- - * lineP = pointer to current character in line buffer - * pSD->keySpecs = list of key binding specifications. - * - * - * Comments: - * -------- - * Skips unnamed key binding set and sets with names that don't match the - * keyBindings resource. - * Skips bad key binding specifications. - * - *************************************<->***********************************/ - -static void ParseKeySet (WmScreenData *pSD, unsigned char *lineP) -{ - unsigned char *string; - KeySpec *keySpec; - KeySpec *lastKeySpec; - unsigned int eventType; - int ix; -#ifdef WSM - Boolean bBadKey; -#endif /* WSM */ - - /* - * Parse the key set bindings from the configuration file. - * If either the key set name or keyBindings resource is NULL or they - * don't match then skip this key specification. - */ - - if (((string = GetString (&lineP)) == NULL) || - (pSD->keyBindings == NULL) || - strcmp ((char *)string, pSD->keyBindings)) - { - return; - } - - /* - * Require leading '{' on next line. - */ - while ((GetNextLine () != NULL)) /* not EOF nor read error */ - { - lineP = line; - ScanWhitespace(&lineP); - - if ((lineP == NULL) || (*line == '!') || (*lineP == '\0') || (*lineP == '#')) - /* ignore empty or comment line */ - { - continue; - } - - if (*lineP == '{') - /* found '{' */ - { - break; - } - - /* not a '{' */ - PWarning (((char *)GETMESSAGE(60, 25, "Expected '{' after key set name"))); - return; - } - - /* - * Found leading "{" or EOF. - * Prepare to accumulate key bindings by finding the end of - * the key specification list. - * lastKeySpec will be NULL only if no prior bindings exist. - */ - - lastKeySpec = pSD->keySpecs; - if (lastKeySpec != NULL) - { - while (lastKeySpec->nextKeySpec != NULL) - { - lastKeySpec = (lastKeySpec->nextKeySpec); - } - } - - /* - * Parse "key context function" until "}" or EOF found. - * Skip bad key bindings. - */ - - while ((GetNextLine () != NULL)) /* not EOF nor read error */ - { - lineP = line; - ScanWhitespace (&lineP); - if ((lineP == NULL) || (*line == '!') || (*lineP == '\0') || (*lineP == '#')) - /* ignore empty or comment lines */ - { - continue; - } - if (*lineP == '}') /* finished with key set */ - { - break; - } - - /* - * Allocate space for the key specification. - */ - if ((keySpec = (KeySpec *)XtMalloc (sizeof (KeySpec))) == NULL) - { - PWarning (((char *)GETMESSAGE(60, 26, "Insufficient memory for key specification"))); - continue; - } - - keySpec->wmFunction = (WmFunction)NULL; - keySpec->wmFuncArgs = NULL; - keySpec->nextKeySpec = NULL; - - /* - * Parse the key specification. - */ -#ifdef WSM - bBadKey = False; -#endif /* WSM */ - if (!ParseKeyEvent(&lineP, - &eventType, - &keySpec->keycode, - &keySpec->state)) - { -#ifdef WSM - bBadKey = True; -#else /* WSM */ - PWarning (((char *)GETMESSAGE(60, 27, "Invalid key specification"))); - XtFree ((char *)keySpec); - continue; /* skip this key specification */ -#endif /* WSM */ - } - - /* - * Parse the key context. - * Here lineP points to the candidate context string. - */ - - if (!ParseContext(&lineP, &keySpec->context, - &keySpec->subContext)) - { -#ifdef WSM - if (bBadKey) - PWarning (((char *)GETMESSAGE(60, 27, "Invalid key specification"))); -#endif /* WSM */ - PWarning (((char *)GETMESSAGE(60, 28, "Invalid key context"))); - XtFree ((char *)keySpec); - continue; /* skip this key specification */ - } -#ifdef WSM - if (bBadKey) - { - /* - * Don't print an error message if this is a "hardware - * available" binding. - */ - if (!(keySpec->context & F_CONTEXT_IFKEY)) - PWarning (((char *)GETMESSAGE(60, 27, "Invalid key specification"))); - XtFree ((char *)keySpec); - continue; /* skip this key specification */ - } - - /* - * This flag is only used for parsing, clear it so the - * rest of the program doesn't see it. - */ - keySpec->context &= ~F_CONTEXT_IFKEY; -#endif /* WSM */ - - - /* - * Parse the key function and any arguments. - */ - - ix = ParseWmFunction (&lineP, CRS_KEY, &keySpec->wmFunction); - - /* - * remove any subContexts that don't apply to this function - */ - if ((functionTable[ix].greyedContext & F_SUBCONTEXT_IB_IICON) && - (keySpec->subContext & F_SUBCONTEXT_IB_IICON)) - { - keySpec->subContext &= ~F_SUBCONTEXT_IB_IICON; - } - - if ((functionTable[ix].greyedContext & F_SUBCONTEXT_IB_WICON) && - (keySpec->subContext & F_SUBCONTEXT_IB_WICON)) - { - keySpec->subContext &= ~F_SUBCONTEXT_IB_WICON; - } - - /* - * Apply the function argument parser. - */ - if (!(*(functionTable [ix].parseProc)) - (&lineP, keySpec->wmFunction, &keySpec->wmFuncArgs)) - { - XtFree ((char *)keySpec); - continue; /* skip this key specification */ - } - - /* - * Add the key specification to the key specification list. - */ - if (lastKeySpec != NULL) - /* a prior specification exists */ - { - lastKeySpec->nextKeySpec = keySpec; - } - else - { - pSD->keySpecs = keySpec; - } - lastKeySpec = keySpec; - } - -} /* END OF FUNCTION ParseKeySet */ - -#ifndef WSM - -/*************************************<->************************************* - * - * GetNextLine () - * - * - * Description: - * ----------- - * Returns the next line from an fopened configuration file or a newline- - * embedded configuration string. - * - * - * Inputs: - * ------ - * cfileP = (global) file pointer to fopened configuration file or NULL - * line = (global) line buffer - * linec = (global) line count - * parseP = (global) parse string pointer if cfileP == NULL - * - * - * Outputs: - * ------- - * line = (global) next line - * linec = (global) line count incremented - * parseP = (global) parse string pointer incremented - * Return = line or NULL if file or string is exhausted. - * - * - * Comments: - * -------- - * If there are more than MAXLINE characters on a line in the file cfileP the - * excess are truncated. - * Assumes the line buffer is long enough for any parse string line. - * - *************************************<->***********************************/ - -unsigned char * -GetNextLine (void) -{ - register unsigned char *string; - int len; - -#ifndef NO_MULTIBYTE - int chlen; - wchar_t last; - wchar_t wdelim; - char delim; - int lastlen; -#endif - - if (cfileP != NULL) - /* read fopened file */ - { - if ((string = (unsigned char *) - fgets ((char *)line, MAXLINE, cfileP)) != NULL) - { -#ifndef NO_MULTIBYTE - - lastlen = 0; - while (*string && - ((len = mblen((char *)string, MB_CUR_MAX)) > 0)) - { - mbtowc(&last, (char *)string, MB_CUR_MAX); - lastlen = len; - string += len; - } - delim = '\\'; - mbtowc(&wdelim, &delim, MB_CUR_MAX); - if (lastlen == 1 && last == wdelim) - { - do - { - if (!fgets((char *)string, MAXLINE - (string - line), cfileP)) - break; - - lastlen = 0; - while (*string && - ((len = mblen((char *)string, MB_CUR_MAX)) > 0)) - { - mbtowc(&last, (char *)string, MB_CUR_MAX); - lastlen = len; - string += len; - } - linec++; - } - while (lastlen == 1 && last == wdelim); - } - string = line; -#else - len = strlen((char *)string) - 2; - if ((len > 0) && string[len] == '\\') - { - do { - string = &string[len]; - if (fgets((char *)string, - MAXLINE - (string-line), cfileP) == NULL) - break; - len = strlen((char *)string) - 2; - linec++; - } while ((len >= 0) && string[len] == '\\'); - string = line; - } -#endif - } - } - else if ((parseP != NULL) && (*parseP != '\0')) - /* read parse string */ - { - string = line; -#ifndef NO_MULTIBYTE -#ifdef FIX_1127 - chlen = mblen((char *)parseP, MB_CUR_MAX); - if(chlen==-1) string = NULL; -#endif - - while ((*parseP != '\0') && - ((chlen = mblen ((char *)parseP, MB_CUR_MAX)) > 0) && - (*parseP != '\n')) - /* copy all but NULL and newlines to line buffer */ - { - while (chlen--) - { - *(string++) = *(parseP++); - } - } -#else - while ((*parseP != '\0') && (*parseP != '\n')) - /* copy all but end-of-line and newlines to line buffer */ - { - *(string++) = *(parseP++); - } -#endif - if (string) - *string = '\0'; - if (*parseP == '\n') - { - parseP++; - } - } - else - { - string = NULL; - } - - linec++; - return (string); - -} /* END OF FUNCTION GetNextLine */ -#endif /* WSM */ - -#ifndef PANELIST - -#ifdef WSM -/*************************************<->************************************* - * - * GetStringC (linePP, SmBehavior) - * - * - * Description: - * ----------- - * Returns the next quoted or whitespace-terminated nonquoted string in the - * line buffer. - * Additional functionality added to GetString in that anything in a - * quoted string is considered sacred and nothing will be stripped from - * the middle of a quoted string. - * - * - * Inputs: - * ------ - * linePP = pointer to current line buffer pointer. - * SmBehavior = flag that enables parsing session manager hints - * if True. - * - * - * Outputs: - * ------- - * linePP = pointer to revised line buffer pointer. - * Return = string - * - * - * Comments: - * -------- - * May alter the line buffer contents. - * Handles quoted strings and characters, removing trailing whitespace from - * quoted strings. - * Returns NULL string if the line is empty or is a comment. - * Code stolen from dtmwm. - * - *************************************<->***********************************/ -#else /* WSM */ -/*************************************<->************************************* - * - * GetString (linePP) - * - * - * Description: - * ----------- - * Returns the next quoted or whitespace-terminated nonquoted string in the - * line buffer. - * - * - * Inputs: - * ------ - * linePP = pointer to current line buffer pointer. - * - * - * Outputs: - * ------- - * linePP = pointer to revised line buffer pointer. - * Return = string - * - * - * Comments: - * -------- - * May alter the line buffer contents. - * Handles quoted strings and characters, removing trailing whitespace from - * quoted strings. - * Returns NULL string if the line is empty or is a comment. - * - *************************************<->***********************************/ -#endif /* WSM */ - -#ifdef WSM -unsigned char *GetStringC (unsigned char **linePP, Boolean SmBehavior) -#else /* WSM */ -unsigned char *GetString (unsigned char **linePP) -#endif /* WSM */ -{ - unsigned char *lineP = *linePP; - unsigned char *endP; - unsigned char *curP; - unsigned char *lnwsP; -#ifdef WSM - unsigned int level = 0, checkLev, i, quoteLevel[10]; -#endif /* WSM */ -#ifndef NO_MULTIBYTE - int chlen; - - /* get rid of leading white space */ - ScanWhitespace (&lineP); - - /* - * Return NULL if line is empty, a comment, or invalid. - */ -#ifdef WSM - if ( - *lineP == '\0' || - ((chlen = mblen ((char *)lineP, MB_CUR_MAX)) < 1) || - ((chlen == 1) && ((*lineP == '!') || - ((!SmBehavior) && (*lineP == '#')))) - ) -#else /* WSM */ - if ( - *lineP == '\0' || - ((chlen = mblen ((char *)lineP, MB_CUR_MAX)) < 1) || - ((chlen > 0) && ((*lineP == '!') || (*lineP == '#'))) - ) -#endif /* WSM */ - { - *linePP = lineP; - return (NULL); - } - - if ((chlen == 1) && (*lineP == '"')) - /* Quoted string */ - { -#ifdef WSM - quoteLevel[level] = 1; -#endif /* WSM */ - /* - * Start beyond double quote and find the end of the quoted string. - * '\' quotes the next character. - * Otherwise, matching double quote or NULL terminates the string. - * - * We use lnwsP to point to the last non-whitespace character in the - * quoted string. When we have found the end of the quoted string, - * increment lnwsP and if lnwsP < endP, write NULL into *lnwsP. - * This removes any trailing whitespace without overwriting the - * matching quote, needed later. If the quoted string was all - * whitespace, then this will write a NULL at the beginning of the - * string that will be returned -- OK. - */ - lnwsP = lineP++; /* lnwsP points to first '"' */ - curP = endP = lineP; /* other pointers point beyond */ - - while ((*endP = *curP) && - ((chlen = mblen ((char *)curP, MB_CUR_MAX)) > 0) && - ((chlen > 1) || (*curP != '"'))) - /* Haven't found matching quote yet. - * First byte of next character has been copied to endP. - */ - { - curP++; - if ((chlen == 1) && (*endP == '\\') && - ((chlen = mblen ((char *)curP, MB_CUR_MAX)) > 0)) - /* character quote: - * copy first byte of quoted nonNULL character down. - * point curP to next byte - */ - { -#ifdef WSM - if (SmBehavior) - { - /* - * Check to see if this is a quoted quote - if it is - * strip off a level - if not - it's sacred leave it alone - */ - checkLev = PeekAhead((curP - 1), quoteLevel[level]); - if(checkLev > 0) - { - if(quoteLevel[level] <= checkLev) - { - level--; - } - else - { - level++; - quoteLevel[level] = checkLev; - } - - for(i = 0;i < (checkLev - 2);i++) - { - *endP++ = *curP++;curP++; - } - *endP = *curP++; - } - } - else - { -#endif /* WSM */ - *endP = *curP++; -#ifdef WSM - } -#endif /* WSM */ - } - - if (chlen == 1) - /* Singlebyte character: character copy finished. */ - { - if (isspace (*endP)) - /* whitespace character: leave lnwsP unchanged. */ - { - endP++; - } - else - /* non-whitespace character: point lnwsP to it. */ - { - lnwsP = endP++; - } - } - else if (chlen > 1) - /* Multibyte (nonwhitespace) character: point lnwsP to it. - * Finish character byte copy. - */ - { - lnwsP = endP++; - while (--chlen) - { - *endP++ = *curP++; - lnwsP++; - } - } - } -#else - - /* get rid of leading white space */ - ScanWhitespace (&lineP); - -#ifdef WSM - /* Return NULL if line is empty, whitespace, or begins with a comment. */ - if ((lineP == NULL || *lineP == '\0') || - (!SmBehavior && (*lineP == '#'))) -#else /* WSM */ - /* Return NULL if line is empty, whitespace, or begins with a comment. */ - if ((lineP == NULL) || (*lineP == '\0') || (*lineP == '#')) -#endif /* WSM */ - { - *linePP = lineP; - return (NULL); - } - - if (*lineP == '"') - /* Quoted string */ - { -#ifdef WSM - quoteLevel[level] = 1; -#endif /* WSM */ - /* - * Start beyond double quote and find the end of the quoted string. - * '\' quotes the next character. - * Otherwise, matching double quote or NULL terminates the string. - * - * We use lnwsP to point to the last non-whitespace character in the - * quoted string. When we have found the end of the quoted string, - * increment lnwsP and if lnwsP < endP, write NULL into *lnwsP. - * This removes any trailing whitespace without overwriting the - * matching quote, needed later. If the quoted string was all - * whitespace, then this will write a NULL at the beginning of the - * string that will be returned -- OK. - */ - lnwsP = lineP++; /* lnwsP points to first '"' */ - curP = endP = lineP; /* other pointers point beyond */ - - while ((*endP = *curP) && (*endP != '"')) - /* haven't found matching quote yet */ - { - /* point curP to next character */ - curP++; - if ((*endP == '\\') && (*curP != '\0')) - /* shift quoted nonNULL character down and curP ahead */ - { -#ifdef WSM - if (SmBehavior) - { - /* - * Check to see if this is a quoted quote - if it is - * strip off a level - if not - it's sacred leave it alone - */ - checkLev = PeekAhead((curP - 1), quoteLevel[level]); - if(checkLev > 0) - { - if(quoteLevel[level] <= checkLev) - { - level--; - } - else - { - level++; - quoteLevel[level] = checkLev; - } - - for(i = 0;i < (checkLev - 2);i++) - { - *endP++ = *curP++;curP++; - } - *endP = *curP++; - } - } - else - { -#endif /* WSM */ - *endP = *curP++; -#ifdef WSM - } -#endif /* WSM */ - } - if (isspace (*endP)) - /* whitespace character: leave lnwsP unchanged. */ - { - endP++; - } - else - /* non-whitespace character: point lnwsP to it. */ - { - lnwsP = endP++; - } - } -#endif - - /* - * Found matching quote or NULL. - * NULL out any trailing whitespace. - */ - - lnwsP++; - if (lnwsP < endP) - { - *lnwsP = '\0'; - } - } - - else - /* Unquoted string */ - { - /* - * Find the end of the nonquoted string. - * '\' quotes the next character. - * Otherwise, whitespace, end-of-line, or '#' terminates the string. - */ - curP = endP = lineP; - -#ifndef NO_MULTIBYTE -#ifdef WSM - while ((*endP = *curP) && - ((chlen = mblen ((char *)curP, MB_CUR_MAX)) > 0) && - ((chlen > 1) || (!isspace (*curP) && - (SmBehavior || (*curP != '#'))))) -#else /* WSM */ - while ((*endP = *curP) && - ((chlen = mblen ((char *)curP, MB_CUR_MAX)) > 0) && - ((chlen > 1) || (!isspace (*curP) && (*curP != '#')))) -#endif /* WSM */ - /* Haven't found whitespace or '#' yet. - * First byte of next character has been copied to endP. - */ - { - curP++; - if ((chlen == 1) && (*endP == '\\') && - ((chlen = mblen ((char *)curP, MB_CUR_MAX)) > 0)) - /* character quote: - * copy first byte of quoted nonNULL character down. - * point curP to next byte - */ - { - *endP = *curP++; - } - endP++; - if (chlen > 1) - /* Multibyte character: finish character copy. */ - { - while (--chlen) - { - *endP++ = *curP++; - } - } - } -#else -#ifdef WSM - while ((*endP = *curP) && !isspace (*endP) && - (SmBehavior || (*endP != '#'))) -#else /* WSM */ - while ((*endP = *curP) && !isspace (*endP) && (*endP != '#')) -#endif /* WSM */ - { - /* point curP to next character */ - curP++; - if ((*endP == '\\') && (*curP != '\0')) - /* shift quoted nonNULL character down and curP ahead */ - { - *endP = *curP++; - } - endP++; - } -#endif - } - - /* - * Three cases for *endP: - * '#' --> write NULL over # and point to NULL - * whitespace or - * matching quote -> write end-of-line over char and point beyond - * NULL -> point to NULL - */ - -#ifdef WSM - if (!SmBehavior && (*endP == '#')) -#else /* WSM */ - if (*endP == '#') -#endif /* WSM */ - { - *endP = '\0'; /* write '\0' over '#' */ - *linePP = endP; /* point to '\0' */ - } - else if (*endP != '\0') - { - *endP = '\0'; /* write NULL over terminator */ - *linePP = ++curP; /* point beyond terminator */ - } - else - { - *linePP = endP; - } - return ((unsigned char *)lineP); - -} /* END OF FUNCTION GetString */ -#endif /* PANELIST */ - - - -/*************************************<->************************************* - * - * ParseBtnEvent (linePP, eventType, button, state, fClick) - * - * - * Description: - * ----------- - * Parse a button event specification. - * - * - * Inputs: - * ------ - * linePP = pointer to current line buffer pointer - * buttonEvents = (global) button event parse table - * modifierStrings = (global) modifier string/mask table - * - * - * Outputs: - * ------- - * linePP = pointer to revised line buffer pointer. - * eventType = type of event - * button = parsed button number - * state = composite modifier mask - * fClick = is click? - * - * Return = (Boolean) true iff valid button event specification - * - * - * Comments: - * -------- - * None. - * - *************************************<->***********************************/ - -Boolean ParseBtnEvent (unsigned char **linePP, - unsigned int *eventType, - unsigned int *button, - unsigned int *state, - Boolean *fClick) -{ - if (!ParseEvent (linePP, buttonEvents, eventType, button, state, fClick)) - { - return (FALSE); - } - - /* - * The following is a fix for an X11 deficiency in regards to - * modifiers in grabs. - */ - if (*eventType == ButtonRelease) - { - /* the button that is going up will always be in the modifiers... */ - *state |= buttonModifierMasks[*button]; - } - - return (TRUE); - -} /* END OF FUNCTION ParseBtnEvent */ - - - -/*************************************<->************************************* - * - * ParseKeyEvent (linePP, eventType, keyCode, state) - * - * - * Description: - * ----------- - * Parse a key event specification. - * - * - * Inputs: - * ------ - * linePP = pointer to current line buffer pointer - * keyEvents = (global) key event parse table - * modifierStrings = (global) modifier string/mask table - * - * - * Outputs: - * ------- - * linePP = pointer to revised line buffer pointer. - * eventType = type of event - * keyCode = parsed KeyCode - * state = composite modifier mask - * - * Return = (Boolean) true iff valid key event specification - * - * - * Comments: - * -------- - * None. - * - *************************************<->***********************************/ - -Boolean ParseKeyEvent (unsigned char **linePP, unsigned int *eventType, - KeyCode *keyCode, unsigned int *state) - - -{ - Boolean fClick; - unsigned int keySym = 0; - - if (!ParseEvent (linePP, keyEvents, eventType, &keySym, state, &fClick)) - { - return (FALSE); - } - - /* - * Here keySym is a KeySym. Convert it to a KeyCode. - * KeyCode will be set to 0 if keySym is not defined for any KeyCode - * (e.g. 0x001). - */ - - *keyCode = XKeysymToKeycode(DISPLAY, (KeySym) keySym); - - if (*keyCode == 0) - { - if (keySym == XK_F9) - { - keySym = XK_KP_F1; - } - else if (keySym == XK_F10) - { - keySym = XK_KP_F2; - } - else if (keySym == XK_F11) - { - keySym = XK_KP_F3; - } - else if (keySym == XK_F12) - { - keySym = XK_KP_F4; - } - *keyCode = XKeysymToKeycode(DISPLAY, (KeySym) keySym); - } - - return (*keyCode != 0); - -} /* END OF FUNCTION ParseKeyEvent */ - - -/*************************************<->************************************* - * - * ParseEvent (linePP, table, eventType, detail, state, fClick) - * - * - * Description: - * ----------- - * Parse an event specification. - * - * - * Inputs: - * ------ - * linePP = pointer to current line buffer pointer. - * table = event parse table - * modifierStrings = (global) modifier string/mask table - * - * - * Outputs: - * ------- - * linePP = pointer to revised line buffer pointer. - * eventType = type of event - * detail = dependent upon parse table detail procedure and closure - * state = composite modifier mask - * fClick = click flag - * - * Return = (Boolean) true iff valid event specification - * - * Comments: - * -------- - * None. - * - *************************************<->***********************************/ - -static Boolean ParseEvent (unsigned char **linePP, EventTableEntry *table, - unsigned int *eventType, unsigned int *detail, - unsigned int *state, Boolean *fClick) -{ - unsigned char *lineP = *linePP; - Cardinal ix; - Boolean status; - - /* Parse the modifiers */ - if (!ParseModifiers (&lineP, state) || *lineP != '<') - { - return (FALSE); - } - lineP++; /* skip '<' */ - - /* Parse the event type */ - if (!ParseEventType (&lineP, table, eventType, &ix) || *lineP != '>') - { - return (FALSE); - } - lineP++; /* skip '>' */ - - /* - * Compute detail and fClick. - * Status will be False for a invalid KeySym name. - */ - status = (*(table[ix].parseProc))(&lineP, table[ix].closure, detail); - *fClick = table[ix].fClick; - - if (status) - { - *linePP = lineP; - } - return (status); - -} /* END OF FUNCTION ParseEvent */ - - - -/*************************************<->************************************* - * - * ParseModifiers(linePP, state) - * - * - * Description: - * ----------- - * Parses a modifier specification. - * - * - * Inputs: - * ------ - * linePP = pointer to current line buffer pointer. - * modifierStrings = (global) modifier string/mask table - * - * - * Outputs: - * ------- - * linePP = pointer to revised line buffer pointer. - * state = composite modifier mask - * Return = (Boolean) true iff valid modifier name - * - * - * Comments: - * -------- - * If successful, will be followed by NULL or '<'. - * - *************************************<->***********************************/ - -static Boolean ParseModifiers(unsigned char **linePP, unsigned int *state) -{ - unsigned char *lineP = *linePP; - unsigned char *startP; - unsigned char modStr[MAX_MODIFIER_STRLEN+1]; - Boolean fNot; - unsigned int maskBit; - int len; - - *state = 0; - - /* - * Parse modifiers until the event specifier is encountered. - */ - - ScanWhitespace (&lineP); - while ((*lineP != '\0') && (*lineP != '<')) - { - if (*lineP == '~') - { - fNot = TRUE; - lineP++; - } - else - { - fNot = FALSE; - } - - startP = lineP; - ScanAlphanumeric (&lineP); - if (startP == lineP) - /* ERROR: Modifier or '<' missing */ - { - return (FALSE); - } - len = min(lineP - startP, MAX_MODIFIER_STRLEN); - (void) strncpy ((char *)modStr, (char *)startP, len); - modStr[len] = '\0'; - - if (!LookupModifier (modStr, &maskBit)) - /* Unknown modifier name */ - { - return (FALSE); - } - - if (fNot) - { - *state &= ~maskBit; - } - else - { - *state |= maskBit; - } - ScanWhitespace(&lineP); - } - - *linePP = lineP; - return (TRUE); /* must have '<' or NULL following */ - -} /* END OF FUNCTION ParseModifiers */ - - -/*************************************<->************************************* - * - * LookupModifier (name, valueP) - * - * - * Description: - * ----------- - * Return the modifier mask for the provided modifier name. - * - * - * Inputs: - * ------ - * name = modifier string - * modifierStrings = modifier string/mask table - * - * - * Outputs: - * ------- - * valueP = modifier mask - * Return = (Boolean) true iff valid modifier name - * - * - * Comments: - * -------- - * None. - * - *************************************<->***********************************/ - -static Boolean LookupModifier (unsigned char *name, unsigned int *valueP) -{ - register int i; - - if (name != NULL) - { - ToLower (name); - for (i=0; modifierStrings[i].name != NULL; i++) - { - if (!strcmp (modifierStrings[i].name, (char *)name)) - { - *valueP = modifierStrings[i].mask; - return (TRUE); - } - } - } - - return (FALSE); - -} /* END OF FUNCTION LookupModifier */ - - -#if ((!defined(WSM)) || defined(MWM_QATS_PROTOCOL)) -/*************************************<->************************************* - * - * GetCCIModifier (modString, mod) - * - * - * Description: - * ----------- - * Return the cci modifier corresponding to the specified string - * - * - * Inputs: - * ------ - * modString = cci modifier string; may be null - * - * - * Outputs: - * ------- - * mod = cci modifier. - * Return = (Boolean) true iff valid modifier string - * - * - * Comments: - * -------- - * None. - * - *************************************<->***********************************/ - -static Boolean GetCCIModifier (String modString, CCIEntryModifier *mod) -{ - CCIEntryModifier i; - - - if (modString != NULL) - { - ToLower ((unsigned char *)modString); - for (i=NONE; i<=EXCLUDE; i++) - { - if (!strcmp (CCIEntryModifierNames[i], modString)) - { - *mod = i; - return (TRUE); - } - } - } - - return (FALSE); - -} /* END OF FUNCTION GetCCIModifier */ - - -/*************************************<->************************************* - * - * FixMenuItem (menuSpec, menuItem) - * - * - * Description: - * ----------- - * Fix-up the menuItem so that it appears an old-style cci command was - * read from the .mwmrc file - * - * - * Inputs: - * ------ - * menuItem = the menu item structure - * menuSpec = the menu specification structure - * - * - * Outputs: - * ------- - * menuItem = the fixed-up menuitem - * menuSpec = the fixed-up menu specification structure if EXCLUDE found - * Return = nothing - * - * Comments: - * -------- - * - *************************************<->***********************************/ - -static void FixMenuItem (MenuSpec *menuSpec, MenuItem *menuItem) -{ - String tmp; - CCIFuncArg *cciArg; - - - if (menuItem == NULL) - return; - - cciArg = (CCIFuncArg *)menuItem->wmFuncArgs; - - menuItem->clientCommandName = menuItem->label; - menuItem->label = cciArg->cciEntry; - - /* - * Fix-up the label to handle the modifier. - */ - - switch (cciArg->mod) - { - case NONE: - break; - - case INLINE: - break; - - case CASCADE: - /* -> */ - tmp = (String) XtMalloc(strlen(menuItem->label) + 3); - sprintf(tmp, "->%s", menuItem->label); - XtFree(menuItem->label); - menuItem->label = tmp; - break; - - case DELIMIT: - /* = */ - tmp = (String) XtMalloc(strlen(menuItem->label) + 2); - sprintf(tmp, "=%s", menuItem->label); - XtFree(menuItem->label); - menuItem->label = tmp; - break; - - case DELIMIT_INLINE: - break; - - case DELIMIT_CASCADE: - /* => */ - tmp = (String) XtMalloc(strlen(menuItem->label) + 3); - sprintf(tmp, "=>%s", menuItem->label); - XtFree(menuItem->label); - menuItem->label = tmp; - break; - - case EXCLUDE: - /* ~ */ - StoreExclusion(menuSpec, menuItem->label); - - tmp = (String) XtMalloc(strlen(menuItem->label) + 2); - sprintf(tmp, "~%s", menuItem->label); - XtFree(menuItem->label); - menuItem->label = tmp; - break; - } -} -#endif /* !defined(WSM) || defined(MWM_QATS_PROTOCOL) */ - - -/*************************************<->************************************* - * - * ParseEventType(linePP, table, eventType, ix) - * - * - * Description: - * ----------- - * Parses the event type string. - * - * - * Inputs: - * ------ - * linePP = pointer to current line buffer pointer. - * table = event parse table - * - * - * Outputs: - * ------- - * linePP = pointer to revised line buffer pointer. - * eventType = type of event - * ix = table index for matched event - * - * Return = (Boolean) true iff valid event - * - * - * Comments: - * -------- - * None. - * - *************************************<->***********************************/ - -static Boolean ParseEventType (unsigned char **linePP, EventTableEntry *table, - unsigned int *eventType, Cardinal *ix) -{ - unsigned char *lineP = *linePP; - unsigned char *startP = *linePP; - unsigned char eventTypeStr[MAX_EVENTTYPE_STRLEN+1]; - register int len; - - /* Parse out the event string */ - ScanAlphanumeric (&lineP); - - /* - * Attempt to match the parsed event against our supported event set. - */ - - if (startP != lineP) - { - len = min (lineP - startP, MAX_EVENTTYPE_STRLEN); - (void) strncpy ((char *)eventTypeStr, (char *)startP, len); - eventTypeStr[len] = '\0'; - ToLower (eventTypeStr); - - for (len = 0; table[len].event != NULL; len++) - if (!strcmp (table[len].event, (char *)eventTypeStr)) - { - *ix = len; - *eventType = table[*ix].eventType; - *linePP = lineP; - return (TRUE); - } - } - - /* Unknown event specified */ - return (FALSE); - -} /* END OF FUNCTION ParseEventType */ - - -/*************************************<->************************************* - * - * ParseImmed (linePP, closure, detail) - * - * - * Description: - * ----------- - * Button event detail procedure. - * - * - * Inputs: - * ------ - * linePP = not used - * closure = table entry - * - * - * Outputs: - * ------- - * detail = pointer to closure - * - * Return = TRUE - * - * - * Comments: - * -------- - * None. - * - *************************************<->***********************************/ - -static Boolean ParseImmed (unsigned char **linePP, unsigned int closure, - unsigned int *detail) -{ - *detail = closure; - return (TRUE); - -} /* END OF FUNCTION ParseImmed */ - - -/*************************************<->************************************* - * - * ParseKeySym (linePP, closure, detail) - * - * - * Description: - * ----------- - * Key event detail procedure. Parses a KeySym string. - * - * - * Inputs: - * ------ - * linePP = pointer to current line buffer pointer - * - * closure = not used. - * - * - * Outputs: - * ------- - * linePP = pointer to revised line buffer pointer - * detail = pointer to parsed KeySym - * - * Return = (Boolean) true iff valid KeySym string - * - * - * Comments: - * -------- - * None. - * - *************************************<->***********************************/ - -static Boolean ParseKeySym (unsigned char **linePP, unsigned int closure, - unsigned int *detail) -{ - unsigned char *lineP = *linePP; - unsigned char *startP; - char keySymName[MAX_KEYSYM_STRLEN+1]; - int len; -#ifndef NO_MULTIBYTE - int chlen; -#endif - - ScanWhitespace (&lineP); - startP = lineP; - -#ifndef NO_MULTIBYTE - while (*lineP && - ((chlen = mblen ((char *)lineP, MB_CUR_MAX)) > 0) && - ((chlen > 1) || - (!isspace (*lineP) && *lineP != ',' && *lineP != ':'))) - { - /* Skip next character */ - lineP += chlen; - } -#else - while (*lineP && !isspace (*lineP) && *lineP != ',' && *lineP != ':' ) - { - /* Skip next character */ - lineP++; - } -#endif - - len = min (lineP - startP, MAX_KEYSYM_STRLEN); - (void) strncpy (keySymName, (char *)startP, len); - keySymName[len] = '\0'; - -#ifndef NO_MULTIBYTE - if ((*detail = XStringToKeysym(keySymName)) == NoSymbol && - (mblen (keySymName, MB_CUR_MAX) == 1)) -#else - if ((*detail = XStringToKeysym(keySymName)) == NoSymbol) -#endif - { - if (!isdigit (keySymName[0]) || - ((*detail = StrToNum ((unsigned char *)&keySymName[0])) == -1)) - { - *detail = NoSymbol; - return (FALSE); - } - } - *linePP = lineP; - return (TRUE); - -} /* END OF FUNCTION ParseKeySym */ - - - -/*************************************<->************************************* - * - * StrToNum(str) - * - * - * Description: - * ----------- - * Converts a string to an unsigned hexadecimal, decimal, or octal integer. - * - * - * Inputs: - * ------ - * str = character string - * - * - * Outputs: - * ------- - * Return = unsigned integer - * - * - * Comments: - * -------- - * None. - * - *************************************<->***********************************/ - -static unsigned int StrToNum(unsigned char *str) -{ - unsigned char c; - unsigned int val = 0; - - if (*str == '0') - { - str++; - if (*str == 'x' || *str == 'X') - { - return (StrToHex(++str)); - } - return (StrToOct(str)); - } - - while ((c = *str) != '\0') - { - if ('0' <= c && c <= '9') - { - val = val*10+c-'0'; - } - else - { - return (-1); - } - str++; - } - - return (val); - -} /* END OF FUNCTION StrToNum */ - - - -/*************************************<->************************************* - * - - * - * - * Description: - * ----------- - * - * Inputs: - * ------ - * - * - * Outputs: - * ------- - * - * Comments: - * -------- - * None. - * - *************************************<->***********************************/ - -static unsigned int StrToHex(unsigned char *str) -{ - unsigned char c; - unsigned int val = 0; - - while ((c = *str) != '\0') - { - if ('0' <= c && c <= '9') - { - val = val*16+c-'0'; - } - else if ('a' <= c && c <= 'f') - { - val = val*16+c-'a'+10; - } - else if ('A' <= c && c <= 'F') - { - val = val*16+c-'A'+10; - } - else - { - return (-1); - } - str++; - } - - return (val); - -} /* END OF FUNCTION StrToHex */ - - - -/*************************************<->************************************* - * - - * - * - * Description: - * ----------- - * - * Inputs: - * ------ - * - * - * Outputs: - * ------- - * - * Comments: - * -------- - * None. - * - *************************************<->***********************************/ - -static unsigned int StrToOct(unsigned char *str) -{ - unsigned char c; - unsigned int val = 0; - - while ((c = *str) != '\0') - { - if ('0' <= c && c <= '7') - { - val = val*8+c-'0'; - } - else - { - return (-1); - } - str++; - } - - return (val); - -} /* END OF FUNCTION StrToOct */ - - - -/*************************************<->************************************* - * - * ScanAlphanumeric (linePP) - * - * - * Description: - * ----------- - * Scan string until a non-alphanumeric character is encountered. - * - * - * Inputs: - * ------ - * linePP = nonNULL pointer to current line buffer pointer - * - * - * Outputs: - * ------- - * linePP = nonNULL pointer to revised line buffer pointer - * - * - * Comments: - * -------- - * Assumes linePP is nonNULL - * - *************************************<->***********************************/ - -void ScanAlphanumeric (unsigned char **linePP) -{ -#ifndef NO_MULTIBYTE - int chlen; - - while (*linePP && - ((chlen = mblen ((char *) *linePP, MB_CUR_MAX)) > 0) && - ((chlen > 1) || isalnum (**linePP))) - { - (*linePP) += chlen; - } -#else - while (*linePP && isalnum (**linePP)) - { - (*linePP)++; - } -#endif - -} /* END OF FUNCTION ScanAlphanumeric */ - - -#ifndef WSM - -/*************************************<->************************************* - * - * ScanWhitespace(linePP) - * - * - * Description: - * ----------- - * Scan the string, skipping over all white space characters. - * - * - * Inputs: - * ------ - * linePP = nonNULL pointer to current line buffer pointer - * - * - * Outputs: - * ------- - * linePP = nonNULL pointer to revised line buffer pointer - * - * - * Comments: - * -------- - * Assumes linePP is nonNULL - * - *************************************<->***********************************/ - -void ScanWhitespace(unsigned char **linePP) -{ -#ifndef NO_MULTIBYTE - while (*linePP && (mblen ((char *)*linePP, MB_CUR_MAX) == 1) && isspace (**linePP)) -#else - while (*linePP && isspace (**linePP)) -#endif - { - (*linePP)++; - } - -} /* END OF FUNCTION ScanWhitespace */ -#endif /* not WSM */ - -#ifndef WSM - -/*************************************<->************************************* - * - * ToLower (string) - * - * - * Description: - * ----------- - * Lower all characters in a string. - * - * - * Inputs: - * ------ - * string = NULL-terminated character string or NULL - * - * - * Outputs: - * ------- - * string = NULL-terminated lower case character string or NULL - * - * - * Comments: - * -------- - * None. - * - *************************************<->***********************************/ - -void ToLower (unsigned char *string) -{ - unsigned char *pch = string; -#ifndef NO_MULTIBYTE - int chlen; - - while (*pch && ((chlen = mblen ((char *)pch, MB_CUR_MAX)) > 0)) - { - if ((chlen == 1) && (isupper (*pch))) - { - *pch = tolower(*pch); - } - pch += chlen; - } -#else - while (*pch != '\0') - { - if (isupper (*pch)) - { - *pch = tolower(*pch); - } - pch++; - } -#endif - -} /* END OF FUNCTION ToLower */ -#endif /* WSM */ - - -/*************************************<->************************************* - * - * PWarning (message) - * - * - * Description: - * ----------- - * This function lists a resource description parse message to stderr. - * - * - * Inputs: - * ------ - * message = pointer to a message string - * cfileP = (global) file pointer to fopened configuration file or NULL - * linec = (global) line counter - * - *************************************<->***********************************/ - -void -PWarning (char *message) -{ - -#ifdef WSM - char pch[MAXWMPATH+1]; - String sMessage; - char *pchFile; - - sMessage = XtNewString ((String) message); - if (cfileP != NULL) - { - if (pConfigStackTop->fileName) - { - pchFile = pConfigStackTop->fileName; - } - else - { - pchFile = wmGD.configFile; - } - - sprintf (pch, pWarningStringFile, - GETMESSAGE(20,1,"Workspace Manager"), - sMessage, linec, pchFile); - } - else - { - sprintf (pch, pWarningStringLine, - GETMESSAGE(20,1,"Workspace Manager"), - sMessage, linec); - } - _DtSimpleError (wmGD.mwmName, DtIgnore, NULL, pch, NULL); - XtFree (sMessage); -#else /* WSM */ - if (cfileP != NULL) - { - fprintf (stderr, ((char *)GETMESSAGE(60, 33, "%s: %s on line %d of configuration file %s\n")), - wmGD.mwmName, message, linec, - wmGD.configFile ? wmGD.configFile : cfileName); - } - else - { - fprintf (stderr, ((char *)GETMESSAGE(60, 34, "%s: %s on line %d of specification string\n")), - wmGD.mwmName, message, linec); - } - fflush (stderr); -#endif /* WSM */ - - -} /* END OF FUNCTION PWarning */ - -#ifdef WSM -/* - * Key substitution table entry - */ - -typedef struct _keySubs -{ - unsigned char * pchFrom; - int lenFrom; - unsigned char * pchTo; -} KeySub; - - -/*************************************<->************************************* - * - * InitKeySubs (ppKeySubs, pNumKeySubs) - * - * - * Description: - * ----------- - * Initialize key label substitutions used in acclerator text - * - * - * Inputs: - * ------ - * ppKeySubs = ptr to key substitution table ptr - * pNumKeySubs = ptr to number of key substitutions - * - * - * Outputs: - * ------- - * *ppKeySubs = ptr to key substitution table - * *pNumKeySubs = number of substitutions found - * - * Comments: - * -------- - * *ppKeySubs is allocated with XtMalloc in a complicated way. - * If this ever needs to be freed, a function to free it needs to - * be written. - * - *************************************<->***********************************/ - -static void InitKeySubs ( - KeySub **ppKeySubs, - int *pNumKeySubs) -{ - int numKS; - KeySub *pKS; - KeySub *pKSret; - unsigned char *pch0; - unsigned char *pch1; - int len; -#ifndef NO_MULTIBYTE - int chlen; -#endif - - pch0 = (unsigned char *)GETMESSAGE(60, 40, ""); - - if ((pch0 == NULL) || (*pch0 == '\0')) - { - *ppKeySubs = NULL; - *pNumKeySubs = 0; - return; - } - - pKSret = NULL; - numKS = 0; - - while (*pch0 != '\0') - { - ScanWhitespace (&pch0); - if (*pch0 == '\0') break; - - /* - * allocate space for next key sub - */ - if (pKSret == NULL) - { - pKSret = (KeySub *) XtMalloc (1*sizeof(KeySub)); - } - else - { - pKSret = (KeySub *) XtRealloc ((char *)pKSret, - (numKS+1)*sizeof(KeySub)); - } - pKS = &pKSret[numKS]; - - /* get "from" string */ - pch1 = pch0; -#ifndef NO_MULTIBYTE - while (*pch1 && ((chlen = mblen ((char *)pch1, MB_CUR_MAX)) > 0)) - { - if ((chlen == 1) && (*pch1 == ' ')) - { - break; - } - pch1 += chlen; - } -#else /* NO_MULTIBYTE */ - while (*pch1 && (*pch1 != ' ')) pch1++; -#endif /* NO_MULTIBYTE */ - pKS->lenFrom = pch1 - pch0; - if (pKS->lenFrom < 1) - { - /* - * no "from" string - */ - break; - } - pKS->pchFrom = (unsigned char *) XtMalloc (1+pKS->lenFrom); - memcpy (pKS->pchFrom, pch0, pKS->lenFrom); - pKS->pchFrom[pKS->lenFrom] = '\0'; - - /* get "to" string */ - ScanWhitespace (&pch1); - pch0 = pch1; - -#ifndef NO_MULTIBYTE - while (*pch1 && ((chlen = mblen ((char *)pch1, MB_CUR_MAX)) > 0)) - { - if ((chlen == 1) && (*pch1 == ' ')) - { - break; - } - pch1 += chlen; - } -#else /* NO_MULTIBYTE */ - while (*pch1 && (*pch1 != ' ')) pch1++; -#endif /* NO_MULTIBYTE */ - - len = pch1 - pch0; - if (len < 1) - { - /* - * Invalid format, "from" string with no "to" string. - */ - break; - } - pKS->pchTo = (unsigned char *) XtMalloc (1+len); - memcpy (pKS->pchTo, pch0, len); - pKS->pchTo[len] = '\0'; - - /* advance cursor */ - pch0 = pch1; - - /* got one, bump the counter */ - numKS++; - } - - *ppKeySubs = pKSret; - *pNumKeySubs = numKS; -} - -#endif /* WSM */ - -/*************************************<->************************************* - * - * ProcessAccelText (startP, endP, destP) - * - * - * Description: - * ----------- - * Process accelerator text and copy into string. - * - * - * Inputs: - * ------ - * startP = pointer to start of valid accelerator specification - * endP = pointer past end of accelerator specification - * destP = pointer to destination buffer - * - * - * Outputs: - * ------- - * Destination buffer has processed accelerator text. - * - * Comments: - * -------- - * None. - * - *************************************<->***********************************/ - -static void ProcessAccelText (unsigned char *startP, unsigned char *endP, - unsigned char *destP) -{ -#ifndef NO_MULTIBYTE - int chlen; -#endif -#ifdef WSM - static Boolean bAccelInit = False; - static KeySub *pKeySub; - static int numKeySubs; - unsigned char * pchFirst; - unsigned char * pchSub; - int lenSub; - int i; - - if (!bAccelInit) - { - InitKeySubs (&pKeySub, &numKeySubs); - bAccelInit = True; - } -#endif /* WSM */ - - /* - * Copy modifiers - */ - - ScanWhitespace (&startP); - - while (*startP != '<') - { - if (*startP == '~') - { - *destP++ = *startP++; - } -#ifdef WSM - pchFirst = startP; -#endif /* WSM */ - -#ifndef NO_MULTIBYTE - while (*startP && - (((chlen = mblen ((char *)startP, MB_CUR_MAX)) > 1) - || isalnum (*startP))) - { - while (chlen--) - { -#ifdef WSM - startP++; - -#else /* WSM */ - *destP++ = *startP++; -#endif /* WSM */ - } - } -#else - while (isalnum (*startP)) - { -#ifdef WSM - startP++; -#else /* WSM */ - *destP++ = *startP++; -#endif /* WSM */ - } -#endif -#ifdef WSM - /* find substitution */ - pchSub = NULL; - lenSub = 0; - - for (i=0; i 0)) - { - memcpy (destP, pchSub, lenSub); - destP += lenSub; - } - else - { - memcpy (destP, pchFirst, startP-pchFirst); - destP += startP-pchFirst; - } -#endif /* WSM */ - *destP++ = '+'; - - ScanWhitespace (&startP); - } - - /* - * Skip the key event type. - */ - startP++; /* skip '<' */ - while (*startP != '>') - { -#ifndef NO_MULTIBYTE - startP += mblen ((char *)startP, MB_CUR_MAX); -#else - startP++; -#endif - } - startP++; /* skip '>' */ - - /* - * Copy the KeySym string. - */ - - ScanWhitespace (&startP); - while (startP != endP) - { - *destP++ = *startP++; - } - *destP = '\0'; - -} /* END OF FUNCTION ProcessAccelText */ - - - -/*************************************<->************************************* - * - * ProcessCommandLine (argc, argv) - * - * - * Description: - * ----------- - * This function looks for and processes mwm options in the command line - * - * Inputs: - * ------ - * argc = argument count. - * argv = argument vector. - * - * - * Outputs: - * ------- - * Changes global data to based on command line options recognized - * - * - *************************************<->***********************************/ -#define SCREENS_OPT "-screens" -#define MULTI_SCREEN_OPT "-multiscreen" - -void ProcessCommandLine (int argc, char *argv[]) -{ - unsigned char *string; - int argnum; - unsigned char *lineP; - - for (argnum = 1; argnum < argc; argnum++) - { - lineP = (unsigned char *) argv[argnum]; - if ((string = GetString (&lineP)) == NULL) - /* empty or comment line */ - { - continue; - } - if (!strcmp((char *)string, MULTI_SCREEN_OPT)) - { - wmGD.multiScreen = True; - wmGD.numScreens = ScreenCount (DISPLAY); - } - else if (!strcmp((char *)string, SCREENS_OPT)) - { - argnum++; /* skip to next arg */ - ParseScreensArgument (argc, argv, &argnum, lineP); - } - } - -} /* END OF FUNCTION ProcessCommandLine */ - - -/*************************************<->************************************* - * - * ParseScreensArgument (argc, argv, pArgnum, lineP) - * - * - * Description: - * ----------- - * This function processes the ``-screens'' command line argument - * - * Inputs: - * ------ - * argc = argument count. - * argv = argument vector. - * pArgnum = pointer to argument number where processing left off - * lineP = pointer into argv[*pArgnum] where processing left off - * - * - * Outputs: - * ------- - * Changes global data to based on command line options recognized - * + wmGD.screenNames - * + wmGD.numScreens - * Assumes default screenNames are already in place - * - *************************************<->***********************************/ - -static void ParseScreensArgument (int argc, char *argv[], int *pArgnum, - unsigned char *lineP) -{ - unsigned char *string; - int sNum = 0; - int lastLen; - int nameCount = 0; - - for (; (*pArgnum < argc) && (sNum < ScreenCount(DISPLAY)); - (*pArgnum)++, sNum++) - { - lineP = (unsigned char *)argv[*pArgnum]; - if (*argv[*pArgnum] == '"') - { - /* - * if Quote, use GetString to strip it - */ - if ((string = GetString (&lineP)) == NULL) - /* empty or comment line */ - { - continue; - } - } - else - { - string = (unsigned char *)argv[*pArgnum]; - if (*string == '-') - { - /* another option, end of screens names */ - break; - } - } - - if (!(wmGD.screenNames[sNum] = (unsigned char *) - XtRealloc ((char*)wmGD.screenNames[sNum], - 1 + strlen((char *)string)))) - { - Warning (((char *)GETMESSAGE(60, 31, "Insufficient memory for screen names"))); - ExitWM(WM_ERROR_EXIT_VALUE); - } - else - { - strcpy((char *)wmGD.screenNames[sNum], (char *)string); - nameCount++; - } - } - - (*pArgnum)--; - - /* - * remaining screens (if any) get first name specified - */ - if (nameCount > 0) - { - lastLen = 1 + strlen((char *)wmGD.screenNames[0]); - for (; sNum < ScreenCount(DISPLAY); sNum++) - { - if (!(wmGD.screenNames[sNum] = (unsigned char *) - XtRealloc ((char*)wmGD.screenNames[sNum], lastLen))) - { - Warning (((char *)GETMESSAGE(60, 32, "Insufficient memory for screen names"))); - ExitWM(WM_ERROR_EXIT_VALUE); - } - else - { - strcpy((char *)wmGD.screenNames[sNum], - (char *)wmGD.screenNames[0]); - } - } - } - -} /* END OF FUNCTION ParseScreensArgument */ - - -/*************************************<->************************************* - * - * ProcessMotifBindings () - * - * - * Description: - * ----------- - * This function is used retrieve the motif input bindings - * and put them into a property on the root window. - * - * - *************************************<->***********************************/ -void ProcessMotifBindings (void) -{ - char fileName[MAXWMPATH+1]; - char *bindings = NULL; -#ifndef MOTIF_ONE_DOT_ONE - char *homeDir = XmeGetHomeDirName(); -#else - FILE *fileP; -#endif - - /* - * Look in the user's home directory for .motifbind - */ - -#ifdef MOTIF_ONE_DOT_ONE - GetHomeDirName(fileName); -#else - strcpy (fileName, homeDir); -#endif - strncat(fileName, "/", MAXWMPATH-strlen(fileName)); - strncat(fileName, MOTIF_BINDINGS_FILE, MAXWMPATH-strlen(fileName)); - -#ifdef MOTIF_ONE_DOT_ONE - if ((fileP = fopen (fileName, "r")) != NULL) - { - unsigned char buffer[MBBSIZ]; - int count; - Boolean first = True; - int mode = PropModeReplace; - Window propWindow; - - /* - * Get the atom for the property. - */ - wmGD.xa_MOTIF_BINDINGS = - XInternAtom (DISPLAY, _XA_MOTIF_BINDINGS, False); - - /* - * The property goes on the root window of screen zero - */ - propWindow = RootWindow(DISPLAY, 0); - - /* - * Copy file contents to property on root window of screen 0. - */ - while ( (count=fread((char *) &buffer[0], 1, MBBSIZ, fileP)) > 0) - { - XChangeProperty (DISPLAY, propWindow, wmGD.xa_MOTIF_BINDINGS, - XA_STRING, 8, mode, - &buffer[0], count); - - if (first) - { - first = False; - mode = PropModeAppend; - } - } - } - -#else - XDeleteProperty (DISPLAY, RootWindow (DISPLAY, 0), - XInternAtom (DISPLAY, "_MOTIF_BINDINGS", False)); - XDeleteProperty (DISPLAY, RootWindow (DISPLAY, 0), - XInternAtom (DISPLAY, "_MOTIF_DEFAULT_BINDINGS", False)); - - if (_XmVirtKeysLoadFileBindings (fileName, &bindings) == True) { - XChangeProperty (DISPLAY, RootWindow(DISPLAY, 0), - XInternAtom (DISPLAY, "_MOTIF_BINDINGS", False), - XA_STRING, 8, PropModeReplace, - (unsigned char *)bindings, strlen(bindings)); - } - else { - _XmVirtKeysLoadFallbackBindings (DISPLAY, &bindings); - } - XtFree (bindings); -#endif -} /* END OF FUNCTION ProcessMotifBindings */ - -#ifdef PANELIST - -/*************************************<->************************************* - * - * void - * ParseWmFunctionArg (linePP, ix, wmFunc, ppArg, sClientName) - * - * - * Description: - * ----------- - * Parse the function arguments for a window manager function. - * - * - * Inputs: - * ------ - * linePP = pointer to line buffer pointer (contains string arg). - * ix = window manager function index (returned by ParseWmFunction) - * pWmFunction = pointer to window manager function destination. - * ppArg = ptr to argument pointer. - * sClientName = string name of client - * - * - * Outputs: - * ------- - * *ppArg = arg to pass to window manager function when invoking. - * Return = true on succes, false on some kind of parse error - * - * - * Comments: - * -------- - * functionTable (window manager function table) is indexed with ix - * to get parsing info. - * - * This function may malloc memory for the returned arg. - * - * The sClientName is needed for starting some hpterm-based push_recall - * clients. It needs to be passed into the action so the hpterm gets - * named appropriately. - * - *************************************<->***********************************/ - -Boolean -ParseWmFunctionArg ( - unsigned char **linePP, - int ix, - WmFunction wmFunc, - void **ppArg, - String sClientName, - String sTitle) -{ - unsigned char *lineP = *linePP; - Boolean bValidArg = True; - unsigned char *str = NULL; - - /* - * If this is (possibly) a string argument, put it - * in quotes so that it will be parsed properly. - */ - if ((functionTable[ix].parseProc == ParseWmFuncStrArg) || - (functionTable[ix].parseProc == ParseWmFuncMaybeStrArg)) - { - if (lineP && *lineP != '"') - { - /* - * not in quotes, repackage it, escaping the appropriate - * characters. - */ - str = _DtWmParseMakeQuotedString (lineP); - if (str) - { - lineP = str; - } - } - } - - /* - * Apply the function argument parser. - */ - if ((functionTable[ix].wmFunction != wmFunc) || - !(*(functionTable [ix].parseProc)) (&lineP, wmFunc, ppArg)) - { - bValidArg = False; - } - - /* - * Add the exec parms if this is an f.action - */ - if ((wmFunc == F_Action) && ppArg && *ppArg) - { - WmActionArg *pAP = (WmActionArg *) *ppArg; - int totLen = 0; - - /* - * allocate more than enough string space to copy - * strings and intervening spaces. - */ - if (sClientName && *sClientName) - { - /* length of: "name=" + sClientName + NULL */ - totLen += 5 + strlen(sClientName) + 1; - } - if (sTitle && *sTitle) - { - /* length of: "," + "title=" + sTitle + NULL */ - totLen += 1 + 6 + strlen(sTitle) + 1; - } - - if (totLen > 0) - { - pAP->szExecParms = (String) XtMalloc (totLen); - /* start with empty string */ - pAP->szExecParms[0] = '\0'; - - if (sClientName && *sClientName) - { - strcat (pAP->szExecParms, "name="); - strcat (pAP->szExecParms, sClientName); - } - if (sTitle && *sTitle) - { - if (pAP->szExecParms[0] != '\0') - { - strcat (pAP->szExecParms, ","); - } - strcat (pAP->szExecParms, "title="); - strcat (pAP->szExecParms, sTitle); - } - } - } - - if (str) - { - XtFree ((char *) str); - } - - return (bValidArg); - -} /* END OF FUNCTION ParseWmFunctionArg */ - - -/*************************************<->************************************* - * - * SystemCmd (pchCmd) - * - * - * Description: - * ----------- - * This function fiddles with our signal handling and calls the - * system() function to invoke a unix command. - * - * - * Inputs: - * ------ - * pchCmd = string with the command we want to exec. - * - * Outputs: - * ------- - * - * - * Comments: - * -------- - * The system() command is touchy about the SIGCLD behavior. Restore - * the default SIGCLD handler during the time we run system(). - * - *************************************<->***********************************/ - -void -SystemCmd (char *pchCmd) -{ - struct sigaction sa; - struct sigaction osa; - - (void) sigemptyset(&sa.sa_mask); - sa.sa_flags = 0; - sa.sa_handler = SIG_DFL; - - (void) sigaction (SIGCLD, &sa, &osa); - - system (pchCmd); - - (void) sigaction (SIGCLD, &osa, (struct sigaction *) 0); -} - - - -/*************************************<->************************************* - * - * DeleteTempConfigFileIfAny () - * - * - * Description: - * ----------- - * This function deletes the temporary config file used to process - * old dtwmrc syntax. - * - * - * Inputs: - * ------ - * - * - * Outputs: - * ------- - * - * - * Comments: - * -------- - * - *************************************<->***********************************/ - -void -DeleteTempConfigFileIfAny (void) -{ - char pchCmd[MAXWMPATH+1]; - - if (pConfigStackTop->tempName) - { - strcpy (pchCmd, "/bin/rm "); - strcat (pchCmd, pConfigStackTop->tempName); - SystemCmd (pchCmd); - XtFree ((char *) pConfigStackTop->tempName); - pConfigStackTop->tempName = NULL; - } - if (pConfigStackTop->cppName) - { - strcpy (pchCmd, "/bin/rm "); - strcat (pchCmd, pConfigStackTop->cppName); - SystemCmd (pchCmd); - XtFree ((char *) pConfigStackTop->cppName); - pConfigStackTop->cppName = NULL; - } -} - - -/*************************************<->************************************* - * - * ParseIncludeSet (pSD, lineP) - * - * - * Description: - * ----------- - * - * - * Inputs: - * ------ - * cfileP = (global) file pointer to fopened configuration file or NULL - * lineP = pointer to line buffer - * line = (global) line buffer - * linec = (global) line count - * parseP = (global) parse string pointer if cfileP == NULL - * pSD->rootWindow = default root window of display - * - * Outputs: - * ------- - * linec = (global) line count incremented - * parseP = (global) parse string pointer if cfileP == NULL - * - * - * Comments: - * -------- - * - *************************************<->***********************************/ - -static void ParseIncludeSet (WmScreenData *pSD, unsigned char *lineP) -{ - unsigned char *string; - unsigned char *pchName; - - /* - * Require leading '{' on the next line. - */ - - while ((GetNextLine () != NULL)) /* not EOF nor read error */ - { - lineP = line; - ScanWhitespace(&lineP); - - if ((lineP == NULL) || (*line == '!') || (*lineP == '\0') || (*lineP == '#')) - /* ignore empty or comment line */ - { - continue; - } - - if (*lineP == '{') - /* found '{' */ - { - break; - } - - /* not a '{' */ - PWarning (((char *)GETMESSAGE(60, 37, "Expected '{'"))); - return; - } - - /* - * Found leading "{" or EOF. - * Parse include files until "}" or EOF found. - */ - while ((GetNextLine () != NULL)) - { - lineP = line; - if ((*line == '!') || (string = GetString (&lineP)) == NULL) - /* ignore empty or comment lines */ - { - continue; - } - if (*string == '}') /* finished with set. */ - { - break; - } - pchName = _DtWmParseFilenameExpand (string); - if (pchName && ConfigStackPush (pchName)) - { - ProcessWmFile (pSD, True /* nested */); - ConfigStackPop (); - XtFree ((char *) pchName); - } - - } - -} - - - -/*************************************<->************************************* - * - * ConfigStackInit (pchFileName) - * - * - * Description: - * ----------- - * Initializes the config file processing stack - * - * Inputs: - * ------ - * pchFileName = name of new file to start parsing - * - * Outputs: - * ------- - * - * - * Comments: - * -------- - * - *************************************<->***********************************/ - -static void ConfigStackInit (char *pchFileName) -{ - - pConfigStack = XtNew (ConfigFileStackEntry); - - if (pConfigStack) - { - pConfigStackTop = pConfigStack; - pConfigStackTop->fileName = XtNewString (pchFileName); - pConfigStackTop->tempName = NULL; - pConfigStackTop->cppName = NULL; - pConfigStackTop->offset = 0; - pConfigStackTop->pWmPB = wmGD.pWmPB; - pConfigStackTop->wmgdConfigFile = wmGD.configFile; - pConfigStackTop->pIncluder = NULL; - - } - else - { - sprintf ((char *)wmGD.tmpBuffer, - (char *)GETMESSAGE(60,36,"Insufficient memory to process included file: %s"), - pchFileName); - Warning ((char *)wmGD.tmpBuffer); - } -} - - -/*************************************<->************************************* - * - * ConfigStackPush (pchFileName) - * - * - * Description: - * ----------- - * Open an included config file - * - * Inputs: - * ------ - * pchFileName = name of new file to start parsing - * wmGD.pWmPB = global parse buffer (pickle this) - * - * Outputs: - * ------- - * wmGD.pWmPB = global parse buffer (new one for new file) - * return = FILE * to open file or NULL - * - * - * Comments: - * -------- - * - *************************************<->***********************************/ - -static FILE * -ConfigStackPush (unsigned char *pchFileName) -{ - ConfigFileStackEntry *pEntry; - FILE *pNewFile = NULL; - - pEntry = XtNew (ConfigFileStackEntry); - if (pEntry) - { - /* save off state of current config file */ - pConfigStackTop->offset = ftell (cfileP); - pConfigStackTop->pWmPB = wmGD.pWmPB; - fclose (cfileP); - - /* set up state of new config file */ - pEntry->fileName = XtNewString ((char *)pchFileName); - pEntry->tempName = NULL; - pEntry->cppName = NULL; - pEntry->wmgdConfigFile = (String) pEntry->fileName; - - /* set globals for new config file */ - wmGD.pWmPB = _DtWmParseNewBuf (); - wmGD.configFile = pEntry->wmgdConfigFile; - - /* put new entry onto stack */ - pEntry->pIncluder = pConfigStackTop; - pConfigStackTop = pEntry; - - /* open the file */ - pNewFile = cfileP = FopenConfigFile(); - - if (!pNewFile) - { - /* file open failed! back out */ - ConfigStackPop (); - } - } - else - { - sprintf ((char *)wmGD.tmpBuffer, - (char *)GETMESSAGE(60,36,"Insufficient memory to process included file: %s"), - pchFileName); - Warning ((char *)wmGD.tmpBuffer); - } - - return (pNewFile); -} - - - -/*************************************<->************************************* - * - * ConfigStackPop () - * - * - * Description: - * ----------- - * - * - * Inputs: - * ------ - * pchFileName = name of new file to start parsing - * wmGD.pWmPB = global parse buffer (pickle this) - * - * Outputs: - * ------- - * wmGD.pWmPB = global parse buffer (new one for new file) - * - * - * Comments: - * -------- - * assumes cfileP is closed already - * - *************************************<->***********************************/ - -static void ConfigStackPop (void) -{ - Boolean error = False; - ConfigFileStackEntry *pPrev; - char pchCmd[MAXWMPATH+1]; - - if (pConfigStackTop != pConfigStack) - { - pPrev = pConfigStackTop->pIncluder; - - _DtWmParseDestroyBuf (wmGD.pWmPB); - if (pConfigStackTop->tempName) - { - XtFree (pConfigStackTop->tempName); - } - if (pConfigStackTop->cppName) - { - strcpy (pchCmd, "/bin/rm "); - strcat (pchCmd, pConfigStackTop->cppName); - SystemCmd (pchCmd); - XtFree ((char *) pConfigStackTop->cppName); - pConfigStackTop->cppName = NULL; - } - if (pConfigStackTop->fileName) - { - XtFree (pConfigStackTop->fileName); - } - - wmGD.pWmPB = pPrev->pWmPB; - wmGD.configFile = pPrev->wmgdConfigFile; - if (pPrev->tempName) - { - cfileP = fopen (pPrev->tempName, "r"); - } - else if (pPrev->cppName) - { - cfileP = fopen (pPrev->cppName, "r"); - } - else - { - cfileP = fopen (pPrev->fileName, "r"); - } - if (cfileP) - { - fseek (cfileP, pPrev->offset, 0); - } - else - { - char msg[MAXWMPATH+1]; - - sprintf(msg, ((char *)GETMESSAGE(60, 39, - "Could not reopen configuration file %s")), - pPrev->fileName); - Warning (msg); - } - - XtFree ((char *)pConfigStackTop); - pConfigStackTop = pPrev; - } -} - - -/*************************************<->************************************* - * - * ParseWmFuncActionArg (linePP, wmFunction, pArgs) - * - * - * Description: - * ----------- - * Parses a window manager f.action argument - * - * - * Inputs: - * ------ - * linePP = pointer to current line buffer pointer. - * wmFunction = function for which the argument string is intended. - * pArgs = pointer to argument destination. - * - * - * Outputs: - * ------- - * linePP = pointer to revised line buffer pointer. - * pArgs = pointer to parsed argument. - * Return = FALSE iff insufficient memory - * - * - * Comments: - * -------- - * - *************************************<->***********************************/ - -Boolean ParseWmFuncActionArg (unsigned char **linePP, - WmFunction wmFunction, String *pArgs) -{ -#define WM_ACTION_ARG_INCREMENT 5 -#define WM_ACTION_ARG_PAD 256 - unsigned char *string; - char *pch; - WmActionArg *pAP; - int iArgSz; - - pAP = XtNew (WmActionArg); - if (pAP && (string = GetString (linePP)) != NULL) - { - /* Got action name */ - pAP->actionName = XtNewString ((char *) string); - - /* Get action arguments, if any */ - if (pAP->aap = (DtActionArg *) - XtMalloc (WM_ACTION_ARG_INCREMENT * sizeof (DtActionArg))) - { - iArgSz = WM_ACTION_ARG_INCREMENT; - pAP->numArgs = 0; - - while ((string = GetString (linePP)) != NULL) - { - if (pAP->aap[pAP->numArgs].u.file.name = (char *) - XtMalloc(1 + strlen((char *)string))) - { - pAP->aap[pAP->numArgs].argClass = DtACTION_FILE; - - /* format the action argument */ - pch = pAP->aap[pAP->numArgs].u.file.name; - - /* - * Expand environment variable - */ - if (string[0] == '$') - { - string = (unsigned char *) getenv ((char *)&string[1]); - if (!string) - { - break; - } - else - { - /* - * Make sure there's room for the new - * string. - */ - pch = (char *) - XtRealloc (pch, (1+strlen((char *)string))); - pAP->aap[pAP->numArgs].u.file.name = pch; - } - } - - /* !!! No host name processing is done!!! */ - - strcpy (pch, (char *)string); - - pAP->numArgs++; - if (pAP->numArgs == iArgSz) - { - /* need to increase our array space */ - iArgSz += WM_ACTION_ARG_INCREMENT; - pAP->aap = (DtActionArg *) - XtRealloc((char *)pAP->aap, - (iArgSz * sizeof (DtActionArg))); - if (!pAP->aap) - { - break; /* out of memory */ - } - } - } - else - { - break; /* out of memory */ - } - } - - } - pAP->szExecParms = NULL; - *pArgs = (String) pAP; - } - else - /* NULL string argument */ - { - *pArgs = NULL; - } - - return (TRUE); - -} /* END OF FUNCTION ParseWmFuncActionArg */ - - -#endif /* PANELIST */ -#ifdef WSM - -/*************************************<->************************************* - * - * PreprocessConfigFile (pSD) - * - * - * Description: - * ----------- - * This function runs the configuration file through the C - * preprocessor - * - * - * Inputs: - * ------ - * pSD = ptr to screen data - * - * Outputs: - * ------- - * - * - * Comments: - * -------- - * - *************************************<->***********************************/ - -static void -PreprocessConfigFile (void) -{ -#define CPP_NAME_SIZE ((L_tmpnam)+1) - char pchCmd[MAXWMPATH+1]; - - if (wmGD.cppCommand && *wmGD.cppCommand) - { - /* - * Generate a temp file name. - */ - pConfigStackTop->cppName = XtMalloc (CPP_NAME_SIZE * sizeof(char)); - if (pConfigStackTop->cppName) - { - (void) tmpnam (pConfigStackTop->cppName); - - /* - * Build up the command line. - */ - strcpy (pchCmd, wmGD.cppCommand); - strcat (pchCmd, " "); - strcat (pchCmd, pConfigStackTop->fileName); - strcat (pchCmd, " "); - strcat (pchCmd, pConfigStackTop->cppName); - - /* - * Run the config file through the converter program - * and send the output to a temp file. - */ - SystemCmd (pchCmd); - } - } -} - - -/*************************************<->************************************* - * - * GetNetworkFileName (char *pchFile) - * - * - * Description: - * ----------- - * This function returns a local representation for a network - * file. - * - * - * Inputs: - * ------ - * pchFile - pointer to file name of form [:] - * - * Return: - * ------- - * String - ptr to allocated string of local file name. If input - * is not a network file, the a copy of pchFile is returned. - * - * - * Comments: - * -------- - * returned file name should be freed with XtFree(). - * - *************************************<->***********************************/ - -static String -GetNetworkFileName (char *pchFile) -{ - char *pch; - char *host_part; - char *file_part; - char *netfile; - char *sName = NULL; - char *pchName = NULL; - int count; - char **pchTok; - String sReturn = NULL; - char *homeDir; - int len; - - - pch = strchr (pchFile, ':'); - - if (pch) - { - /* - * Expand special chars and find matching file. - */ - pchTok = (char **)shellscan (pchFile, &count, 0); - - if ((count == 1) || (count == 2)) - { - /* one match found */ - host_part = pchTok[0]; - } - else if (count > 2) - { - /* several matches found, pick one */ - host_part = pchTok[1]; - } - else - { - host_part = NULL; - } - - if (host_part != NULL) - { - pch = strchr (host_part, ':'); - if (pch) - { - /* - * copy the string so we don't munge data - * inside shellscan - */ - host_part = sName = XtNewString ((String) host_part); - pch = strchr (sName, ':'); - - /* - * separate the host and file parts of the - * file name - */ - *pch = '\0'; - file_part = pch+1; - } - else - { - /* - * The colon went away. Hmm... - */ - file_part = host_part; - host_part = NULL; - } - - if ( -#ifndef NO_MULTIBYTE - (mblen(file_part, MB_CUR_MAX) == 1) && - (mblen(file_part+1, MB_CUR_MAX) == 1) && -#endif - (*file_part == '~') && - (*(file_part+1) == '/')) - { - /* - * Replace '~' with $HOME - */ - homeDir = XmeGetHomeDirName(); - len = strlen (host_part) + 1 + - strlen (homeDir) + strlen (file_part) + 1; - pch = (char *) XtMalloc (len); - strcpy (pch, sName); - host_part = pch; - pch += strlen (pch) + 1; - strcpy (pch, homeDir); - strcat (pch, file_part+1); - file_part = pch; - XtFree (sName); - sName = host_part; - } - } - else - { - /* - * shellscan had a problem with the file name. - * just operate on the name as-is. - * temporarily replace ':' with a NULL - */ - host_part = sName = XtNewString ((String) pchFile); - pch = strchr (sName, ':'); - *pch = '\0'; - host_part = pchFile; - file_part = pch+1; - } - - /* convert to canonical host/file name */ - netfile = (char *) - tt_host_file_netfile (host_part, file_part); - if (tt_pointer_error (netfile) == TT_OK) - { - /* convert to local file name equivalent */ - pchName = tt_netfile_file (netfile); - - if (tt_pointer_error (pchName) == TT_OK) - { - sReturn = XtNewString ((String) pchName); - tt_free ((char *)pchName); - } - tt_free (netfile); - } - - if (sName) - { - XtFree ((char *)sName); - } - } - - if (sReturn == NULL) - { - if ( -#ifndef NO_MULTIBYTE - (mblen(pchFile, MB_CUR_MAX) == 1) && - (mblen(pchFile+1, MB_CUR_MAX) == 1) && -#endif - (*pchFile == '~') && - (*(pchFile+1) == '/')) - { - /* - * Replace '~' with $HOME - */ - homeDir = XmeGetHomeDirName(); - len = strlen (homeDir) + strlen (pchFile) + 1; - sReturn = (char *) XtMalloc (len); - strcpy (sReturn, homeDir); - strcat (sReturn, pchFile+1); - } - else - { - sReturn = XtNewString ((String) pchFile); - } - } - - return (sReturn); -} -/**************************** eof ***************************/ -#endif /* WSM */ - - -#if ((!defined(WSM)) || defined(MWM_QATS_PROTOCOL)) -/*************************************<->************************************* - * - * SetGreyedContextAndMgtMask (menuItem, wmFunction) - * - * - * Description: - * ----------- - * This function sets up the greyed context and management mask - * for a menu item based on the menu function passed in. - * - * Inputs: - * ------ - * menuItem = the menu item to be set up - * wmFunction = the menu function to find in the function table - * to determine how to set up the relevant fields - * - * Outputs: - * ------- - * The menuItem will have its greyed context and management mask fields - * set appropriately. If the given function cannot be found, the fields - * will be set to the appropriate values as if the function were F_Nop. - * Return = True if the function could be found. False otherwise. - * - *************************************<->***********************************/ - -Boolean SetGreyedContextAndMgtMask (MenuItem *menuItem, - WmFunction wmFunction) -{ - int ix; - - for (ix = 0; ix < WMFUNCTIONTABLESIZE - 1; ++ix) - { - if (functionTable[ix].wmFunction == wmFunction) - { - /* Success! The function was found. Set up the - values and get the heck out of here. */ - menuItem->greyedContext = functionTable[ix].greyedContext; - menuItem->mgtMask = functionTable[ix].mgtMask; - return(True); - } - } - - /* We couldn't find the given command in the function table. - Set up the values as if the F_Nop function were found - and return False. */ - menuItem->greyedContext = functionTable[F_NOP_INDEX].greyedContext; - menuItem->mgtMask = functionTable[F_NOP_INDEX].mgtMask; - return(False); -} - - - -/*************************************<->************************************* - * - * MakeSeparatorTemplate () - * - * - * Description: - * ----------- - * - * Inputs: - * ------ - * - * Outputs: - * ------- - * - *************************************<->***********************************/ -static -MenuItem *MakeSeparatorTemplate (int position) -{ - MenuItem *item; - - item = (MenuItem *)XtMalloc(sizeof(MenuItem)); - - /* We use the labelType to determine where this separator is positioned - relative to the client command(s) it is surrounding, i.e. TOP or - BOTTOM */ - item->labelType = position; - /* Make it look like a client command: */ - item->label = XtNewString(""); - item->labelBitmapIndex = -1; - item->mnemonic = (KeySym) 0; - item->accelState = 0; - item->accelKeyCode = (KeyCode) 0; - item->accelText = (String) NULL; - item->wmFunction = (WmFunction) F_Separator; - item->wmFuncArgs = (String) NULL; - item->greyedContext = 0; - item->mgtMask = 0; - item->clientCommandName = (String) NULL; - item->nextMenuItem = (MenuItem *) NULL; - - return(item); -} -#endif /* !defined(WSM) || defined(MWM_QATS_PROTOCOL) */ diff --git a/clients/uil/Makefile.am b/clients/uil/Makefile.am index 0525057..c4f6492 100644 --- a/clients/uil/Makefile.am +++ b/clients/uil/Makefile.am @@ -13,7 +13,7 @@ UilParser.lo: UilParser.c libUil_la_LIBADD = UilParser.lo ../../lib/Mrm/libMrm.la ../../lib/Xm/libXm.la -uil_LDADD = libUil.la ../../lib/Mrm/libMrm.la ../../lib/Xm/libXm.la +uil_LDADD = ../../lib/Mrm/libMrm.la ../../lib/Xm/libXm.la INCLUDES = -DINCDIR=\"@INCDIR@\" \ -DLIBDIR=\"@LIBDIR@\" \ @@ -42,7 +42,7 @@ COMMON_SRC = UilCmd.c UilDiags.c UilKeyTab.c UilLexAna.c \ UilLstMac.c UilSemVal.c UilSemCSet.c UilDB.c SRCS = $(COMMON_SRC) -SRCS2 = UilMain.c +SRCS2 = $(COMMON_SRC) UilMain.c HEADERS_1 = Uil.h UilSymGl.h UilSymDef.h \ UilDef.h XmAppl.uil diff --git a/clients/uil/Makefile.am.uil_lib b/clients/uil/Makefile.am.uil_lib deleted file mode 100644 index c4f6492..0000000 --- a/clients/uil/Makefile.am.uil_lib +++ /dev/null @@ -1,88 +0,0 @@ -MAINTAINERCLEANFILES = Makefile.in Uil.cat UilMsgCatI.h - -EXTRA_DIST = Uil.msg -# -# I don't seem to have all the pieces to make this thing -# -bin_PROGRAMS = uil - -libUil_la_LDFLAGS = -version-info @CURRENT@:@REVISION@:@AGE@ - -UilParser.lo: UilParser.c - $(LTCOMPILE) -DCALLABLE -c UilParser.c - -libUil_la_LIBADD = UilParser.lo ../../lib/Mrm/libMrm.la ../../lib/Xm/libXm.la - -uil_LDADD = ../../lib/Mrm/libMrm.la ../../lib/Xm/libXm.la - -INCLUDES = -DINCDIR=\"@INCDIR@\" \ - -DLIBDIR=\"@LIBDIR@\" \ - -I$(srcdir)/../../include \ - -I$(srcdir)/../../lib \ - -I$(srcdir)/../../tools/wml \ - -I../../include \ - -I../../lib \ - -I../../tools/wml ${X_CFLAGS} - -UilParser.c: - test -f UilParser.c || $(LN_S) $(srcdir)/UilMain.c UilParser.c - -UilLexPars.c: $(top_builddir)/tools/wml/Uil.c - test -f UilLexPars.c || $(LN_S) $(top_builddir)/tools/wml/Uil.c UilLexPars.c - -BUILT_SOURCES = UilParser.c UilLexPars.c UilDBDef.h - -CLEANFILES = UilParser.c UilLexPars.c UilDBDef.h - -COMMON_SRC = UilCmd.c UilDiags.c UilKeyTab.c UilLexAna.c \ - UilLexPars.c UilLstLst.c UilP2Out.c UilP2Reslv.c \ - UilSarComp.c UilSarExp.c UilSarInc.c UilSarMod.c \ - UilSarObj.c UilSarProc.c UilSarVal.c UilSrcSrc.c \ - UilSymNam.c UilSymStor.c UilData.c \ - UilLstMac.c UilSemVal.c UilSemCSet.c UilDB.c - -SRCS = $(COMMON_SRC) -SRCS2 = $(COMMON_SRC) UilMain.c - -HEADERS_1 = Uil.h UilSymGl.h UilSymDef.h \ - UilDef.h XmAppl.uil - -uildir = $(includedir)/uil - -uil_HEADERS = $(HEADERS_1) - -noinst_HEADERS = UilCmdDef.h \ -UilCompGl.h \ -UilDefI.h \ -UilDiagDef.h \ -UilIODef.h \ -UilLexDef.h \ -UilMess.h \ -UilMessTab.h \ -UilSarDef.h \ -UilSrcDef.h - -lib_LTLIBRARIES = libUil.la - -uil_SOURCES = $(SRCS2) -uil_CFLAGS = $(AM_CFLAGS) - -libUil_la_SOURCES = $(SRCS) -libUil_la_DEPENDENCIES = UilDBDef.h UilParser.lo - -UilDBDef.h: - $(LN_S) $(srcdir)/../../tools/wml/UilDBDef.h UilDBDef.h - -if MessageCatalog - -$(COMMON_SRC): $(CAT_FILES) - -CAT_FILES = Uil.cat UilMsgCatI.h - -$(CAT_FILES): Uil.msg - $(mkinstalldirs) $(top_builddir)/localized/C/msg - $(top_builddir)/localized/util/mkcatdefs UilMsgCatI.h $(srcdir)/Uil.msg >$(top_builddir)/localized/C/msg/Uil.msg - gencat Uil.cat $(top_builddir)/localized/C/msg/Uil.msg - -endif - diff --git a/configure.ac b/configure.ac index 3b41236..6db447c 100644 --- a/configure.ac +++ b/configure.ac @@ -179,13 +179,13 @@ AC_SUBST(CDE_CONFIGURATION_TOP) LIBDIR="${libdir}/X11" AC_SUBST(LIBDIR) -MWMRCDIR="/etc/X11/mwm" +MWMRCDIR="${libdir}/X11" AC_SUBST(MWMRCDIR) INCDIR="${includedir}/X11" AC_SUBST(INCDIR) -XMBINDDIR_FALLBACK="${datadir}/X11/bindings" +XMBINDDIR_FALLBACK="${libdir}/X11/bindings" AC_SUBST(XMBINDDIR_FALLBACK) RM="rm -f" diff --git a/configure.ac.bindings b/configure.ac.bindings deleted file mode 100644 index 2b19c41..0000000 --- a/configure.ac.bindings +++ /dev/null @@ -1,401 +0,0 @@ -dnl Process this file with autoconf to produce a configure script. -AC_INIT -AC_CONFIG_SRCDIR([lib/Xm/Form.c]) -AC_PREREQ(2.52) -AC_CONFIG_AUX_DIR(.) -AC_CHECK_FILE(/usr/X/include/X11/X.h, - AC_PREFIX_DEFAULT(/usr/X), - AC_PREFIX_DEFAULT(/usr)) -AC_CHECK_FILE(/usr/X11R6/include/X11/X.h, - AC_PREFIX_DEFAULT(/usr/X11R6), - AC_PREFIX_DEFAULT(/usr)) - -dnl AM_MAINTAINER_MODE -AC_CANONICAL_TARGET - -dnl The version of the Motif libraries -CURRENT=4 -REVISION=4 -AGE=0 -AC_SUBST(CURRENT) -AC_SUBST(REVISION) -AC_SUBST(AGE) - -dnl This is really dumb but it seems to be bug -AM_INIT_AUTOMAKE(motif,2.3.4,no-define) - -LIBTOOL_VERSION=$CURRENT:$REVISION:$AGE - -dnl -dnl Override a default in libtool. -dnl -dnl AC_DISABLE_STATIC - -AM_CONFIG_HEADER(include/config.h lib/Xm/Xm.h) - -dnl Checks for programs. -AC_PROG_CC -AC_PROG_CPP -AM_PROG_CC_STDC -AM_PROG_LIBTOOL - -AC_EXEEXT - -dnl AC_PROG_YACC -dnl Do this the old fashioned way. 'bison -y' doesn't cut it -AC_CHECK_PROGS(YACC, byacc, yacc) - -dnl AC_PROG_SPLINT -AC_CHECK_PROGS(SPLINT, splint) -if test x$SPLINT = x -then - AC_MSG_WARN([No splint is dound]) -fi - -AM_PROG_LEX -AC_PROG_INSTALL -AC_PROG_LN_S -AC_PROG_MAKE_SET - - -dnl Checks for libraries. - -AC_PATH_X -AC_PATH_XTRA -LT_LIB_XTHREADS - -dnl Checks for Xos_r.h - -AC_CHECK_HEADERS([X11/Xos_r.h]) -AC_CHECK_HEADERS([X11/Xpoll.h]) - -dnl Compile in EditRes support if we can find Xmu - -save_LIBS="$LIBS" -save_CFLAGS="$CFLAGS" -LIBS="$X_LIBS $LIBS" -CFLAGS="$X_CFLAGS $CFLAGS" -AC_CHECK_HEADERS(X11/Xmu/Editres.h, -AC_CHECK_LIB(Xmu, _XEditResCheckMessages, -X_XMU=-lXmu -AC_DEFINE(HAVE_LIBXMU, 1, This System has libXmu) -, X_XMU="", -lXt -lX11) -AC_CHECK_LIB(Xmu,XmuNCopyISOLatin1Lowered , -AC_DEFINE(HAVE_XMU_N_COPY_ISO,1,Have XmuNCopyISOLatin1Lowered) -, , -lXt -lX11) -,,[[#include ]] -) - - -AC_SUBST(X_XMU) -LIBS="$save_LIBS" -CFLAGS="$save_CFLAGS" -AM_CONDITIONAL(OM_XMU, test x$X_XMU != x) - -dnl Checks for header files. -AC_HEADER_DIRENT -AC_HEADER_STDC -AC_HEADER_SYS_WAIT -AC_CHECK_HEADERS(fcntl.h limits.h malloc.h sys/malloc.h strings.h sys/file.h sys/time.h unistd.h wchar.h) -AC_CHECK_HEADERS(wctype.h, AC_DEFINE(HAS_WIDECHAR_FUNCTIONS,1,System supports wchar)) -AC_CHECK_HEADER(langinfo.h,,AC_DEFINE(CSRG_BASED,1,System Has langinfo.h)) -AC_CHECK_HEADER(X11/Xos_r.h,,AC_DEFINE(NEED_XOS_R_H,1,System Missing Xos_r.h)) -AC_CHECK_HEADER(X11/Xpoll.h,,AC_DEFINE(NEED_XPOLL_H,1,system Missing X11/Xpoll.h)) -dnl Checks for typedefs, structures, and compiler characteristics. -AC_C_CONST -AC_TYPE_MODE_T -AC_TYPE_OFF_T -AC_TYPE_PID_T -AC_TYPE_SIZE_T -AC_HEADER_TIME -AC_STRUCT_TM -AC_TYPE_UID_T - -dnl Checks for library functions. -AC_FUNC_ALLOCA -AC_FUNC_MEMCMP -AC_FUNC_SETPGRP -AC_TYPE_SIGNAL -AC_FUNC_STRCOLL -AC_FUNC_STRFTIME -AC_FUNC_FORK([]) -AC_FUNC_VPRINTF -AM_FUNC_VOID_SPRINTF -AC_CHECK_FUNCS(wcslen wcscpy wcsncpy wcschr wcscat wcsncat getcwd gettimeofday mkdir re_comp regcmp select strcspn strerror strstr strtod strtol uname) -AC_CHECK_FUNCS(strdup,,AC_DEFINE(NEED_STRDUP, 1, no strdup)) -AC_CHECK_FUNCS(strcasecmp,,AC_DEFINE(NEED_STRCASECMP, 1, no strcasecmp)) -AC_CHECK_FUNCS(putenv,,AC_DEFINE(NO_PUTENV, 1, No PUTENV)) -AC_CHECK_FUNCS(regcomp,,AC_DEFINE(NO_REGCOMP, 1, no regcmp)) -AC_CHECK_FUNCS(memmove,,AC_DEFINE(NO_MEMMOVE, 1, no memmove)) -AC_CHECK_TYPE(XICProc,,AC_DEFINE(NO_XICPROC, 1, XICProc isn't defined), [#include ]) - -AC_ARG_ENABLE(message-catalog, [ --enable-message-catalog - Enable building of the message catalog (default=no)]) -if test "$enable_message_catalog" != "yes" -then - AC_DEFINE(NO_MESSAGE_CATALOG, 1, No Defined Message Catalog) -fi -AM_CONDITIONAL(MessageCatalog, test x$enable_message_catalog = xyes) - -AC_ARG_ENABLE(themes, [ --enable-themes Enable themes (default=no)]) -if test "$enable_themes" = "yes" -then - if test -f $srcdir/lib/Xm/Theme.h - then - AC_DEFINE(USE_XMTHEMES, 1, "Use XmThemes") - XMTHEME_DIST = "Theme.h ThemeP.h DynLibP.h Theme.c DynLib.c" - else - AC_MSG_WARN([--enable-themes specified, but I don't have the code. Disabled]) - enable_themes="no" - fi -fi -AC_SUBST(XMTHEME_DIST) -AM_CONDITIONAL(OM_XMTHEMES, test "$enable_themes" = "yes") - -AC_ARG_ENABLE(debug-themes, [ --enable-debug-themes Enable themes debugging (default=no)]) -if test "$enable_themes" = "yes" -then - if test "$enable_debug_themes" = "yes" - then - AC_DEFINE(DEBUGTHEMES, 1, "Debug Themes") - fi -fi - -if test x$GCC = xyes -then - CFLAGS="$CFLAGS -Wall -g -fno-strict-aliasing -Wno-unused -Wno-comment" - if test ` $CC -dumpversion | sed -e 's/\(^.\).*/\1/'` = "4" ; then - CFLAGS="$CFLAGS -fno-tree-ter" - fi -fi -AC_DEFINE(NO_OL_COMPAT, 1, "No OL Compatability") - -CDE_INSTALLATION_TOP="\${prefix}/dt" -AC_SUBST(CDE_INSTALLATION_TOP) - -CDE_CONFIGURATION_TOP="\${prefix}/etc/dt" -AC_SUBST(CDE_CONFIGURATION_TOP) - -LIBDIR="${libdir}/X11" -AC_SUBST(LIBDIR) - -MWMRCDIR="/etc/X11/mwm" -AC_SUBST(MWMRCDIR) - -INCDIR="${includedir}/X11" -AC_SUBST(INCDIR) - -XMBINDDIR_FALLBACK="${libdir}/X11/bindings" -AC_SUBST(XMBINDDIR_FALLBACK) - -RM="rm -f" -AC_SUBST(RM) - -AC_ARG_ENABLE(motif22-compatibility, [ --disable-motif22-compatibility - Disable binary compatibility with OpenMotif 2.2]) -AC_ARG_ENABLE(utf8, [ --disable-utf8 - Disable UTF-8 support]) - -case "$host_os" in - freebsd*) CFLAGS="$CFLAGS -DCSRG_BASED -DXNO_MTSAFE_API -DXNO_MTSAFE_PWDAPI"; - LDFLAGS="$LDFLAGS -L/usr/local/lib";; - cygwin*) CFLAGS="$CFLAGS -DXNO_MTSAFE_DIRENTDAPI";; - solaris* | sunos*) X_LIBS="$X_LIBS -L/usr/X/lib" && - if test x$enable_motif22_compatibility = x - then - enable_motif22_compatibility="no" - fi; - if test x$enable_utf8 = x - then - enable_utf8="no" - fi; - if test x$enable_xft = x - then - enable_xft="no" - fi;; -esac - -if test x$enable_motif22_compatibility = x -then - enable_motif22_compatibility="yes" -fi - -if test "$enable_motif22_compatibility" = "yes" -then - AC_DEFINE([OM22_COMPATIBILITY], [1], [Compatibility with OpenMotif 2.2]) - OM22_COMPATIBILITY_FALSE=! - OM22_COMPATIBILITY_TRUE= -else - OM22_COMPATIBILITY_FALSE= - OM22_COMPATIBILITY_TRUE=! -fi -AC_SUBST(OM22_COMPATIBILITY_FALSE) -AC_SUBST(OM22_COMPATIBILITY_TRUE) - -if test x$enable_utf8 = x -then - enable_utf8="yes" -fi - -if test "$enable_utf8" = "yes" -then - AC_DEFINE([UTF8_SUPPORTED], [1], [UTF8 is supported]) - AC_SEARCH_LIBS([iconv_open], [iconv], , - AC_SEARCH_LIBS([libiconv_open], [iconv])) -fi - -AC_ARG_ENABLE(printing, [ --disable-printing - Disable printing support]) - -if test x$enable_printing = x -then - enable_printing="yes" -fi - -if test "$enable_printing" = "yes" -then - AC_MSG_CHECKING([for libXp]) - AC_CHECK_HEADERS(X11/extensions/Print.h, - AC_CHECK_LIB(Xp, XpCreateContext, ,enable_printing="no"), - enable_printing="no") -fi - -if test "$enable_printing" = "yes" -then - LIB_XP=-lXp - AC_DEFINE([PRINTING_SUPPORTED], [1], [Printing is supported]) - PRINTING_SUPPORTED_FALSE=! - PRINTING_SUPPORTED_TRUE= -else - LIB_XP= - PRINTING_SUPPORTED_FALSE= - PRINTING_SUPPORTED_TRUE=! -fi -AC_SUBST(PRINTING_SUPPORTED_FALSE) -AC_SUBST(PRINTING_SUPPORTED_TRUE) - -AM_CONDITIONAL(PRINTING, test "$enable_printing" = "yes") -AC_SUBST(LIB_XP) - -AC_FIND_XFT -AC_IMAGE_SUPPORT - - - -# AM_CONDITIONAL(Motif22Compatibility, test x$enable_motif22_compatibility = xyes) - -AC_CONFIG_FILES([Makefile \ -bindings/Makefile \ -bitmaps/Makefile \ -clients/Makefile \ -clients/mwm/Makefile \ -clients/mwm/WmWsmLib/Makefile \ -clients/uil/Makefile \ -clients/xmbind/Makefile \ -config/Makefile \ -config/cf/Makefile \ -config/imake/Makefile \ -config/util/Makefile \ -config/makedepend/Makefile \ -include/Makefile \ -include/Dt/Makefile \ -lib/Makefile \ -lib/Xm/Makefile \ -lib/Mrm/Makefile \ -localized/Makefile \ -localized/util/Makefile \ -doc/Makefile \ -doc/man/Makefile \ -doc/man/man1/Makefile \ -doc/man/man3/Makefile \ -doc/man/man4/Makefile \ -doc/man/man5/Makefile \ -tools/Makefile \ -tools/wml/Makefile \ -demos/Makefile \ -demos/lib/Makefile \ -demos/lib/Xmd/Makefile \ -demos/lib/Wsm/Makefile \ -demos/lib/Exm/Makefile \ -demos/lib/Exm/wml/Makefile \ -demos/programs/Makefile \ -demos/programs/Exm/Makefile \ -demos/programs/Exm/app_in_c/Makefile \ -demos/programs/Exm/app_in_uil/Makefile \ -demos/programs/Exm/simple_app/Makefile \ -demos/programs/airport/Makefile \ -demos/programs/animate/Makefile \ -demos/programs/drag_and_drop/Makefile \ -demos/programs/draw/Makefile \ -demos/programs/earth/Makefile \ -demos/programs/filemanager/Makefile \ -demos/programs/fileview/Makefile \ -demos/programs/getsubres/Makefile \ -demos/programs/hellomotif/Makefile \ -demos/programs/hellomotifi18n/Makefile \ -demos/programs/hellomotifi18n/C/Makefile \ -demos/programs/hellomotifi18n/C/uid/Makefile \ -demos/programs/hellomotifi18n/english/Makefile \ -demos/programs/hellomotifi18n/english/uid/Makefile \ -demos/programs/hellomotifi18n/french/Makefile \ -demos/programs/hellomotifi18n/french/uid/Makefile \ -demos/programs/hellomotifi18n/hebrew/Makefile \ -demos/programs/hellomotifi18n/hebrew/uid/Makefile \ -demos/programs/hellomotifi18n/japan/Makefile \ -demos/programs/hellomotifi18n/japan/uid/Makefile \ -demos/programs/hellomotifi18n/japanese/Makefile \ -demos/programs/hellomotifi18n/japanese/uid/Makefile \ -demos/programs/hellomotifi18n/swedish/Makefile \ -demos/programs/hellomotifi18n/swedish/uid/Makefile \ -demos/programs/i18ninput/Makefile \ -demos/programs/panner/Makefile \ -demos/programs/periodic/Makefile \ -demos/programs/piano/Makefile \ -demos/programs/popups/Makefile \ -demos/programs/sampler2_0/Makefile \ -demos/programs/setdate/Makefile \ -demos/programs/todo/Makefile \ -demos/programs/workspace/Makefile \ -demos/programs/tooltips/Makefile \ -demos/programs/FontSel/Makefile \ -demos/programs/ButtonBox/Makefile \ -demos/programs/ColorSel/Makefile \ -demos/programs/Column/Makefile \ -demos/programs/Combo2/Makefile \ -demos/programs/Ext18List/Makefile \ -demos/programs/Ext18List/pixmaps/Makefile \ -demos/programs/IconB/Makefile \ -demos/programs/Outline/Makefile \ -demos/programs/Paned/Makefile \ -demos/programs/TabStack/Makefile \ -demos/programs/Tree/Makefile \ -demos/programs/pixmaps/Makefile \ -demos/unsupported/Makefile \ -demos/unsupported/Exm/Makefile \ -demos/unsupported/aicon/Makefile \ -demos/unsupported/dainput/Makefile \ -demos/unsupported/dogs/Makefile \ -demos/unsupported/hellomotif/Makefile \ -demos/unsupported/motifshell/Makefile \ -demos/unsupported/uilsymdump/Makefile \ -demos/unsupported/xmapdef/Makefile \ -demos/unsupported/xmfonts/Makefile \ -demos/unsupported/xmforc/Makefile \ -demos/unsupported/xmform/Makefile \ -demos/doc/Makefile \ -demos/doc/programGuide/Makefile \ -demos/doc/programGuide/ch05/Makefile \ -demos/doc/programGuide/ch05/Scale/Makefile \ -demos/doc/programGuide/ch06/Makefile \ -demos/doc/programGuide/ch06/spin_box/Makefile \ -demos/doc/programGuide/ch06/combo_box/Makefile \ -demos/doc/programGuide/ch08/Makefile \ -demos/doc/programGuide/ch08/Notebook/Makefile \ -demos/doc/programGuide/ch08/Container/Makefile \ -demos/doc/programGuide/ch16/Makefile \ -demos/doc/programGuide/ch17/Makefile \ -demos/doc/programGuide/ch17/simple_drop/Makefile \ -demos/doc/programGuide/ch17/simple_drag/Makefile \ -lib/Xm/xmstring.list \ -]) -AC_OUTPUT diff --git a/configure.ac.mwmrc_dir b/configure.ac.mwmrc_dir deleted file mode 100644 index 6db447c..0000000 --- a/configure.ac.mwmrc_dir +++ /dev/null @@ -1,401 +0,0 @@ -dnl Process this file with autoconf to produce a configure script. -AC_INIT -AC_CONFIG_SRCDIR([lib/Xm/Form.c]) -AC_PREREQ(2.52) -AC_CONFIG_AUX_DIR(.) -AC_CHECK_FILE(/usr/X/include/X11/X.h, - AC_PREFIX_DEFAULT(/usr/X), - AC_PREFIX_DEFAULT(/usr)) -AC_CHECK_FILE(/usr/X11R6/include/X11/X.h, - AC_PREFIX_DEFAULT(/usr/X11R6), - AC_PREFIX_DEFAULT(/usr)) - -dnl AM_MAINTAINER_MODE -AC_CANONICAL_TARGET - -dnl The version of the Motif libraries -CURRENT=4 -REVISION=4 -AGE=0 -AC_SUBST(CURRENT) -AC_SUBST(REVISION) -AC_SUBST(AGE) - -dnl This is really dumb but it seems to be bug -AM_INIT_AUTOMAKE(motif,2.3.4,no-define) - -LIBTOOL_VERSION=$CURRENT:$REVISION:$AGE - -dnl -dnl Override a default in libtool. -dnl -dnl AC_DISABLE_STATIC - -AM_CONFIG_HEADER(include/config.h lib/Xm/Xm.h) - -dnl Checks for programs. -AC_PROG_CC -AC_PROG_CPP -AM_PROG_CC_STDC -AM_PROG_LIBTOOL - -AC_EXEEXT - -dnl AC_PROG_YACC -dnl Do this the old fashioned way. 'bison -y' doesn't cut it -AC_CHECK_PROGS(YACC, byacc, yacc) - -dnl AC_PROG_SPLINT -AC_CHECK_PROGS(SPLINT, splint) -if test x$SPLINT = x -then - AC_MSG_WARN([No splint is dound]) -fi - -AM_PROG_LEX -AC_PROG_INSTALL -AC_PROG_LN_S -AC_PROG_MAKE_SET - - -dnl Checks for libraries. - -AC_PATH_X -AC_PATH_XTRA -LT_LIB_XTHREADS - -dnl Checks for Xos_r.h - -AC_CHECK_HEADERS([X11/Xos_r.h]) -AC_CHECK_HEADERS([X11/Xpoll.h]) - -dnl Compile in EditRes support if we can find Xmu - -save_LIBS="$LIBS" -save_CFLAGS="$CFLAGS" -LIBS="$X_LIBS $LIBS" -CFLAGS="$X_CFLAGS $CFLAGS" -AC_CHECK_HEADERS(X11/Xmu/Editres.h, -AC_CHECK_LIB(Xmu, _XEditResCheckMessages, -X_XMU=-lXmu -AC_DEFINE(HAVE_LIBXMU, 1, This System has libXmu) -, X_XMU="", -lXt -lX11) -AC_CHECK_LIB(Xmu,XmuNCopyISOLatin1Lowered , -AC_DEFINE(HAVE_XMU_N_COPY_ISO,1,Have XmuNCopyISOLatin1Lowered) -, , -lXt -lX11) -,,[[#include ]] -) - - -AC_SUBST(X_XMU) -LIBS="$save_LIBS" -CFLAGS="$save_CFLAGS" -AM_CONDITIONAL(OM_XMU, test x$X_XMU != x) - -dnl Checks for header files. -AC_HEADER_DIRENT -AC_HEADER_STDC -AC_HEADER_SYS_WAIT -AC_CHECK_HEADERS(fcntl.h limits.h malloc.h sys/malloc.h strings.h sys/file.h sys/time.h unistd.h wchar.h) -AC_CHECK_HEADERS(wctype.h, AC_DEFINE(HAS_WIDECHAR_FUNCTIONS,1,System supports wchar)) -AC_CHECK_HEADER(langinfo.h,,AC_DEFINE(CSRG_BASED,1,System Has langinfo.h)) -AC_CHECK_HEADER(X11/Xos_r.h,,AC_DEFINE(NEED_XOS_R_H,1,System Missing Xos_r.h)) -AC_CHECK_HEADER(X11/Xpoll.h,,AC_DEFINE(NEED_XPOLL_H,1,system Missing X11/Xpoll.h)) -dnl Checks for typedefs, structures, and compiler characteristics. -AC_C_CONST -AC_TYPE_MODE_T -AC_TYPE_OFF_T -AC_TYPE_PID_T -AC_TYPE_SIZE_T -AC_HEADER_TIME -AC_STRUCT_TM -AC_TYPE_UID_T - -dnl Checks for library functions. -AC_FUNC_ALLOCA -AC_FUNC_MEMCMP -AC_FUNC_SETPGRP -AC_TYPE_SIGNAL -AC_FUNC_STRCOLL -AC_FUNC_STRFTIME -AC_FUNC_FORK([]) -AC_FUNC_VPRINTF -AM_FUNC_VOID_SPRINTF -AC_CHECK_FUNCS(wcslen wcscpy wcsncpy wcschr wcscat wcsncat getcwd gettimeofday mkdir re_comp regcmp select strcspn strerror strstr strtod strtol uname) -AC_CHECK_FUNCS(strdup,,AC_DEFINE(NEED_STRDUP, 1, no strdup)) -AC_CHECK_FUNCS(strcasecmp,,AC_DEFINE(NEED_STRCASECMP, 1, no strcasecmp)) -AC_CHECK_FUNCS(putenv,,AC_DEFINE(NO_PUTENV, 1, No PUTENV)) -AC_CHECK_FUNCS(regcomp,,AC_DEFINE(NO_REGCOMP, 1, no regcmp)) -AC_CHECK_FUNCS(memmove,,AC_DEFINE(NO_MEMMOVE, 1, no memmove)) -AC_CHECK_TYPE(XICProc,,AC_DEFINE(NO_XICPROC, 1, XICProc isn't defined), [#include ]) - -AC_ARG_ENABLE(message-catalog, [ --enable-message-catalog - Enable building of the message catalog (default=no)]) -if test "$enable_message_catalog" != "yes" -then - AC_DEFINE(NO_MESSAGE_CATALOG, 1, No Defined Message Catalog) -fi -AM_CONDITIONAL(MessageCatalog, test x$enable_message_catalog = xyes) - -AC_ARG_ENABLE(themes, [ --enable-themes Enable themes (default=no)]) -if test "$enable_themes" = "yes" -then - if test -f $srcdir/lib/Xm/Theme.h - then - AC_DEFINE(USE_XMTHEMES, 1, "Use XmThemes") - XMTHEME_DIST = "Theme.h ThemeP.h DynLibP.h Theme.c DynLib.c" - else - AC_MSG_WARN([--enable-themes specified, but I don't have the code. Disabled]) - enable_themes="no" - fi -fi -AC_SUBST(XMTHEME_DIST) -AM_CONDITIONAL(OM_XMTHEMES, test "$enable_themes" = "yes") - -AC_ARG_ENABLE(debug-themes, [ --enable-debug-themes Enable themes debugging (default=no)]) -if test "$enable_themes" = "yes" -then - if test "$enable_debug_themes" = "yes" - then - AC_DEFINE(DEBUGTHEMES, 1, "Debug Themes") - fi -fi - -if test x$GCC = xyes -then - CFLAGS="$CFLAGS -Wall -g -fno-strict-aliasing -Wno-unused -Wno-comment" - if test ` $CC -dumpversion | sed -e 's/\(^.\).*/\1/'` = "4" ; then - CFLAGS="$CFLAGS -fno-tree-ter" - fi -fi -AC_DEFINE(NO_OL_COMPAT, 1, "No OL Compatability") - -CDE_INSTALLATION_TOP="\${prefix}/dt" -AC_SUBST(CDE_INSTALLATION_TOP) - -CDE_CONFIGURATION_TOP="\${prefix}/etc/dt" -AC_SUBST(CDE_CONFIGURATION_TOP) - -LIBDIR="${libdir}/X11" -AC_SUBST(LIBDIR) - -MWMRCDIR="${libdir}/X11" -AC_SUBST(MWMRCDIR) - -INCDIR="${includedir}/X11" -AC_SUBST(INCDIR) - -XMBINDDIR_FALLBACK="${libdir}/X11/bindings" -AC_SUBST(XMBINDDIR_FALLBACK) - -RM="rm -f" -AC_SUBST(RM) - -AC_ARG_ENABLE(motif22-compatibility, [ --disable-motif22-compatibility - Disable binary compatibility with OpenMotif 2.2]) -AC_ARG_ENABLE(utf8, [ --disable-utf8 - Disable UTF-8 support]) - -case "$host_os" in - freebsd*) CFLAGS="$CFLAGS -DCSRG_BASED -DXNO_MTSAFE_API -DXNO_MTSAFE_PWDAPI"; - LDFLAGS="$LDFLAGS -L/usr/local/lib";; - cygwin*) CFLAGS="$CFLAGS -DXNO_MTSAFE_DIRENTDAPI";; - solaris* | sunos*) X_LIBS="$X_LIBS -L/usr/X/lib" && - if test x$enable_motif22_compatibility = x - then - enable_motif22_compatibility="no" - fi; - if test x$enable_utf8 = x - then - enable_utf8="no" - fi; - if test x$enable_xft = x - then - enable_xft="no" - fi;; -esac - -if test x$enable_motif22_compatibility = x -then - enable_motif22_compatibility="yes" -fi - -if test "$enable_motif22_compatibility" = "yes" -then - AC_DEFINE([OM22_COMPATIBILITY], [1], [Compatibility with OpenMotif 2.2]) - OM22_COMPATIBILITY_FALSE=! - OM22_COMPATIBILITY_TRUE= -else - OM22_COMPATIBILITY_FALSE= - OM22_COMPATIBILITY_TRUE=! -fi -AC_SUBST(OM22_COMPATIBILITY_FALSE) -AC_SUBST(OM22_COMPATIBILITY_TRUE) - -if test x$enable_utf8 = x -then - enable_utf8="yes" -fi - -if test "$enable_utf8" = "yes" -then - AC_DEFINE([UTF8_SUPPORTED], [1], [UTF8 is supported]) - AC_SEARCH_LIBS([iconv_open], [iconv], , - AC_SEARCH_LIBS([libiconv_open], [iconv])) -fi - -AC_ARG_ENABLE(printing, [ --disable-printing - Disable printing support]) - -if test x$enable_printing = x -then - enable_printing="yes" -fi - -if test "$enable_printing" = "yes" -then - AC_MSG_CHECKING([for libXp]) - AC_CHECK_HEADERS(X11/extensions/Print.h, - AC_CHECK_LIB(Xp, XpCreateContext, ,enable_printing="no"), - enable_printing="no") -fi - -if test "$enable_printing" = "yes" -then - LIB_XP=-lXp - AC_DEFINE([PRINTING_SUPPORTED], [1], [Printing is supported]) - PRINTING_SUPPORTED_FALSE=! - PRINTING_SUPPORTED_TRUE= -else - LIB_XP= - PRINTING_SUPPORTED_FALSE= - PRINTING_SUPPORTED_TRUE=! -fi -AC_SUBST(PRINTING_SUPPORTED_FALSE) -AC_SUBST(PRINTING_SUPPORTED_TRUE) - -AM_CONDITIONAL(PRINTING, test "$enable_printing" = "yes") -AC_SUBST(LIB_XP) - -AC_FIND_XFT -AC_IMAGE_SUPPORT - - - -# AM_CONDITIONAL(Motif22Compatibility, test x$enable_motif22_compatibility = xyes) - -AC_CONFIG_FILES([Makefile \ -bindings/Makefile \ -bitmaps/Makefile \ -clients/Makefile \ -clients/mwm/Makefile \ -clients/mwm/WmWsmLib/Makefile \ -clients/uil/Makefile \ -clients/xmbind/Makefile \ -config/Makefile \ -config/cf/Makefile \ -config/imake/Makefile \ -config/util/Makefile \ -config/makedepend/Makefile \ -include/Makefile \ -include/Dt/Makefile \ -lib/Makefile \ -lib/Xm/Makefile \ -lib/Mrm/Makefile \ -localized/Makefile \ -localized/util/Makefile \ -doc/Makefile \ -doc/man/Makefile \ -doc/man/man1/Makefile \ -doc/man/man3/Makefile \ -doc/man/man4/Makefile \ -doc/man/man5/Makefile \ -tools/Makefile \ -tools/wml/Makefile \ -demos/Makefile \ -demos/lib/Makefile \ -demos/lib/Xmd/Makefile \ -demos/lib/Wsm/Makefile \ -demos/lib/Exm/Makefile \ -demos/lib/Exm/wml/Makefile \ -demos/programs/Makefile \ -demos/programs/Exm/Makefile \ -demos/programs/Exm/app_in_c/Makefile \ -demos/programs/Exm/app_in_uil/Makefile \ -demos/programs/Exm/simple_app/Makefile \ -demos/programs/airport/Makefile \ -demos/programs/animate/Makefile \ -demos/programs/drag_and_drop/Makefile \ -demos/programs/draw/Makefile \ -demos/programs/earth/Makefile \ -demos/programs/filemanager/Makefile \ -demos/programs/fileview/Makefile \ -demos/programs/getsubres/Makefile \ -demos/programs/hellomotif/Makefile \ -demos/programs/hellomotifi18n/Makefile \ -demos/programs/hellomotifi18n/C/Makefile \ -demos/programs/hellomotifi18n/C/uid/Makefile \ -demos/programs/hellomotifi18n/english/Makefile \ -demos/programs/hellomotifi18n/english/uid/Makefile \ -demos/programs/hellomotifi18n/french/Makefile \ -demos/programs/hellomotifi18n/french/uid/Makefile \ -demos/programs/hellomotifi18n/hebrew/Makefile \ -demos/programs/hellomotifi18n/hebrew/uid/Makefile \ -demos/programs/hellomotifi18n/japan/Makefile \ -demos/programs/hellomotifi18n/japan/uid/Makefile \ -demos/programs/hellomotifi18n/japanese/Makefile \ -demos/programs/hellomotifi18n/japanese/uid/Makefile \ -demos/programs/hellomotifi18n/swedish/Makefile \ -demos/programs/hellomotifi18n/swedish/uid/Makefile \ -demos/programs/i18ninput/Makefile \ -demos/programs/panner/Makefile \ -demos/programs/periodic/Makefile \ -demos/programs/piano/Makefile \ -demos/programs/popups/Makefile \ -demos/programs/sampler2_0/Makefile \ -demos/programs/setdate/Makefile \ -demos/programs/todo/Makefile \ -demos/programs/workspace/Makefile \ -demos/programs/tooltips/Makefile \ -demos/programs/FontSel/Makefile \ -demos/programs/ButtonBox/Makefile \ -demos/programs/ColorSel/Makefile \ -demos/programs/Column/Makefile \ -demos/programs/Combo2/Makefile \ -demos/programs/Ext18List/Makefile \ -demos/programs/Ext18List/pixmaps/Makefile \ -demos/programs/IconB/Makefile \ -demos/programs/Outline/Makefile \ -demos/programs/Paned/Makefile \ -demos/programs/TabStack/Makefile \ -demos/programs/Tree/Makefile \ -demos/programs/pixmaps/Makefile \ -demos/unsupported/Makefile \ -demos/unsupported/Exm/Makefile \ -demos/unsupported/aicon/Makefile \ -demos/unsupported/dainput/Makefile \ -demos/unsupported/dogs/Makefile \ -demos/unsupported/hellomotif/Makefile \ -demos/unsupported/motifshell/Makefile \ -demos/unsupported/uilsymdump/Makefile \ -demos/unsupported/xmapdef/Makefile \ -demos/unsupported/xmfonts/Makefile \ -demos/unsupported/xmforc/Makefile \ -demos/unsupported/xmform/Makefile \ -demos/doc/Makefile \ -demos/doc/programGuide/Makefile \ -demos/doc/programGuide/ch05/Makefile \ -demos/doc/programGuide/ch05/Scale/Makefile \ -demos/doc/programGuide/ch06/Makefile \ -demos/doc/programGuide/ch06/spin_box/Makefile \ -demos/doc/programGuide/ch06/combo_box/Makefile \ -demos/doc/programGuide/ch08/Makefile \ -demos/doc/programGuide/ch08/Notebook/Makefile \ -demos/doc/programGuide/ch08/Container/Makefile \ -demos/doc/programGuide/ch16/Makefile \ -demos/doc/programGuide/ch17/Makefile \ -demos/doc/programGuide/ch17/simple_drop/Makefile \ -demos/doc/programGuide/ch17/simple_drag/Makefile \ -lib/Xm/xmstring.list \ -]) -AC_OUTPUT diff --git a/doc/man/man1/mwm.1 b/doc/man/man1/mwm.1 index d9938d2..dd4b3b8 100644 --- a/doc/man/man1/mwm.1 +++ b/doc/man/man1/mwm.1 @@ -366,7 +366,7 @@ The \fBmwm\fP command is configured from its resource database\&. This database is built from the following sources\&. They are listed in order of precedence, low to high: .PP -\fB/usr/share/X11/app-defaults/Mwm\fP +\fB/usr/X11R6/lib/X11/app-defaults/Mwm\fP .PP \fB$HOME/Mwm\fP .PP @@ -376,7 +376,7 @@ in order of precedence, low to high: .PP \fBmwm\fP command line options .PP -The file names \fB/usr/share/X11/app-defaults/Mwm\fP and \fB$HOME/Mwm\fP represent customary locations for these files\&. The actual +The file names \fB/usr/X11R6/lib/X11/app-defaults/Mwm\fP and \fB$HOME/Mwm\fP represent customary locations for these files\&. The actual location of the system-wide class resource file may depend on the \fBXFILESEARCHPATH\fP environment variable and the current language environment\&. The actual location of the user-specific class resource file may depend on the \fBXUSERFILESEARCHPATH\fP and \fBXAPPLRESDIR\fP @@ -595,7 +595,7 @@ lw(1.528376i) lw(1.592955i) lw(1.054795i) lw(1.323875i). NameClassValue TypeDefault autoKeyFocusAutoKeyFocusT/FT autoRaiseDelayAutoRaiseDelaymillisec500 -bitmap-Bitmap-directory/usr/include- +bitmap-Bitmap-directory/usr/X11R6/include- DirectoryDirectory/X11/bitmaps clientAutoPlaceClientAutoPlaceT/FT colormapFocus-ColormapFocus-stringkeyboard @@ -650,7 +650,7 @@ the keyboard focus\&. The default value of this resource is 500 (ms)\&. This resource identifies a directory to be searched for bitmaps referenced by \fBmwm\fP resources\&. This directory is searched if a bitmap is specified without an absolute pathname\&. The default value for this resource -is \fB/usr/include/X11/bitmaps\fP\&. The directory \fB/usr/include/X11/bitmaps\fP +is \fB/usr/X11R6/include/X11/bitmaps\fP\&. The directory \fB/usr/X11R6/include/X11/bitmaps\fP represents the customary locations for this directory\&. The actual location of this directory may vary on some systems\&. If the bitmap is not found in the specified directory, \fBXBMLANGPATH\fP is searched\&. @@ -678,8 +678,8 @@ is set, \fBmwm\fP looks for \fI$HOME/$LANG\fP/ \fBconfigFile\fP\&. If that file \fB$HOME\fP/\fBconfigFile\fP\&. If the \fIconfigFile\fP pathname does not begin with "~/" or "/", \fBmwm\fP considers it to be relative to the current working directory\&. If the \fIconfigFile\fP resource is not specified or if that file does not exist, \fBmwm\fP uses several default -paths to find a configuration file\&. The order of the search is shown below: \fB/etc/X11/mwm/$LANG/system\&.mwmrc\fP\(dg -\fB/etc/X11/mwm/system\&.mwmrc\fP\(dg Paths marked with \&'\(dg\&' are +paths to find a configuration file\&. The order of the search is shown below: \fB/usr/X11R6/lib/X11/$LANG/system\&.mwmrc\fP\(dg +\fB/usr/X11R6/lib/X11/system\&.mwmrc\fP\(dg Paths marked with \&'\(dg\&' are implementation dependent\&. .IP "\fIdeiconifyKeyFocus\fP\ (class\ \fIDeiconifyKeyFocus\fP)" 10 This resource applies only when the keyboard input focus policy is explicit\&. @@ -1344,11 +1344,11 @@ the shell to use when executing commands via the \fBf\&.exec\fP function\&. .SS "Files" .PP -\fB/etc/X11/mwm/$LANG/system\&.mwmrc\fP +\fB/usr/X11R6/lib/X11/$LANG/system\&.mwmrc\fP .PP -\fB/etc/X11/mwm/system\&.mwmrc\fP +\fB/usr/X11R6/lib/X11/system\&.mwmrc\fP .PP -\fB/usr/share/X11/app-defaults/Mwm\fP +\fB/usr/X11R6/lib/X11/app-defaults/Mwm\fP .PP \fB$HOME/Mwm\fP .PP diff --git a/doc/man/man1/mwm.1.mwmrc_dir b/doc/man/man1/mwm.1.mwmrc_dir deleted file mode 100644 index dd4b3b8..0000000 --- a/doc/man/man1/mwm.1.mwmrc_dir +++ /dev/null @@ -1,1361 +0,0 @@ -'\" t -...\" mwm.sgm /main/13 1996/09/25 11:30:27 cdedoc $ -.de P! -.fl -\!!1 setgray -.fl -\\&.\" -.fl -\!!0 setgray -.fl \" force out current output buffer -\!!save /psv exch def currentpoint translate 0 0 moveto -\!!/showpage{}def -.fl \" prolog -.sy sed -e 's/^/!/' \\$1\" bring in postscript file -\!!psv restore -. -.de pF -.ie \\*(f1 .ds f1 \\n(.f -.el .ie \\*(f2 .ds f2 \\n(.f -.el .ie \\*(f3 .ds f3 \\n(.f -.el .ie \\*(f4 .ds f4 \\n(.f -.el .tm ? font overflow -.ft \\$1 -.. -.de fP -.ie !\\*(f4 \{\ -. ft \\*(f4 -. ds f4\" -' br \} -.el .ie !\\*(f3 \{\ -. ft \\*(f3 -. ds f3\" -' br \} -.el .ie !\\*(f2 \{\ -. ft \\*(f2 -. ds f2\" -' br \} -.el .ie !\\*(f1 \{\ -. ft \\*(f1 -. ds f1\" -' br \} -.el .tm ? font underflow -.. -.ds f1\" -.ds f2\" -.ds f3\" -.ds f4\" -.ta 8n 16n 24n 32n 40n 48n 56n 64n 72n -.TH "mwm" "user cmd" -.SH "NAME" -\fBmwm\fP \(em The Motif -Window Manager -.SH "SYNOPSIS" -.PP -\fBmwm\fP [\fIoptions\fP] -.SH "DESCRIPTION" -.PP -The \fBmwm\fP window manager provides -functions that facilitate control (by the user and the programmer) -of elements of window state such as placement, size, icon/normal display, -and input-focus ownership\&. -.PP -The stand-alone window manager is not an integral part -of CDE and does not support communication with other components in the CDE -environment, such as the Style Manager and the Session Manager\&. -.SS "Options" -.IP "\fI-display\fP\ \fBdisplay\fP" 10 -This option specifies the display to use; see \fBX\fP(1)\&. -.IP "\fI-xrm\fP\ \fBresourcestring\fP" 10 -This option specifies a resource string to use\&. -.IP "\fI-multiscreen\fP" 10 -This option causes \fBmwm\fP to manage all screens on -the display\&. The default is to manage only a single screen. -.IP "\fI-name\fP\ \fBname\fP" 10 -This option causes \fBmwm\fP to retrieve its resources -using the specified name, as in \fBname*resource\fP\&. -.IP "\fI-screens\fP\ \fBname\ [name\ [\&.\&.\&.]]\fP" 10 -This option specifies the resource names to use for the screens managed -by \fBmwm\fP\&. If \fBmwm\fP is managing a single -screen, only the first name in the list is used\&. If \fBmwm\fP -is managing multiple screens, the names are assigned to the screens in order, -starting with screen 0\&. Screen 0 gets the first name, screen 1 the second -name, and so on\&. -.SS "Appearance" -.PP -The following sections describe the basic default behaviors of windows, -icons, the icon box, input focus, and window stacking\&. The appearance and -behavior of the window manager can be altered by changing the configuration -of specific resources\&. Resources are defined under the heading "X DEFAULTS\&." -.SS "Screens" -.PP -By default, \fBmwm\fP manages only the single screen specified -by the \fI-display\fP option or the \fBDISPLAY\fP environment variable (by default, screen 0)\&. If the \fI-multiscreen\fP option is specified or if the \fImultiScreen\fP resource is True, \fBmwm\fP tries to manage all -the screens on the display\&. -.PP -When \fBmwm\fP is managing multiple screens, the \fI-screens\fP option can be used to give each screen a unique -resource name\&. The names are separated by blanks, for example, \fI-screens\fP scr0 scr1\&. If there are more screens than names, -resources for the remaining screens will be retrieved using the first name\&. -By default, the screen number is used for the screen name\&. -.SS "Windows" -.PP -Default \fBmwm\fP window frames have distinct components -with associated functions: -.IP "\fITitle\ Area\fP" 10 -In addition to displaying the client\&'s title, the title area is used -to move the window\&. To move the window, place the pointer over the title area, -press button 1 and drag the window to a new location\&. By default, a wire -frame is moved during the drag to indicate the new location\&. When the button -is released, the window is moved to the new location\&. -.IP "\fITitle\ Bar\fP" 10 -The title bar includes the title area, the minimize button, the maximize -button, and the window menu button\&. In shaped windows, such as round windows, -the title bar floats above the window\&. -.IP "\fIMinimize\ Button\fP" 10 -To turn the window into an icon, click button 1 on the minimize button -(the frame box with a \fBsmall\fP square in it)\&. -.IP "\fIMaximize\ Button\fP" 10 -To make the window fill the screen (or enlarge to the largest size allowed -by the configuration files), click button 1 on the maximize button (the frame -box with a \fBlarge\fP square in it)\&. -.IP "\fIWindow\ Menu\ Button\fP" 10 -The window menu button is the frame box with a horizontal bar in it\&. -To pull down the window menu, press button 1\&. While pressing, drag the pointer -on the menu to your selection, then release the button when your selection -is highlighted\&. Pressing button 3 in the title bar or resize border handles -also posts the window menu\&. Alternately, you can click button 1 to pull down -the menu and keep it posted; then position the pointer and select\&. You can -also post the window menu by pressing or \&. -Double-clicking button 1 with the pointer on the window menu button closes -the window\&. -.PP -The following table lists the contents of the window menu\&. -.SS "Default Window Menu" -.TS -tab(); -lw(1.803823i) lw(1.062374i) lw(2.633803i). -SelectionAcceleratorDescription -RestoreT{ -Restores the window to its size before minimizing -or maximizing\&. -T} -MoveT{ -Allows the window to be moved with keys or -mouse\&. -T} -SizeAllows the window to be resized\&. -MinimizeTurns the window into an icon\&. -MaximizeMakes the window fill the screen\&. -LowerT{ -Moves window to bottom of window stack\&. -T} -CloseAlt+F4Causes client to terminate\&. -.TE -.IP "\fIResize\ Border\ Handles\fP" 10 -To change the size of a window, move the pointer over a resize border -handle (the cursor changes), press button 1, and drag the window to a new -size\&. When the button is released, the window is resized\&. While dragging is -being done, a rubber-band outline is displayed to indicate the new window -size\&. -.IP "\fIMatte\fP" 10 -An optional matte decoration can be added between the client area and -the window frame (see the \fImatteWidth\fP resource)\&. A -\fImatte\fP is not actually part of the window frame\&. -There is no functionality associated with a matte\&. -.SS "Icons" -.PP -Icons are small graphic representations of windows\&. A window can be -minimized (iconified) using the minimize button on the window frame\&. Icons -provide a way to reduce clutter on the screen\&. -.PP -Pressing mouse button 1 when the pointer is over an icon causes the -icon\&'s window menu to pop up\&. Releasing the button (press + release without -moving mouse = click) causes the menu to stay posted\&. The menu contains the -following selections: -.SS "Icon Window Menu" -.TS -tab(); -lw(0.913000i) lw(1.144000i) lw(3.443000i). -SelectionAcceleratorDescription -RestoreOpens the associated window\&. -MoveT{ -Allows the icon to be moved with keys\&. -T} -SizeInactive (not an option for icons)\&. -MinimizeInactive (not an option for icons)\&. -MaximizeT{ -Opens the associated window and makes it -fill the screen\&. -T} -LowerMoves icon to bottom of icon stack\&. -CloseAlt+F4T{ -Removes client from \fBmwm\fP -management\&. -T} -.TE -.PP -Note that pressing button 3 over an icon also causes the icon\&'s window -menu to pop up\&. To make a menu selection, drag the pointer over the menu and -release button 3 when the desired item is highlighted\&. -.PP -Double-clicking button 1 on an icon invokes the \fBf\&.restore_and_raise\fP function and restores the icon\&'s associated window to its previous -state\&. For example, if a maximized window is iconified, double-clicking button -1 restores it to its maximized state\&. Double-clicking button 1 on the icon -box\&'s icon opens the icon box and allows access to the contained icons\&. (In -general, double-clicking a mouse button is a quick way to perform a function\&.) -Pressing or (the pop-up menu key) causes the -icon window menu of the currently selected icon to pop up\&. -.SS "Icon Box" -.PP -When icons begin to clutter the screen, they can be packed into an icon -box\&. (To use an icon box, \fBmwm\fP must be started with the -icon box configuration already set\&.) The icon box is a \fBmwm\fP -window that holds client icons\&. It includes one or more scroll bars when there -are more window icons than the icon box can show at the same time\&. -.PP -Icons in the icon box can be manipulated with the mouse\&. The following -table summarizes the behavior of this interface\&. Button actions apply whenever -the pointer is on any part of the icon\&. Note that double-clicking an icon -in the icon box invokes the \fBf\&.restore_and_raise\fP function\&. -.TS -tab(); -lw(0.841046i) lw(1.051308i) lw(3.607646i). -ButtonActionDescription -Button 1clickSelects the icon\&. -Button 1double-clickT{ -Normalizes (opens) the associated window\&. -Raises an already open window to the top of the stack\&. -T} -Button 1dragMoves the icon\&. -Button 3pressT{ -Causes the menu for that icon to pop up\&. -T} -Button 3dragT{ -Highlights items as the pointer moves across -the menu\&. -T} -.TE -.PP -Pressing mouse button 3 when the pointer is over an icon causes the -menu for that icon to pop up\&. -.SS "Icon Menu for the Icon Box" -.TS -tab(); -lw(0.885312i) lw(1.062374i) lw(3.552314i). -SelectionAcceleratorDescription -RestoreT{ -Opens the associated window (if not already -open)\&. -T} -MoveT{ -Allows the icon to be moved with keys\&. -T} -SizeInactive\&. -MinimizeInactive\&. -MaximizeT{ -Opens the associated window (if not already -open) and maximizes its size\&. -T} -LowerInactive\&. -CloseAlt+F4T{ -Removes client from \fBmwm\fP -management\&. -T} -.TE -.PP -To pull down the window menu for the icon box itself, press button 1 -with the pointer over the menu button for the icon box\&. The window menu of -the icon box differs from the window menu of a client window: The "Close" -selection is replaced with the "PackIcons Shift+Alt+F7" selection\&. When selected, -PackIcons packs the icons in the box to achieve neat rows with no empty slots\&. -.PP -You can also post the window menu by pressing , or - \&. Pressing (the pop-up menu key) causes the icon -window menu of the currently selected icon to pop up\&. -.SS "Input Focus" -.PP -The \fBmwm\fP window manager supports (by default) a keyboard -input focus policy of explicit selection\&. This means when a window is selected -to get keyboard input, it continues to get keyboard input until the window -is withdrawn from window management, another window is explicitly selected -to get keyboard input, or the window is iconified\&. Several resources control -the input focus\&. The client window with the keyboard input focus has the active -window appearance with a visually distinct window frame\&. -.PP -The following tables summarize the keyboard input focus selection behavior: -.TS -tab(); -lw(0.880482i) lw(0.844298i) lw(1.350877i) lw(2.424342i). -ButtonActionObjectFunction Description -Button 1pressWindow / window frameKeyboard focus selection\&. -Button 1pressIconKeyboard focus selection\&. -.TE -.TS -tab(); -lw(1.394366i) lw(4.105634i). -Key ActionFunction Description -[Alt][Tab]T{ -Move input focus to next window in window -stack (available only in explicit focus mode)\&. -T} -[Alt][Shift][Tab]T{ -Move input focus to previous window in window -stack (available only in explicit focus mode)\&. -T} -.TE -.SS "Window Stacking" -.PP -There are two types of window stacks: global window stacks and an application\&'s -local family window stack\&. -.PP -The global stacking order of windows may be changed as a result of setting -the keyboard input focus, iconifying a window, or performing a window manager -window stacking function\&. When keyboard focus policy is explicit the default -value of the \fIfocusAutoRaise\fP resource is True\&. This causes -a window to be raised to the top of the stack when it receives input focus, -for example, by pressing button 1 on the title bar\&. The key actions defined -in the previous table will thus raise the window receiving focus to the top -of the stack\&. -.PP -In pointer mode, the default value of \fIfocusAutoRaise\fP -is False, that is, the window stacking order is not changed when a window -receives keyboard input focus\&. The following key actions can be used to cycle -through the global window stack\&. -.TS -tab(); -lw(1.567982i) lw(3.932018i). -Key ActionFunction Description -[Alt][ESC]T{ -Place top window on bottom of stack\&. -T} -[Alt][Shift][ESC]T{ -Place bottom window on top of stack\&. -T} -.TE -.PP -By default, a window\&'s icon is placed on the bottom of the stack when -the window is iconified; however, the default can be changed by the \fIlowerOnIconify\fP resource\&. -.PP -Transient windows (secondary windows such a dialog boxes) stay above -their parent windows by default; however, an application\&'s local family stacking -order may be changed to allow a transient window to be placed below its parent -top-level window\&. The following arguments show the modification of the stacking -order for the \fBf\&.lower\fP function\&. -.IP "\fBf\&.lower\fP" 10 -Lowers the transient window within the family (staying above the parent) -and lowers the family in the global window stack\&. -.IP "\fBf\&.lower\fP\ [ \fIwithin\fP]" 10 -Lowers the transient window within the family (staying above the parent) -but does not lower the family in the global window stack\&. -.IP "\fBf\&.lower\fP\ [\fIfreeFamily\fP ]" 10 -Lowers the window free from its family stack (below the parent), but -does not lower the family in the global window stack\&. -.PP -The arguments \fIwithin\fP and \fIfreeFamily\fP can also be used with \fBf\&.raise\fP -and \fBf\&.raise_lower\fP\&. -.SS "Session Management" -.PP -The window manager is an X Session Management Protocol aware client\&. It responds to SaveYourself -(and other associated messages) by saving the geometries of its clients to a state file\&. -\fBmwm\fP can then be restarted by the XSMP session manager\&. -The default location for the state file is \fB$HOME/\&.mwmclientdb\fP\&. -This location can be overriden with the resource \fBsessionClientDB\fP\&. -.SS "X Resources" -.PP -The \fBmwm\fP command is configured from its resource -database\&. This database is built from the following sources\&. They are listed -in order of precedence, low to high: -.PP -\fB/usr/X11R6/lib/X11/app-defaults/Mwm\fP -.PP -\fB$HOME/Mwm\fP -.PP -\fBRESOURCE_MANAGER\fP root window property or \fB$HOME/\&.Xdefaults\fP -.PP -\fBXENVIRONMENT\fP variable or \fB$HOME/\&.Xdefaults-host\fP -.PP -\fBmwm\fP command line options -.PP -The file names \fB/usr/X11R6/lib/X11/app-defaults/Mwm\fP and \fB$HOME/Mwm\fP represent customary locations for these files\&. The actual -location of the system-wide class resource file may depend on the \fBXFILESEARCHPATH\fP environment variable and the -current language environment\&. The actual location of the user-specific class -resource file may depend on the \fBXUSERFILESEARCHPATH\fP and \fBXAPPLRESDIR\fP -environment variables and the current language environment\&. -.PP -Entries in the resource database may refer to other resource files for -specific types of resources\&. These include files that contain bitmaps, fonts, -and \fBmwm\fP specific resources such as menus and behavior -specifications (for example, button and key bindings)\&. -.PP -\fIMwm\fP is the resource class name of \fBmwm\fP and \fBmwm\fP is the default resource name used by \fBmwm\fP to look up resources\&. the \fI-screens\fP -command line option specifies resource names, such as "mwm_b+w" and "mwm_color"\&.) -In the following discussion of resource specification, "Mwm" and "mwm" (and -the aliased \fBmwm\fP resource names) can be used interchangeably, -but "mwm" takes precedence over "Mwm"\&. -.PP -The \fBmwm\fP command uses the following types of resources: -.IP "\fBComponent Appearance Resources:\fP" 10 -These resources specify appearance attributes of window manager user -interface components\&. They can be applied to the appearance of window manager -menus, feedback windows (for example, the window reconfiguration feedback -window), client window frames, and icons\&. -.IP "\fBGeneral Appearance and Behavior Resources:\fP" 10 -These resources specify \fBmwm\fP appearance and behavior -(for example, window management policies)\&. They are not set separately for -different \fBmwm\fP user interface components\&. They apply to -all screens and workspaces\&. -.IP "\fBScreen Specific Appearance and Behavior Resources:\fP" 10 -These resources specify the appearance and behavior of \fBmwm\fP elements that are settable on a per-screen basis\&. -.IP "\fBClient Specific Resources:\fP" 10 -These \fBmwm\fP resources can be set for a particular -client window or class of client windows\&. They specify client-specific icon -and client window frame appearance and behavior\&. -.PP -Resource identifiers can be either a resource name (for example, foreground) -or a resource class (for example, Foreground)\&. If the value of a resource -is a filename and if the filename is prefixed by "~/", then it is relative -to the path contained in the \fBHOME\fP -environment variable (generally the user\&'s home directory)\&. -.SS "Component Appearance Resources" -.PP -The syntax for specifying component appearance resources that apply -to window manager icons, menus, and client window frames is \fIMwm*\fP \fBresource_id\fP -.PP -For example, \fIMwm*foreground\fP is used to specify -the foreground color for \fBmwm\fP menus, icons, client window -frames, and feedback dialogs\&. -.PP -The syntax for specifying component appearance resources that apply -to a particular \fBmwm\fP component is \fIMwm*\fP[\fImenu\fP|\fIicon\fP|\fIclient\fP|\fIfeedback\fP] \fI*\fP\fBresource_id\fP -.PP -If \fBmenu\fP is specified, the resource is applied only -to \fBmwm\fP menus; if \fBicon\fP is specified, -the resource is applied to icons; and if \fBclient\fP is specified, -the resource is applied to client window frames\&. For example, \fIMwm*icon*foreground\fP is used to specify the foreground color for \fBmwm\fP -icons, \fIMwm*menu*foreground\fP specifies the foreground -color for \fBmwm\fP menus, and \fIMwm*client*foreground\fP is used to specify the foreground color for \fBmwm\fP -client window frames\&. -.PP -The appearance of the title area of a client window frame (including -window management buttons) can be separately configured\&. The syntax for configuring -the title area of a client window frame is \fIMwm*client*title*\fP \fBresource_id\fP -.PP -For example, \fIMwm*client*title*foreground\fP specifies -the foreground color for the title area\&. Defaults for title area resources -are based on the values of the corresponding client window frame resources\&. -.PP -The appearance of menus can be configured based on the name of the menu\&. -The syntax for specifying menu appearance by name is \fIMwm*menu*\fP \fBmenu_name\fP\fI*\fP\fBresource_id\fP -.PP -For example, \fIMwm*menu*my_menu*foreground\fP specifies -the foreground color for the menu named \fImy_menu\fP\&. The -user can also specify resources for window manager menu components, that is, -the gadgets that comprise the menu\&. These may include for example, a menu -title, title separator, one or more buttons, and separators\&. If a menu contains -more than one instance of a class, such as multiple PushButtonGadgets, the -name of the first instance is "PushButtonGadget1", the second is "PushButtonGadget2", -and so on\&. The following list identifies the naming convention used for window -manager menu components: -.IP " \(bu" 6 -Menu Title LabelGadget - "TitleName" -.IP " \(bu" 6 -Menu Title SeparatorGadget - "TitleSeparator" -.IP " \(bu" 6 -CascadeButtonGadget - "CascadeButtonGadget" -.IP " \(bu" 6 -PushButtonGadget - "PushButtonGadget" -.IP " \(bu" 6 -SeparatorGadget - "SeparatorGadget" -.PP -Refer to the man page for each class for a list of resources that can -be specified\&. -.PP -The following component appearance resources that apply to all window -manager parts can be specified: -.SS "Component Appearance Resources - All Window Manager Parts" -.TS -tab(); -lw(1.802521i) lw(1.571429i) lw(1.178571i) lw(0.947479i). -NameClassValue TypeDefault -backgroundBackgroundcolorvaries\(dg -backgroundPixmapBackgroundPixmapstring\(dg\(dgvaries\(dg -bottomShadowColorForegroundcolorvaries\(dg -bottomShadowPixmapForegroundstring\(dg\(dgvaries\(dg -fontListFontListT{ -string\(dg\(dg\(dg -T}"fixed" -foregroundForegroundcolorvaries\(dg -saveUnderSaveUnderT/FF -topShadowColorBackgroundcolorvaries\(dg -topShadowPixmapTopShadowPixmapstring\(dg\(dgvaries\(dg -.TE -.PP -\(dgThe default is chosen based on the visual type of the screen\&. -\(dg\(dgImage name\&. See \fBXmInstallImage\fP(3)\&. \(dg\(dg\(dgX11 -X Logical Font Description -.IP "\fIbackground\fP\ (class\ \fIBackground\fP)" 10 -This resource specifies the background color\&. Any legal X color may -be specified\&. The default value is chosen based on the visual type of the -screen\&. -.IP "\fIbackgroundPixmap\fP\ (class\ \fIBackgroundPixmap\fP)" 10 -This resource specifies the background Pixmap of the \fBmwm\fP -decoration when the window is inactive (does not have the keyboard focus)\&. -The default value is chosen based on the visual type of the screen\&. -.IP "\fIbottomShadowColor\fP\ (class\ \fIForeground\fP)" 10 -This resource specifies the bottom shadow color\&. This color is used -for the lower and right bevels of the window manager decoration\&. Any legal -X color may be specified\&. The default value is chosen based on the visual -type of the screen\&. -.IP "\fIbottomShadowPixmap\fP\ (class\ \fIBottomShadowPixmap\fP)" 10 -This resource specifies the bottom shadow Pixmap\&. This Pixmap is used -for the lower and right bevels of the window manager decoration\&. The default -is chosen based on the visual type of the screen\&. -.IP "\fIfontList\fP\ (class\ \fIFontList\fP)" 10 -This resource specifies the font used in the window manager decoration\&. -The character encoding of the font should match the character encoding of -the strings that are used\&. The default is "fixed\&." -.IP "\fIforeground\fP\ (class\ \fIForeground\fP)" 10 -This resource specifies the foreground color\&. The default is chosen -based on the visual type of the screen\&. -.IP "\fIsaveUnder\fP\ (class\ \fISaveUnder\fP)" 10 -This is used to indicate whether "save unders" are used for \fBmwm\fP components\&. For this to have any effect, save unders must be -implemented by the X server\&. If save unders are implemented, the X server -saves the contents of windows obscured by windows that have the save under -attribute set\&. If the \fIsaveUnder\fP resource is True, \fBmwm\fP will set the save under attribute on the window manager frame -of any client that has it set\&. If \fIsaveUnder\fP is False, -save unders will not be used on any window manager frames\&. The default value -is False\&. -.IP "\fItopShadowColor\fP\ (class\ \fIBackground\fP)" 10 -This resource specifies the top shadow color\&. This color is used for -the upper and left bevels of the window manager decoration\&. The default is -chosen based on the visual type of the screen\&. -.IP "topShadowPixmap\ (\ class\ \fITopShadowPixmap)\fP" 10 -This resource specifies the top shadow Pixmap\&. This Pixmap is used for -the upper and left bevels of the window manager decoration\&. The default is -chosen based on the visual type of the screen\&. -.PP -The following component appearance resources that apply to frame and -icons can be specified: -.SS "Frame and Icon Components" -.TS -tab(); -lw(2.072144i) lw(1.653307i) lw(0.991984i) lw(0.782565i). -NameClassValue TypeDefault -activeBackgroundBackgroundcolorvaries\(dg -activeBackgroundPixmapBackgroundPixmapstring\(dg\(dgvaries\(dg -activeBottomShadowColorForegroundcolorvaries\(dg -activeBottomShadowPixmapBottomShadowPixmapstring\(dg\(dgvaries\(dg -activeForegroundForegroundcolorvaries\(dg -activeTopShadowColorBackgroundcolorvaries\(dg -activeTopShadowPixmapTopShadowPixmapstring\(dg\(dgvaries\(dg -.TE -.PP -\(dgThe default is chosen based on the visual type of the screen\&. -\(dg\(dgSee \fBXmInstallImage\fP(3)\&. -.IP "\fIactiveBackground\fP\ (class\ \fIBackground\fP)" 10 -This resource specifies the background color of the \fBmwm\fP -decoration when the window is active (has the keyboard focus)\&. The default -is chosen based on the visual type of the screen\&. -.IP "\fIactiveBackgroundPixmap\fP\ (class\ \fIActiveBackgroundPixmap\fP)" 10 -This resource specifies the background Pixmap of the \fBmwm\fP -decoration when the window is active (has the keyboard focus)\&. The default -is chosen based on the visual type of the screen\&. -.IP "\fIactiveBottomShadowColor\fP\ (class\ \fIForeground\fP)" 10 -This resource specifies the bottom shadow color of the \fBmwm\fP decoration when the window is active (has the keyboard focus)\&. -The default is chosen based on the visual type of the screen\&. -.IP "\fIactiveBottomShadowPixmap\fP\ (class\ \fIBottomShadowPixmap\fP)" 10 -This resource specifies the bottom shadow Pixmap of the \fBmwm\fP decoration when the window is active (has the keyboard focus)\&. -The default is chosen based on the visual type of the screen\&. -.IP "\fIactiveForeground\fP\ (class\ \fIForeground\fP)" 10 -This resource specifies the foreground color of the \fBmwm\fP -decoration when the window is active (has the keyboard focus)\&. The default -is chosen based on the visual type of the screen\&. -.IP "\fIactiveTopShadowColor\fP\ (class\ \fIBackground\fP)" 10 -This resource specifies the top shadow color of the \fBmwm\fP -decoration when the window is active (has the keyboard focus)\&. The default -is chosen based on the visual type of the screen\&. -.IP "\fIactiveTopShadowPixmap\fP\ (class\ \fITopShadowPixmap\fP)" 10 -This resource specifies the top shadow Pixmap of the \fBmwm\fP -decoration when the window is active (has the keyboard focus)\&. The default -is chosen based on the visual type of the screen\&. -.SS "General Appearance and Behavior Resources" -.PP -The syntax for specifying general appearance and behavior resources -is \fIMwm*\fP\fBresource_id\fP -.PP -For example, \fIMwm*keyboardFocusPolicy\fP specifies -the window manager policy for setting the keyboard focus to a particular client -window\&. -.PP -The following general appearance and behavior resources can be specified: -.SS "General Appearance and Behavior Resources" -.TS -tab(); -lw(1.528376i) lw(1.592955i) lw(1.054795i) lw(1.323875i). -NameClassValue TypeDefault -autoKeyFocusAutoKeyFocusT/FT -autoRaiseDelayAutoRaiseDelaymillisec500 -bitmap-Bitmap-directory/usr/X11R6/include- -DirectoryDirectory/X11/bitmaps -clientAutoPlaceClientAutoPlaceT/FT -colormapFocus-ColormapFocus-stringkeyboard -PolicyPolicy -configFileConfigFilefile$HOME/mwmrc -deiconifyKeyFocusDeiconifyKeyFocusT/FT -doubleClick-DoubleClick-millisec\&.multi-click -TimeTimetime\(dg -enableWarpenableWarpT/FT -enforceKeyFocusEnforceKeyFocusT/FT -frameStyleFrameStylestringrecessed -iconAutoPlaceIconAutoPlaceT/FT -iconClickIconClickT/FT -interactivePlacementInteractivePlacementT/FT -keyboardFocus-KeyboardFocus-stringexplicit -PolicyPolicy -lowerOnIconifyLowerOnIconifyT/FT -moveThresholdMoveThresholdpixels4 -multiScreenMultiScreenT/FF -passButtonsPassButtonsT/FF -passSelectButtonPassSelectButtonT/FT -positionIsFramePositionIsFrameT/FT -positionOnScreenPositionOnScreenT/FT -quitTimeoutQuitTimeoutmillisec\&.1000 -raiseKeyFocusRaiseKeyFocusT/FF -refreshByClearingRefreshByClearingT/FT -rootButtonClickRootButtonClickT/FF -screensScreensstringvaries -sessionClientDBSessionClientDBstring$HOME/\&.mwmclientdb -showFeedbackShowFeedbackstringall -startupKeyFocusStartupKeyFocusT/FT -wMenuButtonClickWMenuButtonClickT/FT -wMenuButtonClick2WMenuButtonClick2T/FT -.TE -.PP -\(dgThe resource doubleClickTime is included for backward compatibility\&. -Use of the Xt resource multiClickTime is preferred\&. -.IP "\fIautoKeyFocus\fP\ (class\ \fIAutoKeyFocus\fP)" 10 -This resource is available only when the keyboard input focus policy -is explicit\&. If \fIautoKeyFocus\fP is given a value of True, -then when a window with the keyboard input focus is withdrawn from window -management or is iconified, the focus is set to the previous window that had -the focus\&. If the value given is False, there is no automatic setting of the -keyboard input focus\&. It is recommended that both \fIautoKeyFocus\fP and \fIstartupKeyFocus\fP be True to work with -tear off menus\&. The default value is True\&. -.IP "\fIautoRaiseDelay\fP\ (class\ \fIAutoRaiseDelay\fP)" 10 -This resource is available only when the \fIfocusAutoRaise\fP -resource is True and the keyboard focus policy is pointer\&. The \fIautoRaiseDelay\fP resource specifies the amount of time (in milliseconds) -that \fBmwm\fP will wait before raising a window after it gets -the keyboard focus\&. The default value of this resource is 500 (ms)\&. -.IP "\fIbitmapDirectory\fP\ (class\ \fIBitmapDirectory\fP)" 10 -This resource identifies a directory to be searched for bitmaps referenced -by \fBmwm\fP resources\&. This directory is searched if a bitmap -is specified without an absolute pathname\&. The default value for this resource -is \fB/usr/X11R6/include/X11/bitmaps\fP\&. The directory \fB/usr/X11R6/include/X11/bitmaps\fP -represents the customary locations for this directory\&. The actual -location of this directory may vary on some systems\&. If the bitmap is not -found in the specified directory, \fBXBMLANGPATH\fP is searched\&. -.IP "\fIclientAutoPlace\fP\ (class\ \fIClientAutoPlace\fP)" 10 -This resource determines the position of a window when the window has -not been given a program- or user-specified position\&. With a value of True, -windows are positioned with the top left corners of the frames offset horizontally -and vertically\&. A value of False causes the currently configured position -of the window to be used\&. In either case, \fBmwm\fP will attempt -to place the windows totally on-screen\&. The default value is True\&. -.IP "\fIcolormapFocusPolicy\fP\ (class\ \fIColormapFocusPolicy\fP)" 10 -This resource indicates the colormap focus policy that is to be used\&. -If the resource value is explicit, a colormap selection action is done on -a client window to set the colormap focus to that window\&. If the value is -pointer, the client window containing the pointer has the colormap focus\&. -If the value is keyboard, the client window that has the keyboard input focus -has the colormap focus\&. The default value for this resource is keyboard\&. -.IP "\fIconfigFile\fP\ (class\ \fIConfigFile\fP)" 10 -The resource value is the pathname for a \fBmwm\fP resource -description file\&. If the pathname begins with "~/", \fBmwm\fP -considers it to be relative to the user\&'s home directory (as specified by -the \fBHOME\fP environment variable)\&. -If the \fBLANG\fP environment variable -is set, \fBmwm\fP looks for \fI$HOME/$LANG\fP/ \fBconfigFile\fP\&. If that file does not exist or if \fBLANG\fP is not set, \fBmwm\fP looks for -\fB$HOME\fP/\fBconfigFile\fP\&. If the \fIconfigFile\fP pathname does not begin with "~/" or "/", \fBmwm\fP considers it to be relative to the current working directory\&. If -the \fIconfigFile\fP resource is not specified -or if that file does not exist, \fBmwm\fP uses several default -paths to find a configuration file\&. The order of the search is shown below: \fB/usr/X11R6/lib/X11/$LANG/system\&.mwmrc\fP\(dg -\fB/usr/X11R6/lib/X11/system\&.mwmrc\fP\(dg Paths marked with \&'\(dg\&' are -implementation dependent\&. -.IP "\fIdeiconifyKeyFocus\fP\ (class\ \fIDeiconifyKeyFocus\fP)" 10 -This resource applies only when the keyboard input focus policy is explicit\&. -If a value of True is used, a window receives the keyboard input focus when -it is normalized (deiconified)\&. True is the default value\&. -.IP "\fIdoubleClickTime\fP\ (class\ \fIDoubleClickTime\fP)" 10 -This resource is used to set the maximum time (in ms) between the clicks -(button presses) that make up a double-click\&. The use of this resource is -deprecated\&. Use the Xt resource \fImultiClickTime\fP instead\&. -The value of \fIdoubleClickTime\fP dynamically defaults to -the value of \fImultiClickTime\fP\&. -.IP "\fIenableWarp\fP\ (class\ \fIEnableWarp\fP)" 10 -The default value of this resource, True, causes \fBmwm\fP -to warp the pointer to the center of the selected window during keyboard-controlled -resize and move operations\&. Setting the value to False causes \fBmwm\fP to leave the pointer at its original place on the screen, unless -the user explicitly moves it with the cursor keys or pointing device\&. -.IP "\fIenforceKeyFocus\fP\ (class\ \fIEnforceKeyFocus\fP)" 10 -If this resource is given a value of True, the keyboard input focus -is always explicitly set to selected windows even if there is an indication -that they are "globally active" input windows\&. (An example of a globally active -window is a scroll bar that can be operated without setting the focus to that -client\&.) If the resource is False, the keyboard input focus is not explicitly -set to globally active windows\&. The default value is True\&. -.IP "\fIframeStyle\fP\ (class\ \fIframeStyle\fP)" 10 -If this resource is given a value of "slab", the the window manager -frame is drawn such that the client area appears to be at the same height -as the top of the window frame\&. If the resource is set to "recessed", the -window frame is drawn such that the client area appears lower than the top -of the window frame\&. The default value is "recessed"\&. -.IP "\fIiconAutoPlace\fP\ (class\ \fIIconAutoPlace\fP)" 10 -This resource indicates whether the window manager arranges icons in -a particular area of the screen or places each icon where the window was when -it was iconified\&. The value True indicates that icons are arranged in a particular -area of the screen, determined by the \fIiconPlacement\fP resource\&. -The value False indicates that an icon is placed at the location of the window -when it is iconified\&. The default is True\&. -.IP "\fIiconClick\fP\ (class\ \fIIconClick\fP)" 10 -When this resource is given the value of True, the system menu is posted -and left posted when an icon is clicked\&. The default value is True\&. -.IP "\fIinteractivePlacement\fP\ (class\ \fIInteractivePlacement\fP)" 10 -This resource controls the initial placement of new windows on the screen\&. -If the value is True, the pointer shape changes before a new window is placed -on the screen to indicate to the user that a position should be selected for -the upper-left hand corner of the window\&. If the value is False, windows are -placed according to the initial window configuration attributes\&. The default -value of this resource is False\&. -.IP "\fIkeyboardFocusPolicy\fP\ (class\ \fIKeyboardFocusPolicy\fP)" 10 -If set to pointer, the keyboard focus policy is to have the keyboard -focus set to the client window that contains the pointer (the pointer could -also be in the client window decoration that \fBmwm\fP adds)\&. -If set to explicit, the policy is to have the keyboard focus set to a client -window when the user presses button 1 with the pointer on the client window -or any part of the associated \fBmwm\fP decoration\&. The default -value for this resource is explicit\&. -.IP "\fIlowerOnIconify\fP\ (class\ \fILowerOnIconify\fP)" 10 -If this resource is given the default value of True, a window\&'s icon -appears on the bottom of the window stack when the window is minimized (iconified)\&. -A value of False places the icon in the stacking order at the same place as -its associated window\&. The default value of this resource is True\&. -.IP "\fImoveThreshold\fP\ (class\ \fIMoveThreshold\fP)" 10 -This resource is used to control the sensitivity of dragging operations -that move windows and icons\&. The value of this resource is the number of pixels -that the locator is moved with a button down before the move operation is -initiated\&. This is used to prevent window/icon movement when you click or -double-click and there is unintentional pointer movement with the button down\&. -The default value of this resource is 4 (pixels)\&. -.IP "\fImultiScreen\fP\ (class\ \fIMultiScreen\fP)" 10 -This resource, if True, causes \fBmwm\fP to manage all -the screens on the display\&. If False, \fBmwm\fP manages only -a single screen\&. The default value is False\&. -.IP "\fIpassButtons\fP\ (class\ \fIPassButtons\fP)" 10 -This resource indicates whether or not button press events are passed -to clients after they are used to do a window manager function in the client -context\&. If the resource value is False, the button press is not passed to -the client\&. If the value is True, the button press is passed to the client -window\&. The window manager function is done in either case\&. The default value -for this resource is False\&. -.IP "\fIpassSelectButton\fP\ (class\ \fIPassSelectButton\fP)" 10 -This resource indicates whether or not to pass the select button press -events to clients after they are used to do a window manager function in the -client context\&. If the resource value is False, then the button press will -not be passed to the client\&. If the value is True, the button press is passed -to the client window\&. The window manager function is done in either case\&. -The default value for this resource is True\&. -.IP "\fIpositionIsFrame\fP\ (class\ \fIPositionIsFrame\fP)" 10 -This resource indicates how client window position information (from -the \fIWM_NORMAL_HINTS\fP property and from configuration requests) -is to be interpreted\&. If the resource value is True, the information is interpreted -as the position of the \fBmwm\fP client window frame\&. If the -value is False, it is interpreted as being the position of the client area -of the window\&. The default value of this resource is True\&. -.IP "\fIpositionOnScreen\fP\ (class\ \fIPositionOnScreen\fP)" 10 -This resource is used to indicate that windows should initially be placed -(if possible) so that they are not clipped by the edge of the screen (if the -resource value is True)\&. If a window is larger than the size of the screen, -at least the upper-left corner of the window is on-screen\&. If the resource -value is False, windows are placed in the requested position even if totally -off-screen\&. The default value of this resource is True\&. -.IP "\fIquitTimeout\fP\ (class\ \fIQuitTimeout\fP)" 10 -This resource specifies the amount of time (in milliseconds) that \fBmwm\fP will wait for a client to update the \fIWM_COMMAND\fP -property after \fBmwm\fP has sent the \fBWM_SAVE_YOURSELF\fP message\&. The default value of this resource is 1000 (ms)\&. (Refer -to the \fBf\&.kill\fP function description for additional information\&.) -.IP "\fIraiseKeyFocus\fP\ (class\ \fIRaiseKeyFocus\fP)" 10 -This resource is available only when the keyboard input focus policy -is explicit\&. When set to True, this resource specifies that a window raised -by means of the \fBf\&.normalize_and_raise\fP function also receives -the input focus\&. The default value of this resource is False\&. -.IP "\fIrefreshByClearing\fP\ (class\ \fIRefreshByClearing\fP)" 10 -This resource determines the mechanism used to refresh a window (or -the screen) when the \fBf\&.refresh_win\fP (\fBf\&.refresh\fP) function is executed\&. When set to True, an XClearArea is performed -over the window for \fBf\&.refresh_win\fP\&. When set to False, -a covering window is created and destroyed over the top of the window to be -refreshed\&. If the function is \fBf\&.refresh\fP and this resource -is set to True, then an XClearArea is performed over every window on the screen\&. -If the resource is set to False, then one large window covering the entire -screen is created and destroyed\&. The default value of this resource is True\&. -.IP "\fIrootButtonClick\fP\ (class\ \fIRootButtonClick\fP)" 10 -The \fIrootButtonClick\fP resource controls whether the -a click on the root window will post the root menu in a "sticky" mode\&. If -this resource is set to True, a button click on the root window will post -the menu bound to the button down event for that button in a "sticky" fashion\&. -If this resource is set to False, then the same button click would only cause -the menu to flash as it would be unposted once the button up event is seen\&. -The criterion used to determine if it is a button click is if the pointer -doesn\&'t move between the button down and button up events\&. The default value -for this resource is True\&. -.IP "\fIscreens\fP\ (class\ \fIScreens\fP)" 10 -This resource specifies the resource names to use for the screens managed -by \fBmwm\fP\&. If \fBmwm\fP is managing a single -screen, only the first name in the list is used\&. If \fBmwm\fP -is managing multiple screens, the names are assigned to the screens in order, -starting with screen 0\&. Screen 0 gets the first name, screen 1 the second -name, and so on\&. The default screen names are 0, 1, and so on\&. -.IP "\fIsessionClientDB\fP\ (class\ \fISessionClientDB\fP)" 10 -This resource identifies a file name to use as a root when saving state -at the request of an XSMP session manager\&. When the session is saved, the window manager will then reuse -the file name by automatically incrementing a suffix\&. -.IP "\fIshowFeedback\fP\ (class\ \fIShowFeedback\fP)" 10 -This resource controls whether or not feedback windows or confirmation -dialogs are displayed\&. A feedback window shows a client window\&'s initial -placement and shows position and size during move and resize operations\&. -Confirmation dialogs can be displayed for certain operations\&. The value for -this resource is a list of names of the feedback options to be enabled or -disabled; the names must be separated by a space\&. If an option is preceded -by a minus sign, that option is excluded from the list\&. The \fBsign\fP of the first item in the list determines the initial set of options\&. -If the sign of the first option is minus, \fBmwm\fP assumes -all options are present and starts subtracting from that set\&. If the sign -of the first decoration is plus (or not specified), \fBmwm\fP -starts with no options and builds up a list from the resource\&. -.PP -The names of the feedback options are shown below: -.TS -tab(); -lw(1.097588i) lw(4.402412i). -NameDescription -allShow all feedback (Default value)\&. -behaviorConfirm behavior switch\&. -killConfirm on receipt of KILL signal\&. -moveShow position during move\&. -noneShow no feedback\&. -placementT{ -Show position and size during initial placement\&. -T} -quitConfirm quitting \fBmwm\fP\&. -resizeShow size during resize\&. -restartConfirm \fBmwm\fP restart\&. -.TE -.PP -The following command line illustrates the syntax for showFeedback: -.PP -.nf -\f(CW\fIMwm*showFeedback: placement resize behavior restart\fP\fR -.fi -.PP -.PP -This resource specification provides feedback for initial client placement -and resize, and enables the dialog boxes to confirm the restart and set behavior -functions\&. It disables feedback for the move function\&. The default value for -this resource is all\&. -.IP "\fIstartupKeyFocus\fP\ (class\ \fIStartupKeyFocus\fP)" 10 -This resource is available only when the keyboard input focus policy -is explicit\&. When given the default value of True, a window gets the keyboard -input focus when the window is mapped (that is, initially managed by the window -manager)\&. It is recommended that both \fIautoKeyFocus\fP and \fIstartupKeyFocus\fP be True to work with tear off menus\&. The default -value is True\&. -.IP "\fIwMenuButtonClick\fP\ (class\ \fIWMenuButtonClick\fP)" 10 -This resource indicates whether a click of the mouse when the pointer -is over the window menu button posts and leaves posted the window menu\&. If -the value given this resource is True, the menu remains posted\&. True is the -default value for this resource\&. -.IP "\fIwMenuButtonClick2\fP\ (class\ \fIWMenuButtonClick2\fP)" 10 -When this resource is given the default value of True, a double-click -action on the window menu button does an \fIf\&.kill function\fP\&. -.SS "Screen Specific Appearance and Behavior Resources" -.PP -The syntax for specifying screen specific resources is \fIMwm*\fP \fBscreen_name\fP\fI*\fP\fBresource_id\fP For example, \fIMwm*1*keyBindings\fP specifies -the key bindings to use for screen "1"\&. -.SS "Screen Specific Resources" -.TS -tab(); -lw(1.768627i) lw(1.790196i) lw(0.927451i) lw(1.013725i). -NameClassValue TypeDefault -buttonBindingsButtonBindingsstringDefaultButtonBindings -cleanTextCleanTextT/FT -fadeNormalIconFadeNormalIconT/FF -feedbackGeometryFeedbackGeometrystringcenter on screen -frameBorderWidthFrameBorderWidthpixelsvaries -iconBoxGeometryIconBoxGeometrystring6x1+0-0 -iconBoxNameIconBoxNamestringiconbox -iconBoxSBDisplayPolicyIconBoxSBDisplayPolicystringall -iconBoxTitleIconBoxTitleXmStringIcons -iconDecorationIconDecorationstringvaries -iconImageMaximumIconImageMaximumwxh48x48 -iconImageMinimumIconImageMinimumwxh16x16 -iconPlacementIconPlacementstringleft bottom -iconPlacementMarginIconPlacementMarginpixelsvaries -keyBindingsKeyBindingsstringDefaultKeyBindings -limitResizeLimitResizeT/FT -maximumMaximumSizeMaximumMaximumSizewxh (pixels)2X screen w&h -moveOpaqueMoveOpaqueT/FF -resizeBorderWidthResizeBorderWidthpixelsvaries -resizeCursorsResizeCursorsT/FT -transientDecorationTransientDecorationstringmenu title -transientFunctionsTransientFunctionsstringT{ --minimize-maximize -T} -useIconBoxUseIconBoxT/FF -.TE -.IP "\fIbuttonBindings\fP\ (class\ \fIButtonBindings\fP)" 10 -This resource identifies the set of button bindings for window management -functions\&. The named set of button bindings is specified in the \fBmwm\fP resource description file\&. These button bindings are \fBmerged\fP with the built-in default bindings\&. The default value for -this resource is "DefaultButtonBindings"\&. -.IP "\fIcleanText\fP\ (class\ \fICleanText\fP)" 10 -This resource controls the display of window manager text in the client -title and feedback windows\&. If the default value of True is used, the text -is drawn with a clear (no stipple) background\&. This makes text easier to read -on monochrome systems where a backgroundPixmap is specified\&. Only the stippling -in the area immediately around the text is cleared\&. If False, the text is -drawn directly on top of the existing background\&. -.IP "\fIfadeNormalIcon\fP\ (class\ \fIFadeNormalIcon\fP)" 10 -If this resource is given a value of True, an icon is grayed out whenever -it has been normalized (its window has been opened)\&. The default value is -False\&. -.IP "\fIfeedbackGeometry\fP\ (class\ \fIFeedbackGeometry\fP)" 10 -This resource sets the position of the move and resize feedback window\&. -If this resource is not specified, the default is to place the feedback window -at the center of the screen\&. The value of the resource is a standard window -geometry string with the following syntax: [\fI=\fP]{ \fI+-\fP}\fBxoffset\fP{\fI+-\fP} \fByoffset\fP] -.IP "\fIframeBorderWidth\fP\ (class\ \fIFrameBorderWidth\fP)" 10 -This resource specifies the width (in pixels) of a client window frame -border without resize handles\&. The border width includes the 3-D shadows\&. -The default value is based on the size and resolution of the screen\&. -.IP "\fIiconBoxGeometry\fP\ (class\ \fIIconBoxGeometry\fP)" 10 -This resource indicates the initial position and size of the icon box\&. -The value of the resource is a standard window geometry string with the following -syntax: [\fI=\fP][\fBwidth\fP \fIx\fP\fBheight\fP][{\fI+-\fP}\fBxoffset\fP {\fI+-\fP}\fByoffset\fP] If the offsets -are not provided, the iconPlacement policy is used to determine the initial -placement\&. The units for width and height are columns and rows\&. The actual -screen size of the icon box window depends on the iconImageMaximum (size) -and \fIiconDecoration\fP resources\&. The default value for size -is (6 * iconWidth + padding) wide by (1 * iconHeight + padding) high\&. The -default value of the location is +0 -0\&. -.IP "\fIiconBoxName\fP\ (class\ \fIIconBoxName\fP)" 10 -This resource specifies the name that is used to look up icon box resources\&. -The default name is iconbox\&. -.IP "\fIiconBoxSBDisplayPolicy\fP\ (class\ \fIIconBoxSBDisplayPolicy\fP)" 10 -This resource specifies the scroll bar display policy of the window -manager in the icon box\&. The resource has three possible values: all, vertical, -and horizontal\&. The default value, "all", causes both vertical and horizontal -scroll bars always to appear\&. The value "vertical" causes a single vertical -scroll bar to appear in the icon box and sets the orientation of the icon -box to horizontal (regardless of the iconBoxGeometry specification)\&. The value -"horizontal" causes a single horizontal scroll bar to appear in the icon box -and sets the orientation of the icon box to vertical (regardless of the iconBoxGeometry -specification)\&. -.IP "\fIiconBoxTitle\fP\ (class\ \fIIconBoxTitle\fP)" 10 -This resource specifies the name that is used in the title area of the -icon box frame\&. The default value is Icons\&. -.IP "\fIiconDecoration\fP\ (class\ \fIIconDecoration\fP)" 10 -This resource specifies the general icon decoration\&. The resource value -is label (only the label part is displayed) or image (only the image part -is displayed) or label image (both the label and image parts are displayed)\&. -A value of activelabel can also be specified to get a label (not truncated -to the width of the icon) when the icon is selected\&. The default icon decoration -for icon box icons is that each icon has a label part and an image part (label -image)\&. The default icon decoration for stand alone icons is that each icon -has an active label part, a label part, and an image part (activelabel label -image)\&. -.IP "\fIiconImageMaximum\fP\ (class\ \fIIconImageMaximum\fP)" 10 -This resource specifies the maximum size of the icon image\&. The resource -value is \fBwidth\fP\fIx\fP \fBheight\fP (for example, 64x64)\&. The maximum supported size is 128x128\&. -The default value of this resource is 50x50\&. -.IP "\fIiconImageMinimum\fP\ (class\ \fIIconImageMinimum\fP)" 10 -This resource specifies the minimum size of the icon image\&. The resource -value is \fBwidth\fP\fIx\fP \fBheight\fP (for example, 32x50)\&. The minimum supported size is 16x16\&. -The default value of this resource is 16x16\&. -.IP "\fIiconPlacement\fP\ (class\ \fIIconPlacement\fP)" 10 -This resource specifies the icon placement scheme to be used\&. The resource -value has the following syntax: -.IP "" 10 -\fBprimary_layout secondary_layout [tight]\fP -.PP -The layout values are one of the following: -.TS -tab(); -lw(0.796053i) lw(4.703947i). -ValueDescription -topLay the icons out top to bottom\&. -bottomLay the icons out bottom to top\&. -leftLay the icons out left to right\&. -rightLay the icons out right to left\&. -.TE -.PP -A horizontal (vertical) layout value should not be used for both the \fBprimary_layout\fP and the \fBsecondary_layout\fP (for -example, don\&'t use top for the \fBprimary_layout\fP and bottom -for the \fBsecondary_layout\fP)\&. -.PP -The \fBprimary_layout\fP indicates whether, when an icon -placement is done, the icon is placed in a row or a column and the direction -of placement\&. The \fBsecondary_layout\fP indicates where to place -new rows or columns\&. For example, top right indicates that icons should be -placed top to bottom on the screen and that columns should be added from right -to left on the screen\&. -.PP -The default placement is left bottom (icons are placed left to right -on the screen, with the first row on the bottom of the screen, and new rows -added from the bottom of the screen to the top of the screen)\&. A \fBtight\fP value places icons with zero spacing in between icons\&. This -value is useful for aesthetic reasons, as well as X-terminals with small screens\&. -.IP "\fIiconPlacementMargin\fP\ (class\ \fIIconPlacementMargin\fP)" 10 -This resource sets the distance between the edge of the screen and the -icons that are placed along the edge of the screen\&. The value should be greater -than or equal to 0\&. A default value (see below) is used if the value specified -is invalid\&. The default value for this resource is equal to the space between -icons as they are placed on the screen (this space is based on maximizing -the number of icons in each row and column)\&. -.IP "\fIkeyBindings\fP\ (class\ \fIKeyBindings\fP)" 10 -This resource identifies the set of key bindings for window management -functions\&. If specified, these key bindings \fBreplace\fP the -built-in default bindings\&. The named set of key bindings is specified in \fBmwm\fP resource description file\&. The default value for this resource -is "DefaultKeyBindings"\&. -.IP "\fIlimitResize\fP\ (class\ \fILimitResize\fP)" 10 -If this resource is True, the user is not allowed to resize a window -to greater than the maximum size\&. The default value for this resource is True\&. -.IP "\fImaximumMaximumSize\fP\ (class\ \fIMaximumMaximumSize\fP)" 10 -This resource is used to limit the maximum size of a client window as -set by the user or client\&. The resource value is \fBwidth\fP\fIx\fP\fBheight\fP (for example, 1024x1024) -where the width and height are in pixels\&. The default value of this resource -is twice the screen width and height\&. -.IP "\fImoveOpaque\fP\ (class\ \fIMoveOpaque\fP)" 10 -This resource controls whether the actual window is moved or a rectangular -outline of the window is moved\&. A default value of False displays a rectangular -outline on moves\&. -.IP "\fIresizeBorderWidth\fP\ (class\ \fIResizeBorderWidth\fP)" 10 -This resource specifies the width (in pixels) of a client window frame -border with resize handles\&. The specified border width includes the 3-D shadows\&. -The default value is based on the size and resolution of the screen\&. -.IP "\fIresizeCursors\fP\ (class\ \fIResizeCursors\fP)" 10 -This is used to indicate whether the resize cursors are always displayed -when the pointer is in the window size border\&. If True, the cursors are shown, -otherwise the window manager cursor is shown\&. The default value is True\&. -.IP "\fItransientDecoration\fP\ (class\ \fITransientDecoration\fP)" 10 -This controls the amount of decoration that \fBmwm\fP -puts on transient windows\&. The decoration specification is exactly the same -as for the \fIclientDecoration\fP (client specific) resource\&. -Transient windows are identified by the \fIWM_TRANSIENT_FOR\fP -property, which is added by the client to indicate a relatively temporary -window\&. The default value for this resource is menu title (that is, transient -windows have frame borders and a titlebar with a window menu button)\&. -.IP "" 10 -An application can also specify which decorations \fBmwm\fP -should apply to its windows\&. If it does so, \fBmwm\fP applies -only those decorations indicated by both the application and the \fItransientDecoration\fP resource\&. Otherwise, \fBmwm\fP -applies the decorations indicated by the \fItransientDecoration\fP -resource\&. For more information see the description of \fBXmNmwmDecorations\fP on the \fBVendorShell\fP(3) -reference page\&. -.IP "\fItransientFunctions\fP\ (class\ \fITransientFunctions\fP)" 10 -This resource is used to indicate which window management functions -are applicable (or not applicable) to transient windows\&. The function specification -is exactly the same as for the \fIclientFunctions\fP (client -specific) resource\&. The default value for this resource is -minimize -maximize\&. -.IP "" 10 -An application can also specify which functions \fBmwm\fP -should apply to its windows\&. If it does so, \fBmwm\fP applies -only those functions indicated by both the application and the \fItransientFunctions\fP resource\&. Otherwise, \fBmwm\fP -applies the functions indicated by the \fItransientFunctions\fP -resource\&. For more information see the description of \fBXmNmwmFunctions\fP on the \fBVendorShell\fP(3) reference -page\&. -.IP "\fIuseIconBox\fP\ (class\ \fIUseIconBox\fP)" 10 -If this resource is given a value of True, icons are placed in an icon -box\&. When an icon box is not used, the icons are placed on the root window -(default value)\&. -.SS "Client Specific Resources" -.PP -The syntax for specifying client specific resources is -.PP -\fIMwm*\fP\fBclient_name_or_class\fP \fI*\fP\fBresource_id\fP -.PP -For example, \fIMwm*mterm*windowMenu\fP is used to specify -the window menu to be used with mterm clients\&. The syntax for specifying client -specific resources for all classes of clients is -.PP -\fIMwm*\fP\fBresource_id\fP -.PP -Specific client specifications take precedence over the specifications -for all clients\&. For example, \fIMwm*windowMenu\fP is used -to specify the window menu to be used for all classes of clients that don\&'t -have a window menu specified\&. -.PP -The syntax for specifying resource values for windows that have an unknown -name and class (that is, windows that do not have a \fBWM_CLASS\fP -property associated with them) is -.PP -\fIMwm*defaults*\fP\fBresource_id\fP -.PP -For example, \fIMwm*defaults*iconImage\fP is used to -specify the icon image to be used for windows that have an unknown name and -class\&. -.PP -The following client specific resources can be specified: -.SS "Client Specific Resources" -.TS -tab(); -lw(1.999018i) lw(1.458743i) lw(0.918468i) lw(1.123772i). -NameClassValue TypeDefault -clientDecorationClientDecorationstringall\&. -clientFunctionsClientFunctionsstringall\&. -focusAutoRaiseFocusAutoRaiseT/Fvaries -iconImageIconImagepathname(image) -iconImage-Backgroundcoloricon background -Background -iconImageBottom-Foregroundcoloricon -ShadowColorbottom shadow -iconImageBottom-BottomShadow-coloricon bottom -ShadowPixmapPixmapshadow pixmap -iconImageForegroundForegroundcolorvaries -iconImageTopShadowColorBackgroundcoloricon top -shadow color -iconImageTop-TopShadowPixmapcoloricon top -ShadowPixmapshadow pixmap -matteBackgroundBackgroundcolorbackground -matteBottom-Foregroundcolorbottom -ShadowColorshadow color -matteBottom-BottomShadow-colorbottom -ShadowPixmapPixmapshadow pixmap -matteForegroundForegroundcolorforeground -matteTopShadowColorBackgroundcolortop -shadow color -matteTopShadowPixmapTopShadowPixmapcolortop -shadow pixmap -matteWidthMatteWidthpixels0 -maximumClientSizeMaximumClientSizewxh -vertical horizontalfill the screen -useClientIconUseClientIconT/FT -usePPositionUsePPositionstringnonzero -windowMenuWindowMenustringDefaultWindowMenu -.TE -.IP "\fIclientDecoration\fP\ (class\ \fIClientDecoration\fP)" 10 -This resource controls the amount of window frame decoration\&. The resource -is specified as a list of decorations to specify their inclusion in the frame\&. -If a decoration is preceded by a minus sign, that decoration is excluded from -the frame\&. The \fBsign\fP of the first item in the list determines -the initial amount of decoration\&. If the sign of the first decoration is minus, \fBmwm\fP assumes all decorations are present and starts subtracting -from that set\&. If the sign of the first decoration is plus (or not specified), -then \fBmwm\fP starts with no decoration and builds up a list -from the resource\&. -.IP "" 10 -An application can also specify which decorations \fBmwm\fP -should apply to its windows\&. If it does so, \fBmwm\fP applies -only those decorations indicated by both the application and the \fIclientDecoration\fP resource\&. Otherwise, \fBmwm\fP applies -the decorations indicated by the \fIclientDecoration\fP resource\&. -For more information see the description of \fBXmNmwmDecorations\fP on the \fBVendorShell\fP(3) reference -page\&. -.TS -tab(); -lw(0.989035i) lw(4.510965i). -NameDescription -allT{ -Include all decorations (default value)\&. -T} -borderWindow border\&. -maximizeT{ -Maximize button (includes title bar)\&. -T} -minimizeT{ -Minimize button (includes title bar)\&. -T} -noneNo decorations\&. -resizehT{ -Border resize handles (includes border)\&. -T} -menuT{ -Window menu button (includes title bar)\&. -T} -titleTitle bar (includes border)\&. -.TE -.PP -Examples: \fIMwm*XClock\&.clientDecoration: -resizeh -maximize\fP This removes the resize handles and maximize button from XClock -windows\&. \fIMwm*XClock\&.clientDecoration: menu minimize border\fP This does the same thing as above\&. Note that either \fImenu\fP or \fIminimize\fP implies -\fItitle\fP\&. -.IP "\fIclientFunctions\fP\ (class\ \fIClientFunctions\fP)" 10 -This resource is used to indicate which \fBmwm\fP functions -are applicable (or not applicable) to the client window\&. The value for the -resource is a list of functions\&. If the first function in the list has a minus -sign in front of it, then \fBmwm\fP starts with all functions -and subtracts from that set\&. If the first function in the list has a plus -sign in front of it, then \fBmwm\fP starts with no functions -and builds up a list\&. Each function in the list must be preceded by the appropriate -plus or minus sign and separated from the next function by a space\&. -.IP "" 10 -An application can also specify which functions \fBmwm\fP -should apply to its windows\&. If it does so, \fBmwm\fP applies -only those functions indicated by both the application and the \fIclientFunctions\fP resource\&. Otherwise, \fBmwm\fP applies -the functions indicated by the \fIclientFunctions\fP resource\&. -For more information see the description of \fBXmNmwmFunctions\fP on the \fBVendorShell\fP(3) reference -page\&. -.PP -The following table lists the functions available for this resource: -.TS -tab(); -lw(0.928728i) lw(4.571272i). -NameDescription -allT{ -Include all functions (default value)\&. -T} -noneNo functions\&. -resizef\&.resize\(dg\&. -movef\&.move\(dg\&. -minimizef\&.minimize\(dg\&. -maximizef\&.maximize\(dg\&. -closef\&.kill\(dg\&. -.TE -.PP -\(dgSee \fBmwmrc\fP(4)\&. -.IP "\fIfocusAutoRaise\fP\ (class\ \fIFocusAutoRaise\fP)" 10 -When the value of this resource is True, clients are raised when they -get the keyboard input focus\&. If the value is False, the stacking of windows -on the display is not changed when a window gets the keyboard input focus\&. -The default value is True when the keyboardFocusPolicy is explicit and False -when the keyboardFocusPolicy is pointer\&. -.IP "\fIiconImage\fP\ (class\ \fIIconImage\fP)" 10 -This resource can be used to specify an icon image for a client (for -example, "Mwm*myclock*iconImage")\&. The resource value is a pathname for a -pixmap or bitmap file\&. The value of the (client specific) \fIuseClientIcon\fP resource is used to determine whether or not user supplied icon -images are used instead of client supplied icon images\&. The default value -is to display a built-in window manager icon image\&. -.IP "\fIiconImageBackground\fP\ (class\ \fIBackground\fP)" 10 -This resource specifies the background color of the icon image that -is displayed in the image part of an icon\&. The default value of this resource -is the icon background color (that is, specified by "Mwm*background or Mwm*icon*background)\&. -.IP "\fIiconImageBottomShadowColor\fP\ (class\ \fIForeground\fP)" 10 -This resource specifies the bottom shadow color of the icon image that -is displayed in the image part of an icon\&. The default value of this resource -is the icon bottom shadow color (that is, specified by Mwm*icon*bottomShadowColor)\&. -.IP "\fIiconImageBottomShadowPixmap\fP\ (class\ \fIBottomShadowPixmap\fP)" 10 -This resource specifies the bottom shadow Pixmap of the icon image that -is displayed in the image part of an icon\&. The default value of this resource -is the icon bottom shadow Pixmap (that is, specified by Mwm*icon*bottomShadowPixmap)\&. -.IP "\fIiconImageForeground\fP\ (class\ \fIForeground\fP)" 10 -This resource specifies the foreground color of the icon image that -is displayed in the image part of an icon\&. The default value of this resource -varies depending on the icon background\&. -.IP "\fIiconImageTopShadowColor\fP\ (class\ \fIBackground\fP)" 10 -This resource specifies the top shadow color of the icon image that -is displayed in the image part of an icon\&. The default value of this resource -is the icon top shadow color (that is, specified by Mwm*icon*topShadowColor)\&. -.IP "\fIiconImageTopShadowPixmap\fP\ (class\ \fITopShadowPixmap\fP)" 10 -This resource specifies the top shadow Pixmap of the icon image that -is displayed in the image part of an icon\&. The default value of this resource -is the icon top shadow pixmap (that is, specified by Mwm*icon*topShadowPixmap)\&. -.IP "\fImatteBackground\fP\ \ (class\ \fIBackground\fP)" 10 -This resource specifies the background color of the matte, when \fImatteWidth\fP is positive\&. The default value of this resource is the -client background color (that is, specified by "Mwm*background or Mwm*client*background)\&. -.IP "\fImatteBottomShadowColor\fP\ (class\ \fIForeground\fP)" 10 -This resource specifies the bottom shadow color of the matte, when \fImatteWidth\fP is positive\&. The default value of this resource is the -client bottom shadow color (that is, specified by Mwm*bottomShadowColor or -Mwm*client*bottomShadowColor)\&. -.IP "\fImatteBottomShadowPixmap\fP\ (class\ \fIBottomShadowPixmap\fP)" 10 -This resource specifies the bottom shadow Pixmap of the matte, when \fImatteWidth\fP is positive\&. The default value of this resource is the -client bottom shadow pixmap (that is, specified by Mwm*bottomShadowPixmap -or Mwm*client*bottomShadowPixmap)\&. -.IP "\fImatteForeground\fP\ (class\ \fIForeground\fP)" 10 -This resource specifies the foreground color of the matte, when \fImatteWidth\fP is positive\&. The default value of this resource is the -client foreground color (that is, specified by Mwm*foreground or Mwm*client*foreground)\&. -.IP "\fImatteTopShadowColor\fP\ (class\ \fIBackground\fP)" 10 -This resource specifies the top shadow color of the matte, when \fImatteWidth\fP is positive\&. The default value of this resource is the -client top shadow color (that is, specified by Mwm*topShadowColor or Mwm*client*topShadowColor)\&. -.IP "\fImatteTopShadowPixmap\fP\ (class\ \fITopShadowPixmap\fP)" 10 -This resource specifies the top shadow pixmap of the matte, when \fImatteWidth\fP is positive\&. The default value of this resource is the -client top shadow pixmap (that is, specified by "Mwm*topShadowPixmap or Mwm*client*topShadowPixmap)\&. -.IP "\fImatteWidth\fP\ (class\ \fIMatteWidth\fP)" 10 -This resource specifies the width of the optional matte\&. The default -value is 0, which effectively disables the matte\&. -.IP "\fImaximumClientSize\fP\ (class\ \fIMaximumClientSize\fP)" 10 -This resource is either a size specification or a direction that indicates -how a client window is to be maximized\&. The resource value can be specified -as a size specification \fBwidth\fP\fIx\fP\fBheight\fP\&. The width and height are interpreted in -the units that the client uses (for example, for terminal emulators this is -generally characters)\&. Alternately, "vertical" or "horizontal" can be specified -to indicate the direction in which the client maximizes\&. -.IP "" 10 -If this resource is not specified, the maximum size from the \fIWM_NORMAL_HINTS\fP property is used if set\&. Otherwise the default -value is the size where the client window with window management borders fills -the screen\&. When the maximum client size is not determined by the \fImaximumClientSize\fP resource, the \fImaximumMaximumSize\fP -resource value is used as a constraint on the maximum size\&. -.IP "\fIuseClientIcon\fP\ (class\ \fIUseClientIcon\fP)" 10 -If the value given for this resource is True, a client-supplied icon -image takes precedence over a user-supplied icon image\&. The default value -is True, giving the client-supplied icon image higher precedence than the -user-supplied icon image\&. -.IP "\fIusePPosition\fP\ (class\ \fIUsePPosition\fP)" 10 -This resource specifies whether Mwm honors program specified position \fBPPosition\fP specified in the \fIWM_NORMAL_HINTS\fP property in the absence of an user specified position\&. Setting -this resource to on, causes \fBmwm\fP to always honor program -specified position\&. Setting this resource to off, causes \fBmwm\fP -to always ignore program specified position\&. Setting this resource to the -default value of nonzero cause \fBmwm\fP to honor program specified -position other than (0,0)\&. -.IP "\fIwindowMenu\fP\ (class\ \fIWindowMenu\fP)" 10 -This resource indicates the name of the menu pane that is posted when -the window menu is popped up (usually by pressing button 1 on the window -menu button on the client window frame)\&. Menu panes are specified in the \fBmwm\fP resource description file\&. Window menus can be customized on -a client class basis by creating custom menus in your \fBmwmrc\fP -file (see \fBmwmrc\fP(4) and specifying resources to activate -the custom menus\&. The resources have the form \fIMwm*\fP \fBclient_name_or_class\fP\fI*windowMenu\fP\&. The default -value of this resource is DefaultWindowMenu\&. -.SS "Resource Description File" -.PP -The \fBmwm\fP resource description file is a supplementary -resource file that contains resource descriptions that are referred to by -entries in the resource manager property (see \fBxrdb\fP(1) and -the defaults files (\fB\&.Xdefaults\fP, \fBapp-defaults/Mwm\fP )\&. It contains descriptions of resources that are to be used by \fBmwm\fP, and that cannot be easily encoded in the defaults files (a -bitmap file is an analogous type of resource description file)\&. A particular \fBmwm\fP resource description file can be selected using the -\fIconfigFile\fP resource\&. -.PP -The following types of resources can be described in the \fBmwm\fP resource description file: -.IP "\fIButtons\fP" 10 -Window manager functions can be bound (associated) with button events\&. -.IP "\fIKeys\fP" 10 -Window manager functions can be bound (associated) with key press events\&. -.IP "\fIMenus\fP" 10 -Menu panes can be used for the window menu and other menus posted with -key bindings and button bindings\&. -.IP "" 10 -The \fBmwm\fP resource description file is described in \fBmwmrc\fP(4)\&. -.SS "Environment" -.PP -The \fBmwm\fP window manager uses the environment variable \fBHOME\fP specifying the user\&'s home directory\&. -.PP -The \fBmwm\fP window manager uses the environment variable \fBLANG\fP specifying the user\&'s choice of language -for the \fBmwm\fP message catalog and the \fBmwm\fP -resource description file\&. -.PP -The \fBmwm\fP window uses the environment variable \fBXFILESEARCHPATH\fP, \fBXUSERFILESEARCHPATH\fP, \fBXAPPLRESDIR\fP, \fBXENVIRONMENT\fP, \fBLANG\fP, and \fBHOME\fP in determining search paths for resource defaults files\&. -The \fBmwm\fP window manager may also us \fBXBMLANGPATH\fP to search for bitmap files\&. -.PP -The \fBmwm\fP window manager reads the \fB$HOME/\&.motifbind\fP -file if it exists to install a virtual key bindings property on -the root window\&. For more information on the content of the \fB\&.motifbind\fP file, see -.PP -The \fBmwm\fP window manager uses the environment variable -\fBMWMSHELL\fP (or \fBSHELL\fP, \fIif\fP \fBMWMSHELL\fP is not set), specifying -the shell to use when executing commands via the \fBf\&.exec\fP -function\&. -.SS "Files" -.PP -\fB/usr/X11R6/lib/X11/$LANG/system\&.mwmrc\fP -.PP -\fB/usr/X11R6/lib/X11/system\&.mwmrc\fP -.PP -\fB/usr/X11R6/lib/X11/app-defaults/Mwm\fP -.PP -\fB$HOME/Mwm\fP -.PP -\fB$HOME/$LANG/\&.mwmrc\fP -.PP -\fB$HOME/\&.mwmrc\fP -.SS "RELATED INFORMATION" -.PP -\fBVendorShell\fP(3), \fBVirtualBindings\fP(3), \fBX\fP(1), \fBXmInstallImage\fP(3), \fBxrdb\fP(1)\&. -...\" created by instant / docbook-to-man, Sun 22 Dec 1996, 20:15 diff --git a/doc/man/man1/mwm.1.no_X11R6 b/doc/man/man1/mwm.1.no_X11R6 deleted file mode 100644 index 1cf2ad8..0000000 --- a/doc/man/man1/mwm.1.no_X11R6 +++ /dev/null @@ -1,1361 +0,0 @@ -'\" t -...\" mwm.sgm /main/13 1996/09/25 11:30:27 cdedoc $ -.de P! -.fl -\!!1 setgray -.fl -\\&.\" -.fl -\!!0 setgray -.fl \" force out current output buffer -\!!save /psv exch def currentpoint translate 0 0 moveto -\!!/showpage{}def -.fl \" prolog -.sy sed -e 's/^/!/' \\$1\" bring in postscript file -\!!psv restore -. -.de pF -.ie \\*(f1 .ds f1 \\n(.f -.el .ie \\*(f2 .ds f2 \\n(.f -.el .ie \\*(f3 .ds f3 \\n(.f -.el .ie \\*(f4 .ds f4 \\n(.f -.el .tm ? font overflow -.ft \\$1 -.. -.de fP -.ie !\\*(f4 \{\ -. ft \\*(f4 -. ds f4\" -' br \} -.el .ie !\\*(f3 \{\ -. ft \\*(f3 -. ds f3\" -' br \} -.el .ie !\\*(f2 \{\ -. ft \\*(f2 -. ds f2\" -' br \} -.el .ie !\\*(f1 \{\ -. ft \\*(f1 -. ds f1\" -' br \} -.el .tm ? font underflow -.. -.ds f1\" -.ds f2\" -.ds f3\" -.ds f4\" -.ta 8n 16n 24n 32n 40n 48n 56n 64n 72n -.TH "mwm" "user cmd" -.SH "NAME" -\fBmwm\fP \(em The Motif -Window Manager -.SH "SYNOPSIS" -.PP -\fBmwm\fP [\fIoptions\fP] -.SH "DESCRIPTION" -.PP -The \fBmwm\fP window manager provides -functions that facilitate control (by the user and the programmer) -of elements of window state such as placement, size, icon/normal display, -and input-focus ownership\&. -.PP -The stand-alone window manager is not an integral part -of CDE and does not support communication with other components in the CDE -environment, such as the Style Manager and the Session Manager\&. -.SS "Options" -.IP "\fI-display\fP\ \fBdisplay\fP" 10 -This option specifies the display to use; see \fBX\fP(1)\&. -.IP "\fI-xrm\fP\ \fBresourcestring\fP" 10 -This option specifies a resource string to use\&. -.IP "\fI-multiscreen\fP" 10 -This option causes \fBmwm\fP to manage all screens on -the display\&. The default is to manage only a single screen. -.IP "\fI-name\fP\ \fBname\fP" 10 -This option causes \fBmwm\fP to retrieve its resources -using the specified name, as in \fBname*resource\fP\&. -.IP "\fI-screens\fP\ \fBname\ [name\ [\&.\&.\&.]]\fP" 10 -This option specifies the resource names to use for the screens managed -by \fBmwm\fP\&. If \fBmwm\fP is managing a single -screen, only the first name in the list is used\&. If \fBmwm\fP -is managing multiple screens, the names are assigned to the screens in order, -starting with screen 0\&. Screen 0 gets the first name, screen 1 the second -name, and so on\&. -.SS "Appearance" -.PP -The following sections describe the basic default behaviors of windows, -icons, the icon box, input focus, and window stacking\&. The appearance and -behavior of the window manager can be altered by changing the configuration -of specific resources\&. Resources are defined under the heading "X DEFAULTS\&." -.SS "Screens" -.PP -By default, \fBmwm\fP manages only the single screen specified -by the \fI-display\fP option or the \fBDISPLAY\fP environment variable (by default, screen 0)\&. If the \fI-multiscreen\fP option is specified or if the \fImultiScreen\fP resource is True, \fBmwm\fP tries to manage all -the screens on the display\&. -.PP -When \fBmwm\fP is managing multiple screens, the \fI-screens\fP option can be used to give each screen a unique -resource name\&. The names are separated by blanks, for example, \fI-screens\fP scr0 scr1\&. If there are more screens than names, -resources for the remaining screens will be retrieved using the first name\&. -By default, the screen number is used for the screen name\&. -.SS "Windows" -.PP -Default \fBmwm\fP window frames have distinct components -with associated functions: -.IP "\fITitle\ Area\fP" 10 -In addition to displaying the client\&'s title, the title area is used -to move the window\&. To move the window, place the pointer over the title area, -press button 1 and drag the window to a new location\&. By default, a wire -frame is moved during the drag to indicate the new location\&. When the button -is released, the window is moved to the new location\&. -.IP "\fITitle\ Bar\fP" 10 -The title bar includes the title area, the minimize button, the maximize -button, and the window menu button\&. In shaped windows, such as round windows, -the title bar floats above the window\&. -.IP "\fIMinimize\ Button\fP" 10 -To turn the window into an icon, click button 1 on the minimize button -(the frame box with a \fBsmall\fP square in it)\&. -.IP "\fIMaximize\ Button\fP" 10 -To make the window fill the screen (or enlarge to the largest size allowed -by the configuration files), click button 1 on the maximize button (the frame -box with a \fBlarge\fP square in it)\&. -.IP "\fIWindow\ Menu\ Button\fP" 10 -The window menu button is the frame box with a horizontal bar in it\&. -To pull down the window menu, press button 1\&. While pressing, drag the pointer -on the menu to your selection, then release the button when your selection -is highlighted\&. Pressing button 3 in the title bar or resize border handles -also posts the window menu\&. Alternately, you can click button 1 to pull down -the menu and keep it posted; then position the pointer and select\&. You can -also post the window menu by pressing or \&. -Double-clicking button 1 with the pointer on the window menu button closes -the window\&. -.PP -The following table lists the contents of the window menu\&. -.SS "Default Window Menu" -.TS -tab(); -lw(1.803823i) lw(1.062374i) lw(2.633803i). -SelectionAcceleratorDescription -RestoreT{ -Restores the window to its size before minimizing -or maximizing\&. -T} -MoveT{ -Allows the window to be moved with keys or -mouse\&. -T} -SizeAllows the window to be resized\&. -MinimizeTurns the window into an icon\&. -MaximizeMakes the window fill the screen\&. -LowerT{ -Moves window to bottom of window stack\&. -T} -CloseAlt+F4Causes client to terminate\&. -.TE -.IP "\fIResize\ Border\ Handles\fP" 10 -To change the size of a window, move the pointer over a resize border -handle (the cursor changes), press button 1, and drag the window to a new -size\&. When the button is released, the window is resized\&. While dragging is -being done, a rubber-band outline is displayed to indicate the new window -size\&. -.IP "\fIMatte\fP" 10 -An optional matte decoration can be added between the client area and -the window frame (see the \fImatteWidth\fP resource)\&. A -\fImatte\fP is not actually part of the window frame\&. -There is no functionality associated with a matte\&. -.SS "Icons" -.PP -Icons are small graphic representations of windows\&. A window can be -minimized (iconified) using the minimize button on the window frame\&. Icons -provide a way to reduce clutter on the screen\&. -.PP -Pressing mouse button 1 when the pointer is over an icon causes the -icon\&'s window menu to pop up\&. Releasing the button (press + release without -moving mouse = click) causes the menu to stay posted\&. The menu contains the -following selections: -.SS "Icon Window Menu" -.TS -tab(); -lw(0.913000i) lw(1.144000i) lw(3.443000i). -SelectionAcceleratorDescription -RestoreOpens the associated window\&. -MoveT{ -Allows the icon to be moved with keys\&. -T} -SizeInactive (not an option for icons)\&. -MinimizeInactive (not an option for icons)\&. -MaximizeT{ -Opens the associated window and makes it -fill the screen\&. -T} -LowerMoves icon to bottom of icon stack\&. -CloseAlt+F4T{ -Removes client from \fBmwm\fP -management\&. -T} -.TE -.PP -Note that pressing button 3 over an icon also causes the icon\&'s window -menu to pop up\&. To make a menu selection, drag the pointer over the menu and -release button 3 when the desired item is highlighted\&. -.PP -Double-clicking button 1 on an icon invokes the \fBf\&.restore_and_raise\fP function and restores the icon\&'s associated window to its previous -state\&. For example, if a maximized window is iconified, double-clicking button -1 restores it to its maximized state\&. Double-clicking button 1 on the icon -box\&'s icon opens the icon box and allows access to the contained icons\&. (In -general, double-clicking a mouse button is a quick way to perform a function\&.) -Pressing or (the pop-up menu key) causes the -icon window menu of the currently selected icon to pop up\&. -.SS "Icon Box" -.PP -When icons begin to clutter the screen, they can be packed into an icon -box\&. (To use an icon box, \fBmwm\fP must be started with the -icon box configuration already set\&.) The icon box is a \fBmwm\fP -window that holds client icons\&. It includes one or more scroll bars when there -are more window icons than the icon box can show at the same time\&. -.PP -Icons in the icon box can be manipulated with the mouse\&. The following -table summarizes the behavior of this interface\&. Button actions apply whenever -the pointer is on any part of the icon\&. Note that double-clicking an icon -in the icon box invokes the \fBf\&.restore_and_raise\fP function\&. -.TS -tab(); -lw(0.841046i) lw(1.051308i) lw(3.607646i). -ButtonActionDescription -Button 1clickSelects the icon\&. -Button 1double-clickT{ -Normalizes (opens) the associated window\&. -Raises an already open window to the top of the stack\&. -T} -Button 1dragMoves the icon\&. -Button 3pressT{ -Causes the menu for that icon to pop up\&. -T} -Button 3dragT{ -Highlights items as the pointer moves across -the menu\&. -T} -.TE -.PP -Pressing mouse button 3 when the pointer is over an icon causes the -menu for that icon to pop up\&. -.SS "Icon Menu for the Icon Box" -.TS -tab(); -lw(0.885312i) lw(1.062374i) lw(3.552314i). -SelectionAcceleratorDescription -RestoreT{ -Opens the associated window (if not already -open)\&. -T} -MoveT{ -Allows the icon to be moved with keys\&. -T} -SizeInactive\&. -MinimizeInactive\&. -MaximizeT{ -Opens the associated window (if not already -open) and maximizes its size\&. -T} -LowerInactive\&. -CloseAlt+F4T{ -Removes client from \fBmwm\fP -management\&. -T} -.TE -.PP -To pull down the window menu for the icon box itself, press button 1 -with the pointer over the menu button for the icon box\&. The window menu of -the icon box differs from the window menu of a client window: The "Close" -selection is replaced with the "PackIcons Shift+Alt+F7" selection\&. When selected, -PackIcons packs the icons in the box to achieve neat rows with no empty slots\&. -.PP -You can also post the window menu by pressing , or - \&. Pressing (the pop-up menu key) causes the icon -window menu of the currently selected icon to pop up\&. -.SS "Input Focus" -.PP -The \fBmwm\fP window manager supports (by default) a keyboard -input focus policy of explicit selection\&. This means when a window is selected -to get keyboard input, it continues to get keyboard input until the window -is withdrawn from window management, another window is explicitly selected -to get keyboard input, or the window is iconified\&. Several resources control -the input focus\&. The client window with the keyboard input focus has the active -window appearance with a visually distinct window frame\&. -.PP -The following tables summarize the keyboard input focus selection behavior: -.TS -tab(); -lw(0.880482i) lw(0.844298i) lw(1.350877i) lw(2.424342i). -ButtonActionObjectFunction Description -Button 1pressWindow / window frameKeyboard focus selection\&. -Button 1pressIconKeyboard focus selection\&. -.TE -.TS -tab(); -lw(1.394366i) lw(4.105634i). -Key ActionFunction Description -[Alt][Tab]T{ -Move input focus to next window in window -stack (available only in explicit focus mode)\&. -T} -[Alt][Shift][Tab]T{ -Move input focus to previous window in window -stack (available only in explicit focus mode)\&. -T} -.TE -.SS "Window Stacking" -.PP -There are two types of window stacks: global window stacks and an application\&'s -local family window stack\&. -.PP -The global stacking order of windows may be changed as a result of setting -the keyboard input focus, iconifying a window, or performing a window manager -window stacking function\&. When keyboard focus policy is explicit the default -value of the \fIfocusAutoRaise\fP resource is True\&. This causes -a window to be raised to the top of the stack when it receives input focus, -for example, by pressing button 1 on the title bar\&. The key actions defined -in the previous table will thus raise the window receiving focus to the top -of the stack\&. -.PP -In pointer mode, the default value of \fIfocusAutoRaise\fP -is False, that is, the window stacking order is not changed when a window -receives keyboard input focus\&. The following key actions can be used to cycle -through the global window stack\&. -.TS -tab(); -lw(1.567982i) lw(3.932018i). -Key ActionFunction Description -[Alt][ESC]T{ -Place top window on bottom of stack\&. -T} -[Alt][Shift][ESC]T{ -Place bottom window on top of stack\&. -T} -.TE -.PP -By default, a window\&'s icon is placed on the bottom of the stack when -the window is iconified; however, the default can be changed by the \fIlowerOnIconify\fP resource\&. -.PP -Transient windows (secondary windows such a dialog boxes) stay above -their parent windows by default; however, an application\&'s local family stacking -order may be changed to allow a transient window to be placed below its parent -top-level window\&. The following arguments show the modification of the stacking -order for the \fBf\&.lower\fP function\&. -.IP "\fBf\&.lower\fP" 10 -Lowers the transient window within the family (staying above the parent) -and lowers the family in the global window stack\&. -.IP "\fBf\&.lower\fP\ [ \fIwithin\fP]" 10 -Lowers the transient window within the family (staying above the parent) -but does not lower the family in the global window stack\&. -.IP "\fBf\&.lower\fP\ [\fIfreeFamily\fP ]" 10 -Lowers the window free from its family stack (below the parent), but -does not lower the family in the global window stack\&. -.PP -The arguments \fIwithin\fP and \fIfreeFamily\fP can also be used with \fBf\&.raise\fP -and \fBf\&.raise_lower\fP\&. -.SS "Session Management" -.PP -The window manager is an X Session Management Protocol aware client\&. It responds to SaveYourself -(and other associated messages) by saving the geometries of its clients to a state file\&. -\fBmwm\fP can then be restarted by the XSMP session manager\&. -The default location for the state file is \fB$HOME/\&.mwmclientdb\fP\&. -This location can be overriden with the resource \fBsessionClientDB\fP\&. -.SS "X Resources" -.PP -The \fBmwm\fP command is configured from its resource -database\&. This database is built from the following sources\&. They are listed -in order of precedence, low to high: -.PP -\fB/usr/X11R6/lib/X11/app-defaults/Mwm\fP -.PP -\fB$HOME/Mwm\fP -.PP -\fBRESOURCE_MANAGER\fP root window property or \fB$HOME/\&.Xdefaults\fP -.PP -\fBXENVIRONMENT\fP variable or \fB$HOME/\&.Xdefaults-host\fP -.PP -\fBmwm\fP command line options -.PP -The file names \fB/usr/X11R6/lib/X11/app-defaults/Mwm\fP and \fB$HOME/Mwm\fP represent customary locations for these files\&. The actual -location of the system-wide class resource file may depend on the \fBXFILESEARCHPATH\fP environment variable and the -current language environment\&. The actual location of the user-specific class -resource file may depend on the \fBXUSERFILESEARCHPATH\fP and \fBXAPPLRESDIR\fP -environment variables and the current language environment\&. -.PP -Entries in the resource database may refer to other resource files for -specific types of resources\&. These include files that contain bitmaps, fonts, -and \fBmwm\fP specific resources such as menus and behavior -specifications (for example, button and key bindings)\&. -.PP -\fIMwm\fP is the resource class name of \fBmwm\fP and \fBmwm\fP is the default resource name used by \fBmwm\fP to look up resources\&. the \fI-screens\fP -command line option specifies resource names, such as "mwm_b+w" and "mwm_color"\&.) -In the following discussion of resource specification, "Mwm" and "mwm" (and -the aliased \fBmwm\fP resource names) can be used interchangeably, -but "mwm" takes precedence over "Mwm"\&. -.PP -The \fBmwm\fP command uses the following types of resources: -.IP "\fBComponent Appearance Resources:\fP" 10 -These resources specify appearance attributes of window manager user -interface components\&. They can be applied to the appearance of window manager -menus, feedback windows (for example, the window reconfiguration feedback -window), client window frames, and icons\&. -.IP "\fBGeneral Appearance and Behavior Resources:\fP" 10 -These resources specify \fBmwm\fP appearance and behavior -(for example, window management policies)\&. They are not set separately for -different \fBmwm\fP user interface components\&. They apply to -all screens and workspaces\&. -.IP "\fBScreen Specific Appearance and Behavior Resources:\fP" 10 -These resources specify the appearance and behavior of \fBmwm\fP elements that are settable on a per-screen basis\&. -.IP "\fBClient Specific Resources:\fP" 10 -These \fBmwm\fP resources can be set for a particular -client window or class of client windows\&. They specify client-specific icon -and client window frame appearance and behavior\&. -.PP -Resource identifiers can be either a resource name (for example, foreground) -or a resource class (for example, Foreground)\&. If the value of a resource -is a filename and if the filename is prefixed by "~/", then it is relative -to the path contained in the \fBHOME\fP -environment variable (generally the user\&'s home directory)\&. -.SS "Component Appearance Resources" -.PP -The syntax for specifying component appearance resources that apply -to window manager icons, menus, and client window frames is \fIMwm*\fP \fBresource_id\fP -.PP -For example, \fIMwm*foreground\fP is used to specify -the foreground color for \fBmwm\fP menus, icons, client window -frames, and feedback dialogs\&. -.PP -The syntax for specifying component appearance resources that apply -to a particular \fBmwm\fP component is \fIMwm*\fP[\fImenu\fP|\fIicon\fP|\fIclient\fP|\fIfeedback\fP] \fI*\fP\fBresource_id\fP -.PP -If \fBmenu\fP is specified, the resource is applied only -to \fBmwm\fP menus; if \fBicon\fP is specified, -the resource is applied to icons; and if \fBclient\fP is specified, -the resource is applied to client window frames\&. For example, \fIMwm*icon*foreground\fP is used to specify the foreground color for \fBmwm\fP -icons, \fIMwm*menu*foreground\fP specifies the foreground -color for \fBmwm\fP menus, and \fIMwm*client*foreground\fP is used to specify the foreground color for \fBmwm\fP -client window frames\&. -.PP -The appearance of the title area of a client window frame (including -window management buttons) can be separately configured\&. The syntax for configuring -the title area of a client window frame is \fIMwm*client*title*\fP \fBresource_id\fP -.PP -For example, \fIMwm*client*title*foreground\fP specifies -the foreground color for the title area\&. Defaults for title area resources -are based on the values of the corresponding client window frame resources\&. -.PP -The appearance of menus can be configured based on the name of the menu\&. -The syntax for specifying menu appearance by name is \fIMwm*menu*\fP \fBmenu_name\fP\fI*\fP\fBresource_id\fP -.PP -For example, \fIMwm*menu*my_menu*foreground\fP specifies -the foreground color for the menu named \fImy_menu\fP\&. The -user can also specify resources for window manager menu components, that is, -the gadgets that comprise the menu\&. These may include for example, a menu -title, title separator, one or more buttons, and separators\&. If a menu contains -more than one instance of a class, such as multiple PushButtonGadgets, the -name of the first instance is "PushButtonGadget1", the second is "PushButtonGadget2", -and so on\&. The following list identifies the naming convention used for window -manager menu components: -.IP " \(bu" 6 -Menu Title LabelGadget - "TitleName" -.IP " \(bu" 6 -Menu Title SeparatorGadget - "TitleSeparator" -.IP " \(bu" 6 -CascadeButtonGadget - "CascadeButtonGadget" -.IP " \(bu" 6 -PushButtonGadget - "PushButtonGadget" -.IP " \(bu" 6 -SeparatorGadget - "SeparatorGadget" -.PP -Refer to the man page for each class for a list of resources that can -be specified\&. -.PP -The following component appearance resources that apply to all window -manager parts can be specified: -.SS "Component Appearance Resources - All Window Manager Parts" -.TS -tab(); -lw(1.802521i) lw(1.571429i) lw(1.178571i) lw(0.947479i). -NameClassValue TypeDefault -backgroundBackgroundcolorvaries\(dg -backgroundPixmapBackgroundPixmapstring\(dg\(dgvaries\(dg -bottomShadowColorForegroundcolorvaries\(dg -bottomShadowPixmapForegroundstring\(dg\(dgvaries\(dg -fontListFontListT{ -string\(dg\(dg\(dg -T}"fixed" -foregroundForegroundcolorvaries\(dg -saveUnderSaveUnderT/FF -topShadowColorBackgroundcolorvaries\(dg -topShadowPixmapTopShadowPixmapstring\(dg\(dgvaries\(dg -.TE -.PP -\(dgThe default is chosen based on the visual type of the screen\&. -\(dg\(dgImage name\&. See \fBXmInstallImage\fP(3)\&. \(dg\(dg\(dgX11 -X Logical Font Description -.IP "\fIbackground\fP\ (class\ \fIBackground\fP)" 10 -This resource specifies the background color\&. Any legal X color may -be specified\&. The default value is chosen based on the visual type of the -screen\&. -.IP "\fIbackgroundPixmap\fP\ (class\ \fIBackgroundPixmap\fP)" 10 -This resource specifies the background Pixmap of the \fBmwm\fP -decoration when the window is inactive (does not have the keyboard focus)\&. -The default value is chosen based on the visual type of the screen\&. -.IP "\fIbottomShadowColor\fP\ (class\ \fIForeground\fP)" 10 -This resource specifies the bottom shadow color\&. This color is used -for the lower and right bevels of the window manager decoration\&. Any legal -X color may be specified\&. The default value is chosen based on the visual -type of the screen\&. -.IP "\fIbottomShadowPixmap\fP\ (class\ \fIBottomShadowPixmap\fP)" 10 -This resource specifies the bottom shadow Pixmap\&. This Pixmap is used -for the lower and right bevels of the window manager decoration\&. The default -is chosen based on the visual type of the screen\&. -.IP "\fIfontList\fP\ (class\ \fIFontList\fP)" 10 -This resource specifies the font used in the window manager decoration\&. -The character encoding of the font should match the character encoding of -the strings that are used\&. The default is "fixed\&." -.IP "\fIforeground\fP\ (class\ \fIForeground\fP)" 10 -This resource specifies the foreground color\&. The default is chosen -based on the visual type of the screen\&. -.IP "\fIsaveUnder\fP\ (class\ \fISaveUnder\fP)" 10 -This is used to indicate whether "save unders" are used for \fBmwm\fP components\&. For this to have any effect, save unders must be -implemented by the X server\&. If save unders are implemented, the X server -saves the contents of windows obscured by windows that have the save under -attribute set\&. If the \fIsaveUnder\fP resource is True, \fBmwm\fP will set the save under attribute on the window manager frame -of any client that has it set\&. If \fIsaveUnder\fP is False, -save unders will not be used on any window manager frames\&. The default value -is False\&. -.IP "\fItopShadowColor\fP\ (class\ \fIBackground\fP)" 10 -This resource specifies the top shadow color\&. This color is used for -the upper and left bevels of the window manager decoration\&. The default is -chosen based on the visual type of the screen\&. -.IP "topShadowPixmap\ (\ class\ \fITopShadowPixmap)\fP" 10 -This resource specifies the top shadow Pixmap\&. This Pixmap is used for -the upper and left bevels of the window manager decoration\&. The default is -chosen based on the visual type of the screen\&. -.PP -The following component appearance resources that apply to frame and -icons can be specified: -.SS "Frame and Icon Components" -.TS -tab(); -lw(2.072144i) lw(1.653307i) lw(0.991984i) lw(0.782565i). -NameClassValue TypeDefault -activeBackgroundBackgroundcolorvaries\(dg -activeBackgroundPixmapBackgroundPixmapstring\(dg\(dgvaries\(dg -activeBottomShadowColorForegroundcolorvaries\(dg -activeBottomShadowPixmapBottomShadowPixmapstring\(dg\(dgvaries\(dg -activeForegroundForegroundcolorvaries\(dg -activeTopShadowColorBackgroundcolorvaries\(dg -activeTopShadowPixmapTopShadowPixmapstring\(dg\(dgvaries\(dg -.TE -.PP -\(dgThe default is chosen based on the visual type of the screen\&. -\(dg\(dgSee \fBXmInstallImage\fP(3)\&. -.IP "\fIactiveBackground\fP\ (class\ \fIBackground\fP)" 10 -This resource specifies the background color of the \fBmwm\fP -decoration when the window is active (has the keyboard focus)\&. The default -is chosen based on the visual type of the screen\&. -.IP "\fIactiveBackgroundPixmap\fP\ (class\ \fIActiveBackgroundPixmap\fP)" 10 -This resource specifies the background Pixmap of the \fBmwm\fP -decoration when the window is active (has the keyboard focus)\&. The default -is chosen based on the visual type of the screen\&. -.IP "\fIactiveBottomShadowColor\fP\ (class\ \fIForeground\fP)" 10 -This resource specifies the bottom shadow color of the \fBmwm\fP decoration when the window is active (has the keyboard focus)\&. -The default is chosen based on the visual type of the screen\&. -.IP "\fIactiveBottomShadowPixmap\fP\ (class\ \fIBottomShadowPixmap\fP)" 10 -This resource specifies the bottom shadow Pixmap of the \fBmwm\fP decoration when the window is active (has the keyboard focus)\&. -The default is chosen based on the visual type of the screen\&. -.IP "\fIactiveForeground\fP\ (class\ \fIForeground\fP)" 10 -This resource specifies the foreground color of the \fBmwm\fP -decoration when the window is active (has the keyboard focus)\&. The default -is chosen based on the visual type of the screen\&. -.IP "\fIactiveTopShadowColor\fP\ (class\ \fIBackground\fP)" 10 -This resource specifies the top shadow color of the \fBmwm\fP -decoration when the window is active (has the keyboard focus)\&. The default -is chosen based on the visual type of the screen\&. -.IP "\fIactiveTopShadowPixmap\fP\ (class\ \fITopShadowPixmap\fP)" 10 -This resource specifies the top shadow Pixmap of the \fBmwm\fP -decoration when the window is active (has the keyboard focus)\&. The default -is chosen based on the visual type of the screen\&. -.SS "General Appearance and Behavior Resources" -.PP -The syntax for specifying general appearance and behavior resources -is \fIMwm*\fP\fBresource_id\fP -.PP -For example, \fIMwm*keyboardFocusPolicy\fP specifies -the window manager policy for setting the keyboard focus to a particular client -window\&. -.PP -The following general appearance and behavior resources can be specified: -.SS "General Appearance and Behavior Resources" -.TS -tab(); -lw(1.528376i) lw(1.592955i) lw(1.054795i) lw(1.323875i). -NameClassValue TypeDefault -autoKeyFocusAutoKeyFocusT/FT -autoRaiseDelayAutoRaiseDelaymillisec500 -bitmap-Bitmap-directory/usr/X11R6/include- -DirectoryDirectory/X11/bitmaps -clientAutoPlaceClientAutoPlaceT/FT -colormapFocus-ColormapFocus-stringkeyboard -PolicyPolicy -configFileConfigFilefile$HOME/mwmrc -deiconifyKeyFocusDeiconifyKeyFocusT/FT -doubleClick-DoubleClick-millisec\&.multi-click -TimeTimetime\(dg -enableWarpenableWarpT/FT -enforceKeyFocusEnforceKeyFocusT/FT -frameStyleFrameStylestringrecessed -iconAutoPlaceIconAutoPlaceT/FT -iconClickIconClickT/FT -interactivePlacementInteractivePlacementT/FT -keyboardFocus-KeyboardFocus-stringexplicit -PolicyPolicy -lowerOnIconifyLowerOnIconifyT/FT -moveThresholdMoveThresholdpixels4 -multiScreenMultiScreenT/FF -passButtonsPassButtonsT/FF -passSelectButtonPassSelectButtonT/FT -positionIsFramePositionIsFrameT/FT -positionOnScreenPositionOnScreenT/FT -quitTimeoutQuitTimeoutmillisec\&.1000 -raiseKeyFocusRaiseKeyFocusT/FF -refreshByClearingRefreshByClearingT/FT -rootButtonClickRootButtonClickT/FF -screensScreensstringvaries -sessionClientDBSessionClientDBstring$HOME/\&.mwmclientdb -showFeedbackShowFeedbackstringall -startupKeyFocusStartupKeyFocusT/FT -wMenuButtonClickWMenuButtonClickT/FT -wMenuButtonClick2WMenuButtonClick2T/FT -.TE -.PP -\(dgThe resource doubleClickTime is included for backward compatibility\&. -Use of the Xt resource multiClickTime is preferred\&. -.IP "\fIautoKeyFocus\fP\ (class\ \fIAutoKeyFocus\fP)" 10 -This resource is available only when the keyboard input focus policy -is explicit\&. If \fIautoKeyFocus\fP is given a value of True, -then when a window with the keyboard input focus is withdrawn from window -management or is iconified, the focus is set to the previous window that had -the focus\&. If the value given is False, there is no automatic setting of the -keyboard input focus\&. It is recommended that both \fIautoKeyFocus\fP and \fIstartupKeyFocus\fP be True to work with -tear off menus\&. The default value is True\&. -.IP "\fIautoRaiseDelay\fP\ (class\ \fIAutoRaiseDelay\fP)" 10 -This resource is available only when the \fIfocusAutoRaise\fP -resource is True and the keyboard focus policy is pointer\&. The \fIautoRaiseDelay\fP resource specifies the amount of time (in milliseconds) -that \fBmwm\fP will wait before raising a window after it gets -the keyboard focus\&. The default value of this resource is 500 (ms)\&. -.IP "\fIbitmapDirectory\fP\ (class\ \fIBitmapDirectory\fP)" 10 -This resource identifies a directory to be searched for bitmaps referenced -by \fBmwm\fP resources\&. This directory is searched if a bitmap -is specified without an absolute pathname\&. The default value for this resource -is \fB/usr/X11R6/include/X11/bitmaps\fP\&. The directory \fB/usr/X11R6/include/X11/bitmaps\fP -represents the customary locations for this directory\&. The actual -location of this directory may vary on some systems\&. If the bitmap is not -found in the specified directory, \fBXBMLANGPATH\fP is searched\&. -.IP "\fIclientAutoPlace\fP\ (class\ \fIClientAutoPlace\fP)" 10 -This resource determines the position of a window when the window has -not been given a program- or user-specified position\&. With a value of True, -windows are positioned with the top left corners of the frames offset horizontally -and vertically\&. A value of False causes the currently configured position -of the window to be used\&. In either case, \fBmwm\fP will attempt -to place the windows totally on-screen\&. The default value is True\&. -.IP "\fIcolormapFocusPolicy\fP\ (class\ \fIColormapFocusPolicy\fP)" 10 -This resource indicates the colormap focus policy that is to be used\&. -If the resource value is explicit, a colormap selection action is done on -a client window to set the colormap focus to that window\&. If the value is -pointer, the client window containing the pointer has the colormap focus\&. -If the value is keyboard, the client window that has the keyboard input focus -has the colormap focus\&. The default value for this resource is keyboard\&. -.IP "\fIconfigFile\fP\ (class\ \fIConfigFile\fP)" 10 -The resource value is the pathname for a \fBmwm\fP resource -description file\&. If the pathname begins with "~/", \fBmwm\fP -considers it to be relative to the user\&'s home directory (as specified by -the \fBHOME\fP environment variable)\&. -If the \fBLANG\fP environment variable -is set, \fBmwm\fP looks for \fI$HOME/$LANG\fP/ \fBconfigFile\fP\&. If that file does not exist or if \fBLANG\fP is not set, \fBmwm\fP looks for -\fB$HOME\fP/\fBconfigFile\fP\&. If the \fIconfigFile\fP pathname does not begin with "~/" or "/", \fBmwm\fP considers it to be relative to the current working directory\&. If -the \fIconfigFile\fP resource is not specified -or if that file does not exist, \fBmwm\fP uses several default -paths to find a configuration file\&. The order of the search is shown below: \fB/etc/X11/mwm/$LANG/system\&.mwmrc\fP\(dg -\fB/etc/X11/mwm/system\&.mwmrc\fP\(dg Paths marked with \&'\(dg\&' are -implementation dependent\&. -.IP "\fIdeiconifyKeyFocus\fP\ (class\ \fIDeiconifyKeyFocus\fP)" 10 -This resource applies only when the keyboard input focus policy is explicit\&. -If a value of True is used, a window receives the keyboard input focus when -it is normalized (deiconified)\&. True is the default value\&. -.IP "\fIdoubleClickTime\fP\ (class\ \fIDoubleClickTime\fP)" 10 -This resource is used to set the maximum time (in ms) between the clicks -(button presses) that make up a double-click\&. The use of this resource is -deprecated\&. Use the Xt resource \fImultiClickTime\fP instead\&. -The value of \fIdoubleClickTime\fP dynamically defaults to -the value of \fImultiClickTime\fP\&. -.IP "\fIenableWarp\fP\ (class\ \fIEnableWarp\fP)" 10 -The default value of this resource, True, causes \fBmwm\fP -to warp the pointer to the center of the selected window during keyboard-controlled -resize and move operations\&. Setting the value to False causes \fBmwm\fP to leave the pointer at its original place on the screen, unless -the user explicitly moves it with the cursor keys or pointing device\&. -.IP "\fIenforceKeyFocus\fP\ (class\ \fIEnforceKeyFocus\fP)" 10 -If this resource is given a value of True, the keyboard input focus -is always explicitly set to selected windows even if there is an indication -that they are "globally active" input windows\&. (An example of a globally active -window is a scroll bar that can be operated without setting the focus to that -client\&.) If the resource is False, the keyboard input focus is not explicitly -set to globally active windows\&. The default value is True\&. -.IP "\fIframeStyle\fP\ (class\ \fIframeStyle\fP)" 10 -If this resource is given a value of "slab", the the window manager -frame is drawn such that the client area appears to be at the same height -as the top of the window frame\&. If the resource is set to "recessed", the -window frame is drawn such that the client area appears lower than the top -of the window frame\&. The default value is "recessed"\&. -.IP "\fIiconAutoPlace\fP\ (class\ \fIIconAutoPlace\fP)" 10 -This resource indicates whether the window manager arranges icons in -a particular area of the screen or places each icon where the window was when -it was iconified\&. The value True indicates that icons are arranged in a particular -area of the screen, determined by the \fIiconPlacement\fP resource\&. -The value False indicates that an icon is placed at the location of the window -when it is iconified\&. The default is True\&. -.IP "\fIiconClick\fP\ (class\ \fIIconClick\fP)" 10 -When this resource is given the value of True, the system menu is posted -and left posted when an icon is clicked\&. The default value is True\&. -.IP "\fIinteractivePlacement\fP\ (class\ \fIInteractivePlacement\fP)" 10 -This resource controls the initial placement of new windows on the screen\&. -If the value is True, the pointer shape changes before a new window is placed -on the screen to indicate to the user that a position should be selected for -the upper-left hand corner of the window\&. If the value is False, windows are -placed according to the initial window configuration attributes\&. The default -value of this resource is False\&. -.IP "\fIkeyboardFocusPolicy\fP\ (class\ \fIKeyboardFocusPolicy\fP)" 10 -If set to pointer, the keyboard focus policy is to have the keyboard -focus set to the client window that contains the pointer (the pointer could -also be in the client window decoration that \fBmwm\fP adds)\&. -If set to explicit, the policy is to have the keyboard focus set to a client -window when the user presses button 1 with the pointer on the client window -or any part of the associated \fBmwm\fP decoration\&. The default -value for this resource is explicit\&. -.IP "\fIlowerOnIconify\fP\ (class\ \fILowerOnIconify\fP)" 10 -If this resource is given the default value of True, a window\&'s icon -appears on the bottom of the window stack when the window is minimized (iconified)\&. -A value of False places the icon in the stacking order at the same place as -its associated window\&. The default value of this resource is True\&. -.IP "\fImoveThreshold\fP\ (class\ \fIMoveThreshold\fP)" 10 -This resource is used to control the sensitivity of dragging operations -that move windows and icons\&. The value of this resource is the number of pixels -that the locator is moved with a button down before the move operation is -initiated\&. This is used to prevent window/icon movement when you click or -double-click and there is unintentional pointer movement with the button down\&. -The default value of this resource is 4 (pixels)\&. -.IP "\fImultiScreen\fP\ (class\ \fIMultiScreen\fP)" 10 -This resource, if True, causes \fBmwm\fP to manage all -the screens on the display\&. If False, \fBmwm\fP manages only -a single screen\&. The default value is False\&. -.IP "\fIpassButtons\fP\ (class\ \fIPassButtons\fP)" 10 -This resource indicates whether or not button press events are passed -to clients after they are used to do a window manager function in the client -context\&. If the resource value is False, the button press is not passed to -the client\&. If the value is True, the button press is passed to the client -window\&. The window manager function is done in either case\&. The default value -for this resource is False\&. -.IP "\fIpassSelectButton\fP\ (class\ \fIPassSelectButton\fP)" 10 -This resource indicates whether or not to pass the select button press -events to clients after they are used to do a window manager function in the -client context\&. If the resource value is False, then the button press will -not be passed to the client\&. If the value is True, the button press is passed -to the client window\&. The window manager function is done in either case\&. -The default value for this resource is True\&. -.IP "\fIpositionIsFrame\fP\ (class\ \fIPositionIsFrame\fP)" 10 -This resource indicates how client window position information (from -the \fIWM_NORMAL_HINTS\fP property and from configuration requests) -is to be interpreted\&. If the resource value is True, the information is interpreted -as the position of the \fBmwm\fP client window frame\&. If the -value is False, it is interpreted as being the position of the client area -of the window\&. The default value of this resource is True\&. -.IP "\fIpositionOnScreen\fP\ (class\ \fIPositionOnScreen\fP)" 10 -This resource is used to indicate that windows should initially be placed -(if possible) so that they are not clipped by the edge of the screen (if the -resource value is True)\&. If a window is larger than the size of the screen, -at least the upper-left corner of the window is on-screen\&. If the resource -value is False, windows are placed in the requested position even if totally -off-screen\&. The default value of this resource is True\&. -.IP "\fIquitTimeout\fP\ (class\ \fIQuitTimeout\fP)" 10 -This resource specifies the amount of time (in milliseconds) that \fBmwm\fP will wait for a client to update the \fIWM_COMMAND\fP -property after \fBmwm\fP has sent the \fBWM_SAVE_YOURSELF\fP message\&. The default value of this resource is 1000 (ms)\&. (Refer -to the \fBf\&.kill\fP function description for additional information\&.) -.IP "\fIraiseKeyFocus\fP\ (class\ \fIRaiseKeyFocus\fP)" 10 -This resource is available only when the keyboard input focus policy -is explicit\&. When set to True, this resource specifies that a window raised -by means of the \fBf\&.normalize_and_raise\fP function also receives -the input focus\&. The default value of this resource is False\&. -.IP "\fIrefreshByClearing\fP\ (class\ \fIRefreshByClearing\fP)" 10 -This resource determines the mechanism used to refresh a window (or -the screen) when the \fBf\&.refresh_win\fP (\fBf\&.refresh\fP) function is executed\&. When set to True, an XClearArea is performed -over the window for \fBf\&.refresh_win\fP\&. When set to False, -a covering window is created and destroyed over the top of the window to be -refreshed\&. If the function is \fBf\&.refresh\fP and this resource -is set to True, then an XClearArea is performed over every window on the screen\&. -If the resource is set to False, then one large window covering the entire -screen is created and destroyed\&. The default value of this resource is True\&. -.IP "\fIrootButtonClick\fP\ (class\ \fIRootButtonClick\fP)" 10 -The \fIrootButtonClick\fP resource controls whether the -a click on the root window will post the root menu in a "sticky" mode\&. If -this resource is set to True, a button click on the root window will post -the menu bound to the button down event for that button in a "sticky" fashion\&. -If this resource is set to False, then the same button click would only cause -the menu to flash as it would be unposted once the button up event is seen\&. -The criterion used to determine if it is a button click is if the pointer -doesn\&'t move between the button down and button up events\&. The default value -for this resource is True\&. -.IP "\fIscreens\fP\ (class\ \fIScreens\fP)" 10 -This resource specifies the resource names to use for the screens managed -by \fBmwm\fP\&. If \fBmwm\fP is managing a single -screen, only the first name in the list is used\&. If \fBmwm\fP -is managing multiple screens, the names are assigned to the screens in order, -starting with screen 0\&. Screen 0 gets the first name, screen 1 the second -name, and so on\&. The default screen names are 0, 1, and so on\&. -.IP "\fIsessionClientDB\fP\ (class\ \fISessionClientDB\fP)" 10 -This resource identifies a file name to use as a root when saving state -at the request of an XSMP session manager\&. When the session is saved, the window manager will then reuse -the file name by automatically incrementing a suffix\&. -.IP "\fIshowFeedback\fP\ (class\ \fIShowFeedback\fP)" 10 -This resource controls whether or not feedback windows or confirmation -dialogs are displayed\&. A feedback window shows a client window\&'s initial -placement and shows position and size during move and resize operations\&. -Confirmation dialogs can be displayed for certain operations\&. The value for -this resource is a list of names of the feedback options to be enabled or -disabled; the names must be separated by a space\&. If an option is preceded -by a minus sign, that option is excluded from the list\&. The \fBsign\fP of the first item in the list determines the initial set of options\&. -If the sign of the first option is minus, \fBmwm\fP assumes -all options are present and starts subtracting from that set\&. If the sign -of the first decoration is plus (or not specified), \fBmwm\fP -starts with no options and builds up a list from the resource\&. -.PP -The names of the feedback options are shown below: -.TS -tab(); -lw(1.097588i) lw(4.402412i). -NameDescription -allShow all feedback (Default value)\&. -behaviorConfirm behavior switch\&. -killConfirm on receipt of KILL signal\&. -moveShow position during move\&. -noneShow no feedback\&. -placementT{ -Show position and size during initial placement\&. -T} -quitConfirm quitting \fBmwm\fP\&. -resizeShow size during resize\&. -restartConfirm \fBmwm\fP restart\&. -.TE -.PP -The following command line illustrates the syntax for showFeedback: -.PP -.nf -\f(CW\fIMwm*showFeedback: placement resize behavior restart\fP\fR -.fi -.PP -.PP -This resource specification provides feedback for initial client placement -and resize, and enables the dialog boxes to confirm the restart and set behavior -functions\&. It disables feedback for the move function\&. The default value for -this resource is all\&. -.IP "\fIstartupKeyFocus\fP\ (class\ \fIStartupKeyFocus\fP)" 10 -This resource is available only when the keyboard input focus policy -is explicit\&. When given the default value of True, a window gets the keyboard -input focus when the window is mapped (that is, initially managed by the window -manager)\&. It is recommended that both \fIautoKeyFocus\fP and \fIstartupKeyFocus\fP be True to work with tear off menus\&. The default -value is True\&. -.IP "\fIwMenuButtonClick\fP\ (class\ \fIWMenuButtonClick\fP)" 10 -This resource indicates whether a click of the mouse when the pointer -is over the window menu button posts and leaves posted the window menu\&. If -the value given this resource is True, the menu remains posted\&. True is the -default value for this resource\&. -.IP "\fIwMenuButtonClick2\fP\ (class\ \fIWMenuButtonClick2\fP)" 10 -When this resource is given the default value of True, a double-click -action on the window menu button does an \fIf\&.kill function\fP\&. -.SS "Screen Specific Appearance and Behavior Resources" -.PP -The syntax for specifying screen specific resources is \fIMwm*\fP \fBscreen_name\fP\fI*\fP\fBresource_id\fP For example, \fIMwm*1*keyBindings\fP specifies -the key bindings to use for screen "1"\&. -.SS "Screen Specific Resources" -.TS -tab(); -lw(1.768627i) lw(1.790196i) lw(0.927451i) lw(1.013725i). -NameClassValue TypeDefault -buttonBindingsButtonBindingsstringDefaultButtonBindings -cleanTextCleanTextT/FT -fadeNormalIconFadeNormalIconT/FF -feedbackGeometryFeedbackGeometrystringcenter on screen -frameBorderWidthFrameBorderWidthpixelsvaries -iconBoxGeometryIconBoxGeometrystring6x1+0-0 -iconBoxNameIconBoxNamestringiconbox -iconBoxSBDisplayPolicyIconBoxSBDisplayPolicystringall -iconBoxTitleIconBoxTitleXmStringIcons -iconDecorationIconDecorationstringvaries -iconImageMaximumIconImageMaximumwxh48x48 -iconImageMinimumIconImageMinimumwxh16x16 -iconPlacementIconPlacementstringleft bottom -iconPlacementMarginIconPlacementMarginpixelsvaries -keyBindingsKeyBindingsstringDefaultKeyBindings -limitResizeLimitResizeT/FT -maximumMaximumSizeMaximumMaximumSizewxh (pixels)2X screen w&h -moveOpaqueMoveOpaqueT/FF -resizeBorderWidthResizeBorderWidthpixelsvaries -resizeCursorsResizeCursorsT/FT -transientDecorationTransientDecorationstringmenu title -transientFunctionsTransientFunctionsstringT{ --minimize-maximize -T} -useIconBoxUseIconBoxT/FF -.TE -.IP "\fIbuttonBindings\fP\ (class\ \fIButtonBindings\fP)" 10 -This resource identifies the set of button bindings for window management -functions\&. The named set of button bindings is specified in the \fBmwm\fP resource description file\&. These button bindings are \fBmerged\fP with the built-in default bindings\&. The default value for -this resource is "DefaultButtonBindings"\&. -.IP "\fIcleanText\fP\ (class\ \fICleanText\fP)" 10 -This resource controls the display of window manager text in the client -title and feedback windows\&. If the default value of True is used, the text -is drawn with a clear (no stipple) background\&. This makes text easier to read -on monochrome systems where a backgroundPixmap is specified\&. Only the stippling -in the area immediately around the text is cleared\&. If False, the text is -drawn directly on top of the existing background\&. -.IP "\fIfadeNormalIcon\fP\ (class\ \fIFadeNormalIcon\fP)" 10 -If this resource is given a value of True, an icon is grayed out whenever -it has been normalized (its window has been opened)\&. The default value is -False\&. -.IP "\fIfeedbackGeometry\fP\ (class\ \fIFeedbackGeometry\fP)" 10 -This resource sets the position of the move and resize feedback window\&. -If this resource is not specified, the default is to place the feedback window -at the center of the screen\&. The value of the resource is a standard window -geometry string with the following syntax: [\fI=\fP]{ \fI+-\fP}\fBxoffset\fP{\fI+-\fP} \fByoffset\fP] -.IP "\fIframeBorderWidth\fP\ (class\ \fIFrameBorderWidth\fP)" 10 -This resource specifies the width (in pixels) of a client window frame -border without resize handles\&. The border width includes the 3-D shadows\&. -The default value is based on the size and resolution of the screen\&. -.IP "\fIiconBoxGeometry\fP\ (class\ \fIIconBoxGeometry\fP)" 10 -This resource indicates the initial position and size of the icon box\&. -The value of the resource is a standard window geometry string with the following -syntax: [\fI=\fP][\fBwidth\fP \fIx\fP\fBheight\fP][{\fI+-\fP}\fBxoffset\fP {\fI+-\fP}\fByoffset\fP] If the offsets -are not provided, the iconPlacement policy is used to determine the initial -placement\&. The units for width and height are columns and rows\&. The actual -screen size of the icon box window depends on the iconImageMaximum (size) -and \fIiconDecoration\fP resources\&. The default value for size -is (6 * iconWidth + padding) wide by (1 * iconHeight + padding) high\&. The -default value of the location is +0 -0\&. -.IP "\fIiconBoxName\fP\ (class\ \fIIconBoxName\fP)" 10 -This resource specifies the name that is used to look up icon box resources\&. -The default name is iconbox\&. -.IP "\fIiconBoxSBDisplayPolicy\fP\ (class\ \fIIconBoxSBDisplayPolicy\fP)" 10 -This resource specifies the scroll bar display policy of the window -manager in the icon box\&. The resource has three possible values: all, vertical, -and horizontal\&. The default value, "all", causes both vertical and horizontal -scroll bars always to appear\&. The value "vertical" causes a single vertical -scroll bar to appear in the icon box and sets the orientation of the icon -box to horizontal (regardless of the iconBoxGeometry specification)\&. The value -"horizontal" causes a single horizontal scroll bar to appear in the icon box -and sets the orientation of the icon box to vertical (regardless of the iconBoxGeometry -specification)\&. -.IP "\fIiconBoxTitle\fP\ (class\ \fIIconBoxTitle\fP)" 10 -This resource specifies the name that is used in the title area of the -icon box frame\&. The default value is Icons\&. -.IP "\fIiconDecoration\fP\ (class\ \fIIconDecoration\fP)" 10 -This resource specifies the general icon decoration\&. The resource value -is label (only the label part is displayed) or image (only the image part -is displayed) or label image (both the label and image parts are displayed)\&. -A value of activelabel can also be specified to get a label (not truncated -to the width of the icon) when the icon is selected\&. The default icon decoration -for icon box icons is that each icon has a label part and an image part (label -image)\&. The default icon decoration for stand alone icons is that each icon -has an active label part, a label part, and an image part (activelabel label -image)\&. -.IP "\fIiconImageMaximum\fP\ (class\ \fIIconImageMaximum\fP)" 10 -This resource specifies the maximum size of the icon image\&. The resource -value is \fBwidth\fP\fIx\fP \fBheight\fP (for example, 64x64)\&. The maximum supported size is 128x128\&. -The default value of this resource is 50x50\&. -.IP "\fIiconImageMinimum\fP\ (class\ \fIIconImageMinimum\fP)" 10 -This resource specifies the minimum size of the icon image\&. The resource -value is \fBwidth\fP\fIx\fP \fBheight\fP (for example, 32x50)\&. The minimum supported size is 16x16\&. -The default value of this resource is 16x16\&. -.IP "\fIiconPlacement\fP\ (class\ \fIIconPlacement\fP)" 10 -This resource specifies the icon placement scheme to be used\&. The resource -value has the following syntax: -.IP "" 10 -\fBprimary_layout secondary_layout [tight]\fP -.PP -The layout values are one of the following: -.TS -tab(); -lw(0.796053i) lw(4.703947i). -ValueDescription -topLay the icons out top to bottom\&. -bottomLay the icons out bottom to top\&. -leftLay the icons out left to right\&. -rightLay the icons out right to left\&. -.TE -.PP -A horizontal (vertical) layout value should not be used for both the \fBprimary_layout\fP and the \fBsecondary_layout\fP (for -example, don\&'t use top for the \fBprimary_layout\fP and bottom -for the \fBsecondary_layout\fP)\&. -.PP -The \fBprimary_layout\fP indicates whether, when an icon -placement is done, the icon is placed in a row or a column and the direction -of placement\&. The \fBsecondary_layout\fP indicates where to place -new rows or columns\&. For example, top right indicates that icons should be -placed top to bottom on the screen and that columns should be added from right -to left on the screen\&. -.PP -The default placement is left bottom (icons are placed left to right -on the screen, with the first row on the bottom of the screen, and new rows -added from the bottom of the screen to the top of the screen)\&. A \fBtight\fP value places icons with zero spacing in between icons\&. This -value is useful for aesthetic reasons, as well as X-terminals with small screens\&. -.IP "\fIiconPlacementMargin\fP\ (class\ \fIIconPlacementMargin\fP)" 10 -This resource sets the distance between the edge of the screen and the -icons that are placed along the edge of the screen\&. The value should be greater -than or equal to 0\&. A default value (see below) is used if the value specified -is invalid\&. The default value for this resource is equal to the space between -icons as they are placed on the screen (this space is based on maximizing -the number of icons in each row and column)\&. -.IP "\fIkeyBindings\fP\ (class\ \fIKeyBindings\fP)" 10 -This resource identifies the set of key bindings for window management -functions\&. If specified, these key bindings \fBreplace\fP the -built-in default bindings\&. The named set of key bindings is specified in \fBmwm\fP resource description file\&. The default value for this resource -is "DefaultKeyBindings"\&. -.IP "\fIlimitResize\fP\ (class\ \fILimitResize\fP)" 10 -If this resource is True, the user is not allowed to resize a window -to greater than the maximum size\&. The default value for this resource is True\&. -.IP "\fImaximumMaximumSize\fP\ (class\ \fIMaximumMaximumSize\fP)" 10 -This resource is used to limit the maximum size of a client window as -set by the user or client\&. The resource value is \fBwidth\fP\fIx\fP\fBheight\fP (for example, 1024x1024) -where the width and height are in pixels\&. The default value of this resource -is twice the screen width and height\&. -.IP "\fImoveOpaque\fP\ (class\ \fIMoveOpaque\fP)" 10 -This resource controls whether the actual window is moved or a rectangular -outline of the window is moved\&. A default value of False displays a rectangular -outline on moves\&. -.IP "\fIresizeBorderWidth\fP\ (class\ \fIResizeBorderWidth\fP)" 10 -This resource specifies the width (in pixels) of a client window frame -border with resize handles\&. The specified border width includes the 3-D shadows\&. -The default value is based on the size and resolution of the screen\&. -.IP "\fIresizeCursors\fP\ (class\ \fIResizeCursors\fP)" 10 -This is used to indicate whether the resize cursors are always displayed -when the pointer is in the window size border\&. If True, the cursors are shown, -otherwise the window manager cursor is shown\&. The default value is True\&. -.IP "\fItransientDecoration\fP\ (class\ \fITransientDecoration\fP)" 10 -This controls the amount of decoration that \fBmwm\fP -puts on transient windows\&. The decoration specification is exactly the same -as for the \fIclientDecoration\fP (client specific) resource\&. -Transient windows are identified by the \fIWM_TRANSIENT_FOR\fP -property, which is added by the client to indicate a relatively temporary -window\&. The default value for this resource is menu title (that is, transient -windows have frame borders and a titlebar with a window menu button)\&. -.IP "" 10 -An application can also specify which decorations \fBmwm\fP -should apply to its windows\&. If it does so, \fBmwm\fP applies -only those decorations indicated by both the application and the \fItransientDecoration\fP resource\&. Otherwise, \fBmwm\fP -applies the decorations indicated by the \fItransientDecoration\fP -resource\&. For more information see the description of \fBXmNmwmDecorations\fP on the \fBVendorShell\fP(3) -reference page\&. -.IP "\fItransientFunctions\fP\ (class\ \fITransientFunctions\fP)" 10 -This resource is used to indicate which window management functions -are applicable (or not applicable) to transient windows\&. The function specification -is exactly the same as for the \fIclientFunctions\fP (client -specific) resource\&. The default value for this resource is -minimize -maximize\&. -.IP "" 10 -An application can also specify which functions \fBmwm\fP -should apply to its windows\&. If it does so, \fBmwm\fP applies -only those functions indicated by both the application and the \fItransientFunctions\fP resource\&. Otherwise, \fBmwm\fP -applies the functions indicated by the \fItransientFunctions\fP -resource\&. For more information see the description of \fBXmNmwmFunctions\fP on the \fBVendorShell\fP(3) reference -page\&. -.IP "\fIuseIconBox\fP\ (class\ \fIUseIconBox\fP)" 10 -If this resource is given a value of True, icons are placed in an icon -box\&. When an icon box is not used, the icons are placed on the root window -(default value)\&. -.SS "Client Specific Resources" -.PP -The syntax for specifying client specific resources is -.PP -\fIMwm*\fP\fBclient_name_or_class\fP \fI*\fP\fBresource_id\fP -.PP -For example, \fIMwm*mterm*windowMenu\fP is used to specify -the window menu to be used with mterm clients\&. The syntax for specifying client -specific resources for all classes of clients is -.PP -\fIMwm*\fP\fBresource_id\fP -.PP -Specific client specifications take precedence over the specifications -for all clients\&. For example, \fIMwm*windowMenu\fP is used -to specify the window menu to be used for all classes of clients that don\&'t -have a window menu specified\&. -.PP -The syntax for specifying resource values for windows that have an unknown -name and class (that is, windows that do not have a \fBWM_CLASS\fP -property associated with them) is -.PP -\fIMwm*defaults*\fP\fBresource_id\fP -.PP -For example, \fIMwm*defaults*iconImage\fP is used to -specify the icon image to be used for windows that have an unknown name and -class\&. -.PP -The following client specific resources can be specified: -.SS "Client Specific Resources" -.TS -tab(); -lw(1.999018i) lw(1.458743i) lw(0.918468i) lw(1.123772i). -NameClassValue TypeDefault -clientDecorationClientDecorationstringall\&. -clientFunctionsClientFunctionsstringall\&. -focusAutoRaiseFocusAutoRaiseT/Fvaries -iconImageIconImagepathname(image) -iconImage-Backgroundcoloricon background -Background -iconImageBottom-Foregroundcoloricon -ShadowColorbottom shadow -iconImageBottom-BottomShadow-coloricon bottom -ShadowPixmapPixmapshadow pixmap -iconImageForegroundForegroundcolorvaries -iconImageTopShadowColorBackgroundcoloricon top -shadow color -iconImageTop-TopShadowPixmapcoloricon top -ShadowPixmapshadow pixmap -matteBackgroundBackgroundcolorbackground -matteBottom-Foregroundcolorbottom -ShadowColorshadow color -matteBottom-BottomShadow-colorbottom -ShadowPixmapPixmapshadow pixmap -matteForegroundForegroundcolorforeground -matteTopShadowColorBackgroundcolortop -shadow color -matteTopShadowPixmapTopShadowPixmapcolortop -shadow pixmap -matteWidthMatteWidthpixels0 -maximumClientSizeMaximumClientSizewxh -vertical horizontalfill the screen -useClientIconUseClientIconT/FT -usePPositionUsePPositionstringnonzero -windowMenuWindowMenustringDefaultWindowMenu -.TE -.IP "\fIclientDecoration\fP\ (class\ \fIClientDecoration\fP)" 10 -This resource controls the amount of window frame decoration\&. The resource -is specified as a list of decorations to specify their inclusion in the frame\&. -If a decoration is preceded by a minus sign, that decoration is excluded from -the frame\&. The \fBsign\fP of the first item in the list determines -the initial amount of decoration\&. If the sign of the first decoration is minus, \fBmwm\fP assumes all decorations are present and starts subtracting -from that set\&. If the sign of the first decoration is plus (or not specified), -then \fBmwm\fP starts with no decoration and builds up a list -from the resource\&. -.IP "" 10 -An application can also specify which decorations \fBmwm\fP -should apply to its windows\&. If it does so, \fBmwm\fP applies -only those decorations indicated by both the application and the \fIclientDecoration\fP resource\&. Otherwise, \fBmwm\fP applies -the decorations indicated by the \fIclientDecoration\fP resource\&. -For more information see the description of \fBXmNmwmDecorations\fP on the \fBVendorShell\fP(3) reference -page\&. -.TS -tab(); -lw(0.989035i) lw(4.510965i). -NameDescription -allT{ -Include all decorations (default value)\&. -T} -borderWindow border\&. -maximizeT{ -Maximize button (includes title bar)\&. -T} -minimizeT{ -Minimize button (includes title bar)\&. -T} -noneNo decorations\&. -resizehT{ -Border resize handles (includes border)\&. -T} -menuT{ -Window menu button (includes title bar)\&. -T} -titleTitle bar (includes border)\&. -.TE -.PP -Examples: \fIMwm*XClock\&.clientDecoration: -resizeh -maximize\fP This removes the resize handles and maximize button from XClock -windows\&. \fIMwm*XClock\&.clientDecoration: menu minimize border\fP This does the same thing as above\&. Note that either \fImenu\fP or \fIminimize\fP implies -\fItitle\fP\&. -.IP "\fIclientFunctions\fP\ (class\ \fIClientFunctions\fP)" 10 -This resource is used to indicate which \fBmwm\fP functions -are applicable (or not applicable) to the client window\&. The value for the -resource is a list of functions\&. If the first function in the list has a minus -sign in front of it, then \fBmwm\fP starts with all functions -and subtracts from that set\&. If the first function in the list has a plus -sign in front of it, then \fBmwm\fP starts with no functions -and builds up a list\&. Each function in the list must be preceded by the appropriate -plus or minus sign and separated from the next function by a space\&. -.IP "" 10 -An application can also specify which functions \fBmwm\fP -should apply to its windows\&. If it does so, \fBmwm\fP applies -only those functions indicated by both the application and the \fIclientFunctions\fP resource\&. Otherwise, \fBmwm\fP applies -the functions indicated by the \fIclientFunctions\fP resource\&. -For more information see the description of \fBXmNmwmFunctions\fP on the \fBVendorShell\fP(3) reference -page\&. -.PP -The following table lists the functions available for this resource: -.TS -tab(); -lw(0.928728i) lw(4.571272i). -NameDescription -allT{ -Include all functions (default value)\&. -T} -noneNo functions\&. -resizef\&.resize\(dg\&. -movef\&.move\(dg\&. -minimizef\&.minimize\(dg\&. -maximizef\&.maximize\(dg\&. -closef\&.kill\(dg\&. -.TE -.PP -\(dgSee \fBmwmrc\fP(4)\&. -.IP "\fIfocusAutoRaise\fP\ (class\ \fIFocusAutoRaise\fP)" 10 -When the value of this resource is True, clients are raised when they -get the keyboard input focus\&. If the value is False, the stacking of windows -on the display is not changed when a window gets the keyboard input focus\&. -The default value is True when the keyboardFocusPolicy is explicit and False -when the keyboardFocusPolicy is pointer\&. -.IP "\fIiconImage\fP\ (class\ \fIIconImage\fP)" 10 -This resource can be used to specify an icon image for a client (for -example, "Mwm*myclock*iconImage")\&. The resource value is a pathname for a -pixmap or bitmap file\&. The value of the (client specific) \fIuseClientIcon\fP resource is used to determine whether or not user supplied icon -images are used instead of client supplied icon images\&. The default value -is to display a built-in window manager icon image\&. -.IP "\fIiconImageBackground\fP\ (class\ \fIBackground\fP)" 10 -This resource specifies the background color of the icon image that -is displayed in the image part of an icon\&. The default value of this resource -is the icon background color (that is, specified by "Mwm*background or Mwm*icon*background)\&. -.IP "\fIiconImageBottomShadowColor\fP\ (class\ \fIForeground\fP)" 10 -This resource specifies the bottom shadow color of the icon image that -is displayed in the image part of an icon\&. The default value of this resource -is the icon bottom shadow color (that is, specified by Mwm*icon*bottomShadowColor)\&. -.IP "\fIiconImageBottomShadowPixmap\fP\ (class\ \fIBottomShadowPixmap\fP)" 10 -This resource specifies the bottom shadow Pixmap of the icon image that -is displayed in the image part of an icon\&. The default value of this resource -is the icon bottom shadow Pixmap (that is, specified by Mwm*icon*bottomShadowPixmap)\&. -.IP "\fIiconImageForeground\fP\ (class\ \fIForeground\fP)" 10 -This resource specifies the foreground color of the icon image that -is displayed in the image part of an icon\&. The default value of this resource -varies depending on the icon background\&. -.IP "\fIiconImageTopShadowColor\fP\ (class\ \fIBackground\fP)" 10 -This resource specifies the top shadow color of the icon image that -is displayed in the image part of an icon\&. The default value of this resource -is the icon top shadow color (that is, specified by Mwm*icon*topShadowColor)\&. -.IP "\fIiconImageTopShadowPixmap\fP\ (class\ \fITopShadowPixmap\fP)" 10 -This resource specifies the top shadow Pixmap of the icon image that -is displayed in the image part of an icon\&. The default value of this resource -is the icon top shadow pixmap (that is, specified by Mwm*icon*topShadowPixmap)\&. -.IP "\fImatteBackground\fP\ \ (class\ \fIBackground\fP)" 10 -This resource specifies the background color of the matte, when \fImatteWidth\fP is positive\&. The default value of this resource is the -client background color (that is, specified by "Mwm*background or Mwm*client*background)\&. -.IP "\fImatteBottomShadowColor\fP\ (class\ \fIForeground\fP)" 10 -This resource specifies the bottom shadow color of the matte, when \fImatteWidth\fP is positive\&. The default value of this resource is the -client bottom shadow color (that is, specified by Mwm*bottomShadowColor or -Mwm*client*bottomShadowColor)\&. -.IP "\fImatteBottomShadowPixmap\fP\ (class\ \fIBottomShadowPixmap\fP)" 10 -This resource specifies the bottom shadow Pixmap of the matte, when \fImatteWidth\fP is positive\&. The default value of this resource is the -client bottom shadow pixmap (that is, specified by Mwm*bottomShadowPixmap -or Mwm*client*bottomShadowPixmap)\&. -.IP "\fImatteForeground\fP\ (class\ \fIForeground\fP)" 10 -This resource specifies the foreground color of the matte, when \fImatteWidth\fP is positive\&. The default value of this resource is the -client foreground color (that is, specified by Mwm*foreground or Mwm*client*foreground)\&. -.IP "\fImatteTopShadowColor\fP\ (class\ \fIBackground\fP)" 10 -This resource specifies the top shadow color of the matte, when \fImatteWidth\fP is positive\&. The default value of this resource is the -client top shadow color (that is, specified by Mwm*topShadowColor or Mwm*client*topShadowColor)\&. -.IP "\fImatteTopShadowPixmap\fP\ (class\ \fITopShadowPixmap\fP)" 10 -This resource specifies the top shadow pixmap of the matte, when \fImatteWidth\fP is positive\&. The default value of this resource is the -client top shadow pixmap (that is, specified by "Mwm*topShadowPixmap or Mwm*client*topShadowPixmap)\&. -.IP "\fImatteWidth\fP\ (class\ \fIMatteWidth\fP)" 10 -This resource specifies the width of the optional matte\&. The default -value is 0, which effectively disables the matte\&. -.IP "\fImaximumClientSize\fP\ (class\ \fIMaximumClientSize\fP)" 10 -This resource is either a size specification or a direction that indicates -how a client window is to be maximized\&. The resource value can be specified -as a size specification \fBwidth\fP\fIx\fP\fBheight\fP\&. The width and height are interpreted in -the units that the client uses (for example, for terminal emulators this is -generally characters)\&. Alternately, "vertical" or "horizontal" can be specified -to indicate the direction in which the client maximizes\&. -.IP "" 10 -If this resource is not specified, the maximum size from the \fIWM_NORMAL_HINTS\fP property is used if set\&. Otherwise the default -value is the size where the client window with window management borders fills -the screen\&. When the maximum client size is not determined by the \fImaximumClientSize\fP resource, the \fImaximumMaximumSize\fP -resource value is used as a constraint on the maximum size\&. -.IP "\fIuseClientIcon\fP\ (class\ \fIUseClientIcon\fP)" 10 -If the value given for this resource is True, a client-supplied icon -image takes precedence over a user-supplied icon image\&. The default value -is True, giving the client-supplied icon image higher precedence than the -user-supplied icon image\&. -.IP "\fIusePPosition\fP\ (class\ \fIUsePPosition\fP)" 10 -This resource specifies whether Mwm honors program specified position \fBPPosition\fP specified in the \fIWM_NORMAL_HINTS\fP property in the absence of an user specified position\&. Setting -this resource to on, causes \fBmwm\fP to always honor program -specified position\&. Setting this resource to off, causes \fBmwm\fP -to always ignore program specified position\&. Setting this resource to the -default value of nonzero cause \fBmwm\fP to honor program specified -position other than (0,0)\&. -.IP "\fIwindowMenu\fP\ (class\ \fIWindowMenu\fP)" 10 -This resource indicates the name of the menu pane that is posted when -the window menu is popped up (usually by pressing button 1 on the window -menu button on the client window frame)\&. Menu panes are specified in the \fBmwm\fP resource description file\&. Window menus can be customized on -a client class basis by creating custom menus in your \fBmwmrc\fP -file (see \fBmwmrc\fP(4) and specifying resources to activate -the custom menus\&. The resources have the form \fIMwm*\fP \fBclient_name_or_class\fP\fI*windowMenu\fP\&. The default -value of this resource is DefaultWindowMenu\&. -.SS "Resource Description File" -.PP -The \fBmwm\fP resource description file is a supplementary -resource file that contains resource descriptions that are referred to by -entries in the resource manager property (see \fBxrdb\fP(1) and -the defaults files (\fB\&.Xdefaults\fP, \fBapp-defaults/Mwm\fP )\&. It contains descriptions of resources that are to be used by \fBmwm\fP, and that cannot be easily encoded in the defaults files (a -bitmap file is an analogous type of resource description file)\&. A particular \fBmwm\fP resource description file can be selected using the -\fIconfigFile\fP resource\&. -.PP -The following types of resources can be described in the \fBmwm\fP resource description file: -.IP "\fIButtons\fP" 10 -Window manager functions can be bound (associated) with button events\&. -.IP "\fIKeys\fP" 10 -Window manager functions can be bound (associated) with key press events\&. -.IP "\fIMenus\fP" 10 -Menu panes can be used for the window menu and other menus posted with -key bindings and button bindings\&. -.IP "" 10 -The \fBmwm\fP resource description file is described in \fBmwmrc\fP(4)\&. -.SS "Environment" -.PP -The \fBmwm\fP window manager uses the environment variable \fBHOME\fP specifying the user\&'s home directory\&. -.PP -The \fBmwm\fP window manager uses the environment variable \fBLANG\fP specifying the user\&'s choice of language -for the \fBmwm\fP message catalog and the \fBmwm\fP -resource description file\&. -.PP -The \fBmwm\fP window uses the environment variable \fBXFILESEARCHPATH\fP, \fBXUSERFILESEARCHPATH\fP, \fBXAPPLRESDIR\fP, \fBXENVIRONMENT\fP, \fBLANG\fP, and \fBHOME\fP in determining search paths for resource defaults files\&. -The \fBmwm\fP window manager may also us \fBXBMLANGPATH\fP to search for bitmap files\&. -.PP -The \fBmwm\fP window manager reads the \fB$HOME/\&.motifbind\fP -file if it exists to install a virtual key bindings property on -the root window\&. For more information on the content of the \fB\&.motifbind\fP file, see -.PP -The \fBmwm\fP window manager uses the environment variable -\fBMWMSHELL\fP (or \fBSHELL\fP, \fIif\fP \fBMWMSHELL\fP is not set), specifying -the shell to use when executing commands via the \fBf\&.exec\fP -function\&. -.SS "Files" -.PP -\fB/etc/X11/mwm/$LANG/system\&.mwmrc\fP -.PP -\fB/etc/X11/mwm/system\&.mwmrc\fP -.PP -\fB/usr/X11R6/lib/X11/app-defaults/Mwm\fP -.PP -\fB$HOME/Mwm\fP -.PP -\fB$HOME/$LANG/\&.mwmrc\fP -.PP -\fB$HOME/\&.mwmrc\fP -.SS "RELATED INFORMATION" -.PP -\fBVendorShell\fP(3), \fBVirtualBindings\fP(3), \fBX\fP(1), \fBXmInstallImage\fP(3), \fBxrdb\fP(1)\&. -...\" created by instant / docbook-to-man, Sun 22 Dec 1996, 20:15 diff --git a/doc/man/man3/VirtualBindings.3 b/doc/man/man3/VirtualBindings.3 index 8c10e18..e227f0e 100644 --- a/doc/man/man3/VirtualBindings.3 +++ b/doc/man/man3/VirtualBindings.3 @@ -90,7 +90,7 @@ bindings contained in that file\&. If it has found no bindings, Motif next looks for the file \fBxmbind\&.alias\fP in the directory specified by the environment variable \fBXMBINDDIR\fP, if \fBXMBINDDIR\fP is set, or in the directory -\fB/usr/share/X11/bindings\fP if \fBXMBINDDIR\fP is not set\&. +\fB/usr/lib/Xm/bindings\fP if \fBXMBINDDIR\fP is not set\&. If this file exists Motif searches it for a pathname associated with the vendor string or with the vendor string and vendor release\&. If it finds such a pathname and if that file exists, Motif loads the diff --git a/doc/man/man3/VirtualBindings.3.bindings b/doc/man/man3/VirtualBindings.3.bindings deleted file mode 100644 index e227f0e..0000000 --- a/doc/man/man3/VirtualBindings.3.bindings +++ /dev/null @@ -1,412 +0,0 @@ -'\" t -...\" VirtBind.sgm /main/12 1996/09/08 21:43:15 rws $ -.de P! -.fl -\!!1 setgray -.fl -\\&.\" -.fl -\!!0 setgray -.fl \" force out current output buffer -\!!save /psv exch def currentpoint translate 0 0 moveto -\!!/showpage{}def -.fl \" prolog -.sy sed -e 's/^/!/' \\$1\" bring in postscript file -\!!psv restore -. -.de pF -.ie \\*(f1 .ds f1 \\n(.f -.el .ie \\*(f2 .ds f2 \\n(.f -.el .ie \\*(f3 .ds f3 \\n(.f -.el .ie \\*(f4 .ds f4 \\n(.f -.el .tm ? font overflow -.ft \\$1 -.. -.de fP -.ie !\\*(f4 \{\ -. ft \\*(f4 -. ds f4\" -' br \} -.el .ie !\\*(f3 \{\ -. ft \\*(f3 -. ds f3\" -' br \} -.el .ie !\\*(f2 \{\ -. ft \\*(f2 -. ds f2\" -' br \} -.el .ie !\\*(f1 \{\ -. ft \\*(f1 -. ds f1\" -' br \} -.el .tm ? font underflow -.. -.ds f1\" -.ds f2\" -.ds f3\" -.ds f4\" -.ta 8n 16n 24n 32n 40n 48n 56n 64n 72n -.TH "VirtualBindings" "library call" -.SH "NAME" -\fBVirtualBindings\fP \(em Bindings for virtual mouse and key events -.iX "VirtualBindings" -.iX "default bindings" "VirtualBindings" -.SH "DESCRIPTION" -.PP -The Motif reference pages describe key translations in terms of -\fIvirtual bindings\fP, based on those described in the \fIMotif Style Guide\fP\&. -.SS "Bindings for osf Keysyms" -.PP -Keysym strings that begin with \fB\fP are not part of the X server\&'s -keyboard mapping\&. -Instead, these keysyms are produced on the client side at run time\&. -They are interpreted by the routine \fBXmTranslateKey\fP, and -are used by the translation manager when the server delivers an actual -key event\&. -For each application, a mapping is maintained between \fB\fP keysyms and -keysyms that correspond to actual keys\&. -This mapping is based on information obtained at application startup -from one of the following sources, listed in order of precedence: -.IP " \(bu" 6 -The \fBXmNdefaultVirtualBindings\fP resource from Display\&. -.IP " \(bu" 6 -A property on the root window, which can be set by \fBmwm\fP on startup, -or by the \fBxmbind\fP client, or on prior startup of a Motif -application\&. -.IP " \(bu" 6 -The file \fB\&.motifbind\fP in the user\&'s home directory\&. -.IP " \(bu" 6 -A set of bindings based on the vendor string and optionally the vendor -release of the X server\&. -Motif searches for these bindings in the following steps: -.RS -.IP " 0." 6 -If the file \fBxmbind\&.alias\fP exists in the user\&'s home directory, -Motif searches this file for a pathname associated with the vendor -string or with the vendor string and vendor release\&. -If it finds such a pathname and if that file exists, Motif loads the -bindings contained in that file\&. -.IP " 1." 6 -If it has found no bindings, Motif next looks for the file -\fBxmbind\&.alias\fP in the directory specified by the environment -variable \fBXMBINDDIR\fP, if \fBXMBINDDIR\fP is set, or in the directory -\fB/usr/lib/Xm/bindings\fP if \fBXMBINDDIR\fP is not set\&. -If this file exists Motif searches it for a pathname associated with the -vendor string or with the vendor string and vendor release\&. -If it finds such a pathname and if that file exists, Motif loads the -bindings contained in that file\&. -.IP " 2." 6 -If it still has found no bindings, Motif loads a set of hard-coded -fallback bindings\&. -.RE -.PP -The \fBxmbind\&.alias\fP file contains zero or more lines of the following form: -.PP -.nf -\f(CW"\fIvendor_string\fP[ \fIvendor_release\fP]" \fIbindings_file\fP\fR -.fi -.PP -.PP -where \fIvendor_string\fP is the X server vendor name as returned by the -X client \fBxdpyinfo\fP or the Xlib function \fBXServerVendor\fP, and -must appear in double quotes\&. -If \fIvendor_release\fP is included, it is the X server vendor release -number as returned by the X client \fBxdpyinfo\fP or the Xlib function -\fBXVendorRelease\fP, and must also be contained within the double -quotes separated by one space from \fIvendor_string\fP\&. -The \fIvendor_release\fP argument is provided to allow support -of changes in keyboard -hardware from a vendor, assuming that the vendor increments the release -number to flag such changes\&. -Alternatively, the vendor may simply use a unique vendor string for each -different keyboard\&. -.PP -The \fIbindings_file\fP argument is the pathname of -the file containing the bindings -themselves\&. -It can be a relative or absolute pathname\&. -If it it is a relative pathname, it is relative to the location of the -\fBxmbind\&.alias\fP file\&. -.PP -Comment lines in the \fBxmbind\&.alias\fP file begin with ! (exclamation -point)\&. -.PP -The bindings found in either the \fB\&.motifbind\fP file or the vendor -mapping are placed in a property on the root window\&. -This property is used to determine the bindings for subsequent Motif -applications\&. -.PP -On startup \fBmwm\fP attempts to load the file \fB\&.motifbind\fP in the -user\&'s home directory\&. -If this is unsuccessful, it loads the vendor bindings as described -previously\&. -It places the bindings it loads in a property on the root window for use -by subsequent Motif applications\&. -.PP -The \fBxmbind\fP function loads bindings -from a file if that file is specified on the -command line\&. -If no file is specified on the command line, it attempts to load the -file \fB\&.motifbind\fP in the user\&'s home directory\&. -If this fails, it loads the vendor bindings as described previously\&. -It places the bindings it loads in a property on the root window for use -by subsequent Motif applications\&. -.PP -The format of the specification for mapping \fB\fP keysyms to -actual keysyms is similar to that of a specification for an event -translation\&. (See below) The syntax is specified (and below) here in -EBNF notation using the following conventions: -.PP -.nf -\f(CW[\fIa\fP] Means either nothing or \fIa\fP -{\fIa\fP} Means zero or more occurrences of \fIa\fP -(\fIa\fP|\fIb\fP) Means either \fIa\fP or \fIb\fP\&.\fR -.fi -.PP -.PP -Terminals are enclosed in double quotation marks\&. -.PP -The syntax of an \fB\fP keysym binding specification is as follows: -.PP -.nf -\f(CWbinding_spec = {line "\en"} [line] -line = virtual_keysym ":" list_of_key_event -list_of_key_event= key_event { "," key_event} -key_event = {modifier_name} "" actual_keysym -virtual_keysym = keysym -actual_keysym = keysym -keysym = A valid X11 keysym name that is - mapped by \fBXStringToKeysym\fP\fR -.fi -.PP -.PP -As with event translations, more specific event descriptions must -precede less specific descriptions\&. -For example, an event description for a key with a modifier must precede -a description for the same key without the same modifier\&. -.PP -Following is an example of a specification for the -\fBdefaultVirtualBindings\fP resource in a resource file: -.PP -.nf -\f(CW*defaultVirtualBindings: \e - osfBackSpace: BackSpace \en\e - osfInsert: InsertChar \en\e - osfDelete: DeleteChar \en\e -\&.\&.\&. - osfLeft: left, CtrlH\fR -.fi -.PP -.PP -The format of a \fB\&.motifbind\fP file or of a file containing vendor -bindings is the same, except that the binding specification for each -keysym is placed on a separate line\&. -The previous example specification appears as follows in a -\fB\&.motifbind\fP or vendor bindings file: -.PP -.nf -\f(CWosfBackSpace: BackSpace -osfInsert: InsertChar -osfDelete: DeleteChar -\&.\&.\&. -osfLeft: left, CtrlH\fR -.fi -.PP -.PP -The following table lists the fixed fallback default bindings for -\fB\fP keysyms\&. -.TS -tab() box; -c s -l| l. -T{ -\fBFallback Default Bindings for osf Keysyms\fP -T} -\fB\fP\fBFallback Default Binding\fP -__ -\fB\fP\fB:\fP\fBKP_Enter\fP, \fBExecute\fP -__ -\fB\fP\fB:\fP\fBShiftF8\fP -__ -\fB\fP\fB:\fP\fB\fP\fBBackSpace\fP -__ -\fB\fP\fB:\fP\fBHome\fP, \fBBegin\fP -__ -\fB\fP\fB:\fP\fBEscape\fP, \fBCancel\fP -__ -\fB\fP\fB:\fP\fB\fP\fBClear\fP -__ -\fB\fP\fB:\fP\fIunbound\fP -__ -\fB\fP\fB:\fP\fIunbound\fP -__ -\fB\fP\fB:\fP\fB\fP\fBDelete\fP -__ -\fB\fP\fB:\fP\fIunbound\fP -__ -\fB\fP\fB:\fP\fB\fP\fBDown\fP -__ -\fB\fP\fB:\fP\fB\fP\fBEnd\fP -__ -\fB\fP\fB:\fP\fBF1\fP, \fBHelp\fP -__ -\fB\fP\fB:\fP\fB\fP\fBInsert\fP -__ -\fB\fP\fB:\fP\fB\fP\fBLeft\fP -__ -\fB\fP\fB:\fP\fIunbound\fP -__ -\fB\fP\fB:\fP\fBShift\fP\fBF10\fP, \fBMenu\fP -__ -\fB\fP\fB:\fP\fBF10\fP, \fBShift\fP\fBMenu\fP -__ -\fB\fP\fB:\fP\fIunbound\fP -__ -\fB\fP\fB:\fP\fB\fP\fBNext\fP -__ -\fB\fP\fB:\fP\fIunbound\fP -__ -\fB\fP\fB:\fP\fIunbound\fP -__ -\fB\fP\fB:\fP\fB\fP\fBPrior\fP -__ -\fB\fP\fB:\fP\fIunbound\fP -__ -\fB\fP\fB:\fP\fIunbound\fP -__ -\fB\fP\fB:\fP\fIunbound\fP -__ -\fB\fP\fB:\fP\fIunbound\fP -__ -\fB\fP\fB:\fP\fIunbound\fP -__ -\fB\fP\fB:\fP\fB\fP\fBRight\fP -__ -\fB\fP\fB:\fP\fIunbound\fP -__ -\fB\fP\fB:\fP\fB\fP\fBSelect\fP -__ -\fB\fP\fB:\fP\fIunbound\fP -__ -\fB\fP\fB:\fP\fBAltReturn\fP, \fBAltKP_Enter\fP -__ -\fB\fP\fB:\fP\fB\fP\fBUndo\fP -__ -\fB\fP\fB:\fP\fB\fP\fBUp\fP -__ -.TE -.SS "Changes in the Handling of Shifted Keys" -.PP -In conjunction with MIT X11R5 Patch 24, this version of Motif -introduces a change in the way that keys involving the -modifier are processed\&. This change allows the numeric keypad to be -used to generate numbers using the standard X mechanisms\&. Since the -default behavior is now to honor the xmodmap keymap bindings, -translations and virtual key bindings that use may behave -differently\&. A common symptom is that unshifted keypad and function -keys (with or without other modifiers) produce the expected results, -but shifted ones do not\&. -.PP -To obtain the old behavior you can remove the shifted interpretation -from problematic keys using the \fBxmodmap\fP utility\&. Each entry in -a \fBxmodmap\fP keymap table contains up to four keysym bindings\&. The -second and fourth keysyms are for shifted keys\&. If an expression -contains only two keysyms, simply remove the second keysym\&. If -an entry contains three or more keysyms, replace the second keysym -with \fBNoSymbol\fP and remove the fourth keysym\&. -.SS "Action Translations" -.PP -The translation table syntax used by Motif is completely specified -in the X11R5 Toolkit Intrinsics Documentation\&. For the complete syntax -description, and for general instructions about writing or modifying a -translation table, please refer to this document\&. A brief summary of the -translation table format, however, is included below\&. -.PP -The syntax is defined as in the binding syntax specification above\&. -Informal descriptions are contained in angle brackets (<>)\&. -.PP -.nf -\f(CWTranslationTable= [ directive ] { production } -directive = ( "#replace" | "#override" | "#augment") "\en" -production = lhs ":" rhs "\en" -lhs = ( event | keyseq) {"," ( event | keyseq) } -keyseq = """ keychar { keychar } """ -keychar = ( "^" | "$" | "\e\e") -event = [ modifier_list ] "<" event_type ">" [ count ] {detail} -modifier_list = ( ["!"][":"] { modifier } | "None") -modifier = [ "~" ] ( "@" | ) -count = "(" [ "+" ] ")" -rhs = { action_name "(" [params] ")" } -params = string { "," string }\fR -.fi -.PP -The \fIstring\fP field need not be quoted unless it includes a space -or tab character, or any comma, newline, or parenthesis\&. The entire -list of string values making up the \fIparams\fP field will ba passed -to the named action routine\&. -.PP -The \fIdetails\fP field may be used to specify a keysym that will -identify a particular key event\&. For example, \fB\fP is the name -of a type of event, but it must be modified by the \fIdetails\fP field -to name a specific event, such as \fB\fP\fBA\fP\&. -.PP -\fBModifier Names\fP -The modifier list, which may be empty, consists of a list of modifier -keys that must be pressed with the key sequence\&. The modifier keys -may abbreviated with single letters, as in the following list of the -familiar modifiers: -.IP "s" 10 -Shift -.IP "c\ or\ ^" 10 -Ctrl (Control) -.IP "m\ or\ $" 10 -Meta -.IP "a" 10 -Alt -.PP -Other modifiers are available, such as "Mod5" and "Button2\&." These -have no abbreviation (although the "Button" modifiers may be -abbreviated in combination with events, as outlined below)\&. If a -modifier list has no entries, and is not "None", it means the position -of the modifier keys is irrelevant\&. If modifiers are listed, the -designated keys must be in the specified position, but the unlisted -modifier keys are irrelevant\&. If the list begins with an exclamation -point (!), however, the unlisted modifiers may not be asserted\&. In -addition, if a modifier name is preceded by a tilde (~), the -corresponding key must \fInot\fP be pressed\&. -.PP -If a modifier list begins with a colon (:), X tries to use the -standard modifiers (Shift and Lock), if present, to map the key event -code into a recognized keysym\&. -.PP -Event Types -These are a few of the recognized event types\&. -.IP "Key or KeyDown" 10 -A keyboard key was pressed\&. -.IP "KeyUp" 10 -A keyboard key was released\&. -.IP "BtnDown" 10 -A mouse button was pressed\&. -.IP "BtnUp" 10 -A mouse button was released\&. -.IP "Motion" 10 -The mouse pointer moved\&. -.IP "Enter" 10 -The pointer entered the widget\&'s window\&. -.IP "Leave" 10 -The pointer left the widget\&'s window\&. -.IP "FocusIn" 10 -The widget has received focus\&. -.IP "FocusOut" 10 -The widget has lost focus\&. -.PP -There are some event abbreviations available\&. For example, -\fB\fP is actually a "Motion" event, modified with the -"Button1" modifier (\fBButton1\fP)\&. Similarly, \fB\fP -is actually a "BtnUp" event with the "Button3" modifier\&. These -abbreviations are used extensively in the Motif translation -tables\&. -.SH "RELATED" -.PP -\fBxmbind\fP(1) -...\" created by instant / docbook-to-man, Sun 22 Dec 1996, 20:16 diff --git a/doc/man/man3/XmColorSelector.3 b/doc/man/man3/XmColorSelector.3 index fb43803..22e0047 100644 --- a/doc/man/man3/XmColorSelector.3 +++ b/doc/man/man3/XmColorSelector.3 @@ -34,7 +34,7 @@ marginWidth%MarginWidth%HorizontalDimension%2 noCellError%NoCellError%XmString%"No Color Cell %%% Available" redSliderLabel%SliderLabel%XmString%"Red" -rgbFile%String%String%/usr/share/X11/rgb.txt +rgbFile%String%String%/usr/lib/X11/rgb.txt sliderTogLabel%TogLabel%XmString%"Color Sliders" .TE .PP diff --git a/doc/man/man3/XmColorSelector.3.rgbtxt b/doc/man/man3/XmColorSelector.3.rgbtxt deleted file mode 100644 index 22e0047..0000000 --- a/doc/man/man3/XmColorSelector.3.rgbtxt +++ /dev/null @@ -1,158 +0,0 @@ -.DT -.TH XmColorSelector 3X "" -.SH NAME -The Color Selector widget -.SH SYNOPSIS -#include -.SH DESCRIPTION -.PP -.TS -tab(%); -l l. -.TE -.PP -The Color Selector widget allows users to choose a color by using either a set of RGB -sliders or choosing from a list of all colors available in the rgb database. The name or -rgb value, as well as the color selected, are dynamically displayed to the user as they -pick and choose different colors. -.PP -.SH Normal Resources -.PP -.TS -tab (%); -l l l l. -Name%Class%Type%Initial Value -blueSliderLabel%SliderLabel%XmString%"Blue" -colorListTogLabel%TogLabel%XmString%"Color List" -colorMode%ColorMode%XiColorMode%XmScaleMode -colorName%String%String%White -fileReadError%FileReadError%XmString%"Could not read -%%% RGB.txt file" -greenSliderLabel%SliderLabel%XmString%"Green" -marginHeight%MarginHeight%VerticalDimension%2 -marginWidth%MarginWidth%HorizontalDimension%2 -noCellError%NoCellError%XmString%"No Color Cell -%%% Available" -redSliderLabel%SliderLabel%XmString%"Red" -rgbFile%String%String%/usr/lib/X11/rgb.txt -sliderTogLabel%TogLabel%XmString%"Color Sliders" -.TE -.PP -All resource names begin with XmN and all resource class names begin with XmC. -.SH blueSliderLabel -.PP -The string appearing for the label of the blue slider -.PP -.SH colorListTogLabel -.PP -The string appearing for the label of the color list toggle -.PP -.SH colorMode -.PP -The color list can be used in either slider or list mode. Acceptable values are -XmListMode and XmScaleMode. This resource allows the application to determine -the mode that the color selector should use when it is created. After this point, the -user may freely change modes by utilizing a pair of radio buttons in the color -selector. A type converter is registered to convert the strings "ScaleMode" and -"ListMode" to color modes for use with the resource database. -.PP -.SH colorName -.PP -This resource controls the color name that is currently displayed to the user. This -value can be modified to change the color displayed in the color selector or -queried to find the color the user has selected. The string returned here is either a -color name or a pound sign (#) followed by a set of rgb values as specified in the -Xlib specification. -.PP -.SH fileReadError -.PP -The message which is displayed when the Color Selector cannot read the rgb.txt file. The message is displayed at the top of the window in which the color list would normally appear. -.PP -.SH greenSliderLabel -.PP -The string appearing for the label of the green slider -.PP -.SH marginHeight -.PP -.SH marginWidth -.PP -This is the amount of space left between each of the children in the color selector -and between the outside children and the edge of the color selector widget. -.PP -.SH noCellError -.PP -This resource controls the message which is displayed in the sample color field when the Color Selector cannot allocate a read/write color cell -.PP -.SH redSliderLabel -.PP -The string appearing for the label of the red slider -.PP -.SH rgbFile -This is the name of the file to be loaded, which contains the valid color names. -Each of these names is sorted and the duplicates removed before being shown to -the user. -.PP -.SH sliderTogLabel -.PP -The string appearing for the label of the color slider toggle -.PP -.SH Convenience Routine -.PP -.SH -.HP 5 -.SH XmCreateColorSelector - Widget creation convenience routine -.nf - -Widget XmCreateColorSelector( - Widget parent, /* Widget id of parent for ColorSelector */ - String name, /* Name of the created widget */ - ArgList args, /* argument list */ - Cardinal num_args /* number of items in argument list */ - ) - -.nf -.PP -.SH Children -.PP -The color selector is composed of many sub-widgets. As with all widgets, most values -are passed to this widget through the argument list at creation time or via set values -and are passed to each of this widget's children, although get values requests must be -made on a child-by-child basis. The children of -the color selector are listed below. The documentation for each of the children should -be consulted for a list of resources for each child. -.ta 5,10,15,20,25,30,35 -.df - - -XmColorSelector - - XmScrolledWindow scrolled - - XmScrollBar ListvScrollBar - - XmScrollBar ListhScrollBar - - XmList list - - XmButtonBox buttonBox - - XmScale scale - - XmLabelGadget scale_title - - XmScrollBar scale_scrollbar - - XmRowColumn radioBox - - XmToggleButton colorListToggle - - XmToggleButton colorSlidersToggle - - XmFrame colorFrame - - XmLabel colorWindow -.fi -.PP -.SH COPYRIGHT -.PP -Copyright (c) 1992 by Integrated Computer Solutions, Inc. diff --git a/doc/man/man4/mwmrc.4 b/doc/man/man4/mwmrc.4 index 5d16fca..e8de9f9 100644 --- a/doc/man/man4/mwmrc.4 +++ b/doc/man/man4/mwmrc.4 @@ -57,7 +57,7 @@ file that controls much of the behavior of the Motif window manager \fBmwm\fP\&. It contains descriptions of resources that cannot easily be written using standard X Window System, Version 11 resource syntax\&. The resource description file contains entries that are referred to by X resources in -defaults files (for example, \fB/usr/share/X11/app-defaults/Mwm\fP) +defaults files (for example, \fB/usr/X11R6/lib/X11/app-defaults/Mwm\fP) or in the \fBRESOURCE_MANAGER\fP property on the root window\&. For example, the resource description file enables you to specify different types of window menus; however, an X resource is used to specify @@ -72,8 +72,8 @@ on a per-user basis: .nf \f(CW$HOME/$LANG/\&.mwmrc $HOME/\&.mwmrc -/etc/X11/mwm/$LANG/system\&.mwmrc -/etc/X11/mwm/system\&.mwmrc\fR +/usr/X11R6/lib/X11/$LANG/system\&.mwmrc +/usr/X11R6/lib/X11/system\&.mwmrc\fR .fi .PP .PP @@ -84,7 +84,7 @@ resource\&. The following shows how a different resource description file can be specified from the command line: .PP .nf -\f(CW/usr/bin/mwm -xrm "mwm*configFile: mymwmrc"\fR +\f(CW/usr/X11R6/bin/X11/mwm -xrm "mwm*configFile: mymwmrc"\fR .fi .PP .SS "Resource Types" @@ -626,8 +626,8 @@ is not what you expect\&. .nf \fB$HOME/$LANG/\&.mwmrc $HOME/\&.mwmrc -/etc/X11/mwm/$LANG/system\&.mwmrc -/etc/X11/mwm/system\&.mwmrc\fP +/usr/X11R6/lib/X11/$LANG/system\&.mwmrc +/usr/X11R6/lib/X11/system\&.mwmrc\fP .fi .SH "RELATED INFORMATION" .PP diff --git a/doc/man/man4/mwmrc.4.mwmrc_dir b/doc/man/man4/mwmrc.4.mwmrc_dir deleted file mode 100644 index e8de9f9..0000000 --- a/doc/man/man4/mwmrc.4.mwmrc_dir +++ /dev/null @@ -1,636 +0,0 @@ -'\" t -...\" mwmrc.sgm /main/8 1996/09/08 21:43:59 rws $ -.de P! -.fl -\!!1 setgray -.fl -\\&.\" -.fl -\!!0 setgray -.fl \" force out current output buffer -\!!save /psv exch def currentpoint translate 0 0 moveto -\!!/showpage{}def -.fl \" prolog -.sy sed -e 's/^/!/' \\$1\" bring in postscript file -\!!psv restore -. -.de pF -.ie \\*(f1 .ds f1 \\n(.f -.el .ie \\*(f2 .ds f2 \\n(.f -.el .ie \\*(f3 .ds f3 \\n(.f -.el .ie \\*(f4 .ds f4 \\n(.f -.el .tm ? font overflow -.ft \\$1 -.. -.de fP -.ie !\\*(f4 \{\ -. ft \\*(f4 -. ds f4\" -' br \} -.el .ie !\\*(f3 \{\ -. ft \\*(f3 -. ds f3\" -' br \} -.el .ie !\\*(f2 \{\ -. ft \\*(f2 -. ds f2\" -' br \} -.el .ie !\\*(f1 \{\ -. ft \\*(f1 -. ds f1\" -' br \} -.el .tm ? font underflow -.. -.ds f1\" -.ds f2\" -.ds f3\" -.ds f4\" -.ta 8n 16n 24n 32n 40n 48n 56n 64n 72n -.TH "mwmrc" "special file" -.SH "NAME" -\fBmwmrc\fP \(em the -Motif Window Manager Resource Description File -.SH "DESCRIPTION" -.PP -The \fBmwmrc\fP file is a supplementary resource -file that controls much of the behavior of the Motif window manager \fBmwm\fP\&. -It contains descriptions of resources that cannot easily be -written using standard X Window System, Version 11 resource syntax\&. The resource -description file contains entries that are referred to by X resources in -defaults files (for example, \fB/usr/X11R6/lib/X11/app-defaults/Mwm\fP) -or in the \fBRESOURCE_MANAGER\fP property on the -root window\&. For example, the resource description file enables you to specify -different types of window menus; however, an X resource is used to specify -which of these window menus \fBmwm\fP should use for a particular -window\&. -.SS "Location" -.PP -The window manager searches for one of the following resource description -files, where \fI$LANG\fP is the value of the language environment -on a per-user basis: -.PP -.nf -\f(CW$HOME/$LANG/\&.mwmrc -$HOME/\&.mwmrc -/usr/X11R6/lib/X11/$LANG/system\&.mwmrc -/usr/X11R6/lib/X11/system\&.mwmrc\fR -.fi -.PP -.PP -The first file found is the first used\&. If no file is found, a -set of built-in specifications is used\&. A particular resource description -file can be selected using the \fIconfigFile\fP -resource\&. The following shows how a different resource description file can -be specified from the command line: -.PP -.nf -\f(CW/usr/X11R6/bin/X11/mwm -xrm "mwm*configFile: mymwmrc"\fR -.fi -.PP -.SS "Resource Types" -.PP -The following types of resources can be described in the mwm resource -description file: -.IP "\fBButtons\fP" 10 -Window manager functions can be bound (associated) with button events\&. -.IP "\fBKeys\fP" 10 -Window manager functions can be bound (associated) with key press -events\&. -.IP "\fBMenus\fP" 10 -Menu panes can be used for the window menu and other menus posted with -key bindings and button bindings\&. -.SH "MWM RESOURCE DESCRIPTION FILE SYNTAX" -.PP -The \fBmwm\fP resource description file is a standard -text file that contains items of information separated by blanks, tabs, and -new lines characters\&. Blank lines are ignored\&. Items or characters can be -quoted to avoid special interpretation (for example, the comment character -can be quoted to prevent it from being interpreted as the comment character)\&. -A quoted item can be contained in double quotes (\fB" "\fP)\&. -Single characters can be quoted by preceding them by the back-slash character -(\fB\\\fP)\&. If a line ends with a back-slash, the next line is considered -a continuation of that line\&. All text from an unquoted \fB#\fP -to the end of the line is regarded as a comment and is not interpreted as -part of a resource description\&. If \fB!\fP is the first character -in a line, the line is regarded as a comment\&. -.SS "Window Manager Functions" -.PP -Window manager functions can be accessed with button and key bindings, -and with window manager menus\&. Functions are indicated as part of the specifications -for button and key binding sets, and menu panes\&. The function specification -has the following syntax: -.PP -.nf -\f(CW\fBfunction\fP = \fBfunction_name\fP [\fBfunction_args\fP] -\fBfunction_name\fP = \fBwindow manager function\fP -\fBfunction_args\fP = {\fBquoted_item\fP | \fBunquoted_item\fP}\fR -.fi -.PP -.PP -The following functions are supported\&. If a function is specified that -isn\&'t one of the supported functions then it is interpreted by \fBmwm\fP as \fBf\&.nop\fP\&. -.IP "\fBf\&.beep\fP" 10 -This function causes a beep\&. -.IP "\fBf\&.circle_down\fP [ \fIicon\fP | \fIwindow\fP]" 10 -This function causes the window or icon that is on the top of the window -stack to be put on the bottom of the window stack (so that it is no longer -obscuring any other window or icon)\&. This function affects only those windows -and icons that are obscuring other windows and icons, or that are obscured -by other windows and icons\&. Secondary windows (that is, transient windows) -are restacked with their associated primary window\&. Secondary windows always -stay on top of the associated primary window and there can be no other primary -windows between the secondary windows and their primary window\&. If an -\fIicon\fP function argument is specified, then the function -applies only to icons\&. If a \fIwindow\fP function -argument is specified then the function applies only to windows\&. -.IP "\fBf\&.circle_up\fP [ \fIicon\fP | \fIwindow\fP]" 10 -This function raises the window or icon on the bottom of the window -stack (so that it is not obscured by any other windows)\&. This function affects -only those windows and icons that are obscuring other windows and icons, or -that are obscured by other windows and icons\&. Secondary windows (that is, -transient windows) are restacked with their associated primary window\&. If -an \fIicon\fP function argument is specified then -the function applies only to icons\&. If an \fIwindow\fP -function argument is specified then the function applies only to windows\&. -.IP "\fBf\&.exec\fP \fBcommand\fP (or \fI!\fP \fBcommand\fP)" 10 -This function causes \fIcommand\fP to be -executed (using the value of the \fI$MWMSHELL\fP or \fI$SHELL\fP environment variable if set; otherwise, \fB/bin/sh\fP )\&. The \fI!\fP notation can be used in place of the \fBf\&.exec\fP function name\&. -.IP "\fBf\&.focus_color\fP" 10 -This function sets the colormap focus to a client window\&. If this function -is done in a root context, then the default colormap (setup by the X Window -System for the screen where \fBmwm\fP is running) is installed -and there is no specific client window colormap focus\&. This function is treated -as \fBf\&.nop\fP if \fIcolormapFocusPolicy\fP -is not explicit\&. -.IP "\fBf\&.focus_key\fP" 10 -This function sets the keyboard input focus to a client window or icon\&. -This function is treated as \fBf\&.nop\fP if \fIkeyboardFocusPolicy\fP is not explicit or the function is executed in a root context\&. -.IP "\fBf\&.kill\fP" 10 -This function is used to close application windows\&. The actual processing -that occurs depends on the protocols that the application observes\&. The application -lists the protocols it observes in the \fBWM_PROTOCOLS\fP property -on its top level window\&. If the application observes the \fBWM_DELETE_WINDOW\fP protocol, it is sent a message that requests the window be deleted\&. -If the application observes both \fBWM_DELETE_WINDOW\fP and \fBWM_SAVE_YOURSELF\fP, it is sent one message requesting the window -be deleted and another message advising it to save its state\&. If the application -observes only the \fBWM_SAVE_YOURSELF\fPprotocol \fI,\fP it is sent a message advising it to save its state\&. After a -delay (specified by the resource \fIquitTimeout\fP), the application\&'s -connection to the X server is terminated\&. If the application observes neither -of these protocols, its connection to the X server is terminated\&. -.IP "\fBf\&.lower\fP\ [\fI-\fP \fBclient\fP | \fIwithin\fP\ | \fIfreeFamily\fP]" 10 -This function lowers a primary window to the bottom of the global window -stack (where it obscures no other window) and lowers the secondary window -(transient window or dialog box) within the client family\&. The arguments to -this function are mutually exclusive\&. The \fIclient\fP -argument indicates the name or class of a client to lower\&. The name or class -of a client appears in the \fBWM_CLASS\fP property on the -client\&'s top-level window\&. If the \fIclient\fP -argument is not specified, the context that the function was invoked in indicates -the window or icon to lower\&. Specifying \fIwithin\fP -lowers the secondary window within the family (staying above the parent) but -does not lower the client family in the global window stack\&. Specifying \fIfreeFamily\fP lowers the window to the bottom of the global windows -stack from its local family stack\&. -.IP "\fBf\&.maximize\fP" 10 -This function causes a client window to be displayed with its maximum -size\&. Refer to the \fImaximumClientSize\fP, \fImaximumMaximumSize\fP, and \fIlimitResize\fP resources in \fBmwm\fP(1)\&. -.IP "\fBf\&.menu\fP \fImenu_name\fP" 10 -This function associates a cascading (pull-right) menu with a menu -pane entry or a menu with a button or key binding\&. The \fImenu_name\fP function argument identifies the menu to be used\&. -.IP "\fBf\&.minimize\fP" 10 -This function causes a client window to be minimized (iconified)\&. When -a window is minimized with no icon box in use, and if the \fIlowerOnIconify\fP resource has the value True (the default), the icon is placed -on the bottom of the window stack (such that it obscures no other window)\&. -If an icon box is used, then the client\&'s icon changes to its iconified form -inside the icon box\&. Secondary windows (that is, transient windows) are minimized -with their associated primary window\&. There is only one icon for a primary -window and all its secondary windows\&. -.IP "\fBf\&.move\fP" 10 -This function initiates an interactive move of a client window\&. -.IP "\fBf\&.next_cmap\fP" 10 -This function installs the next colormap in the list of colormaps for -the window with the colormap focus\&. -.IP "\fBf\&.next_key\fP [ \fIicon\fP | \fIwindow\fP | \fItransient\fP]" 10 -This function sets the keyboard input focus to the next window/icon -in the set of windows/icons managed by the window manager (the ordering -of this set is based on the stacking of windows on the screen)\&. This function -is treated as \fBf\&.nop\fP if \fBkeyboardFocusPolicy\fP -is not explicit\&. The keyboard input focus is only moved to windows that do -not have an associated secondary window that is application modal\&. If the -\fItransient\fP argument is specified, then transient (secondary) -windows are traversed (otherwise, if only \fIwindow\fP -is specified, traversal is done only to the last focused window in a transient -group)\&. If an \fIicon\fP function argument is specified, -then the function applies only to icons\&. If a \fIwindow\fP function argument is specified, then the function applies only to -windows\&. -.IP "\fBf\&.nop\fP" 10 -This function does nothing\&. -.IP "\fBf\&.normalize\fP" 10 -This function causes a client window to be displayed with its normal -size\&. Secondary windows (that is, transient windows) are placed in their normal -state along with their associated primary window\&. -.IP "\fBf\&.normalize_and_raise\fP" 10 -This function causes a client window to be displayed with its normal -size and raised to the top of the window stack\&. Secondary windows (that is, -transient windows) are placed in their normal state along with their associated -primary window\&. -.IP "\fBf\&.pack_icons\fP" 10 -This function is used to relayout icons (based on the layout policy -being used) on the root window or in the icon box\&. In general this causes -icons to be "packed" into the icon grid\&. -.IP "\fBf\&.pass_keys\fP" 10 -This function is used to enable/disable (toggle) processing of key bindings -for window manager functions\&. When it disables key binding processing all -keys are passed on to the window with the keyboard input focus and no window -manager functions are invoked\&. If the \fBf\&.pass_keys\fP function -is invoked with a key binding to disable key binding processing the same key -binding can be used to enable key binding processing\&. -.IP "\fBf\&.post_wmenu\fP" 10 -This function is used to post the window menu\&. If a key is used to post -the window menu and a window menu button is present, the window menu is automatically -placed with its top-left corner at the bottom-left corner of the window menu -button for the client window\&. If no window menu button is present, the window -menu is placed at the top-left corner of the client window\&. -.IP "\fBf\&.prev_cmap\fP" 10 -This function installs the previous colormap in the list of colormaps -for the window with the colormap focus\&. -.IP "\fBf\&.prev_key\fP [ \fIicon\fP | \fIwindow\fP | \fItransient\fP]" 10 -This function sets the keyboard input focus to the previous window/icon -in the set of windows/icons managed by the window manager (the ordering -of this set is based on the stacking of windows on the screen)\&. This function -is treated as \fBf\&.nop\fP if \fIkeyboardFocusPolicy\fP is not explicit\&. The keyboard input focus is only moved to windows -that do not have an associated secondary window that is application modal\&. -If the \fItransient\fP argument is specified, then -transient (secondary) windows are traversed (otherwise, if only \fIwindow\fP is specified, traversal is done only to the last focused window -in a transient group)\&. If an \fIicon\fP function -argument is specified then the function applies only to icons\&. If an -\fIwindow\fP function argument is specified then the function -applies only to windows\&. -.IP "\fBf\&.quit_mwm\fP" 10 -This function terminates mwm (but NOT the X window system)\&. -.IP "\fBf\&.raise\fP\ [\fI-\fP\fIclient\fP | \fIwithin\fP | \fIfreeFamily\fP]" 10 -This function raises a primary window to the top of the global window -stack (where it is obscured by no other window) and raises the secondary window -(transient window or dialog box) within the client family\&. The arguments to -this function are mutually exclusive\&. The \fIclient\fP -argument indicates the name or class of a client to lower\&. If the \fIclient\fP -is not specified, the context that the function -was invoked in indicates the window or icon to lower\&. Specifying \fIwithin\fP raises the secondary window within the family but does not -raise the client family in the global window stack\&. Specifying \fIfreeFamily\fP raises the window to the top of its local family stack -and raises the family to the top of the global window stack\&. -.IP "\fBf\&.raise_lower\fP\ [ \fIwithin\fP | \fIfreeFamily\fP]" 10 -This function raises a primary window to the top of the global window -stack if it is partially obscured by another window; otherwise, it lowers -the window to the bottom of the window stack\&. The arguments to this function -are mutually exclusive\&. Specifying \fIwithin\fP -raises a secondary window within the family (staying above the parent window), -if it is partially obscured by another window in the application\&'s family; -otherwise, it lowers the window to the bottom of the family stack\&. It has -no effect on the global window stacking order\&. Specifying \fIfreeFamily\fP raises the window to the top of its local family stack, if obscured -by another window, and raises the family to the top of the global window -stack; otherwise, it lowers the window to the bottom of its local family stack -and lowers the family to the bottom of the global window stack\&. -.IP "\fBf\&.refresh\fP" 10 -This function causes all windows to be redrawn\&. -.IP "\fBf\&.refresh_win\fP" 10 -This function causes a client window to be redrawn\&. -.IP "\fBf\&.resize\fP" 10 -This function initiates an interactive resize of a client window\&. -.IP "\fBf\&.restore\fP" 10 -This function restores the previous state of an icon\&'s associated window\&. -If a maximized window is iconified, then \fBf\&.restore\fP restores -it to its maximized state\&. If a normal window is iconified, then \fBf\&.restore\fP restores it to its normalized state\&. -.IP "\fBf\&.restore_and_raise\fP" 10 -This function restores the previous state of an icon\&'s associated window -and raises the window to the top of the window stack\&. If a maximized window -is iconified, then \fBf\&.restore_and_raise\fP restores it to -its maximized state and raises it to the top of the window stack\&. If a normal -window is iconified, then \fBf\&.restore_and_raise\fP restores -it to its normalized state and raises it to the top of the window stack\&. -.IP "\fBf\&.restart\fP" 10 -This function causes mwm to be restarted (effectively terminated and -re-executed)\&. Restart is necessary for \fBmwm\fP to incorporate -changes in both the \fBmwmrc\fP file and X resources\&. -.IP "\fBf\&.screen\fP\ [ \fInext\fP | \fIprev\fP | \fIback\fP | \fIscreen_number\fP]" 10 -This function causes the pointer to be warp to a specific screen number -or to the \fInext\fP, \fIprevious\fP, or last visited (\fIback\fP) -screen\&. The arguments to this function are mutually exclusive\&. The -\fIscreen_number\fP argument indicates the screen number -that the pointer is to be warped\&. Screens are numbered starting from screen -0\&. Specifying \fInext\fP cause the pointer to warp -to the next managed screen (skipping over any unmanaged screens)\&. Specifying -\fIprev\fP cause the pointer to warp to the previous managed -screen (skipping over any unmanaged screens)\&. Specifying \fIback\fP cause the pointer to warp to the last visited screen\&. -.IP "\fBf\&.send_msg\fP \fImessage_number\fP" 10 -This function sends an \fBXClientMessageEvent\fR of type \fB_MOTIF_WM_MESSAGES\fP with -\fImessage_type\fP set to \fImessage_number\fP\&. -The client message is sent only if \fImessage_number\fP -is included in the client\&'s \fB_MOTIF_WM_MESSAGES\fP -property\&. A menu item label is grayed out if the menu item is used to do \fBf\&.send_msg\fP of a message that is not included in the client\&'s \fB_MOTIF_WM_MESSAGES\fP property\&. -.IP "\fBf\&.separator\fP" 10 -This function causes a menu separator to be put in the menu pane at -the specified location (the label is ignored)\&. -.IP "\fBf\&.set_behavior\fP" 10 -This function causes the window manager to restart with the default -behavior (if a custom behavior is configured) or a custom behavior (if a -default behavior is configured)\&. By default this is bound to \fIShift\ Ctrl\ Alt\ !\fP\&. -.IP "\fBf\&.title\fP" 10 -This function inserts a title in the menu pane at the specified location\&. -.IP "\fBf\&.version\fP" 10 -This function causes the window manager to display its release version -in a dialog box\&. -.SS "Function Constraints" -.PP -Each function may be constrained as to which resource types can specify -the function (for example, menu pane) and also what context the function -can be used in (for example, the function is done to the selected client window)\&. -Function contexts are: -.IP "\fIroot\fP" 10 -No client window or icon has been selected as an object for the function\&. -.IP "\fIwindow\fP" 10 -A client window has been selected as an object for the function\&. This -includes the window\&'s title bar and frame\&. Some functions are applied only -when the window is in its normalized state (for example, \fBf\&.maximize\fP) or its maximized state (for example, \fBf\&.normalize\fP)\&. -.IP "\fIicon\fP" 10 -An icon has been selected as an object for the function\&. -.PP -If a function is specified in a type of resource where it is not supported -or is invoked in a context that does not apply then the function is treated -as \fBf\&.nop\fP\&. The following table indicates the resource -types and function contexts in which window manager functions apply\&. -.PP -.TS -tab(); -lw(2.289841i) lw(1.851594i) lw(1.358566i). -FunctionContextsResources -_ -\fBf\&.beep\fProot,icon,windowbutton,key,menu -\fBf\&.circle_down\fProot,icon,windowbutton,key,menu -\fBf\&.circle_up\fProot,icon,windowbutton,key,menu -\fBf\&.exec\fProot,icon,windowbutton,key,menu -\fBf\&.focus_color\fProot,icon,windowbutton,key,menu -\fBf\&.focus_key\fProot,icon,windowbutton,key,menu -\fBf\&.kill\fPicon,windowbutton,key,menu -\fBf\&.lower\fProot,icon,windowbutton,key,menu -\fBf\&.maximize\fPicon,window(normal)button,key,menu -\fBf\&.menu\fProot,icon,windowbutton,key,menu -\fBf\&.minimize\fPwindowbutton,key,menu -\fBf\&.move\fPicon,windowbutton,key,menu -\fBf\&.next_cmap\fProot,icon,windowbutton,key,menu -\fBf\&.next_key\fProot,icon,windowbutton,key,menu -\fBf\&.nop\fProot,icon,windowbutton,key,menu -\fBf\&.normalize\fPicon,window(maximized)button,key,menu -\fBf\&.normalize_and_raise\fPicon,windowbutton,key,menu -\fBf\&.pack_icons\fProot,icon,windowbutton,key,menu -\fBf\&.pass_keys\fProot,icon,windowbutton,key,menu -\fBf\&.post_wmenu\fProot,icon,windowbutton,key -\fBf\&.prev_cmap\fProot,icon,windowbutton,key,menu -\fBf\&.prev_key\fProot,icon,windowbutton,key,menu -\fBf\&.quit_mwm\fProotbutton,key,menu (root only) -\fBf\&.raise\fProot,icon,windowbutton,key,menu -\fBf\&.raise_lower\fPicon,windowbutton,key,menu -\fBf\&.refresh\fProot,icon,windowbutton,key,menu -\fBf\&.refresh_win\fPwindowbutton,key,menu -\fBf\&.resize\fPwindowbutton,key,menu -\fBf\&.restart\fProotbutton,key,menu (root only) -\fBf\&.restore\fPicon,windowbutton,key,menu -\fBf\&.restore_and_raise\fPicon,windowbutton,key,menu -\fBf\&.screen\fProot,icon,windowbutton,key,menu -\fBf\&.send_msg\fPicon,windowbutton,key,menu -\fBf\&.separator\fProot,icon,windowmenu -\fBf\&.set_behavior\fProot,icon,windowbutton,key,menu -\fBf\&.title\fProot,icon,windowmenu -\fBf\&.version\fProot,icon,windowbutton,key,menu -.TE -.SH "WINDOW MANAGER EVENT SPECIFICATION" -.PP -Events are indicated as part of the specifications for button and key -binding sets, and menu panes\&. Button events have the following syntax: -.PP -.nf -\f(CW\fBbutton\fP =~[\fBmodifier_list\fP ]\fI<\fP\fBbutton_event_name\fP \fI>\fP -\fBmodifier_list\fP =~\fBmodifier_name\fP { \fBmodifier_name\fP}\fR -.fi -.PP -.PP -The following table indicates the values that can be used for \fBmodifier_name\fP\&. Note that [Alt] and [Meta] can be used interchangably -on some hardware\&. -.PP -.TS -tab(); -lw(1.097588i) lw(4.402412i). -ModifierDescription -_ -CtrlControl Key -ShiftShift Key -AltAlt Key -MetaMeta Key -Mod1Modifier1 -Mod2Modifier2 -Mod3Modifier3 -Mod4Modifier4 -Mod5Modifier5 -.TE -.PP -Locking modifiers are ignored when processing button and key bindings\&. -The following table lists keys that are interpreted as locking modifiers\&. -The X server may map some of these symbols to the Mod1 - Mod5 modifier keys\&. -These keys may or may not be available on your hardware: Key Symbol Caps Lock -Shift Lock Kana Lock Num Lock Scroll Lock The following table indicates the -values that can be used for \fBbutton_event_name\fP\&. -.PP -.TS -tab(); -lw(1.290570i) lw(4.209430i). -ButtonDescription -_ -Btn1DownButton 1 Press -Btn1UpButton 1 Release -Btn1ClickButton 1 Press and Release -Btn1Click2Button 1 Double Click -Btn2DownButton 2 Press -Btn2UpButton 2 Release -Btn2ClickButton 2 Press and Release -Btn2Click2Button 2 Double Click -Btn3DownButton 3 Press -Btn3UpButton 3 Release -Btn3ClickButton 3 Press and Release -Btn3Click2Button 3 Double Click -Btn4DownButton 4 Press -Btn4UpButton 4 Release -Btn4ClickButton 4 Press and Release -Btn4Click2Button 4 Double Click -Btn5DownButton 5 Press -Btn5UpButton 5 Release -Btn5ClickButton 5 Press and Release -Btn5Click2Button 5 Double Click -.TE -.PP -Key events that are used by the window manager for menu mnemonics -and for binding to window manager functions are single key presses; key -releases are ignored\&. Key events have the following syntax: -.PP -.nf -\f(CW\fBkey\fP =~[\fBmodifier_list\fP] \fB\fP\fBkey_name\fP -\fBmodifier_list\fP =~\fBmodifier_name\fP { \fBmodifier_name\fP}\fR -.fi -.PP -.PP -All modifiers specified are interpreted as being exclusive (this means -that only the specified modifiers can be present when the key event occurs)\&. -Modifiers for keys are the same as those that apply to buttons\&. The \fBkey_name\fP is an X11 keysym name\&. Keysym names can be found in the -\fBkeysymdef\&.h\fP file (remove the \fBXK_\fP -prefix)\&. -.SH "BUTTON BINDINGS" -.PP -The \fBbuttonBindings\fP resource value is the name of -a set of button bindings that are used to configure window manager behavior\&. -A window manager function can be done when a button press occurs with -the pointer over a framed client window, an icon or the root window\&. The -context for indicating where the button press applies is also the context -for invoking the window manager function when the button press is done -(significant for functions that are context sensitive)\&. The button binding -syntax is -.PP -.nf -\f(CW\fIButtons\fP \fBbindings_set_name\fP -\fI{\fP - \fBbutton\fP \fBcontext\fP \fBfunction\fP - \fBbutton\fP \fBcontext\fP \fBfunction\fP - \&.\&.\&. - \fBbutton\fP \fBcontext\fP \fBfunction\fP -\fI}\fP\fR -.fi -.PP -.PP -The syntax for the \fBcontext\fP specification is: \fBcontext\fP = \fBobject\fP[\fI|\fP \fBcontext\fP] \fBobject\fP = \fIroot\fP | \fIicon\fP | \fIwindow\fP | \fItitle\fP | \fIframe\fP | \fIborder\fP | \fIapp\fP The context specification indicates where the pointer must be -for the button binding to be effective\&. For example, a context of -\fIwindow\fP indicates that the pointer must be over a -client window or window management frame for the button binding to be effective\&. -The \fIframe\fP context is for the window management -frame around a client window (including the border and titlebar), the -\fIborder\fP context is for the border part of the window -management frame (not including the titlebar), the \fItitle\fP context is for the title area of the window management frame, -and the \fIapp\fP context is for the application -window (not including the window management frame)\&. If an \fBf\&.nop\fP function is specified for a button binding, the button binding -is not done\&. -.SH "KEY BINDINGS" -.PP -The \fBkeyBindings\fP resource value is the name of a set -of key bindings that are used to configure window manager behavior\&. A -window manager function can be done when a particular key is pressed\&. The -context in which the key binding applies is indicated in the key binding specification\&. -The valid contexts are the same as those that apply to button bindings\&. The -key binding syntax is: -.PP -.nf -\f(CW\fIKeys\fP \fBbindings_set_name\fP -\fI{\fP - \fBkey\fP \fBcontext\fP \fBfunction\fP - \fBkey\fP \fBcontext\fP \fBfunction\fP - \&.\&.\&. - \fBkey\fP \fBcontext\fP \fBfunction\fP -\fI}\fP\fR -.fi -.PP -.PP -If an \fBf\&.nop\fP function is specified for a key binding, -the key binding is not done\&. If an \fBf\&.post_wmenu\fP or \fBf\&.menu\fP function is bound to a key, \fBmwm\fP automatically -uses the same key for removing the menu from the screen after it has been -popped up\&. The \fBcontext\fP specification syntax is the same -as for button bindings with one addition\&. The context \fIifkey\fP -may be specified for binding keys that may not be available on all displays\&. -If the key is not available and if \fIifkey\fP is in the context, -then reporting of the error message to the error log is suppressed\&. This feature -is useful for networked, heterogeneous environments\&. For key bindings, the -\fIframe\fP, \fItitle\fP, -\fIborder\fP, and \fIapp\fP -contexts are equivalent to the \fIwindow\fP context\&. -The context for a key event is the window or icon that has the keyboard input -focus (\fIroot\fP if no window or icon has the -keyboard input focus)\&. -.SH "MENU PANES" -.PP -Menus can be popped up using the \fBf\&.post_wmenu\fP and \fBf\&.menu\fP window manager functions\&. The context for window manager -functions that are done from a menu is \fIroot\fP, -\fIicon\fP or \fIwindow\fP depending -on how the menu was popped up\&. In the case of the \fIwindow\fP menu or menus popped up with a key binding, the location of -the keyboard input focus indicates the context\&. For menus popped up using -a button binding, the context of the button binding is the context of the -menu\&. The menu pane specification syntax is: -.PP -.nf -\f(CW\fIMenu\fP \fBmenu_name\fP -\fI{\fP - \fBlabel\fP [\fBmnemonic\fP] [\fBaccelerator\fP ] \fBfunction\fP - \fBlabel\fP [\fBmnemonic\fP] [\fBaccelerator\fP ] \fBfunction\fP - \&.\&.\&. - \fBlabel\fP [\fBmnemonic\fP] [\fBaccelerator\fP ] \fBfunction\fP -\fI}\fP\fR -.fi -.PP -.PP -Each line in the \fIMenu\fP specification identifies -the label for a menu item and the function to be done if the menu item is -selected\&. Optionally a menu button mnemonic and a menu button keyboard accelerator -may be specified\&. Mnemonics are functional only when the menu is posted and -keyboard traversal applies\&. The \fBlabel\fP may be a string or -a bitmap file\&. The label specification has the following syntax: -.PP -.nf -\f(CW\fBlabel\fP = \fBtext\fP | \fBbitmap_file\fP -\fBbitmap_file\fP = \fI@\fP\fBfile_name\fP -\fBtext\fP = \fBquoted_item\fP | \fBunquoted_item\fP\fR -.fi -.PP -.PP -The string encoding for labels must be compatible with the menu font -that is used\&. Labels are greyed out for menu items that do the \fBf\&.nop\fP function or an invalid function or a function that doesn\&'t -apply in the current context\&. A \fBmnemonic\fP specification -has the following syntax: -.PP -.nf -\f(CW\fBmnemonic\fP = \fI_\fP \fBcharacter\fP\fR -.fi -.PP -.PP -The first matching \fBcharacter\fP in the label is underlined\&. -If there is no matching \fBcharacter\fP in the label, no mnemonic -is registered with the window manager for that label\&. Although the \fBcharacter\fP must exactly match a character in the label, the mnemonic -does not execute if any modifier (such as Shift) is pressed with the character -key\&. The \fBaccelerator\fP specification is a key event specification -with the same syntax as is used for key bindings to window manager functions\&. -.SH "INCLUDING FILES" -.PP -You may include other files into your mwmrc file by using the -\fIinclude\fP construct\&. For example, -.PP -.nf -\f(CWINCLUDE -{ - /usr/local/shared/mwm\&.menus - /home/kmt/personal/my\&.bindings -}\fR -.fi -.PP -.PP -causes the files named to be read in and interpreted in order as an -additional part of the mwmrc file\&. \fIInclude\fP is a top-level -construct\&. It cannot be nested inside another construct\&. -.SH "WARNINGS" -.PP -Errors that occur during the processing of the resource description -file are recorded in: \fB$HOME/\&.mwm/errorlog\fP\&. Be sure to -check this file if the appearance or behavior of \fBmwm\fP -is not what you expect\&. -.SH "FILES" -.PP -.nf -\fB$HOME/$LANG/\&.mwmrc -$HOME/\&.mwmrc -/usr/X11R6/lib/X11/$LANG/system\&.mwmrc -/usr/X11R6/lib/X11/system\&.mwmrc\fP -.fi -.SH "RELATED INFORMATION" -.PP -\fBmwm\fP(1), -\fBX\fP(1)\&. -...\" created by instant / docbook-to-man, Sun 22 Dec 1996, 20:36 diff --git a/lib/Mrm/Mrmhier.c b/lib/Mrm/Mrmhier.c index 2a8703c..2712742 100644 --- a/lib/Mrm/Mrmhier.c +++ b/lib/Mrm/Mrmhier.c @@ -264,10 +264,10 @@ Urm__OpenHierarchy (MrmCount num_files, case MrmSUCCESS: break; case MrmNOT_VALID: - sprintf (err_stg, "%s", _MrmMMsg_0113); + sprintf (err_stg, _MrmMMsg_0113); break; default: - sprintf (err_stg, "%s", _MrmMMsg_0114); + sprintf (err_stg, _MrmMMsg_0114); break; } } diff --git a/lib/Mrm/Mrmhier.c.format-security b/lib/Mrm/Mrmhier.c.format-security deleted file mode 100644 index 2712742..0000000 --- a/lib/Mrm/Mrmhier.c.format-security +++ /dev/null @@ -1,779 +0,0 @@ -/* - * Motif - * - * Copyright (c) 1987-2012, The Open Group. All rights reserved. - * - * These libraries and programs are free software; you can - * redistribute them and/or modify them under the terms of the GNU - * Lesser General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) - * any later version. - * - * These libraries and programs are distributed in the hope that - * they will be useful, but WITHOUT ANY WARRANTY; without even the - * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU Lesser General Public License for more - * details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with these librararies and programs; if not, write - * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth - * Floor, Boston, MA 02110-1301 USA - */ -/* - * HISTORY - */ -#ifdef HAVE_CONFIG_H -#include -#endif - - -#ifdef REV_INFO -#ifndef lint -static char rcsid[] = "$XConsortium: Mrmhier.c /main/17 1996/11/13 14:01:19 drk $" -#endif -#endif - -/* (c) Copyright 1989, 1990, DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS. */ - - -/* - *++ - * FACILITY: - * - * UIL Resource Manager (URM): - * - * ABSTRACT: - * - *-- - */ - -/* - * This file contains routines which assist in managing URM hierarchies - */ - - -/* - * - * INCLUDE FILES - * - */ - -#include -#include -#include - -#include /* for _XmOSInitPath() */ -#include /* for _XmGetDefaultDisplay() */ - -#include "MrmMsgI.h" - -#ifndef NO_MESSAGE_CATALOG -#if !defined(NL_CAT_LOCALE) -#define NL_CAT_LOCALE 0 -#endif -#endif - - -/* - * - * TABLE OF CONTENTS - * - * Urm__OpenHierarchy Open hierarchy (internal version) - * - * Urm__CloseHierarchy Close hierarchy (internal version) - * - * UrmHGetIndexedResource Get resource from hierarchy - * - */ - - -/* - * - * DEFINE and MACRO DEFINITIONS - * - */ - -static Cardinal I18NOpenFile (Display *display, - String name , - MrmOsOpenParamPtr os_ext , - IDBFile *file_id_return ); - - -/* - * - * OWN VARIABLE DECLARATIONS - * - */ -static char *uidPath; -static SubstitutionRec uidSubs[1]; - - - -/* - *++ - * - * PROCEDURE DESCRIPTION: - * - * This routine allocates a hierarchy descriptor, and opens - * all the IDB files in the hierarchy. It initializes the - * optimized search lists in the hierarchy from the open files. - * All files are closed if there are any errors. - * - * FORMAL PARAMETERS: - * - * num_files The number of files in the name list - * name_list A list of the file names - * os_ext_list A list of system-dependent ancillary - * structures corresponding to the files. - * This parameter may be NULL. - * hierarchy_id_return To return the hierarchy id - * - * IMPLICIT INPUTS: - * - * IMPLICIT OUTPUTS: - * - * FUNCTION VALUE: - * - * MrmSUCCESS operation succeeded - * MrmFAILURE allocation or other failure - * MrmDISPLAY_NOT_OPENED Display hasn't been opened yet - * Others see UrmIdbOpenFileRead - * - * SIDE EFFECTS: - * - *-- - */ - -Cardinal -Urm__OpenHierarchy (MrmCount num_files, - String *name_list, - MrmOsOpenParamPtr *os_ext_list, - MrmHierarchy *hierarchy_id_return, - MrmFlag in_memory, - unsigned char *uid_buffer) -{ - - /* - * Local variables - */ - Cardinal result ; /* function result */ - MrmHierarchy hiptr ; /* hierarchy descriptor */ - MrmCount list_size ; /* # bytes for file lists */ - int ndx ; /* loop index */ - IDBFile *idvec ; /* current file id vector */ - int file_ndx ; /* file loop index */ - IDBFile cur_file ; /* current IDB file */ - URMResourceContextPtr class_ctx; /* for class compression table */ - URMResourceContextPtr resource_ctx; /* for resource compression table */ - Display *display; /* display for XtResolvePathNames */ - char err_stg[300]; - -#ifndef NO_MESSAGE_CATALOG - static Boolean first = True; - - /* - * We open the message catalog from MrmOpenHierarchy... routines. - * We cannot open it from MrmInitialize, since this call can be done - * before Xt has been initialized, so at that time the locale could - * be wrong. - */ - - /* We only want to open the message catalog once. */ - - if (first) - { - Mrm_catd = catopen("Mrm", NL_CAT_LOCALE); - first = False; - } -#endif - - if ( os_ext_list == NULL ) - { - display = NULL; - } - else - { - MrmOsOpenParamPtr os_data; - os_data = *os_ext_list; - if (os_data->display == NULL) - { - display = NULL; - } - else - { - display = os_data->display; - } - } - - if (display == NULL) - { - display = _XmGetDefaultDisplay(); - } - - if (display == NULL) - { - return Urm__UT_Error ("Urm__OpenHierarchy", _MrmMMsg_0030, - NULL, NULL, MrmDISPLAY_NOT_OPENED); - }; - - /* - * If the uidPath was previously set, XtFree it so we can try any - * new paths that may have been setup. - */ - if (uidPath != 0) - { - XtFree (uidPath); - uidPath = 0; - } - - /* - * Allocate a hierarchy, and allocate all file lists. - */ - hiptr = (MrmHierarchy) XtMalloc (sizeof(MrmHierarchyDesc)) ; - if ( hiptr == NULL ) return MrmFAILURE ; - - hiptr->validation = MrmHIERARCHY_VALID; - hiptr->num_file = 0 ; - - list_size = num_files * sizeof(IDBFile) ; - hiptr->file_list = (IDBFile *) XtMalloc (list_size) ; - if ( hiptr->file_list == NULL ) return MrmFAILURE ; - - for ( ndx=URMgMin ; ndx<=URMgMax ; ndx++ ) - { - hiptr->grp_num[ndx] = 0 ; - idvec = (IDBFile *) XtMalloc (list_size) ; - if ( idvec == NULL ) return MrmFAILURE ; - hiptr->grp_ids[ndx] = idvec ; - } - - hiptr->name_registry = NULL; - - /* - * Now open each file. Any failure causes an error return, with any - * open files closed and the descriptor and lists freed. - */ - for ( file_ndx=0 ; file_ndxfile_list[hiptr->num_file] = cur_file ; - hiptr->num_file++ ; - for ( ndx=URMgMin ; ndx<=URMgMax ; ndx++ ) - if ( cur_file->group_counts[ndx] > 0 ) - { - idvec = hiptr->grp_ids[ndx] ; - idvec[hiptr->grp_num[ndx]] = cur_file ; - hiptr->grp_num[ndx]++ ; - } - - /* - * Attempt to read in compression tables for this UID file. - * Retain and fixup the tables if they are found. - */ - cur_file->class_ctable = NULL; - cur_file->resource_ctable = NULL; - result = UrmGetResourceContext ((char *(*)())NULL, (void(*)())NULL, - 0, &class_ctx); - if ( result != MrmSUCCESS ) return result; - result = UrmGetResourceContext ((char *(*)())NULL, (void(*)())NULL, - 0, &resource_ctx); - if ( result != MrmSUCCESS ) return result; - result = UrmGetIndexedLiteral (cur_file, UilMrmClassTableIndex, - class_ctx); - if ( result != MrmSUCCESS ) continue; - result = UrmGetIndexedLiteral (cur_file, UilMrmResourceTableIndex, - resource_ctx); - if ( result != MrmSUCCESS ) continue; - - /* - * Retain the buffers from the contexts, but free the contexts - * themselves. Fixup the tables. - */ - cur_file->class_ctable = (UidCompressionTablePtr) - UrmRCBuffer (class_ctx); - UrmRCSetBuffer (class_ctx, NULL); - UrmFreeResourceContext (class_ctx); - Urm__FixupCompressionTable (cur_file->class_ctable, TRUE, - cur_file->byte_swapped); - cur_file->resource_ctable = (UidCompressionTablePtr) - UrmRCBuffer (resource_ctx); - UrmRCSetBuffer (resource_ctx, NULL); - UrmFreeResourceContext (resource_ctx); - Urm__FixupCompressionTable (cur_file->resource_ctable, FALSE, - cur_file->byte_swapped); - } - - /* - * successfully opened. Free the uidPath at this point - */ - XtFree (uidPath); - uidPath = 0; - *hierarchy_id_return = hiptr ; - return MrmSUCCESS ; - -} - - - -/* - *++ - * - * PROCEDURE DESCRIPTION: - * - * This is the internal routine which closes a URM search hierarchy - * - * FORMAL PARAMETERS: - * - * hierarchy_id ID of an open URM database hierarchy - * - * IMPLICIT INPUTS: - * - * IMPLICIT OUTPUTS: - * - * FUNCTION VALUE: - * - * MrmSUCCESS operation succeeded - * MrmBAD_HIERARCHY invalid URM hierarchy - * MrmFAILURE operation failed, no further reason - * - * SIDE EFFECTS: - * - *-- - */ - -Cardinal -Urm__CloseHierarchy (MrmHierarchy hierarchy_id) -{ - - /* - * Local variables - */ - int ndx ; /* loop index */ - URMHashTableEntryPtr cp, np; /* for fixing 7303 */ - - /* - * validity check the hierarchy, then close all files, deallocate all - * lists, and deallocate the descriptor - */ - if ( hierarchy_id == NULL ) - return Urm__UT_Error ("Urm__CloseHierarchy", _MrmMMsg_0023, - NULL, NULL, MrmBAD_HIERARCHY) ; - if ( ! MrmHierarchyValid(hierarchy_id) ) - return Urm__UT_Error ("Urm__CloseHierarchy", _MrmMMsg_0024, - NULL, NULL, MrmBAD_HIERARCHY) ; - - for ( ndx=0 ; ndxnum_file ; ndx++ ) - if (hierarchy_id->file_list[ndx]->in_memory == FALSE ) - UrmIdbCloseFile (hierarchy_id->file_list[ndx], FALSE) ; - - /* Begin fixing DTS 7303 */ - if(hierarchy_id->name_registry){ - for ( ndx=0 ; ndxname_registry[ndx]) != NULL) - while(cp){ - np = cp->az_next_entry; - XtFree((char*)cp); - cp = np; - }; - XtFree ((char*)hierarchy_id->name_registry); - } - /* End fixing DTS 7303 */ - - XtFree ((char*)hierarchy_id->file_list); - - for ( ndx=URMgMin ; ndx<=URMgMax ; ndx++ ) - XtFree ((char*)hierarchy_id->grp_ids[ndx]) ; - - hierarchy_id->validation = 0; - XtFree ((char*)hierarchy_id) ; - return MrmSUCCESS ; - -} - - - -/* - *++ - * - * PROCEDURE DESCRIPTION: - * - * UrmHGetIndexedResource attempts to retrieve a resource - * from an open URM hierarchy. It functions exactly like - * UrmIdbGetIndexedResource except that it queries each file - * in the hierarchy in turn. It uses the optimized search lists - * where possible. - * - * FORMAL PARAMETERS: - * - * hierarchy_id open URM hierarchy to search - * index case-sensitive index for the entry to match - * group_filter if not null, entry found must match this group - * type_filter if not null, entry found must match this type - * context_id URM resource context to receieve data block - * file_id_return to return file in which resource was found - * - * IMPLICIT INPUTS: - * - * IMPLICIT OUTPUTS: - * - * FUNCTION VALUE: - * - * MrmSUCCESS operation succeeded - * MrmBAD_HIERARCHY invalid URM hierarchy - * MrmNOT_FOUND entry not found - * MrmWRONG_GROUP entry didn't match group filter - * MrmWRONG_TYPE entry didn't match type filter - * MrmFAILURE operation failed, no further reason - * - * SIDE EFFECTS: - * - *-- - */ - -Cardinal -UrmHGetIndexedResource (MrmHierarchy hierarchy_id, - String index , - MrmGroup group_filter, - MrmType type_filter, - URMResourceContextPtr context_id, - IDBFile *file_id_return) -{ - - /* - * Local variables - */ - Cardinal result ; /* function results */ - IDBFile *file_ids ; /* list of files to search */ - int num_ids ; /* number of entries in file_ids */ - int ndx ; /* loop index */ - - - /* - * Validate hierarchy. Then loop through the files which define the resource, - * searching for the desired resource. - */ - if ( hierarchy_id == NULL ) - return Urm__UT_Error ("UrmHGetIndexedResource", _MrmMMsg_0023, - NULL, NULL, MrmBAD_HIERARCHY) ; - if ( ! MrmHierarchyValid(hierarchy_id) ) - return Urm__UT_Error ("UrmHGetIndexedResource", _MrmMMsg_0024, - NULL, context_id, MrmBAD_HIERARCHY) ; - - if ( group_filter>=URMgMin && group_filter<=URMgMax) - { - file_ids = hierarchy_id->grp_ids[group_filter] ; - num_ids = hierarchy_id->grp_num[group_filter] ; - } - else - { - file_ids = hierarchy_id->file_list ; - num_ids = hierarchy_id->num_file ; - } - for ( ndx=0 ; ndxname_registry; - if ( name_table == NULL ) - { - name_table = (URMHashTableEntryPtr *) - XtMalloc(sizeof(URMHashTableEntryPtr)*k_hash_table_size); - /* Begin fixing DTS 7303 */ - for ( ndx=0 ; ndxname_registry = name_table; - hash_initialize (name_table, &inited); - } - - /* - * Store each name-value pair in the hash table. - */ - for (ndx = 0 ; ndx < num_cb ; ndx++) - { - current_name = names [ndx]; - current_value = values [ndx]; - hash_entry = (URMHashTableEntryPtr) - hash_insert_name (name_table, current_name); - hash_entry->az_value = current_value; - } - - return MrmSUCCESS; - -} - - - -/* - *++ - * - * PROCEDURE DESCRIPTION: - * - * This routine returns the value registered for a name. It first - * attempts to look up the name in the hierarchy's name registry. - * If that fails, or their is no registry, then a global lookup is - * attempted. - * - * FORMAL PARAMETERS: - * - * hierarchy_id open URM hierarchy to search. - * name case-sensitive name to be matched - * value_return to return value. - * - * IMPLICIT INPUTS: - * - * IMPLICIT OUTPUTS: - * - * FUNCTION VALUE: - * - * MrmSUCCESS operation succeeded - * MrmNOT_FOUND no match found - * - * SIDE EFFECTS: - * - *-- - */ - -Cardinal -Urm__LookupNameInHierarchy (MrmHierarchy hierarchy_id, - String name, - XtPointer *value_return) - -{ - - URMHashTableEntryPtr *name_table; - URMHashTableEntryPtr hash_entry; - - - /* - * Look up in hierarchy first (if there is a registry) - */ - name_table = hierarchy_id->name_registry; - if ( name_table != NULL ) - { - hash_entry = (URMHashTableEntryPtr) hash_find_name (name_table, name); - if (hash_entry != NULL) - { - *value_return = hash_entry->az_value; - return MrmSUCCESS; - } - } - - /* - * Fall back on global table - */ - return Urm__WCI_LookupRegisteredName (name, value_return); - -} - - - -/* - *++ - * - * PROCEDURE DESCRIPTION: - * - * This routine opens a single UID file in a platform-dependent way, - * performing i18n language switching in order to do so. - * - * Per the latest agreement on semantics, this routine does: - * - first, try to open in the local directory (that is, with - * no switching). - * - second, try language switching and open - * - * FORMAL PARAMETERS: - * - * name A system-dependent string specifying the IDB file - * to be opened. - * os_ext An operating-system specific structure which - * supports using specific file system features - * file_id_return returns the IDB file id used in all other IDB routines - * - * IMPLICIT INPUTS: - * - * IMPLICIT OUTPUTS: - * - * FUNCTION VALUE: - * - * SIDE EFFECTS: - * - *-- - */ - -static Cardinal -I18NOpenFile (Display *display, - String name, - MrmOsOpenParamPtr os_ext, - IDBFile *file_id_return) -{ - - /* - * Local variables - */ - Cardinal result; /* function results */ - char dummy[300]; /* file name (unused) */ - char err_stg[300]; - - /* - * Use XtResolvePathName. If the last 4 characters of the file name - * are not .uid then pass in the suffix of .uid. If a file is not - * found with the suffix passed in then try without the suffix. - */ - char *resolvedname; /* current resolved name */ - Boolean user_path ; - - uidSubs[0].substitution = name; - - if (uidPath == 0) - { - uidPath = _XmOSInitPath(name, "UIDPATH", &user_path); - if (user_path) uidSubs[0].match = 'U'; - else uidSubs[0].match = MATCH_CHAR ; - } - - resolvedname = 0; - - /* - * Check and see if the .uid suffix is already on the file. If not then try to - * resolve the pathname with .uid suffix first. If that fails or the suffix is - * already on the file then just try to resolve the pathname. - */ - if ( strcmp (&name[strlen(name)-4],".uid") != 0 ) - resolvedname = XtResolvePathname (display, - "uid", - NULL, - ".uid", - uidPath, - uidSubs, - XtNumber(uidSubs), - (XtFilePredicate)NULL); - - /* - * No .uid suffix or a failure to resolve the pathname with the .uid suffix - */ - if (resolvedname == 0) - resolvedname = XtResolvePathname (display, - "uid", - NULL, - NULL, - uidPath, - uidSubs, - XtNumber(uidSubs), - (XtFilePredicate)NULL); - - if (resolvedname == 0) - { - sprintf (err_stg, _MrmMMsg_0031, name) ; - return Urm__UT_Error ("I18NOpenFile", err_stg, NULL, NULL, MrmNOT_FOUND); - } - - result = UrmIdbOpenFileRead (resolvedname, os_ext, file_id_return, dummy) ; - switch ( result ) - { - case MrmSUCCESS: - break; - case MrmNOT_VALID: - sprintf (err_stg, _MrmMMsg_0032, resolvedname) ; - break; - case MrmNOT_FOUND: - default: - sprintf (err_stg, _MrmMMsg_0031, resolvedname) ; - break; - } - - XtFree(resolvedname); /* allocated in XtResolvePathName() */ - - if (result == MrmSUCCESS) - return result; - else - return Urm__UT_Error ("I18NOpenFile", err_stg, NULL, NULL, result); -} - diff --git a/lib/Mrm/Mrmicon.c b/lib/Mrm/Mrmicon.c index 191e2d2..95d4086 100644 --- a/lib/Mrm/Mrmicon.c +++ b/lib/Mrm/Mrmicon.c @@ -1176,7 +1176,7 @@ Urm__RealizeColorTable (Screen *screen, } break; default: - sprintf(err_msg, "%s", _MrmMMsg_0040); + sprintf(err_msg, _MrmMMsg_0040); return Urm__UT_Error ("Urm__RelizeColorTable", err_msg, NULL, NULL, MrmFAILURE) ; } @@ -1252,7 +1252,7 @@ Urm__RealizeColorTable (Screen *screen, break; default: result = MrmFAILURE; - sprintf (err_msg, "%s", _MrmMMsg_0040); + sprintf (err_msg, _MrmMMsg_0040); Urm__UT_Error ("Urm__RelizeColorTable", err_msg, NULL, NULL, MrmFAILURE) ; } diff --git a/lib/Mrm/Mrmicon.c.format-security b/lib/Mrm/Mrmicon.c.format-security deleted file mode 100644 index 95d4086..0000000 --- a/lib/Mrm/Mrmicon.c.format-security +++ /dev/null @@ -1,1573 +0,0 @@ -/* - * Motif - * - * Copyright (c) 1987-2012, The Open Group. All rights reserved. - * - * These libraries and programs are free software; you can - * redistribute them and/or modify them under the terms of the GNU - * Lesser General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) - * any later version. - * - * These libraries and programs are distributed in the hope that - * they will be useful, but WITHOUT ANY WARRANTY; without even the - * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU Lesser General Public License for more - * details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with these librararies and programs; if not, write - * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth - * Floor, Boston, MA 02110-1301 USA - */ -/* - * HISTORY - */ -#ifdef HAVE_CONFIG_H -#include -#endif - - -#ifdef REV_INFO -#ifndef lint -static char rcsid[] = "$XConsortium: Mrmicon.c /main/14 1996/11/13 14:01:43 drk $" -#endif -#endif - -/* (c) Copyright 1989, 1990, DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS. */ - - -/* - *++ - * FACILITY: - * - * UIL Resource Manager (URM) - * - * ABSTRACT: - * - * This module contains routines which operate on URM icon images - - * RGMIconImage structs. - * - *-- - */ - - -/* - * - * INCLUDE FILES - * - */ - -#include -#include -#include -#include "MrmMsgI.h" - - - - -/* - *++ - * - * PROCEDURE DESCRIPTION: - * - * This routine creates and returns an X pixmap from a URM icon - * for some widget. It uses the foreground and background obtainable - * from the widget as required. - * - * FORMAL PARAMETERS: - * - * icon URM icon image to be converted to X pixmap - * screen screen to use for pixmap - * display display to use for pixmap - * fgpix foreground color for pixmap - * bgpix background color for pixmap - * pixmap to return resulting X pixmap - * - * IMPLICIT INPUTS: - * - * IMPLICIT OUTPUTS: - * - * FUNCTION VALUE: - * - * URM status - * - * SIDE EFFECTS: - * - *-- - */ - -Cardinal -UrmCreatePixmap (RGMIconImagePtr icon, - Screen *screen, - Display *display, - Pixel fgpix, - Pixel bgpix, - Pixel *pixmap, - Widget parent) -{ - - /* - * Local variables - */ - Cardinal result; /* function results */ - RGMColorTablePtr ctable; /* color table in icon */ - unsigned maxbits; /* # bits required for X image */ - int srcpix; /* # bits per pixel in icon (actual) */ - int dds ; - - /* - * Convert the color table colors to pixels. - */ - ctable = icon->color_table.ctptr; - result = - Urm__RealizeColorTable (screen, display, fgpix, bgpix, ctable, parent); - if ( result != MrmSUCCESS ) return result; - - /* - * Use the depth of screen to infer the number of bits required to - * hold the pixels in X format. The ZPixmap format only supports 1, 8, 16, - * and 32 bit pixels, so we always map to one of these sizes. - */ - if (parent) dds = parent->core.depth; - else dds = DefaultDepthOfScreen(screen) ; - - if (dds == 1) - maxbits = 1; - else if (dds <= 8) - maxbits = 8; - else if (dds <= 16) - maxbits = 16; - else - maxbits = 32; - - - /* - * See if the icon can be mapped as a bitmap. This will be true if the - * color table has only FG/BG entries, or uses only those entries. - */ - if ( ctable->count <= 2 ) maxbits = 1; - - - /* - * Compute the number of bits available in the icon pixmap - */ - switch ( icon->pixel_size ) - { - case URMPixelSize1Bit: - srcpix = 1; - break; - case URMPixelSize2Bit: - srcpix = 2; - break; - case URMPixelSize4Bit: - srcpix = 4; - break; - case URMPixelSize8Bit: - srcpix = 8; - break; - default: - return MrmNOT_VALID; - } - - /* - * Map the icon image pixmap from color table indices to Pixel values. - * There are three cases: - * maxbits == 1; a bitmap is possible, so map to a bitmap. - * maxbits <= # bits/pixel in pixmap. Map in place. In fact, - * only works if maxbits == srcpix == 8. - * maxbits > # bits/pixel. Map to allocated pixmap. - * - * Each of the three routines which performs these mappings completes - * the entire process of doing the mapping and creating the X pixmap. - */ - if ( maxbits == 1 ) - return Urm__MapIconBitmap - (icon, srcpix, ctable, screen, display, pixmap); - if ((maxbits == 8) && (srcpix == 8)) - return Urm__MapIconReplace - (icon, srcpix, ctable, screen, display, pixmap, parent); - if ( maxbits > srcpix ) - return Urm__MapIconAllocate - (icon, srcpix, maxbits, ctable, screen, display, pixmap, parent); - - return MrmNOT_VALID; -} - - -/* - *++ - * - * PROCEDURE DESCRIPTION: - * - * This routine creates and returns an X pixmap of depth 1 from a URM icon - * for some widget. - * - * FORMAL PARAMETERS: - * - * icon URM icon image to be converted to X pixmap - * screen screen to use for pixmap - * display display to use for pixmap - * pixmap to return resulting X pixmap - * - * IMPLICIT INPUTS: - * - * IMPLICIT OUTPUTS: - * - * FUNCTION VALUE: - * - * URM status - * - * SIDE EFFECTS: - * - *-- - */ - -Cardinal -UrmCreateBitmap (RGMIconImagePtr icon, - Screen *screen, - Display *display, - Pixel *pixmap) -{ - - /* - * Local variables - */ - int srcpix; /* # bits per pixel in icon (actual) */ - - - /* - * Compute the number of bits available in the icon pixmap - */ - switch ( icon->pixel_size ) - { - case URMPixelSize1Bit: - srcpix = URMPixelSize1Bit; - break; - default: - return MrmNOT_VALID; - } - - return Urm__MapIconBitmapDepth1 (icon, srcpix, screen, display, pixmap); - -} - - -/* - *++ - * - * PROCEDURE DESCRIPTION: - * - * This routine creates and returns an X pixmap from the X bitmap file - * name specified. It uses the foreground and background as needed. - * - * - * FORMAL PARAMETERS: - * - * filename file containing the bitmap to be converted to X pixmap - * screen screen to use for pixmap - * display display to use for pixmap - not used - * fgint foreground color for pixmap - * bgint background color for pixmap - * pixmap to return resulting X pixmap - * - * IMPLICIT INPUTS: - * - * IMPLICIT OUTPUTS: - * - * FUNCTION VALUE: - * - * URM status - * - * SIDE EFFECTS: - * - *-- - */ - -Cardinal -Urm__CW_ReadBitmapFile (String filename, - Screen *screen, - Pixel fgint, - Pixel bgint, - Pixmap *pixmap, - Widget parent) -{ - int depth; - char err_msg[300]; - - /* - ** Create a pixmap from a X bitmap file specification - */ - depth = parent ? parent->core.depth : DefaultDepthOfScreen(screen); - - *pixmap = XmGetPixmapByDepth(screen, filename, fgint, bgint, depth); - - if (*pixmap == XmUNSPECIFIED_PIXMAP) - { - pixmap = 0; - sprintf (err_msg, _MrmMMsg_0033, filename); - return Urm__UT_Error ("UrmReadBitmapFile", err_msg, - NULL, NULL, MrmFAILURE); - } - - return MrmSUCCESS; -} - - - - -/* - *++ - * - * PROCEDURE DESCRIPTION: - * - * This routine maps the pixmap in the icon into a bitmap. The - * bitmap is written over pixmap data. The X pixmap is then - * constructed as an XYBitmap. - * - * FORMAL PARAMETERS: - * - * icon the IconImage being converted - * srcpix number of bits/pixel in icon - * ctable the color table for (in) icon - * screen screen for the X pixmap - * display display for the X pixmap - * pixmap to return the result - * - * IMPLICIT INPUTS: - * - * IMPLICIT OUTPUTS: - * - * FUNCTION VALUE: - * - * SIDE EFFECTS: - * - *-- - */ - -Cardinal -Urm__MapIconBitmap(RGMIconImagePtr icon, - int srcpix, - RGMColorTablePtr ctable, - Screen *screen, - Display *display, - Pixmap *pixmap) -{ - - /* - * Local variables - */ - Pixel fgpix; /* foreground pixel value */ - int iconwid; /* icon width */ - int srclinebyt; /* # bytes per icon line */ - int dstlinebyt; /* # bytes per bitmap line */ - char *srcbytptr; /* image byte pointer */ - char *dstbytptr; /* bitmap pointer */ - int lin; /* icon line number */ - int byt; /* line byte number */ - int pix; /* line pixel number */ - unsigned char srcbyt; /* icon image byte */ - unsigned char dstbyt; /* mapped image byte */ - int tndx; /* color table index */ - XImage *imagep; /* X image */ - GC gc; - XGCValues gcValues; - int endian; /* to determine which endian. */ - - /* - * Overwrite the icon data with a bitmap. Use 0 for background, 1 for - * foreground. - */ - fgpix = ctable->item[URMColorTableFG].color_pixel; - iconwid = icon->width; - srclinebyt = (iconwid*srcpix+7) / 8; - dstlinebyt = (iconwid+7) / 8; - srcbytptr = icon->pixel_data.pdptr; - for ( lin=0 ; linheight ; lin++ ) - { - pix = 0; - dstbytptr = icon->pixel_data.pdptr + lin*dstlinebyt; - dstbyt = 0; - for ( byt=0 ; bytpixel_size ) - { - case URMPixelSize1Bit: - *dstbytptr = srcbyt; - srcbytptr += 1; - dstbytptr += 1; - pix += 8; - /* - * NOTE: The original algorithm used here cleared any - * unused bits of the last byte. I don't think - * the protocol requires that... - if ( pix > iconwid ) - */ - continue; - case URMPixelSize2Bit: - tndx = srcbyt & 0x3; - if ( pix < iconwid ) - if ( ctable->item[tndx].color_pixel == fgpix) - dstbyt |= 1<<(pix%8); - pix += 1; - srcbyt >>= 2; - tndx = srcbyt & 0x3; - if ( pix < iconwid ) - if ( ctable->item[tndx].color_pixel == fgpix) - dstbyt |= 1<<(pix%8); - pix += 1; - srcbyt >>= 2; - tndx = srcbyt & 0x3; - if ( pix < iconwid ) - if ( ctable->item[tndx].color_pixel == fgpix) - dstbyt |= 1<<(pix%8); - pix += 1; - srcbyt >>= 2; - tndx = srcbyt & 0x3; - if ( pix < iconwid ) - if ( ctable->item[tndx].color_pixel == fgpix) - dstbyt |= 1<<(pix%8); - pix += 1; - break; - case URMPixelSize4Bit: - tndx = srcbyt & 0xF; - if ( pix < iconwid ) - if ( ctable->item[tndx].color_pixel == fgpix) - dstbyt |= 1<<(pix%8); - pix += 1; - srcbyt >>= 4; - tndx = srcbyt & 0xF; - if ( pix < iconwid ) - if ( ctable->item[tndx].color_pixel == fgpix) - dstbyt |= 1<<(pix%8); - pix += 1; - break; - case URMPixelSize8Bit: - if ( pix < iconwid ) - if ( ctable->item[srcbyt].color_pixel == fgpix) - dstbyt |= 1<<(pix%8); - pix += 1; - break; - } - /* - * NOTE: The "1Bit" case CONTINUEs directly and will never - * reach this point in the loop... - */ - srcbytptr += 1; - if ( pix%8 == 0 ) - { - *dstbytptr = dstbyt; - dstbytptr += 1; - dstbyt = 0; - } - } - if ( pix%8 != 0 ) - *dstbytptr = dstbyt; - } - - - imagep = XCreateImage(display, - DefaultVisualOfScreen(screen), - 1, - XYBitmap, - 0, - icon->pixel_data.pdptr, - (unsigned int)icon->width, - (unsigned int)icon->height, - 8, - dstlinebyt); - - if ( imagep == NULL ) - return Urm__UT_Error ("Urm__MapIconBitmap", _MrmMMsg_0034, - NULL, NULL, MrmFAILURE); - - /* - * Well, Uil creates a uid icon in its byteorder, on his side - * XCreateImage creates an image in the byte_order of the server, so - * its not correct, we have to adjust the byte_order fields of this - * image to match those of the icon. - */ - - endian = 1; - imagep->bitmap_unit = 8 ; - if (*(char *) &endian) { - imagep->byte_order = LSBFirst ; - imagep->bitmap_bit_order = LSBFirst ; - } - else { - imagep->byte_order = MSBFirst; - imagep->bitmap_bit_order = LSBFirst ; - } - - *pixmap = XCreatePixmap (display, - RootWindowOfScreen(screen), - icon->width, - icon->height, - (unsigned)DefaultDepthOfScreen(screen)); - if ( *pixmap == (Pixmap)0) - { - XFree((char*)imagep); - return Urm__UT_Error ("Urm__MapIconBitmap", _MrmMMsg_0035, - NULL, NULL, MrmFAILURE); - } - - /* - * Build a gc to use when drawing into the pixmap - */ - gcValues.foreground = ctable->item[URMColorTableFG].color_pixel; - gcValues.background = ctable->item[URMColorTableBG].color_pixel; - gcValues.fill_style = FillTiled; - gcValues.tile = *pixmap; - - gc = XCreateGC (display, - RootWindowOfScreen (screen), - GCForeground | GCBackground | GCFillStyle | GCTile, - &gcValues); - if ( gc == NULL ) - return Urm__UT_Error ("Urm__MapIconBitmap", _MrmMMsg_0036, - NULL, NULL, MrmFAILURE); - - /* - * Put bits into the pixmap - */ - XPutImage (display, - *pixmap, - gc, - imagep, - 0, 0, /* source x, y */ - 0, 0, icon->width, icon->height); /* dest, loc & size */ - - XFreeGC (display, gc); - XFree ((char*)imagep); - - /* - * Successfully created - */ - return MrmSUCCESS; - -} - - -/* - *++ - * - * PROCEDURE DESCRIPTION: - * - * This routine maps the pixmap in the icon into a bitmap. The - * bitmap is written over pixmap data. The X pixmap is then - * constructed as an XYBitmap. - * - * FORMAL PARAMETERS: - * - * icon the IconImage being converted - * srcpix number of bits/pixel in icon - * screen screen for the X pixmap - * display display for the X pixmap - * pixmap to return the result - * - * IMPLICIT INPUTS: - * - * IMPLICIT OUTPUTS: - * - * FUNCTION VALUE: - * - * SIDE EFFECTS: - * - *-- - */ - -Cardinal -Urm__MapIconBitmapDepth1 (RGMIconImagePtr icon, - int srcpix, - Screen *screen, - Display *display, - Pixmap *pixmap) -{ - - /* - * Local variables - */ - int iconwid; /* icon width */ - int srclinebyt; /* # bytes per icon line */ - int dstlinebyt; /* # bytes per bitmap line */ - char *srcbytptr; /* image byte pointer */ - char *dstbytptr; /* bitmap pointer */ - int lin; /* icon line number */ - int byt; /* line byte number */ - int pix; /* line pixel number */ - unsigned char srcbyt; /* icon image byte */ - unsigned char dstbyt; /* mapped image byte */ - XImage *imagep; /* X image */ - GC gc; - XGCValues gcValues; - int endian; /* to determine which endian. */ - - - /* - * Overwrite the icon data with a bitmap. Use 0 for background, 1 for - * foreground. - */ - iconwid = icon->width; - srclinebyt = (iconwid*srcpix+7) / 8; - dstlinebyt = (iconwid+7) / 8; - srcbytptr = icon->pixel_data.pdptr; - for ( lin=0 ; linheight ; lin++ ) - { - pix = 0; - dstbytptr = icon->pixel_data.pdptr + lin*dstlinebyt; - dstbyt = 0; - for ( byt=0 ; bytpixel_size ) - { - case URMPixelSize1Bit: - *dstbytptr = srcbyt; - srcbytptr += 1; - dstbytptr += 1; - pix += 8; - /* - * NOTE: The original algorithm used here cleared any - * unused bits of the last byte. I don't think - * the protocol requires that... - if ( pix > iconwid ) - */ - continue; - default: - return MrmNOT_VALID; - } - } - if ( pix%8 != 0 ) - *dstbytptr = dstbyt; - } - - - imagep = XCreateImage(display, - DefaultVisualOfScreen(screen), - 1, - XYBitmap, - 0, - icon->pixel_data.pdptr, - (unsigned int)icon->width, - (unsigned int)icon->height, - 8, - dstlinebyt); - - if ( imagep == NULL ) - return Urm__UT_Error ("Urm__MapIconBitmapDepth1", _MrmMMsg_0034, - NULL, NULL, MrmFAILURE); - - /* Well, Uil creates a uid icon in its byteorder, on his side - XCreateImage creates an image in the byte_order of the server, so - its not correct, we have to adjust the byte_order fields of this - image to match those of the icon. */ - - endian = 1; - imagep->bitmap_unit = 8 ; - if (*(char *) &endian) { - imagep->byte_order = LSBFirst ; - imagep->bitmap_bit_order = LSBFirst ; - } - else { - imagep->byte_order = MSBFirst; - imagep->bitmap_bit_order = LSBFirst ; - } - - *pixmap = XCreatePixmap (display, - RootWindowOfScreen(screen), - icon->width, - icon->height, - 1); - if ( *pixmap == (Pixmap)0) - { - XFree((char*)imagep); - return Urm__UT_Error ("Urm__MapIconBitmapDepth1", _MrmMMsg_0035, - NULL, NULL, MrmFAILURE); - } - - - /* - * Build a gc to use when drawing into the pixmap - */ - gcValues.foreground = 1; - gcValues.background = 0; - gcValues.fill_style = FillTiled; - gcValues.tile = *pixmap; - - gc = XCreateGC (display, - *pixmap, - GCForeground | GCBackground | GCFillStyle | GCTile, - &gcValues); - - if ( gc == NULL ) - return Urm__UT_Error ("Urm__MapIconBitmapDepth1", _MrmMMsg_0036, - NULL, NULL, MrmFAILURE); - - /* - * Put bits into the pixmap - */ - XPutImage (display, - *pixmap, - gc, - imagep, - 0, 0, /* source x, y */ - 0, 0, icon->width, icon->height); /* dest, loc & size */ - - - XFreeGC (display, gc); - XFree ((char *)imagep); - - /* - * Successfully created - */ - return MrmSUCCESS; -} - - -/* - *++ - * - * PROCEDURE DESCRIPTION: - * - * This routine maps the pixmap in the icon into a ZPixmap. The - * ZPixmap is written over the icon image pixmap data. The X pixmap - * is then constructed as a ZPixmap from the overwritten data. - * - * This routine is called only when srcpix == 8. - * - * FORMAL PARAMETERS: - * - * icon the IconImage being converted - * srcpix number of bits/pixel in icon - * ctable the color table for (in) icon - * screen screen for the X pixmap - * display display for the X pixmap - * pixmap to return the result - * - * IMPLICIT INPUTS: - * - * IMPLICIT OUTPUTS: - * - * FUNCTION VALUE: - * - * SIDE EFFECTS: - * - *-- - */ - -Cardinal -Urm__MapIconReplace (RGMIconImagePtr icon, - int srcpix, - RGMColorTablePtr ctable, - Screen *screen, - Display *display, - Pixmap *pixmap, - Widget parent) -{ - - /* - * Local variables - */ - int iconwid; /* icon width */ - int linebyt; /* # bytes per icon line */ - char *bytptr; /* image byte pointer */ - int lin; /* icon line number */ - int byt; /* line byte number */ - int pix; /* line pixel number */ - unsigned char srcbyt; /* icon image byte */ - XImage *imagep; /* X image */ - GC gc; - XGCValues gcValues; - int depth; /* depth of screen */ - - /* - * Overwrite the pixmap with actual Pixel values. The source and destination - * bit widths are the same (==8), and the same pointer can be used for - * both source and destination. - */ - iconwid = icon->width; - linebyt = (iconwid*srcpix+7) / 8; - bytptr = icon->pixel_data.pdptr; - for ( lin=0 ; linheight ; lin++ ) - { - pix = 0; - for ( byt=0 ; bytitem[srcbyt].color_pixel; - pix += 1; - bytptr += 1; - } - } - - depth = parent ? parent->core.depth : DefaultDepthOfScreen(screen); - - imagep = XCreateImage(display, - DefaultVisualOfScreen(screen), - depth, - ZPixmap, - 0, - icon->pixel_data.pdptr, - (unsigned int)icon->width, - (unsigned int)icon->height, - srcpix, - linebyt); - - if ( imagep == NULL ) - return Urm__UT_Error ("Urm__MapIconReplace", _MrmMMsg_0034, - NULL, NULL, MrmFAILURE); - - *pixmap = XCreatePixmap (display, - RootWindowOfScreen(screen), - icon->width, - icon->height, - (unsigned)depth); - if ( *pixmap == (Pixmap)0) - { - XFree((char*)imagep); - return Urm__UT_Error ("Urm__MapIconReplace", _MrmMMsg_0035, - NULL, NULL, MrmFAILURE); - } - - /* - * Build a gc to use when drawing into the pixmap - */ - gcValues.foreground = ctable->item[URMColorTableFG].color_pixel; - gcValues.background = ctable->item[URMColorTableBG].color_pixel; - gcValues.fill_style = FillTiled; - gcValues.tile = *pixmap; - - gc = XCreateGC (display, - RootWindowOfScreen (screen), - GCForeground | GCBackground | GCFillStyle | GCTile, - &gcValues); - if ( gc == NULL ) - return Urm__UT_Error ("Urm__MapIconReplace", _MrmMMsg_0036, - NULL, NULL, MrmFAILURE); - - /* - * Put bits into the pixmap - */ - XPutImage (display, - *pixmap, - gc, - imagep, - 0, 0, /* source x, y */ - 0, 0, icon->width, icon->height); /* dest, loc & size */ - - XFreeGC (display, gc); - XFree((char*)imagep); - - /* - * Successfully created - */ - return MrmSUCCESS; - -} - - - -/* - *++ - * - * PROCEDURE DESCRIPTION: - * - * This routine maps the pixmap in the icon into a ZPixmap. The - * ZPixmap is allocated 1 byte per pixel, as the icon image pixmap - * has too few bits per pixel to be replace in situ. The X pixmap - * is created from the allocated ZPixmap. - * - * FORMAL PARAMETERS: - * - * icon the IconImage being converted - * srcpix number of bits/pixel in icon - * dstpix number of bits/pixel in resulting image - * ctable the color table for (in) icon - * screen screen for the X pixmap - * display display for the X pixmap - * pixmap to return the result - * - * IMPLICIT INPUTS: - * - * IMPLICIT OUTPUTS: - * - * FUNCTION VALUE: - * - * SIDE EFFECTS: - * - *-- - */ - -Cardinal -Urm__MapIconAllocate (RGMIconImagePtr icon, - int srcpix, - int dstpix, - RGMColorTablePtr ctable, - Screen *screen, - Display *display, - Pixmap *pixmap, - Widget parent) -{ - - /* - * Local variables - */ - int iconwid; /* icon width */ - int iconhgt; /* icon height */ - char *alloc_pixmap; /* allocated pixmap */ - int dstbytsize; /* # 8-bit bytes per bitmap byte */ - int srclinebyt; /* # bytes per icon line */ - char *srcbytptr; /* image byte pointer */ - int lin; /* icon line number */ - int byt; /* line byte number */ - int bit; /* bit loop index */ - int pix; /* line pixel number */ - unsigned char srcbyt; /* icon image byte */ - int bitmask; /* mask all but significant bits */ - int num_bits; /* real (not coded) pixel size */ - int tndx; /* color table index */ - XImage *imagep; /* X image */ - GC gc; - XGCValues gcValues; - int depth; /* depth of screen */ - - /* - * Allocate a new pixmap image. - */ - iconwid = icon->width; - iconhgt = icon->height; - if (dstpix <= 8) dstpix = 8; - else if (dstpix <= 16) dstpix = 16; - else dstpix = 32; - dstbytsize = dstpix / 8; - alloc_pixmap = (char *) XtMalloc (iconwid * iconhgt * dstbytsize); - if (alloc_pixmap == NULL) - return Urm__UT_Error ("Urm__MapIconAllocate", _MrmMMsg_0037, - NULL, NULL, MrmFAILURE); - srclinebyt = (iconwid * srcpix + 7) / 8; - srcbytptr = icon->pixel_data.pdptr; - - depth = parent ? parent->core.depth : DefaultDepthOfScreen(screen); - - imagep = XCreateImage(display, - DefaultVisualOfScreen(screen), - depth, - ZPixmap, - 0, - alloc_pixmap, - iconwid, - iconhgt, - dstpix, - 0); /* Let Xlib calculate it. */ - - if ( imagep == NULL ) - { - XtFree (alloc_pixmap); - return Urm__UT_Error ("Urm__MapIconAllocate", _MrmMMsg_0034, - NULL, NULL, MrmFAILURE); - } - - if(icon->pixel_size == URMPixelSize1Bit) - { num_bits = 1; bitmask=0x1; } - else if(icon->pixel_size == URMPixelSize2Bit) - { num_bits = 2; bitmask=0x3; } - else if(icon->pixel_size == URMPixelSize4Bit) - { num_bits = 4; bitmask=0xF; } - else if(icon->pixel_size == URMPixelSize8Bit) - { num_bits = 8; bitmask=0xFF; } - for ( pix=0,lin=0 ; linheight ; pix=0,lin++ ) - { - for ( byt=0 ; bytitem[tndx].color_pixel); - pix++; - srcbyt >>= num_bits; - } - } - } - - *pixmap = XCreatePixmap (display, - RootWindowOfScreen(screen), - iconwid, - iconhgt, - (unsigned)depth); - if ( *pixmap == (Pixmap)0) - { - XtFree (alloc_pixmap); - XFree((char*)imagep); - return Urm__UT_Error ("Urm__MapIconAllocate", _MrmMMsg_0035, - NULL, NULL, MrmFAILURE); - } - - /* - * Build a gc to use when drawing into the pixmap - */ - gcValues.foreground = ctable->item[URMColorTableFG].color_pixel; - gcValues.background = ctable->item[URMColorTableBG].color_pixel; - gcValues.fill_style = FillTiled; - gcValues.tile = *pixmap; - - gc = XCreateGC (display, - RootWindowOfScreen (screen), - GCForeground | GCBackground | GCFillStyle | GCTile, - &gcValues); - if ( gc == NULL ) - { - XtFree (alloc_pixmap); - return Urm__UT_Error ("Urm__MapIconAllocate", _MrmMMsg_0036, - NULL, NULL, MrmFAILURE); - } - - /* - * Put bits into the pixmap - */ - XPutImage (display, - *pixmap, - gc, - imagep, - 0, 0, /* source x, y */ - 0, 0, iconwid, iconhgt); /* dest, loc & size */ - - /* - * don't deallocate with XDestroyImage, which would destroy alloc_pixmap - */ - XFree((char*)imagep); - XFreeGC (display, gc); - XtFree (alloc_pixmap); - - /* - * Successfully created - */ - return MrmSUCCESS; - -} - - - -/* - *++ - * - * PROCEDURE DESCRIPTION: - * - * This routine sets the Pixel values corresponding to each of the - * entries in the color table. Foreground and background are set by - * querying the widget for those values, or falling back on - * Black/WhitePixelOfScreen. All other colors are set by honoring - * FG/BG setting for monochrome devices, or by getting the xolor - * Pixel values from X. - * - * FORMAL PARAMETERS: - * - * screen screen to use for color table - * display display to use for color table - * fgpix foreground color for color table - * bgpix background color for color table - * ctable the color table - * - * IMPLICIT INPUTS: - * - * IMPLICIT OUTPUTS: - * - * FUNCTION VALUE: - * - * SIDE EFFECTS: - * - *-- - */ - -Cardinal -Urm__RealizeColorTable (Screen *screen, - Display *display, - Pixel fgpix, - Pixel bgpix, - RGMColorTablePtr ctable, - Widget parent) -{ - - /* - * Local variables - */ - Cardinal result; /* function results */ - Cardinal ndx; /* loop index */ - RGMColorTableEntryPtr citem; /* color table entry */ - Colormap cmap; /* default color map */ - int depth; /* # planes in screen */ - char err_msg[300]; - - - /* - * Load the foreground and background pixel values. - */ - ctable->item[URMColorTableFG].color_pixel = fgpix; - ctable->item[URMColorTableBG].color_pixel = bgpix; - - /* - * Get the Pixel for each defined color. Honor the FG/BG specification - * if present on monochrome displays. Otherwise, get the Pixel value for - * the color. Use the FG/BG specification as a fallback for unfound - * colors in non-monochrome. If no reasonable color Pixel can be found, - * return an error. - */ - cmap = parent ? parent->core.colormap : DefaultColormapOfScreen(screen); - depth = parent ? parent->core.depth : DefaultDepthOfScreen(screen); - - for ( ndx=URMColorTableUserMin ; ndxcount ; ndx++ ) - { - citem = &ctable->item[ndx]; - if ( depth == 1 ) - switch ( citem->color_item.cptr->mono_state ) - { - case URMColorMonochromeUnspecified: - switch (citem->color_item.cptr->desc_type) - { - case URMColorDescTypeName: - result = Urm__UT_GetNamedColorPixel - (display, cmap, citem->color_item.cptr, &citem->color_pixel, - ctable->item[URMColorTableBG].color_pixel); - if ( result != MrmSUCCESS) { - /* we use PARTIAL_SUCCESS only to indicate - the color allocation failed and we've - substituted the fallback color. We still - want a warning, though */ - if (result == MrmPARTIAL_SUCCESS) { - result = MrmSUCCESS; - sprintf (err_msg, _MrmMMsg_0038, - citem->color_item.cptr->desc.name); - return Urm__UT_Error ("Urm__RealizeColorTable", - err_msg, NULL, NULL, result); - } else { - sprintf (err_msg, _MrmMMsg_0038, - citem->color_item.cptr->desc.name); - return Urm__UT_Error ("Urm__RealizeColorTable", - err_msg, NULL, NULL, result); - } - } - break; - case URMColorDescTypeRGB: - result = Urm__UT_GetColorPixel - (display, cmap, citem->color_item.cptr, &citem->color_pixel, - ctable->item[URMColorTableBG].color_pixel); - if ( result != MrmSUCCESS ) { - /* we use PARTIAL_SUCCESS only to indicate - the color allocation failed and we've - substituted the fallback color. We still - want a warning, though */ - if (result == MrmPARTIAL_SUCCESS) { - result = MrmSUCCESS; - sprintf (err_msg, _MrmMMsg_0038, - citem->color_item.cptr->desc.name); - return Urm__UT_Error ("Urm__RealizeColorTable", - err_msg, NULL, NULL, result); - } else { - sprintf (err_msg, _MrmMMsg_0039, - citem->color_item.cptr->desc.rgb.red, - citem->color_item.cptr->desc.rgb.green, - citem->color_item.cptr->desc.rgb.blue) ; - return Urm__UT_Error ("Urm__RealizeColorTable", - err_msg, NULL, NULL, result); - } - } - break; - default: - sprintf(err_msg, _MrmMMsg_0040); - return Urm__UT_Error ("Urm__RelizeColorTable", - err_msg, NULL, NULL, MrmFAILURE) ; - } - break; - case URMColorMonochromeForeground: - citem->color_pixel = - ctable->item[URMColorTableFG].color_pixel; - break; - case URMColorMonochromeBackground: - citem->color_pixel = - ctable->item[URMColorTableBG].color_pixel; - break; - default: - sprintf (err_msg, _MrmMMsg_0041, - citem->color_item.cptr->mono_state); - return Urm__UT_Error ("Urm__RealizeColorTable", - err_msg, NULL, NULL, result); - } - else - { - switch (citem->color_item.cptr->desc_type) - { - case URMColorDescTypeName: - result = Urm__UT_GetNamedColorPixel - (display, cmap, citem->color_item.cptr, &citem->color_pixel, - ((citem->color_item.cptr->mono_state == - URMColorMonochromeForeground) ? - ctable->item[URMColorTableFG].color_pixel : - ctable->item[URMColorTableBG].color_pixel)); - if (result != MrmSUCCESS) { - /* we use PARTIAL_SUCCESS only to indicate - the color allocation failed and we've - substituted the fallback color. We still - want a warning, though */ - if (result == MrmPARTIAL_SUCCESS) { - result = MrmSUCCESS; - sprintf (err_msg, _MrmMMsg_0038, - citem->color_item.cptr->desc.name); - return Urm__UT_Error ("Urm__RealizeColorTable", - err_msg, NULL, NULL, result); - } else { - sprintf (err_msg, _MrmMMsg_0038, - citem->color_item.cptr->desc.name); - Urm__UT_Error ("Urm__RealizeColorTable", - err_msg, NULL, NULL, result); - } - } - break; - case URMColorDescTypeRGB: - result = Urm__UT_GetColorPixel - (display, cmap, citem->color_item.cptr, &citem->color_pixel, - ctable->item[URMColorTableBG].color_pixel); - if (result != MrmSUCCESS) { - /* we use PARTIAL_SUCCESS only to indicate - the color allocation failed and we've - substituted the fallback color. We still - want a warning, though */ - if (result == MrmPARTIAL_SUCCESS) { - result = MrmSUCCESS; - sprintf (err_msg, _MrmMMsg_0038, - citem->color_item.cptr->desc.name); - return Urm__UT_Error ("Urm__RealizeColorTable", - err_msg, NULL, NULL, result); - } else { - sprintf (err_msg, _MrmMMsg_0039, - citem->color_item.cptr->desc.rgb.red, - citem->color_item.cptr->desc.rgb.green, - citem->color_item.cptr->desc.rgb.blue) ; - Urm__UT_Error ("Urm__RealizeColorTable", - err_msg, NULL, NULL, result); - } - } - break; - default: - result = MrmFAILURE; - sprintf (err_msg, _MrmMMsg_0040); - Urm__UT_Error ("Urm__RelizeColorTable", - err_msg, NULL, NULL, MrmFAILURE) ; - } - if ( result != MrmSUCCESS ) - { - switch ( citem->color_item.cptr->mono_state ) - { - case URMColorMonochromeForeground: - citem->color_pixel = - ctable->item[URMColorTableFG].color_pixel; - break; - case URMColorMonochromeBackground: - citem->color_pixel = - ctable->item[URMColorTableBG].color_pixel; - break; - default: - return result; - } - } - } - } - - return MrmSUCCESS; -} - -/* - *++ - * - * PROCEDURE DESCRIPTION: - * - * This routine makes a copy of a URM icon into a memory block - * which has been pre-allocated. The block must be big enough - * to hold both the header and the bit vector. - * - * FORMAL PARAMETERS: - * - * dst_icon the memory block to receive the copy - * src_icon the URM icon descriptor to be copied. - * - * IMPLICIT INPUTS: - * - * IMPLICIT OUTPUTS: - * - * FUNCTION VALUE: - * - * SIDE EFFECTS: - * - *-- - */ - - -RGMIconImagePtr -UrmCopyAllocatedIconImage (RGMIconImagePtr dst_icon, - RGMIconImagePtr src_icon) -{ - - /* - * Copy the header and bit vector into the new memory block. - */ - dst_icon->validation = URMIconImageValid; - dst_icon->pixel_size = src_icon->pixel_size; - dst_icon->width = src_icon->width; - dst_icon->height = src_icon->height; - dst_icon->hot_x = src_icon->hot_x; - dst_icon->hot_y = src_icon->hot_y; - - /* - * Copy the color table as an immediate. It is allocated immediately - * after the image header. - */ - - /* - * Copy the pixel data - */ - - return dst_icon; - -} - - - -/* - *++ - * - * PROCEDURE DESCRIPTION: - * - * This routine attempts to look up the name of a color, and return - * the pixel value required as a widget arglist value. It will use - * the default color map if necessary, and returns the closest color - * supported by the hardware (as defined by X), not the exact database - * definition. If the screen is depth 1 (monochrome), the routine will - * honor the monochrome rendition specified in the color descriptor. - * - * FORMAL PARAMETERS: - * - * display specifies the X server connection - * cmap color map ID. If NULL, the default color map is used - * colorptr color descriptor - * pixel_return to return the pixel value for the color - * fallback fallback color to use in case of alloc failure - * - * IMPLICIT INPUTS: - * - * IMPLICIT OUTPUTS: - * - * FUNCTION VALUE: - * - * MrmSUCCESS color found and translated - * MrmNOT_FOUND conversion failure - * MrmPARTIAL_SUCCESS internal only, for allocation failure - * - * SIDE EFFECTS: - * - *-- - */ - -Cardinal -Urm__UT_GetNamedColorPixel (Display *display, - Colormap cmap, - RGMColorDescPtr colorptr, - Pixel *pixel_return, - Pixel fallback) -{ - - /* - * Local variables - */ - XColor screen_def; /* realizable values */ - XColor exact_def; /* exact values */ - int status; /* function return */ - - - if ( cmap == (Colormap)0) - cmap = DefaultColormap (display, DefaultScreen(display)); - - /* CR 9891: Support new pixel constants. */ - if (XmeNamesAreEqual(colorptr->desc.name, "default_select_color")) - { - *pixel_return = XmDEFAULT_SELECT_COLOR; - return MrmSUCCESS; - } - else if (XmeNamesAreEqual(colorptr->desc.name, "reversed_ground_colors")) - { - *pixel_return = XmREVERSED_GROUND_COLORS; - return MrmSUCCESS; - } - else if (XmeNamesAreEqual(colorptr->desc.name, "highlight_color")) - { - *pixel_return = XmHIGHLIGHT_COLOR; - return MrmSUCCESS; - } - - status = XAllocNamedColor - (display, cmap, colorptr->desc.name, &screen_def, &exact_def); - - if ( status == 0) { - if (fallback) { - *pixel_return = fallback; - return MrmPARTIAL_SUCCESS; - } - else - return MrmFAILURE; - } - *pixel_return = screen_def.pixel; - return MrmSUCCESS; - -} - - - -/* - *++ - * - * PROCEDURE DESCRIPTION: - * - * This routine attempts to look up the RGB values of a color, and return - * the pixel value required as a widget arglist value. It will use - * the default color map if necessary, and returns the closest color - * supported by the hardware (as defined by X), not the exact database - * definition. If the screen is depth 1 (monochrome), the routine will - * honor the monochrome rendition specified in the color descriptor. - * - * FORMAL PARAMETERS: - * - * display specifies the X server connection - * cmap color map ID. If NULL, the default color map is used - * colorptr color descriptor - * pixel_return to return the pixel value for the color - * fallback fallback color to use in case of alloc failure - * - * IMPLICIT INPUTS: - * - * IMPLICIT OUTPUTS: - * - * FUNCTION VALUE: - * - * MrmSUCCESS color found and translated - * MrmNOT_FOUND conversion failure - * MrmPARTIAL_SUCCESS internal only, for allocation failure - * - * SIDE EFFECTS: - * - *-- - */ - -Cardinal -Urm__UT_GetColorPixel (Display *display, - Colormap cmap, - RGMColorDescPtr colorptr, - Pixel *pixel_return, - Pixel fallback) -{ - - /* - * Local variables - */ - XColor screen_in_out; /* realizable values */ - int status; /* function return */ - - - if ( cmap == (Colormap)0) - cmap = DefaultColormap (display, DefaultScreen(display)); - screen_in_out.red = colorptr->desc.rgb.red; - screen_in_out.green = colorptr->desc.rgb.green; - screen_in_out.blue = colorptr->desc.rgb.blue; - status = XAllocColor (display, cmap, &screen_in_out); - - if ( status == 0) { - if (fallback) { - *pixel_return = fallback; - return MrmPARTIAL_SUCCESS; - } else - return MrmFAILURE; - } - *pixel_return = screen_in_out.pixel; - return MrmSUCCESS; - -} - - - -/* - *++ - * - * PROCEDURE DESCRIPTION: - * - * This routine computes the number of bytes used by a URM icon - * - * FORMAL PARAMETERS: - * - * icon URM icon image - * - * IMPLICIT INPUTS: - * - * IMPLICIT OUTPUTS: - * - * FUNCTION VALUE: - * - * # bytes in the image - * - * SIDE EFFECTS: - * - *-- - */ - -Cardinal -UrmIconImageSize (RGMIconImagePtr icon) -{ - - /* - * Local variables - */ - int bytes_per_line; /* # bytes for padded width */ - int raster_len; /* bytes in image */ - Cardinal size; /* # bytes in descriptor */ - - - bytes_per_line = (icon->width+7) / 8; - raster_len = bytes_per_line * icon->height; - size = sizeof(RGMIconImage) + (raster_len-1)*sizeof(char); - return size; - -} - - -/* - *++ - * - * PROCEDURE DESCRIPTION: - * - * This routine computes the number of bytes necessary to store - * the given color table in a single memory block. - * - * FORMAL PARAMETERS: - * - * ctable An allocated color table - * - * IMPLICIT INPUTS: - * - * IMPLICIT OUTPUTS: - * - * FUNCTION VALUE: - * - * table size in bytes - * - * SIDE EFFECTS: - * - *-- - */ - -/*ARGSUSED*/ -Cardinal -UrmColorTableSize (RGMColorTablePtr ctable) /* unused */ -{ - - return sizeof(RGMColorTable); - -} diff --git a/lib/Mrm/Mrmlread.c b/lib/Mrm/Mrmlread.c index be433a3..c2fd94c 100644 --- a/lib/Mrm/Mrmlread.c +++ b/lib/Mrm/Mrmlread.c @@ -698,7 +698,7 @@ MrmFetchColorLiteral (MrmHierarchy hierarchy_id, XBlackPixelOfScreen(XDefaultScreenOfDisplay(display))); break; default: - sprintf(err_msg, "%s", _MrmMMsg_0040); + sprintf(err_msg, _MrmMMsg_0040); result = Urm__UT_Error ("MrmFetchColorLiteral", err_msg, NULL, NULL, MrmFAILURE) ; _MrmAppUnlock(app); diff --git a/lib/Mrm/Mrmlread.c.format-security b/lib/Mrm/Mrmlread.c.format-security deleted file mode 100644 index c2fd94c..0000000 --- a/lib/Mrm/Mrmlread.c.format-security +++ /dev/null @@ -1,964 +0,0 @@ -/* - * Motif - * - * Copyright (c) 1987-2012, The Open Group. All rights reserved. - * - * These libraries and programs are free software; you can - * redistribute them and/or modify them under the terms of the GNU - * Lesser General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) - * any later version. - * - * These libraries and programs are distributed in the hope that - * they will be useful, but WITHOUT ANY WARRANTY; without even the - * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU Lesser General Public License for more - * details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with these librararies and programs; if not, write - * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth - * Floor, Boston, MA 02110-1301 USA - */ -/* - * HISTORY - */ -#ifdef HAVE_CONFIG_H -#include -#endif - - -#ifdef REV_INFO -#ifndef lint -static char rcsid[] = "$XConsortium: Mrmlread.c /main/16 1996/11/13 14:02:28 drk $" -#endif -#endif - -/* * - * (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 1989, 1990, 1996 Digital Equipment Corporation. * - * (c) Copyright 1996 FUJITSU LIMITED. * - * (c) Copyright 1996 Hitachi. * - */ - -/* - *++ - * FACILITY: - * - * UIL Resource Manager (URM): - * - * ABSTRACT: - * - * This module contains the literal read routines. All these routines - * read a literal from a hierarchy or IDB file into a resource context. - * - *-- - */ - - -/* - * - * INCLUDE FILES - * - */ - -#include -#include -#include -#include "MrmosI.h" -#include "MrmMsgI.h" - -/* - * - * TABLE OF CONTENTS - * - * UrmGetIndexedLiteral Read indexed literal from IDB file - * - * UrmGetRIDLiteral Read RID literal from IDB file - * - * UrmHGetIndexedLiteral Read indexed literal from hierarchy - * - */ - -/* - *++ - * - * PROCEDURE DESCRIPTION: - * - * This routine is a service routine for the various XmFetch...Literal - * routine. It fetches a literal into a context. It also fetches any - * other literals which are referenced. - * - * FORMAL PARAMETERS: - * - * hierarchy_id id of an open hierarchy containing the literal - * index index of the desired literal - * context_id context in which to return literal. Literal will - * be fixed up. - * ctxlist list of other contexts created (if needed) - * - * IMPLICIT INPUTS: - * - * IMPLICIT OUTPUTS: - * - * FUNCTION VALUE: - * - * SIDE EFFECTS: - * - *-- - */ - -Cardinal -Urm__FetchLiteral (MrmHierarchy hierarchy_id, - String index, - URMResourceContextPtr context_id, - URMPointerListPtr *ctxlist) -{ - - /* - * Local variables - */ - Cardinal result; /* function results */ - IDBFile file_id = NULL; /* file containing literal */ - long val; /* literal value */ - MrmType type; /* literal type */ - char err_msg[300]; /* for error messages */ - Boolean swap_needed = FALSE ; - - - /* - * read the literal into the context - */ - result = Urm__HGetIndexedLiteral (hierarchy_id, index, context_id, &file_id); - if ( result != MrmSUCCESS ) - { - sprintf (err_msg, _MrmMMsg_0042, index); - return Urm__UT_Error ("Urm__FetchLiteral", err_msg, NULL, NULL, result); - } - - swap_needed = UrmRCByteSwap(context_id) ; - - /* - * Acquire the literal type and value, and do any fixups which are required. - */ - val = (long) UrmRCBuffer (context_id); - type = UrmRCType (context_id); - switch ( type ) - { - case MrmRtypeIconImage: - UrmPlistInit (10, ctxlist); - result = Urm__CW_LoadIconImage ((RGMIconImagePtr)val, (XtPointer)val, - hierarchy_id, file_id, *ctxlist); - /* LoadIconImage checks validations and handle swapping */ - swap_needed = FALSE ; - break; - case MrmRtypeFontList: - /* Check for old style font list, allocate new value if necessary. */ - if (strcmp(file_id->db_version, URM1_1version) <= 0) - { - int count = ((OldRGMFontListPtr)val)->count; - RGMFontListPtr fontlist = (RGMFontListPtr) - XtMalloc(sizeof(RGMFontList) + (sizeof(RGMFontItem) * (count - 1))); - Urm__CW_FixupValue ((long)fontlist, type, (XtPointer)val, file_id, - &swap_needed); - XtFree((char *)val); - UrmRCBuffer(context_id) = (char *)fontlist; - } - else - Urm__CW_FixupValue (val, type, (XtPointer)val, file_id, &swap_needed); - break; - case MrmRtypeInteger: - case MrmRtypeBoolean: - if ( swap_needed ) - { - swapbytes( (*(int *)UrmRCBuffer (context_id)) ); - swap_needed = FALSE ; - } - break; - case MrmRtypeSingleFloat: - if ( swap_needed ) - { - swapbytes( (*(int *)UrmRCBuffer (context_id)) ); - swap_needed = FALSE ; - } - _MrmOSIEEEFloatToHost( (float *)UrmRCBuffer (context_id)); - break; - case MrmRtypeFloat: - if ( swap_needed ) - { - swapdouble( (*(double *)UrmRCBuffer (context_id)) ); - swap_needed = FALSE ; - } - _MrmOSIEEEDoubleToHost( (double *)UrmRCBuffer (context_id)); - break; - - default: - Urm__CW_FixupValue (val, type, (XtPointer)val, file_id, &swap_needed); - break; - } - - UrmRCSetByteSwap(context_id, swap_needed); - return MrmSUCCESS; - -} - - - -/* - *++ - * - * PROCEDURE DESCRIPTION: - * - * This routine reads and returns the value of a literal (named value) - * stored as a public resource in a single UID file. It returns a - * pointer to value of the literal, fixed up and converted for - * use as a toolkit argument. The return is always a pointer -- an - * integer is returned as a pointer to an integer, and a string is - * returned as a pointer to a string. The caller is responsible for - * freeing the literal's storage, which was acquired with XtMalloc. - * - * This routine should not be used for fetching icon or color literals, - * as more information is required for converting them. If fetched, - * an error is returned. - * - * FORMAL PARAMETERS: - * - * hierarchy_id id of an open hierarchy containing the literal - * index index of the desired literal - * value_return to return pointer to literal value - * type_return will be set to the literal data type, from RGMrType... - * - * IMPLICIT INPUTS: - * - * IMPLICIT OUTPUTS: - * - * FUNCTION VALUE: - * - * MrmSUCCESS - literal found and returned - * MrmWRONG_TYPE - unsupported literal type encountered - * MrmNOT_FOUND - literal not found - * MrmFAILURE - file system error - * - * SIDE EFFECTS: - * - *-- - */ - -Cardinal -MrmFetchLiteral (MrmHierarchy hierarchy_id, - String index, - Display *display, - XtPointer *value_return, - MrmCode *type_return) -{ - - /* - * Local variables - */ - Cardinal result; /* function results */ - URMResourceContextPtr context_id; /* for the literal */ - URMPointerListPtr ctxlist = NULL; /* save added contexts */ - Cardinal ndx; /* loop index */ - int vec_size = 0; - int vec_count = 0; - _MrmDisplayToAppContext(display); - - _MrmAppLock(app); - _MrmProcessLock(); - - /* - * Read the literal, discard the context, and return. - */ - UrmGetResourceContext ((char *(*)())NULL, (void(*)())NULL, 0, &context_id); - result = Urm__FetchLiteral (hierarchy_id, index, context_id, &ctxlist); - if ( result == MrmSUCCESS ) - { - *value_return = (XtPointer) UrmRCBuffer (context_id); - (*type_return) = (MrmCode) UrmRCType (context_id); - vec_size = UrmRCSize (context_id); - switch ( *type_return ) - { - case MrmRtypeIconImage: - case MrmRtypeColor: - case MrmRtypeColorTable: - case MrmRtypeXBitmapFile: - if ( ctxlist != NULL ) - { - for ( ndx=0 ; ndxcount; - result = Urm__CW_ConvertValue (NULL, (long*)value_return, - (MrmType)*type_return, 0, display, - hierarchy_id, NULL) ; - if ( result != MrmSUCCESS ) - { - _MrmAppUnlock(app); - _MrmProcessUnlock(); - return MrmFAILURE; - } - Urm__CW_SafeCopyValue ((long *)value_return, (MrmType)*type_return, - NULL, vec_count, vec_size); - UrmFreeResourceContext (context_id); - break; - - case MrmRtypeIntegerVector: - /* - ** Do necessary conversions (Fixups were done by Urm__FetchLiteral) - */ - vec_count = ((RGMIntegerVectorPtr)*value_return)->count; - vec_size = vec_count * sizeof ( int * ); - result = Urm__CW_ConvertValue (NULL, (long*)value_return, - (MrmType)*type_return, 0, display, - hierarchy_id, NULL) ; - if ( result != MrmSUCCESS ) - { - _MrmAppUnlock(app); - _MrmProcessUnlock(); - return MrmFAILURE; - } - Urm__CW_SafeCopyValue ((long *)value_return, (MrmType)*type_return, - NULL, vec_count, vec_size); - UrmFreeResourceContext (context_id); - break; - - default : - /* - ** Do necessary conversions (Fixups were done by Urm__FetchLiteral) - */ - result = Urm__CW_ConvertValue (NULL, (long*)value_return, - (MrmType)*type_return, 0, display, - hierarchy_id, NULL) ; - - switch ( *type_return ) - { - /* - * Free the context id AND the buffer in these cases - */ - case MrmRtypeTransTable: - case MrmRtypeClassRecName: - case MrmRtypeKeysym: - UrmFreeResourceContext (context_id); - break; - - default: - /* - * Only free the context id in all other cases - */ - (*(context_id->free_func)) (context_id) ; - break; - } - - if ( result != MrmSUCCESS ) - { - _MrmAppUnlock(app); - _MrmProcessUnlock(); - return MrmFAILURE; - } - break; - } - _MrmAppUnlock(app); - _MrmProcessUnlock(); - return MrmSUCCESS; - } - else - { - (*(context_id->free_func)) (context_id) ; - _MrmAppUnlock(app); - _MrmProcessUnlock(); - return result; - } -} - - - -/* - *++ - * - * PROCEDURE DESCRIPTION: - * - * This routine fetches an icon literal from a hierarchy. It converts - * the icon to an X pixmap. - * - * FORMAL PARAMETERS: - * - * hierarchy_id id of an open hierarchy containing the literal - * index index of the desired literal - * screen screen to use for pixmap - * display display to use for pixmap - * fgpix foreground color for pixmap - * bgpix background color for pixmap - * pixmap_return to return resulting X pixmap - * - * IMPLICIT INPUTS: - * - * IMPLICIT OUTPUTS: - * - * FUNCTION VALUE: - * - * SIDE EFFECTS: - * - *-- - */ - -Cardinal -MrmFetchIconLiteral (MrmHierarchy hierarchy_id, - String index, - Screen *screen, - Display *display, - Pixel fgpix, - Pixel bgpix, - Pixmap *pixmap_return) -{ - - /* - * Local variables - */ - Cardinal result; /* function results */ - URMResourceContextPtr context_id; /* for the literal */ - URMPointerListPtr ctxlist = NULL; /* save added contexts */ - Cardinal ndx; /* loop index */ - MrmType type; - _MrmDisplayToAppContext(display); - - _MrmAppLock(app); - _MrmProcessLock(); - - /* - * Read the literal, and deal with errors - */ - UrmGetResourceContext ((char *(*)())NULL, (void(*)())NULL, 0, &context_id); - result = Urm__FetchLiteral (hierarchy_id, index, context_id, &ctxlist); - if ( result == MrmSUCCESS ) { - type = UrmRCType(context_id); - } - else - { - if ( ctxlist != NULL ) - { - for ( ndx=0 ; ndxwidth; - *height = icon->height; - break; - /* - >>> Andy research here if we can do this for a depth of 1 - case MrmRtypeXBitmapFile: - result = Urm__CW_ReadBitmapFile (UrmRCBuffer(context_id), screen, - fgpix, bgpix, pixmap_return); - break; - */ - default: - result = MrmWRONG_TYPE; - } - - if ( ctxlist != NULL ) - { - for ( ndx=0 ; ndxdesc_type) - { - case URMColorDescTypeName: - result = Urm__UT_GetNamedColorPixel - (display, cmap, colorptr, pixel_return, - XBlackPixelOfScreen(XDefaultScreenOfDisplay(display))); - break; - case URMColorDescTypeRGB: - result = Urm__UT_GetColorPixel - (display, cmap, colorptr, pixel_return, - XBlackPixelOfScreen(XDefaultScreenOfDisplay(display))); - break; - default: - sprintf(err_msg, _MrmMMsg_0040); - result = Urm__UT_Error ("MrmFetchColorLiteral", - err_msg, NULL, NULL, MrmFAILURE) ; - _MrmAppUnlock(app); - _MrmProcessUnlock(); - return result; - }; - UrmFreeResourceContext (context_id); - - /* partial success only returned when a color allocation fails, but - we've tried to make a reasonable substitution */ - if (result == MrmPARTIAL_SUCCESS) result = MrmSUCCESS; - _MrmAppUnlock(app); - _MrmProcessUnlock(); - return result; - -} - - - -/* - *++ - * - * PROCEDURE DESCRIPTION: - * - * UrmGetIndexedLiteral searches a single database file for a literal - * given its index (i.e. it gets a public literal from a single file). - * It returns the literal as the contents of the context buffer. The - * group which is fetched is always URMgLiteral. The literal type - * filter is taken from the context; if unmodified in the context - * as obtained from UrmGetResourceContext, there is no filtering - * (type=RGMtNul). - * - * The buffer contents will be as follows for some common literal - * types obtained from a .UID file. Note that in some cases that - * the caller must fix up offsets to be memory pointers. - * - * UrmRCType(context_id) == MrmRtypeChar8: - * UrmRCBuffer(context_id) contains a nul-terminated - * ASCII string - * - * UrmRCType(context_id) == MrmRtypeCString: - * UrmRCBuffer(context_id) contains a compound string - * - * UrmRCType(context_id) == MrmRtypeChar8Vector: - * UrmRCType(context_id) == MrmRtypeCStringVector: - * UrmRCBuffer(context_id) contains an RGM text vector - * or stringtable (RGMTextVector). The items in the - * text vector contain offsets into the buffer which - * locate either nul-terminated ASCII strings or compound - * compound strings. These may be relocated to memory - * pointers by adding the buffer address to the offset, i.e. - * item[n].text_item.pointer = item[n].text_item.offset+bufadr - * - * FORMAL PARAMETERS: - * - * file_id id of an open URM database file (IDB file) - * index index of the desired literal - * context_id resource context into which to read the literal - * - * IMPLICIT INPUTS: - * - * IMPLICIT OUTPUTS: - * - * FUNCTION VALUE: - * - * MrmSUCCESS operation succeeded - * MrmBAD_CONTEXT invalid resource context - * Other See UrmIdbGetIndexedResource - * - * SIDE EFFECTS: - * - *-- - */ - -Cardinal -UrmGetIndexedLiteral (IDBFile file_id , - String index , - URMResourceContextPtr context_id ) -{ - - /* - * Local variables - */ - MrmType lit_type ; /* the type of the literal */ - - - /* - * Validate context, then attempt the read. - */ - if ( ! UrmRCValid(context_id) ) - return Urm__UT_Error ("UrmGetIndexedLiteral", _MrmMMsg_0043, - file_id, context_id, MrmBAD_CONTEXT) ; - - lit_type = UrmRCType (context_id) ; - return UrmIdbGetIndexedResource - (file_id, index, URMgLiteral, lit_type, context_id) ; - -} - - -/* - *++ - * - * PROCEDURE DESCRIPTION: - * - * UrmGetRIDLiteral retrieves a literal from a single database file - * given its resource id as an accessor. It returns the literal record. - * - * FORMAL PARAMETERS: - * - * file_id id of an open URM database file (IDB file) - * resource_id resource id for literal - * context_id literal context in which to return record read in - * - * IMPLICIT INPUTS: - * - * IMPLICIT OUTPUTS: - * - * FUNCTION VALUE: - * - * MrmSUCCESS operation succeeded - * MrmNOT_FOUND literal not found - * MrmFAILURE operation failed, further reason not given. - * - * SIDE EFFECTS: - * - *-- - */ - -Cardinal -UrmGetRIDLiteral (IDBFile file_id , - MrmResource_id resource_id , - URMResourceContextPtr context_id ) -{ - - /* - * Local variables - */ - MrmType lit_type ; /* the type of the literal */ - - - /* - * Validate context, then attempt the read. - */ - if ( ! UrmRCValid(context_id) ) - return Urm__UT_Error ("UrmGetRIDLiteral", _MrmMMsg_0043, - file_id, context_id, MrmBAD_CONTEXT) ; - - lit_type = UrmRCType (context_id) ; - return UrmIdbGetRIDResource - (file_id, resource_id, URMgLiteral, lit_type, context_id) ; - -} - - -/* - *++ - * - * PROCEDURE DESCRIPTION: - * - * Urm__HGetIndexedLiteral is exactly like UrmGetLiteral except - * that it searches a hierarchy for the literal rather than reading - * from a single file. - * - * FORMAL PARAMETERS: - * - * hierarchy_id hierarchy to be searched - * index index of the desired literal - * context_id resource context into which to read the literal - * file_id_return to return IDB file in which literal was found - * - * IMPLICIT INPUTS: - * - * IMPLICIT OUTPUTS: - * - * FUNCTION VALUE: - * - * MrmSUCCESS operation succeeded - * MrmBAD_CONTEXT invalid resource context - * Other See UrmIdbGetIndexedResource - * - * SIDE EFFECTS: - * - *-- - */ - -Cardinal -Urm__HGetIndexedLiteral (MrmHierarchy hierarchy_id , - String index , - URMResourceContextPtr context_id , - IDBFile *file_id_return ) -{ - - /* - * Local variables - */ - MrmType lit_type ; /* the type of the literal */ - - /* - * Validate hierarchy and context, then attempt the read. - */ - if ( hierarchy_id == NULL ) - return Urm__UT_Error ("Urm__HGetIndexedLiteral", _MrmMMsg_0023, - NULL, NULL, MrmBAD_HIERARCHY) ; - if ( ! MrmHierarchyValid(hierarchy_id) ) - return Urm__UT_Error ("Urm__HGetIndexedLiteral", _MrmMMsg_0024, - NULL, NULL, MrmBAD_HIERARCHY) ; - if ( ! UrmRCValid(context_id) ) - return Urm__UT_Error ("Urm__HGetIndexedLiteral", _MrmMMsg_0043, - NULL, context_id, MrmBAD_CONTEXT) ; - - lit_type = UrmRCType (context_id) ; - return UrmHGetIndexedResource - (hierarchy_id, index, URMgLiteral, lit_type, context_id, file_id_return) ; - -} - - - -/* - *++ - * - * PROCEDURE DESCRIPTION: - * - * UrmHGetIndexedLiteral is exactly like UrmGetLiteral except - * that it searches a hierarchy for the literal rather than reading - * from a single file. - * - * FORMAL PARAMETERS: - * - * hierarchy_id hierarchy to be searched - * index index of the desired literal - * context_id resource context into which to read the literal - * - * IMPLICIT INPUTS: - * - * IMPLICIT OUTPUTS: - * - * FUNCTION VALUE: - * - * MrmSUCCESS operation succeeded - * MrmBAD_CONTEXT invalid resource context - * Other See UrmIdbGetIndexedResource - * - * SIDE EFFECTS: - * - *-- - */ - -Cardinal -UrmHGetIndexedLiteral (MrmHierarchy hierarchy_id , - String index , - URMResourceContextPtr context_id ) -{ - - /* - * Local variables - */ - IDBFile dummy ; /* unused file return */ - - return Urm__HGetIndexedLiteral (hierarchy_id, index, context_id, &dummy) ; -} - diff --git a/lib/Mrm/Mrmwcrw.c b/lib/Mrm/Mrmwcrw.c index 3c5857f..fe3db52 100644 --- a/lib/Mrm/Mrmwcrw.c +++ b/lib/Mrm/Mrmwcrw.c @@ -1390,7 +1390,7 @@ Urm__CW_CreateArglist (Widget parent, } break; default: - sprintf (err_msg, "%s", _MrmMMsg_0040); + sprintf (err_msg, _MrmMMsg_0040); result = Urm__UT_Error ("Urm__CW_ConvertValue", err_msg, NULL, NULL, MrmFAILURE) ; }; @@ -2426,7 +2426,7 @@ Urm__CW_ConvertValue (Widget parent, } break; default: - sprintf(err_msg, "%s", _MrmMMsg_0040); + sprintf(err_msg, _MrmMMsg_0040); return Urm__UT_Error ("Urm__CW_ConvertValue", err_msg, NULL, NULL, MrmFAILURE) ; }; diff --git a/lib/Mrm/Mrmwcrw.c.format-security b/lib/Mrm/Mrmwcrw.c.format-security deleted file mode 100644 index fe3db52..0000000 --- a/lib/Mrm/Mrmwcrw.c.format-security +++ /dev/null @@ -1,3639 +0,0 @@ -/* - * Motif - * - * Copyright (c) 1987-2012, The Open Group. All rights reserved. - * - * These libraries and programs are free software; you can - * redistribute them and/or modify them under the terms of the GNU - * Lesser General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) - * any later version. - * - * These libraries and programs are distributed in the hope that - * they will be useful, but WITHOUT ANY WARRANTY; without even the - * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU Lesser General Public License for more - * details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with these librararies and programs; if not, write - * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth - * Floor, Boston, MA 02110-1301 USA - */ -/* - * HISTORY - */ -#ifdef HAVE_CONFIG_H -#include -#endif - - -#ifdef REV_INFO -#ifndef lint -static char rcsid[] = "$TOG: Mrmwcrw.c /main/20 1999/05/19 15:26:23 mgreess $" -#endif -#endif - -/* (c) Copyright 1989, 1990, DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS. */ - -/* - *++ - * FACILITY: - * - * UIL Resource Manager (URM): - * - * ABSTRACT: - * - * This module contains the routine which implement widget creation - * and management at runtime from a widget stored in a resource context. - * - *-- - */ - - -/* - * - * INCLUDE FILES - * - */ -#include -#include -#include -#include "MrmosI.h" -#include "MrmMsgI.h" -#include -#include /* for ALLOCATE/DEALLOCATE_LOCAL */ -#include /* for XmGetTearOffControl */ -#include /* for XmDisplay */ - -#include -#include -#include - -/* - * - * TABLE OF CONTENTS - * - * UrmCreateWidgetTree Create a widget and its subtree - * - * UrmCreateWidgetInstance Create a widget instance - * - * Urm__CW_CreateArglist Create a widget arglist - * - * Urm__CW_FixupCallback Complete a callback item - * - * Urm__CW_EvaluateResource Evaluate a resource ref value - * - */ - - -static void DisplayDestroyCallback (Widget w, - XtPointer client_data, - XtPointer call_data ); - -/* - * - * DEFINE and MACRO DEFINITIONS - * - */ - -#define MAKEINT(float_value) ((int) (((float_value) > 0.0) ? \ - ((float_value) + 0.5) : \ - ((float_value) - 0.5))) - - - -/* - *++ - * - * PROCEDURE DESCRIPTION: - * - * UrmCreateWidgetInstanceCleanup determines from a RGM widget - * record if the widget instance is real. If it is and it has - * a cleanup, the cleanup is called. This mechanism is - * used to clean up dangling XmRenderTable and XmRendition handles - * left dangling in calls to UrmCreateWidgetInstance. - * - * FORMAL PARAMETERS: - * - * context_id context containing widget record describing widget - * to create - * hierarchy_id URM hierarchy from which to read public resources - * file_id URM file from which to read private resources - * child id of child widget - * - * IMPLICIT INPUTS: - * - * IMPLICIT OUTPUTS: - * - * FUNCTION VALUE: - * - * MrmSUCCESS operation succeeded - * MrmBAD_CONTEXT invalid context - * MrmBAD_WIDGET_REC invalid widget record - * - * SIDE EFFECTS: - * - *-- - */ - -Cardinal -UrmCreateWidgetInstanceCleanup (URMResourceContextPtr context_id, - Widget child, - IDBFile file_id) -{ - /* - * Local variables - */ - RGMWidgetRecordPtr widgetrec ; /* widget record in the context */ - WCIClassDescPtr cldesc ; /* class descriptor */ - Cardinal result; - - /* - * Validate the context and the widget record in the context. - * Check the variety and call the appropriate set or create function. - */ - if ( ! UrmRCValid(context_id) ) - return Urm__UT_Error ("UrmCreateWidgetInstanceCleanup", _MrmMMsg_0043, - NULL, NULL, MrmBAD_CONTEXT) ; - widgetrec = (RGMWidgetRecordPtr) UrmRCBuffer (context_id) ; - if ( ! UrmWRValid(widgetrec) ) - return Urm__UT_Error ("UrmCreateWidgetInstanceCleanup", _MrmMMsg_0026, - NULL, context_id, MrmBAD_WIDGET_REC) ; - - if (widgetrec->variety == UilMrmWidgetVariety) - { - result = Urm__FindClassDescriptor (file_id, - widgetrec->type, - (XtPointer) - ((char *)widgetrec+widgetrec->class_offs), - &cldesc) ; - if ( result != MrmSUCCESS ) return result ; - - if (NULL != cldesc->cleanup) (*(cldesc->cleanup)) (child) ; - } - else if (widgetrec->variety != UilMrmAutoChildVariety) - return Urm__UT_Error("UrmCreateWidgetInstanceCleanup", _MrmMMsg_0055, - NULL, context_id, MrmBAD_WIDGET_REC); - - return MrmSUCCESS; -} - - -/* - *++ - * - * PROCEDURE DESCRIPTION: - * - * UrmCreateWidgetTree is the recursive routine - * which recurses down a widget subtree and instantiates all widgets - * in the tree. The recursion process is: - * - * o Create this widget. - * o Create a new context. Read each child of this widget - * into the context in succession. Create each child, - * saving its id. - * o manage the children - * - * This routine accepts override parameters for the widget name, and - * to override arguments in the creation arglist. The latter are appended - * to the list created from the UID file, and do not replace all values. - * The parameters are not passed down to any children in the subtree. - * - * FORMAL PARAMETERS: - * - * context_id context containing widget record describing widget - * to create - * parent id of parent widget - * hierarchy_id URM hierarchy from which to read public resources - * file_id URM file from which to read private resources - * ov_name Name to override widget name (NULL for no override) - * ov_args Override arglist, exactly as would be given to - * XtCreateWidget (conversion complete, etc). NULL - * for no override. - * ov_num_args # args in ov_args; 0 for no override - * keytype type of key which accessed this widget - * kindex index for URMrIndex access - * krid resource id for URMrRID access - * svlist list of SetValues descriptors for widgets in tree - * wref_id to accumulate widget reference definitions - * w_return To return id of newly created widget - * - * IMPLICIT INPUTS: - * - * IMPLICIT OUTPUTS: - * - * FUNCTION VALUE: - * - * MrmSUCCESS operation succeeded - * MrmBAD_CONTEXT invalid context - * MrmBAD_WIDGET_REC invalid widget record - * - * SIDE EFFECTS: - * - *-- - */ - -Cardinal -UrmCreateWidgetTree (URMResourceContextPtr context_id, - Widget parent, - MrmHierarchy hierarchy_id, - IDBFile file_id, - String ov_name, - ArgList ov_args, - Cardinal ov_num_args, - MrmCode keytype, - String kindex, - MrmResource_id krid, - MrmManageFlag manage, - URMPointerListPtr *svlist, - URMResourceContextPtr wref_id, - Widget *w_return) -{ - /* - * Local variables - */ - Cardinal result ; /* function results */ - Widget widget_id ; /* this widget id */ - URMResourceContextPtr child_ctx ; /* context for children */ - Widget child_id ; /* current child */ - IDBFile loc_file_id ; /* local file id, may be modified */ - RGMWidgetRecordPtr widgetrec ; /* the widget record in the context */ - int ndx ; /* loop index */ - RGMChildrenDescPtr childrendesc ; /* children list descriptor */ - RGMChildDescPtr childptr ; /* current child */ - String child_idx = NULL ; /* current child index */ - char err_msg[300] ; - char *w_name; - - /* - * Create the widget instance. - */ - result = UrmCreateOrSetWidgetInstance (context_id, parent, hierarchy_id, - file_id, ov_name, ov_args, ov_num_args, - keytype, kindex, krid, manage, svlist, - wref_id, &widget_id, &w_name) ; - if ( result != MrmSUCCESS ) return result ; - *w_return = widget_id ; - - /* - * Initialize a context, and create all the children, Saving their ids. - * Note there are no interior returns from the processing loop, and that - * all locally acquired resources are returned at the routine exit. - * - * Initialize a sibling reference context for any class which allows - * sibling widget references. - */ - widgetrec = (RGMWidgetRecordPtr) UrmRCBuffer (context_id) ; - if ( widgetrec->children_offs > 0) - { - UrmGetResourceContext ((char *(*)())NULL, (void(*)())NULL, 0, &child_ctx); - childrendesc = - (RGMChildrenDescPtr)((char *)widgetrec+widgetrec->children_offs); - - for ( ndx=0 ; ndxcount ; ndx++ ) - { - childptr = &childrendesc->child[ndx] ; - - /* - * Read the next child into the child context. Continue looping if it - * can't be found. Reading the child from a hierarchy may modify the - * file id, but only for reading the child's subtree. - */ - loc_file_id = file_id ; - switch ( childptr->type ) - { - case URMrIndex: - child_idx = (char *) widgetrec+childptr->key.index_offs ; - if ( childptr->access == URMaPublic ) - result = UrmHGetWidget (hierarchy_id, child_idx, - child_ctx, &loc_file_id) ; - else - result = UrmGetIndexedWidget (file_id, child_idx, child_ctx) ; - if ( result != MrmSUCCESS ) - sprintf (err_msg, _MrmMMsg_0052, child_idx) ; - break ; - case URMrRID: - result = UrmGetRIDWidget (file_id, childptr->key.id, - child_ctx) ; - if ( result != MrmSUCCESS ) - sprintf (err_msg, _MrmMMsg_0053, childptr->key.id) ; - break ; - default: - result = MrmFAILURE ; - sprintf (err_msg, _MrmMMsg_0054, childptr->type) ; - break ; - } - if ( result != MrmSUCCESS ) - { - Urm__UT_Error ("UrmCreateWidgetTree", - err_msg, NULL, NULL, result) ; - continue ; - } - - /* - * Create the child and its subtree. - */ - result = UrmCreateWidgetTree (child_ctx, widget_id, hierarchy_id, - loc_file_id, NULL, NULL, 0, - childptr->type, child_idx, - childptr->key.id, - ((childptr->manage) ? - MrmManageManage : MrmManageUnmanage), - svlist, wref_id, &child_id) ; - UrmCreateWidgetInstanceCleanup(child_ctx, child_id, loc_file_id); - if ( result != MrmSUCCESS ) continue ; - - /* - * loop end - */ - } - /* - * done. Deallocate local resources. - */ - UrmFreeResourceContext (child_ctx) ; - } - - /* - * Add the parent widget to the widget reference structure, and update the - * SetValues descriptors if appropriate - */ - if ((w_name != NULL) && (*svlist != NULL)) - Urm__CW_ResolveSVWidgetRef(svlist, w_name, *w_return); - - return MrmSUCCESS ; -} - - -/* - *++ - * - * PROCEDURE DESCRIPTION: - * - * UrmCreateOrSetWidgetInstance determines from a RGM widget - * record if the widget instance is real and has to be created by - * a call to UrmCreateWidgetInstance or is an automatic child widget - * and has to be set by a call to UrmSetWidgetInstance. - * - * Once UrmCreateOrSetWidgetInstance has been called, then the only - * information in the RGM record which may still be required is the - * privacy information and the widget children list. This information - * may be copied and the resource context reused by users who are doing - * recursive widget access, and wish to avoid recursive accumulation - * of resource contexts in memory. - * - * The URM hierarchy for public resources and the IDB file for private - * resources are required to evaluate resource references occurring in - * the widget arglist. - * - * This routine accepts override parameters for the widget name, and - * to override arguments in the creation arglist. The latter are appended - * to the list created from the UID file, and do not replace all values. - * - * FORMAL PARAMETERS: - * - * context_id context containing widget record describing widget - * to create - * parent id of parent widget - * hierarchy_id URM hierarchy from which to read public resources - * file_id URM file from which to read private resources - * ov_name Name to override widget name (NULL for no override) - * ov_args Override arglist, exactly as would be given to - * XtCreateWidget (conversion complete, etc). NULL - * for no override. - * ov_num_args # args in ov_args; 0 for no override - * keytype type of key which accessed this widget - * kindex index for URMrIndex access - * krid resource id for URMrRID access - * manage create-managed flag - * svlist list of SetValues descriptors - * wref_id structure in which to resolve references to widgets - * which have already been defined. - * w_return To return id of newly created widget - * - * IMPLICIT INPUTS: - * - * IMPLICIT OUTPUTS: - * - * FUNCTION VALUE: - * - * MrmSUCCESS operation succeeded - * MrmBAD_CONTEXT invalid context - * MrmBAD_WIDGET_REC invalid widget record - * - * SIDE EFFECTS: - * - *-- - */ - -Cardinal -UrmCreateOrSetWidgetInstance (URMResourceContextPtr context_id, - Widget parent, - MrmHierarchy hierarchy_id, - IDBFile file_id, - String ov_name, - ArgList ov_args, - Cardinal ov_num_args, - MrmCode keytype, - String kindex, - MrmResource_id krid, - MrmManageFlag manage, - URMPointerListPtr *svlist, - URMResourceContextPtr wref_id, - Widget *w_return, - char **w_name) -{ - /* - * Local variables - */ - RGMWidgetRecordPtr widgetrec ; /* widget record in the context */ - - /* - * Validate the context and the widget record in the context. - * Check the variety and call the appropriate set or create function. - */ - if ( ! UrmRCValid(context_id) ) - return Urm__UT_Error ("UrmCreateOrSetWidgetInstance", _MrmMMsg_0043, - NULL, NULL, MrmBAD_CONTEXT) ; - widgetrec = (RGMWidgetRecordPtr) UrmRCBuffer (context_id) ; - if ( ! UrmWRValid(widgetrec) ) - return Urm__UT_Error ("UrmCreateOrSetWidgetInstance", _MrmMMsg_0026, - NULL, context_id, MrmBAD_WIDGET_REC) ; - - if (widgetrec->variety == UilMrmWidgetVariety) - { - return UrmCreateWidgetInstance(context_id, parent, hierarchy_id, file_id, - ov_name, ov_args, ov_num_args, keytype, - kindex, krid, manage, svlist, wref_id, - w_return, w_name); - } - else if (widgetrec->variety == UilMrmAutoChildVariety) - { - *w_name = NULL; - return UrmSetWidgetInstance(context_id, parent, hierarchy_id, file_id, - ov_args, ov_num_args, keytype, kindex, - krid, manage, svlist, wref_id, w_return); - } - else - return Urm__UT_Error("UrmCreateOrSetWidgetInstance", _MrmMMsg_0055, - NULL, context_id, MrmBAD_WIDGET_REC); -} - - -/* - *++ - * - * PROCEDURE DESCRIPTION: - * - * UrmCreateWidgetInstance creates a widget instance from a RGM widget - * record by: - * - * o Creating a legal XtCreateWidget arglist from the RGM - * arglist by expanding compressed tags, evaluating values, - * and doing type conversion. - * - * o Deriving the correct low-level widget creation routine - * from the RGM record's class specifier, and calling with - * the given parent and the arglist. - * - * Once UrmCreateWidgetInstance has been called, then the only - * information in the RGM record which may still be required is the - * privacy information and the widget children list. This information - * may be copied and the resource context reused by users who are doing - * recursive widget access, and wish to avoid recursive accumulation - * of resource contexts in memory (see next routine). - * - * The URM hierarchy for public resources and the IDB file for private - * resources are required to evaluate resource references occurring in - * the widget arglist. - * - * This routine accepts override parameters for the widget name, and - * to override arguments in the creation arglist. The latter are appended - * to the list created from the UID file, and do not replace all values. - * - * FORMAL PARAMETERS: - * - * context_id context containing widget record describing widget - * to create - * parent id of parent widget - * hierarchy_id URM hierarchy from which to read public resources - * file_id URM file from which to read private resources - * ov_name Name to override widget name (NULL for no override) - * ov_args Override arglist, exactly as would be given to - * XtCreateWidget (conversion complete, etc). NULL - * for no override. - * ov_num_args # args in ov_args; 0 for no override - * keytype type of key which accessed this widget - * kindex index for URMrIndex access - * krid resource id for URMrRID access - * manage create-managed flag - * svlist list of SetValues descriptors - * wref_id structure in which to resolve references to widgets - * which have already been defined. - * w_return To return id of newly created widget - * - * IMPLICIT INPUTS: - * - * IMPLICIT OUTPUTS: - * - * FUNCTION VALUE: - * - * MrmSUCCESS operation succeeded - * MrmBAD_CONTEXT invalid context - * MrmBAD_WIDGET_REC invalid widget record - * - * SIDE EFFECTS: - * - *-- - */ - -/*ARGSUSED*/ -Cardinal -UrmCreateWidgetInstance (URMResourceContextPtr context_id, - Widget parent, - MrmHierarchy hierarchy_id, - IDBFile file_id, - String ov_name, - ArgList ov_args, - Cardinal ov_num_args, - MrmCode keytype, /* unused */ - String kindex, /* unused */ - MrmResource_id krid, /* unused */ - MrmManageFlag manage, - URMPointerListPtr *svlist, - URMResourceContextPtr wref_id, - Widget *w_return, - char **w_name) -{ - /* - * Local variables - */ - Cardinal result ; /* function results */ - RGMWidgetRecordPtr widgetrec ; /* widget record in the context */ - RGMArgListDescPtr argdesc = NULL ; /* arg list descriptor in record */ - Arg *args = NULL ; /* arg list argument for create */ - Cardinal num_used = 0 ; /* number of args used in arglist */ - MrmCount num_listent = ov_num_args ; /* # entries in args */ - WCIClassDescPtr cldesc ; /* class descriptor */ - URMPointerListPtr ptrlist = NULL ; /* to hold scratch callbacks */ - URMPointerListPtr cblist = NULL ; /* to hold scratch contexts */ - URMPointerListPtr ftllist = NULL ; /* to hold scratch fontlists */ - int ndx ; /* loop index */ - RGMCallbackDescPtr cbptr ; /* creation callback descriptor */ - RGMCallbackItemPtr itmptr ; /* current callback item */ - void (* cb_rtn) () ; /* current callback routine */ - /* BEGIN OSF Fix pir 1860, 2813 */ - XmAnyCallbackStruct cb_reason; /* creation callback reason */ - /* END OSF Fix pir 1860, 2813 */ - - /* - * Validate the context and the widget record in the context. - * Get the low-level creation routine pointer. - */ - if ( ! UrmRCValid(context_id) ) - return Urm__UT_Error ("UrmCreateWidgetInstance", _MrmMMsg_0043, - NULL, NULL, MrmBAD_CONTEXT) ; - widgetrec = (RGMWidgetRecordPtr) UrmRCBuffer (context_id) ; - if ( ! UrmWRValid(widgetrec) ) - return Urm__UT_Error ("UrmCreateWidgetInstance", _MrmMMsg_0026, - NULL, context_id, MrmBAD_WIDGET_REC) ; - - result = Urm__FindClassDescriptor (file_id, - widgetrec->type, - (XtPointer) - ((char *)widgetrec+widgetrec->class_offs), - &cldesc) ; - if ( result != MrmSUCCESS ) - return result ; - - /* - * Allocate the args list, big enough for all the arguments in the widget - * record plus all the override arguments. Also initialize a pointer list - * to save any contexts created to evaluate resources. - */ - if ( widgetrec->arglist_offs != 0) - { - argdesc = (RGMArgListDescPtr) - ((char *)widgetrec + widgetrec->arglist_offs) ; - num_listent += argdesc->count + argdesc->extra ; - UrmPlistInit (10, &ftllist) ; - } - if ( num_listent > 0 ) - { - args = (Arg *) XtMalloc (num_listent*sizeof(Arg)) ; - UrmPlistInit (10, &ptrlist) ; - } - - /* - * Set up the structure for the callback list to free memory on destory widget - */ - UrmPlistInit (10, &cblist); - - /* - * Set the arg list from the widget record argument list - */ - if ( argdesc != NULL ) - { - Urm__CW_CreateArglist - (parent, widgetrec, argdesc, ptrlist, cblist, ftllist, - hierarchy_id, file_id, args, svlist, wref_id, &num_used) ; - } - - /* - * Copy in any override args - */ - for ( ndx=0 ; ndxname_offs; - *w_return = (*(cldesc->creator)) (parent, *w_name, args, num_used) ; - - Urm__CW_AddWRef (wref_id, *w_name, *w_return) ; - if ( *svlist != NULL ) - Urm__CW_UpdateSVWidgetRef (svlist, *w_return) ; - - if ( manage==MrmManageManage )XtManageChild(*w_return); - - /* - * Call the creation callbacks if there are any. - */ - if ( widgetrec->creation_offs != 0) - { - if (strcmp(file_id->db_version, URM1_1version) <= 0) - cbptr = Urm__CW_TranslateOldCallback((OldRGMCallbackDescPtr) - ((char *)widgetrec + - widgetrec->creation_offs)); - else - cbptr = (RGMCallbackDescPtr) ((char *)widgetrec + - widgetrec->creation_offs) ; - - if ( ptrlist == NULL ) - UrmPlistInit (10, &ptrlist) ; - result = Urm__CW_FixupCallback (parent, (XtPointer)widgetrec, cbptr, - ptrlist, cblist, hierarchy_id, - file_id, wref_id) ; - if ( result == MrmSUCCESS ) - for ( ndx=0 ; ndxcount ; ndx++ ) - { - itmptr = &cbptr->item[ndx] ; - - cb_rtn = (void (*)()) itmptr->runtime.callback.callback ; - if ( cb_rtn != (XtCallbackProc)NULL ) - /* BEGIN OSF Fix pir 2813 */ - { - cb_reason.reason = MrmCR_CREATE; - cb_reason.event = NULL; - (*cb_rtn) (*w_return, itmptr->runtime.callback.closure, - &cb_reason) ; - } - /* END OSF Fix pir 2813 */ - } - else if (result == MrmUNRESOLVED_REFS) - Urm__UT_Error("UrmCreateWidgetInstance", _MrmMMsg_0056, - NULL, NULL, MrmFAILURE) ; - else - return Urm__UT_Error("UrmCreateWidgetInstance", _MrmMMsg_0057, - NULL, NULL, MrmFAILURE); - - if (strcmp(file_id->db_version, URM1_1version) <= 0) - XtFree((char *)cbptr); - } - - /* - * successfully created (as far as we can tell). Deallocate all local - * resources, including any contexts in the pointer list. - */ - if ( args != NULL ) XtFree ((char*)args) ; - if ( ptrlist != NULL ) - { - for ( ndx=0 ; ndxnum_ptrs > 0) - { - XtAddCallback (*w_return, XmNdestroyCallback, - (XtCallbackProc) UrmDestroyCallback, cblist); - } - else - { - UrmPlistFree (cblist); - } - - /* - ** We should really let Xt take care of handling the fontlists by using its - ** converters; but for the meanwhile avoid freeing the fontlists here, as the - ** widget may be one which doesn't do an XmFontListCopy. Instead, later free - ** our extra copy. - */ - if (ftllist != NULL) - { - if (UrmPlistNum(ftllist) > 0) - XtAddCallback(*w_return, XmNdestroyCallback, - (XtCallbackProc) UrmDestroyCallback, ftllist); - else - UrmPlistFree (ftllist) ; - } - - return MrmSUCCESS ; - -} - - -/* - *++ - * - * PROCEDURE DESCRIPTION: - * - * UrmSetWidgetInstance sets the appropriate resources from a RGM widget - * record on the appropriate automatically created child of parent by: - * - * o Creating a legal XtSetValues arglist from the RGM - * arglist by expanding compressed tags, evaluating values, - * and doing type conversion. - * - * o Finding the correct widget child of parent by uncompressing - * the resource compression code found in the RGM record's - * type specifier, and calling XtNameToWidget on the result. - * - * Once UrmSetWidgetInstance has been called, then the only - * information in the RGM record which may still be required is the - * privacy information and the widget children list. This information - * may be copied and the resource context reused by users who are doing - * recursive widget access, and wish to avoid recursive accumulation - * of resource contexts in memory (see next routine). - * - * The URM hierarchy for public resources and the IDB file for private - * resources are required to evaluate resource references occurring in - * the widget arglist. - * - * This routine accepts override parameters to override - * arguments in the setvalues arglist. They are appended - * to the list created from the UID file, and do not replace all values. - * - * FORMAL PARAMETERS: - * - * context_id context containing widget record describing widget - * to create - * parent id of parent widget - * hierarchy_id URM hierarchy from which to read public resources - * file_id URM file from which to read private resources - * ov_args Override arglist, exactly as would be given to - * XtCreateWidget (conversion complete, etc). NULL - * for no override. - * ov_num_args # args in ov_args; 0 for no override - * keytype type of key which accessed this widget - * kindex index for URMrIndex access - * krid resource id for URMrRID access - * manage create-managed flag - * svlist list of SetValues descriptors - * wref_id structure in which to resolve references to widgets - * which have already been defined. - * w_return To return id of newly created widget - * - * IMPLICIT INPUTS: - * - * IMPLICIT OUTPUTS: - * - * FUNCTION VALUE: - * - * MrmSUCCESS operation succeeded - * MrmBAD_CONTEXT invalid context - * MrmBAD_WIDGET_REC invalid widget record - * - * SIDE EFFECTS: - * - *-- - */ - -/*ARGSUSED*/ -Cardinal -UrmSetWidgetInstance (URMResourceContextPtr context_id, - Widget parent, - MrmHierarchy hierarchy_id, - IDBFile file_id, - ArgList ov_args, - Cardinal ov_num_args, - MrmCode keytype, /* unused */ - String kindex, /* unused */ - MrmResource_id krid, /* unused */ - MrmManageFlag manage, - URMPointerListPtr *svlist, - URMResourceContextPtr wref_id, - Widget *w_return) -{ - /* - * Local variables - */ - Cardinal result ; /* function results */ - RGMWidgetRecordPtr widgetrec ; /* widget record in the context */ - String c_name ; /* child name */ - String c_name_tmp ; /* child name - temporary */ - RGMArgListDescPtr argdesc = NULL ; /* arg list descriptor in record */ - Arg *args = NULL ; /* arg list argument for create */ - Cardinal num_used = 0 ; /* number of args used in arglist */ - MrmCount num_listent = ov_num_args ; /* # entries in args */ - URMPointerListPtr ptrlist = NULL ;/* to hold scratch contexts */ - URMPointerListPtr cblist = NULL ; /* to hold scratch callbacks */ - URMPointerListPtr ftllist = NULL ;/* to hold scratch fontlists */ - int ndx ; /* loop index */ - RGMCallbackDescPtr cbptr ; /* creation callback descriptor */ - RGMCallbackItemPtr itmptr ; /* current callback item */ - void (* cb_rtn) () ; /* current callback routine */ - /* BEGIN OSF Fix pir 1860, 2813 */ - XmAnyCallbackStruct cb_reason; /* creation callback reason */ - /* END OSF Fix pir 1860, 2813 */ - - /* - * Validate the context and the widget record in the context. - */ - if ( ! UrmRCValid(context_id) ) - return Urm__UT_Error ("UrmSetWidgetInstance", _MrmMMsg_0043, - NULL, NULL, MrmBAD_CONTEXT) ; - widgetrec = (RGMWidgetRecordPtr) UrmRCBuffer (context_id) ; - if ( ! UrmWRValid(widgetrec) ) - return Urm__UT_Error ("UrmSetWidgetInstance", _MrmMMsg_0026, - NULL, context_id, MrmBAD_WIDGET_REC) ; - - result = Urm__UncompressCode (file_id, widgetrec->type, &c_name) ; - if ( result != MrmSUCCESS ) - return Urm__UT_Error("UrmSetWidgetInstance", _MrmMMsg_0058, - NULL, context_id, result) ; - - /* Find the widget */ - if (strcmp(c_name, "TearOffControl") == 0) /* Special case */ - *w_return = XmGetTearOffControl(parent); - else - { - /* Need to add * for ScrolledText and ScrolledList */ - c_name_tmp = (String)ALLOCATE_LOCAL((strlen(c_name) + 2) * sizeof(char)); - sprintf(c_name_tmp, "*%s", c_name); - *w_return = XtNameToWidget(parent, c_name_tmp); - - /* Deal with ScrollBars for ScrolledList and ScrolledText subclasses. */ - if ((*w_return == NULL) && - ((strcmp(c_name, "VertScrollBar") == 0) || - (strcmp(c_name, "HorScrollBar") == 0))) - { - *w_return = XtNameToWidget(XtParent(parent), c_name_tmp); - } - - DEALLOCATE_LOCAL(c_name_tmp); - } - - if (*w_return == NULL) - return Urm__UT_Error("UrmSetWidgetInstance", _MrmMMsg_0059, - NULL, context_id, MrmFAILURE) ; - - /* - * Allocate the args list, big enough for all the arguments in the widget - * record plus all the override arguments. Also initialize a pointer list - * to save any contexts created to evaluate resources. - */ - if ( widgetrec->arglist_offs != 0) - { - argdesc = (RGMArgListDescPtr) - ((char *)widgetrec + widgetrec->arglist_offs) ; - num_listent += argdesc->count + argdesc->extra ; - UrmPlistInit (10, &ftllist) ; - } - if ( num_listent > 0 ) - { - args = (Arg *) XtMalloc (num_listent*sizeof(Arg)) ; - UrmPlistInit (10, &ptrlist) ; - } - - /* - * Set up the structure for the callback list to free memory on destroy widget - */ - UrmPlistInit (10, &cblist); - - /* - * Set the arg list from the widget record argument list - */ - if ( argdesc != NULL ) - { - Urm__CW_CreateArglist - (parent, widgetrec, argdesc, ptrlist, cblist, ftllist, - hierarchy_id, file_id, args, svlist, wref_id, &num_used) ; - } - - /* - * Copy in any override args - */ - for ( ndx=0 ; ndxcreation_offs != 0) - { - if (strcmp(file_id->db_version, URM1_1version) <= 0) - cbptr = Urm__CW_TranslateOldCallback((OldRGMCallbackDescPtr) - ((char *)widgetrec + - widgetrec->creation_offs)); - else - cbptr = (RGMCallbackDescPtr) ((char *)widgetrec + - widgetrec->creation_offs) ; - - if ( ptrlist == NULL ) - UrmPlistInit (10, &ptrlist) ; - result = Urm__CW_FixupCallback (parent, (XtPointer)widgetrec, - cbptr, ptrlist, cblist, hierarchy_id, - file_id, wref_id) ; - if ( result == MrmSUCCESS ) - for ( ndx=0 ; ndxcount ; ndx++ ) - { - itmptr = &cbptr->item[ndx] ; - - cb_rtn = (void (*)()) itmptr->runtime.callback.callback ; - if ( cb_rtn != (XtCallbackProc)NULL ) - /* BEGIN OSF Fix pir 2813 */ - { - cb_reason.reason = MrmCR_CREATE; - cb_reason.event = NULL; - (*cb_rtn) (*w_return, itmptr->runtime.callback.closure, - &cb_reason) ; - } - /* END OSF Fix pir 2813 */ - } - else if (result == MrmUNRESOLVED_REFS) - Urm__UT_Error("UrmCreateWidgetInstance", _MrmMMsg_0056, - NULL, NULL, MrmFAILURE) ; - else - return Urm__UT_Error("UrmCreateWidgetInstance", _MrmMMsg_0057, - NULL, NULL, MrmFAILURE); - - if (strcmp(file_id->db_version, URM1_1version) <= 0) - XtFree((char *)cbptr); - } - - /* - * successfully set (as far as we can tell). Deallocate all local - * resources, including any contexts in the pointer list. - */ - if ( args != NULL ) XtFree ((char*)args) ; - if ( ptrlist != NULL ) - { - for ( ndx=0 ; ndxnum_ptrs > 0) - { - XtAddCallback (*w_return, XmNdestroyCallback, - (XtCallbackProc) UrmDestroyCallback, cblist); - } - else - { - UrmPlistFree (cblist); - } - - /* - ** We should really let Xt take care of handling the fontlists by using its - ** converters; but for the meanwhile avoid freeing the fontlists here, as the - ** widget may be one which doesn't do an XmFontListCopy. Instead, later free - ** our extra copy. - */ - if (ftllist != NULL) - { - if (UrmPlistNum(ftllist) > 0) - XtAddCallback(*w_return, XmNdestroyCallback, - (XtCallbackProc) UrmDestroyCallback, ftllist); - else - UrmPlistFree (ftllist) ; - } - - return MrmSUCCESS ; - -} - - -/* - *++ - * - * PROCEDURE DESCRIPTION: - * - * Urm__CW_CreateArglist reads the arglist descriptor in an RGM widget - * record and produces a legal arglist for XtCreateWidget in the args - * parameter. Any argument which encounters an error, or which must - * be done with a SetValues, does not appear in the list. - * - * FORMAL PARAMETERS: - * - * parent parent of the widget being created - * widgetrec widget record pointer - * argdesc arglist descriptor in widget record - * ctxlist A pointer list to save contexts created to - * evaluate literals. - * ftllist A pointer list to save fontlists created for use - * as resource values, and which must be freed - * hierarchy_id URM hierarchy from which to read public resources - * file_id URM file from which to read private resources - * args buffer in which the arglist array of longwords is to - * be created. Caller guarantees that it is big enough - * (since caller knows number of arguments). - * svlist SetValues descriptor list. This routine will add - * any SetValues widget arguments to this list. - * wref_id reference structure from which references to - * previously created widgets in the tree can be - * resolved. - * num_used Returns number of arguments actually set in args - * - * IMPLICIT INPUTS: - * - * IMPLICIT OUTPUTS: - * - * FUNCTION VALUE: - * - * SIDE EFFECTS: - * - *-- - */ - -void -Urm__CW_CreateArglist (Widget parent, - RGMWidgetRecordPtr widgetrec, - RGMArgListDescPtr argdesc, - URMPointerListPtr ctxlist, - URMPointerListPtr cblist, - URMPointerListPtr ftllist, - MrmHierarchy hierarchy_id, - IDBFile file_id, - ArgList args, - URMPointerListPtr *svlist, - URMResourceContextPtr wref_id, - Cardinal *num_used) - -{ - /* - * Local structures - */ - typedef struct { - RGMIconImagePtr icon ; /* icon to be converted */ - RGMArgumentPtr pixarg ; /* argument in widget record */ - String filename; /* file name if pixtype is bitmap */ - MrmType pixtype ; /* MrmRtypeIconImage or */ - /* MrmRtypeXBitmapFile */ - } _SavePixmapItem, *_SavePixmapItemPtr ; - - /* - * Local variables - */ - Cardinal result ; /* function results */ - int ndx, cbndx; /* loop indices */ - RGMArgumentPtr argptr ; /* current argument descriptor */ - MrmType reptype ; /* arg value representation type */ - long argval ; /* arg value as it is in record */ - int vec_count ; /* count of items in the vector */ - long val ; /* value as immediate or pointer */ - RGMCallbackDescPtr cbptr ; /* val as callback descriptor */ - RGMCallbackItemPtr items; /* Callback items as RGM items */ - XtCallbackRec *callbacks; /* Callback items as Xt callbacks */ - RGMIconImagePtr icon ; /* val as icon image */ - RGMResourceDescPtr resptr ; /* values as resource reference */ - String ref_name ; /* referenced widget name */ - Widget ref_id ; /* referenced widget id */ - IDBFile act_file ; /* file from which literals read */ - RGMTextVectorPtr vecptr ; /* text vector arg value */ - char err_msg[300] ; - _SavePixmapItem pixargs[10] ; /* to save pixmap args */ - Cardinal pixargs_cnt = 0 ; /* # pixargs saved */ - _SavePixmapItemPtr savepix ; /* current saved pixmap entry */ - Screen *screen ; /* screen for pixmaps */ - Display *display ; /* display for pixmaps */ - Pixel fgint = (Pixel) -1 ; /* fg for pixmaps */ - Pixel bgint = (Pixel) -1 ; /* background for pixmaps */ - Pixmap pixmap ; /* result of icon conversion */ - Cardinal uncmp_res ; /* string uncompression result */ - WCIClassDescPtr class_desc ; /* for URM__FindClassDescriptor */ - String resource_name ; /* resource name for comparison */ - int vec_size ; - RGMFontListPtr fontlist; /* for converting old style fontlist */ - Boolean swap_needed; /* for resource arguments */ - - /* - * Loop through all the arguments in descriptor. An entry is made in the - * in the arglist for each entry which can be successfully evaluated, - * fixed up, and converted. - * - * Some arguments may be affected by other arg values in the arglist. These - * are deferred so that these other values will - * be available if they are present in the arglist. This removes order - * dependency. All such arguments are handled as special cases: - * IconImages: saved in pixargs vector - * - * Ordering may have an important effect on finding widget references. In - * particular, references to widgets in submenus depends on the submenus - * being created before the reference, as the referenced widget then - * appears in the widget reference structure. This is currently done - * by the compiler, which orders submenus first in an arglist. - */ - for ( ndx=0 ; ndxcount ; ndx++ ) - { - argptr = &argdesc->args[ndx] ; - reptype = argptr->arg_val.rep_type ; - swap_needed = FALSE ; - - /* - * Create the value. Some representation types and arguments require - * special handling. First, the immediate value or pointer is evaluated. - * then special handling is done. If no special handling is required, then - * the value is fixed up, converted, and put in the args list. - * - * Icon images are loaded (i.e. brought into memory and all pointer - * fixups done), but they are then treated as SetValues args, and saved - * for processing after the widget is created. - */ - argval = Urm__CW_EvaluateValOrOffset (reptype, (XtPointer)widgetrec, - argptr->arg_val.datum.ival, - argptr->arg_val.datum.offset) ; - val = argval ; - switch ( reptype ) - { - case MrmRtypeCallback: - if (strcmp(file_id->db_version, URM1_1version) <= 0) - cbptr = Urm__CW_TranslateOldCallback((OldRGMCallbackDescPtr)val); - else - cbptr = (RGMCallbackDescPtr)val; - - result = Urm__CW_FixupCallback(parent, (XtPointer)widgetrec, cbptr, - ctxlist, cblist, hierarchy_id, - file_id, wref_id) ; - switch (result) - { - case MrmSUCCESS: - /* Move individual items so array functions as callback list */ - items = cbptr->item; - callbacks = (XtCallbackRec *)((RGMCallbackDescPtr)val)->item; - - for (cbndx = 0; cbndx <= cbptr->count; cbndx++) - /* <= so that null item is copied. */ - { - callbacks[cbndx].callback = (XtCallbackProc) - items[cbndx].runtime.callback.callback; - callbacks[cbndx].closure = (XtPointer) - items[cbndx].runtime.callback.closure; - } - - val = (long)callbacks; - break; - case MrmUNRESOLVED_REFS: - Urm__CW_AppendCBSVWidgetRef - (file_id, svlist, cbptr, argptr->tag_code, - (String) ((char *)widgetrec+argptr->stg_or_relcode.tag_offs)); - /* No break */ - default: - continue; - } - if (strcmp(file_id->db_version, URM1_1version) <= 0) - XtFree((char *)cbptr); - break ; - case MrmRtypeResource: - resptr = (RGMResourceDescPtr) val ; - if (resptr->cvt_type & MrmResourceUnswapped) - { - resptr->cvt_type &= ~MrmResourceUnswapped; - swap_needed = TRUE; - } - - switch ( resptr->res_group ) - { - case URMgWidget: - if ( ((unsigned char)resptr->cvt_type==RGMwrTypeSubTree) || - Urm__IsSubtreeResource(file_id,argptr->tag_code) ) - { - result = - Urm__CW_LoadWidgetResource (parent, widgetrec, resptr, - ctxlist, hierarchy_id, file_id, - svlist, wref_id, &val) ; - if ( result != MrmSUCCESS ) continue ; - } - else - { - if ( resptr->type != URMrIndex ) - { - Urm__UT_Error ("Urm__CW_CreateArglist", _MrmMMsg_0060, - NULL, NULL, MrmFAILURE) ; - continue; - } - ref_name = (String) resptr->key.index; - result = Urm__CW_FindWRef (wref_id, ref_name, &ref_id) ; - if ( result != MrmSUCCESS ) - { - Urm__CW_AppendSVWidgetRef - (file_id, svlist, ref_name, argptr->tag_code, - (String)widgetrec+ - argptr->stg_or_relcode.tag_offs); - continue ; - } - val = (long) ref_id ; - } - break ; - case URMgLiteral: - result = Urm__CW_ReadLiteral (resptr, hierarchy_id, file_id, - ctxlist, &reptype, &argval, - &vec_count, &act_file, &vec_size) ; - val = argval ; - if ( result != MrmSUCCESS ) continue ; - switch ( reptype ) - { - case MrmRtypeIconImage: - savepix = &pixargs[pixargs_cnt] ; - savepix->icon = (RGMIconImagePtr) val ; - savepix->pixarg = argptr ; - savepix->pixtype = reptype ; - pixargs_cnt += 1 ; - continue ; - case MrmRtypeXBitmapFile: - savepix = &pixargs[pixargs_cnt] ; - savepix->filename = (String) val ; - savepix->pixarg = argptr ; - savepix->pixtype = reptype ; - pixargs_cnt += 1 ; - continue ; - case MrmRtypeInteger: - case MrmRtypeBoolean: - if ( swap_needed ) - { - swapbytes( val ); - swap_needed = FALSE ; - } - break; - case MrmRtypeFontList: - if (strcmp(file_id->db_version, URM1_1version) <= 0) - { - int count = ((OldRGMFontListPtr)val)->count; - fontlist = (RGMFontListPtr) - XtMalloc(sizeof(RGMFontList) + - (sizeof(RGMFontItem) * (count - 1))); - result = Urm__CW_FixupValue((long)fontlist, reptype, - (XtPointer)val, file_id, - &swap_needed); - val = (long)fontlist; - } - else - result = Urm__CW_FixupValue(val, reptype, - (XtPointer)val, - file_id, &swap_needed) ; - break; - case MrmRtypeSingleFloat: - if ( swap_needed ) - { - swapbytes( val ); - swap_needed = FALSE ; - } - _MrmOSIEEEFloatToHost( (float *) &val ); - break; - case MrmRtypeFloat: - if ( swap_needed ) - { - swapdouble( *(double *)val ); - swap_needed = FALSE ; - } - _MrmOSIEEEDoubleToHost( (double *) val ); - break; - default: - result = Urm__CW_FixupValue(val,reptype,(XtPointer)val, - file_id, &swap_needed) ; - } - if ( result != MrmSUCCESS ) continue ; - - /* - * Fix for CR 5410 - Do not run ConvertValue on Colors - * because the parent's colormap should be used when - * allocating the colors which is currently impossible - * in ConvertValue. Convert the colors separately. - */ - if (reptype == MrmRtypeColor) - { - Pixel pix; - RGMColorDescPtr colorptr; - Colormap cmap; - - uncmp_res = Urm__FindClassDescriptor - (file_id, widgetrec->type, - (XtPointer)((char *)widgetrec+widgetrec->class_offs), - &class_desc) ; - if ((uncmp_res == MrmSUCCESS) && - (class_desc->creator == _XmCreateRendition)) - { - display = _XmRenderTableDisplay((XmRenderTable)parent); - cmap = XDefaultColormap(display, XDefaultScreen(display)); - } - else { - display = XtDisplay(parent); - cmap = parent->core.colormap; - } - - colorptr = (RGMColorDescPtr) val; - switch (colorptr->desc_type) - { - case URMColorDescTypeName: - result = Urm__UT_GetNamedColorPixel - (display, cmap, colorptr, &pix, - XBlackPixelOfScreen(XDefaultScreenOfDisplay(display))); - if ( result != MrmSUCCESS ) - { - sprintf (err_msg, _MrmMMsg_0061, - (String)(colorptr->desc.name)) ; - result = Urm__UT_Error("Urm__CW_ConvertValue",err_msg, - NULL, NULL, MrmNOT_FOUND) ; - } - break; - case URMColorDescTypeRGB: - result = Urm__UT_GetColorPixel - (display, cmap, colorptr, &pix, - XBlackPixelOfScreen(XDefaultScreenOfDisplay(display))); - if ( result != MrmSUCCESS ) - { - sprintf (err_msg, _MrmMMsg_0039, - colorptr->desc.rgb.red, - colorptr->desc.rgb.green, - colorptr->desc.rgb.blue) ; - result = Urm__UT_Error("Urm__CW_ConvertValue",err_msg, - NULL, NULL, MrmNOT_FOUND) ; - } - break; - default: - sprintf (err_msg, _MrmMMsg_0040); - result = Urm__UT_Error ("Urm__CW_ConvertValue", - err_msg, NULL, NULL, MrmFAILURE) ; - }; - val = (long) pix ; - } - else - /* - * End Fix for CR 5410 - */ - { - uncmp_res = Urm__FindClassDescriptor - (file_id, widgetrec->type, - (XtPointer)((char *)widgetrec+widgetrec->class_offs), - &class_desc) ; - if ((uncmp_res == MrmSUCCESS) && - (class_desc->creator == _XmCreateRendition)) - display = _XmRenderTableDisplay((XmRenderTable)parent); - else - display = XtDisplay(parent); - - result = Urm__CW_ConvertValue (parent, &val, reptype, - resptr->cvt_type, display, - hierarchy_id, ftllist) ; - } - - if ( result != MrmSUCCESS ) continue ; - if ( argptr->tag_code == UilMrmUnknownCode ) - { - resource_name = (char *) - ((char *)widgetrec+argptr->stg_or_relcode.tag_offs) ; - } - else - { - uncmp_res = Urm__UncompressCode - (file_id, argptr->tag_code, &resource_name) ; - if ( uncmp_res != MrmSUCCESS ) - { - sprintf (err_msg, _MrmMMsg_0062, - argptr->tag_code) ; - Urm__UT_Error ("Urm__CW_CreateArglist", - err_msg, NULL, NULL, uncmp_res) ; - } - } - - if ( strcmp(resource_name, XmNuserData) == 0) - { - switch (reptype) - { - case MrmRtypeChar8Vector: - case MrmRtypeCStringVector: - vec_size -= (sizeof ( RGMTextVector ) - - sizeof ( RGMTextEntry )); - break; - default: - break; - } - Urm__CW_SafeCopyValue (&val, reptype, cblist, - vec_count, vec_size); - } - - /* - * Fix for CR 3281 - check to see if the resource_name - * is XmNaccelerators. If it is, run - * XtParseAcceleratorTable and assign the output to val. - */ - if ( strcmp(resource_name, XmNaccelerators) == 0) - { - val = (long)XtParseAcceleratorTable((String)argval); - } - /* - * End fix for CR 3281 - */ - break ; - - default: - Urm__UT_Error ("Urm__CW_CreateArglist", _MrmMMsg_0063, - NULL, NULL, MrmFAILURE) ; - continue ; - } - break ; - case MrmRtypeIconImage: - icon = (RGMIconImagePtr) val ; - result = Urm__CW_LoadIconImage (icon, (XtPointer)widgetrec, - hierarchy_id, file_id, ctxlist) ; - if ( result != MrmSUCCESS ) continue ; - savepix = &pixargs[pixargs_cnt] ; - savepix->icon = icon ; - savepix->pixarg = argptr ; - savepix->pixtype = reptype ; - pixargs_cnt += 1 ; - continue ; - case MrmRtypeXBitmapFile: - savepix = &pixargs[pixargs_cnt] ; - savepix->filename = (String) val ; - savepix->pixarg = argptr ; - savepix->pixtype = reptype ; - pixargs_cnt += 1 ; - continue ; - default: - result = Urm__CW_FixupValue (val, reptype, (XtPointer)widgetrec, - file_id, &swap_needed) ; - if ( result != MrmSUCCESS ) continue ; - uncmp_res = Urm__FindClassDescriptor - (file_id, widgetrec->type, - (XtPointer)((char *)widgetrec+widgetrec->class_offs), - &class_desc); - if ((uncmp_res == MrmSUCCESS) && - (class_desc->creator == _XmCreateRendition)) - display = _XmRenderTableDisplay((XmRenderTable)parent); - else if ((uncmp_res == MrmSUCCESS) && - (class_desc->creator == _XmCreateTab)) - display = NULL; - else display = XtDisplay(parent); - result = Urm__CW_ConvertValue - (parent, &val, reptype, 0, display, - hierarchy_id, ftllist) ; - if ( result != MrmSUCCESS ) continue ; - break ; - } - - args[*num_used].value = (XtArgVal)val ; - - /* - * Create the tag string in the name slot of the current entry. Also - * do any special processing based on tag code: - * - Retain values of foreground and background if they are - * explicitly set - * - Set the count for some lists - * - * 'argval' has preserved the pointer to RGM structures which may have - * been replaced in 'val' by a pointer to structures (lists) required by - * the toolkit - */ - if ( argptr->tag_code == UilMrmUnknownCode ) - { - args[*num_used].name = (char *) - widgetrec+argptr->stg_or_relcode.tag_offs ; - *num_used += 1 ; - } - else - { - uncmp_res = Urm__UncompressCode - (file_id, argptr->tag_code, &(args[*num_used].name)) ; - if ( uncmp_res == MrmSUCCESS ) - *num_used += 1 ; - else - { - sprintf (err_msg, _MrmMMsg_0062, argptr->tag_code) ; - Urm__UT_Error ("Urm__CW_CreateArglist", err_msg, - NULL, NULL, uncmp_res) ; - } - } - - /* - * Special processing: - * retain the value pointer for foreground or background. - * Note reference to name in arglist from previous operation. - */ - /* Begin fixing OSF 5473 */ - if(*num_used){ - if ( strcmp(args[*num_used-1].name,XmNforeground) == 0 ) - fgint = val ; - if ( strcmp(args[*num_used-1].name,XmNbackground) == 0 ) - bgint = val ; - } - /* End fixing OSF 5473 */ - - /* - * Create an additional arglist entry for the count field for any argument - * which has a related argument (which is always a counter) - */ - if ( argptr->tag_code != UilMrmUnknownCode ) - if ( argptr->stg_or_relcode.related_code != 0) - { - switch ( reptype ) - { - case MrmRtypeChar8Vector: - case MrmRtypeCStringVector: - /* - * Fix for HaL DTS 10226 - If the type is Integer Vector - * (used mainly in the XmNselectionArray resource on - * the Text and TextField widgets), load in the count - * for the XmNselectionArrayCount resource. - */ - case MrmRtypeIntegerVector: - vecptr = (RGMTextVectorPtr) argval; - args[*num_used].value = (XtArgVal)vecptr->count; - break; - } - uncmp_res = Urm__UncompressCode - (file_id, argptr->stg_or_relcode.related_code, - &args[*num_used].name); - if ( uncmp_res == MrmSUCCESS ) - *num_used += 1; - else - { - sprintf (err_msg, _MrmMMsg_0062, argptr->tag_code) ; - Urm__UT_Error ("Urm__CW_CreateArglist", err_msg, - NULL, NULL, uncmp_res) ; - } - } - - } /* Loop end */ - - - /* - * Now set any pixmap arguments. This requires finding the display, screen, - * foreground, and background values for this widget. These values are - * available from the parent widget and the arglist. - */ - if ( pixargs_cnt > 0 ) - { - Urm__CW_GetPixmapParms (parent, &screen, &display, &fgint, &bgint) ; - for ( ndx=0,savepix=pixargs ; ndxpixtype == MrmRtypeXBitmapFile ) { - result = Urm__CW_ReadBitmapFile - (savepix->filename, screen, - fgint, bgint, &pixmap, parent); - if ( result != MrmSUCCESS ) continue ; - } - else { - /* - ** Create a pixmap from an Icon definition - */ - result = UrmCreatePixmap (savepix->icon, screen, display, - fgint, bgint, &pixmap, parent) ; - if ( result != MrmSUCCESS ) continue ; - } - - /* - ** Place resultant Pixmap in arglist - */ - args[*num_used].value = (XtArgVal) pixmap ; - argptr = savepix->pixarg ; - if ( argptr->tag_code == UilMrmUnknownCode ) - args[*num_used].name = (char *) - (widgetrec+argptr->stg_or_relcode.tag_offs) ; - else - Urm__UncompressCode - (file_id, argptr->tag_code, &(args[*num_used].name)) ; - *num_used += 1 ; - } - } - - /* - * arglist creation complete. - */ - -} - - - -/* - *++ - * - * PROCEDURE DESCRIPTION: - * - * Return either a immediate value (ival) or a widget record memory - * pointer depending on the representation type. - * - * FORMAL PARAMETERS: - * - * reptype representation type, from RGMrType... - * bufptr buffer address for offset - * ival immediate value - * offset offset in widget record - * - * IMPLICIT INPUTS: - * - * IMPLICIT OUTPUTS: - * - * FUNCTION VALUE: - * - * SIDE EFFECTS: - * - *-- - */ - -long -Urm__CW_EvaluateValOrOffset (MrmType reptype, - XtPointer bufptr, - long ival, - MrmOffset offset) -{ - - switch ( reptype ) - { - case MrmRtypeInteger: - case MrmRtypeBoolean: - case MrmRtypeSingleFloat: - return ival ; - case MrmRtypeNull: - return 0; - default: - return (long) ((char *)bufptr+offset) ; - } - -} - - - -/* - *++ - * - * PROCEDURE DESCRIPTION: - * - * This routine does any fixups required on a value. The fixups are - * usually relocation of pointers within the object located by the - * value interpreted as a pointer to a data structure. - * - * FORMAL PARAMETERS: - * - * val value of an argument (may be a pointer) - * reptype vaue representation type, from RGMrType... - * bufptr the buffer (base address) for any fixed-up - * values - * - * IMPLICIT INPUTS: - * - * IMPLICIT OUTPUTS: - * - * FUNCTION VALUE: - * - * MrmSUCCESS ; - * - * SIDE EFFECTS: - * - *-- - */ - -/*ARGSUSED*/ -Cardinal -Urm__CW_FixupValue (long val, - MrmType reptype, - XtPointer bufptr, - IDBFile file_id, /* unused */ - Boolean *swap_needed) -{ - /* - * Local variables - */ - RGMTextVectorPtr vecptr ; /* text vector arg value */ - int fixndx ; /* list fixup loop index */ - /* BEGIN OSF Fix CR 4859 */ - RGMWCharEntryPtr wcharentry; /* Resource as wide character string */ - wchar_t *wcstr_r; - size_t max_size, str_size; - /* END OSF Fix CR 4859 */ - RGMFontItemPtr fontitem; /* resource as font item */ - OldRGMFontItemPtr olditem; /* old style font item */ - RGMFontListPtr fontlist ; /* resource as font list */ - OldRGMFontListPtr oldlist ; /* resource as old style font list */ - - switch ( reptype ) - { - case MrmRtypeChar8Vector: - case MrmRtypeCStringVector: - vecptr = (RGMTextVectorPtr) val ; - if ( *swap_needed ) - { - swapbytes(vecptr->count); - swapbytes(vecptr->validation); - } - for ( fixndx=0 ; fixndxcount ; fixndx++ ) - { - if ( *swap_needed ) - { -#ifdef WORD64 - swap4bytes(vecptr->item[fixndx].text_item.rep_type); - swap4bytes(vecptr->item[fixndx].text_item.offset); -#else - swap2bytes(vecptr->item[fixndx].text_item.rep_type); - swap2bytes(vecptr->item[fixndx].text_item.offset); -#endif - } - if (reptype == MrmRtypeChar8Vector) - vecptr->item[fixndx].pointer = (XtPointer) - ((char *)bufptr+vecptr->item[fixndx].text_item.offset) ; - else - vecptr->item[fixndx].pointer = (XtPointer) - XmCvtByteStreamToXmString((unsigned char *)bufptr + - vecptr->item[fixndx].text_item.offset); - } - *swap_needed = FALSE; - break ; - - /* BEGIN OSF Fix CR 4859 */ - case MrmRtypeWideCharacter: - wcharentry = (RGMWCharEntryPtr)val; - if (*swap_needed) - swapbytes(wcharentry->wchar_item.count); - /* Allocate memory */ - max_size = wcharentry->wchar_item.count; - wcstr_r = (wchar_t *)XtMalloc(sizeof(wchar_t) * (max_size + 1)); - - /* Convert, realloc, store */ - str_size = mbstowcs(wcstr_r, wcharentry->wchar_item.bytes, max_size); - if (str_size == -1) - return(Urm__UT_Error("Urm__CW_FixupValue", _MrmMMsg_0110, - NULL, NULL, MrmFAILURE)); - if (str_size != max_size) - wcstr_r = (wchar_t *)XtRealloc((char *)wcstr_r, - sizeof(wchar_t) * (str_size + 1)); - else - wcstr_r[str_size] = (wchar_t)0L; - wcharentry->pointer = (XtPointer)wcstr_r; - *swap_needed = FALSE; - break; - - /* END OSF Fix CR 4859 */ - case MrmRtypeFont: - case MrmRtypeFontSet: - fontitem = (RGMFontItemPtr) val; - if ( *swap_needed ) - { - swapbytes( fontitem->cset.cs_offs ); - swapbytes( fontitem->font.font_offs ); - } - fontitem->cset.charset = (/*XmStringCharset*/String) - bufptr+fontitem->cset.cs_offs; - fontitem->font.font = (String) - bufptr+fontitem->font.font_offs; - *swap_needed = FALSE; - break; - case MrmRtypeFontList: - if (strcmp(file_id->db_version, URM1_1version) <= 0) - /* Converting an old style fontlist */ - { - oldlist = (OldRGMFontListPtr)bufptr; - - fontlist = (RGMFontListPtr)val; - - fontlist->validation = oldlist->validation; - fontlist->count = oldlist->count; - - for ( fixndx=0 ; fixndxcount ; fixndx++ ) - { - olditem = &oldlist->item[fixndx]; - fontitem = &fontlist->item[fixndx]; - - fontitem->cset.charset = - XtNewString(( /*XmStringCharset*/String) - bufptr+olditem->cset.cs_offs); - fontitem->font.font = - XtNewString((String)bufptr+olditem->font.font_offs); - fontitem->type = MrmRtypeFont; - } - } - else - { - fontlist = (RGMFontListPtr) val ; - if ( *swap_needed ) - { - swapbytes( fontlist->validation ); - swapbytes( fontlist->count ); - } - for ( fixndx=0 ; fixndxcount ; fixndx++ ) - { - fontitem = &fontlist->item[fixndx]; - if ( *swap_needed ) - { - swapbytes( fontitem->cset.cs_offs ); - swapbytes( fontitem->font.font_offs ); - swapbytes( fontitem->type ); - } - fontitem->cset.charset = ( /*XmStringCharset*/String) - bufptr+fontitem->cset.cs_offs; - fontitem->font.font = (String) - bufptr+fontitem->font.font_offs; - } - } - *swap_needed = FALSE; - break ; - case MrmRtypeHorizontalInteger: - case MrmRtypeVerticalInteger: - { - RGMUnitsIntegerPtr unitsvalue; - - unitsvalue = (RGMUnitsIntegerPtr) val; - if ( *swap_needed ) - { - swapbytes( unitsvalue->value ); - swapbytes( unitsvalue->units ); - *swap_needed = FALSE; - } - } - break ; - case MrmRtypeHorizontalFloat: - case MrmRtypeVerticalFloat: - { - RGMUnitsFloatPtr unitsvalue; - double *floatval; - - unitsvalue = (RGMUnitsFloatPtr) val; - floatval = (double *)(&unitsvalue->value[0]); - if ( *swap_needed ) - { - swapdouble(*floatval); - swapbytes( unitsvalue->units ); - } - *swap_needed = FALSE; - _MrmOSIEEEDoubleToHost( floatval ); - *((double *)(&unitsvalue->value[0])) = *floatval; - } - break ; - default: - break ; - } - return MrmSUCCESS ; - -} - - - -/* - *++ - * - * PROCEDURE DESCRIPTION: - * - * This routine converts the display into a string byte by - * byte. Any Null bytes are not (?) omitted in returned string. - * - * FORMAL PARAMETERS: - * - * val the value to be converted (may be a pointer) - * add_sting a string to be added to the returned string - * after the display. - * add_string_size the additional string length when Calloc on - * the return value is done. - * - * IMPLICIT INPUTS: - * - * IMPLICIT OUTPUTS: - * - * FUNCTION VALUE: - * - * returns the string if one is created, otherwise returns null - * - * SIDE EFFECTS: - * - *-- - */ - -String -Urm__CW_DisplayToString (char *val, - String add_string, - int add_string_size) -{ - /* - * Local variables - */ - String return_val; - unsigned int dpysize = sizeof(Display *); - int ndx; - int count=0; - - return_val = XtCalloc (1, dpysize + add_string_size); - if (return_val == NULL) - { - return (return_val); - } - - for (ndx=0 ; ndxcount; - tbl = (String *)vecptr->item; - for (ndx = 0; ndx < vec_count; ndx++) - tbl[ndx] = (String)(vecptr->item[ndx].pointer); - *val = (long)tbl; - break ; - } - case MrmRtypeCStringVector: - { - XmStringTable tbl; - - vecptr = (RGMTextVectorPtr) (*val) ; - /* Have to pack vecptr */ - vec_count = vecptr->count; - tbl = (XmStringTable)vecptr->item; - for (ndx = 0; ndx < vec_count; ndx++) - tbl[ndx] = (XmString)(vecptr->item[ndx].pointer); - *val = (long)tbl; - break; - } - case MrmRtypeCString: - cstg = XmCvtByteStreamToXmString((unsigned char *)*val); - *val = (long)cstg; - /* BEGIN OSF Fix CR 8392 */ - /* fix memory leak */ - if ( ftllist != NULL ) - { - UrmPlistAppendPointer (ftllist, (XtPointer)(long)reptype); - UrmPlistAppendPointer (ftllist, (XtPointer)*val); - } - /* END OSF Fix CR 8392 */ - break; - case MrmRtypeIntegerVector: - { - RGMIntegerVectorPtr vecptr ; /* val as integer vector */ - - vecptr = (RGMIntegerVectorPtr) (*val) ; - *val = (long) vecptr->item ; - break ; - } - case MrmRtypeAddrName: - result = Urm__LookupNameInHierarchy (hierarchy_id, (String)(*val), &addr); - if ( result != MrmSUCCESS ) - { - sprintf (err_msg, _MrmMMsg_0066, (String)(*val)) ; - return Urm__UT_Error ("Urm__CW_ConvertValue", - err_msg, NULL, NULL, result) ; - } - *val = (long) addr ; - break ; - case MrmRtypeIconImage: - Urm__CW_GetPixmapParms(parent, &screen, &display, &fgint, &bgint); - result = UrmCreatePixmap((RGMIconImagePtr)(*val), screen, display, - fgint, bgint, &pixmap, parent); - if (result != MrmSUCCESS) - return (Urm__UT_Error("Urm__CW_ConvertValue", _MrmMMsg_0112, - NULL, NULL, MrmFAILURE)); - *val = (long)pixmap; - break; - - case MrmRtypeXBitmapFile: - Urm__CW_GetPixmapParms(parent, &screen, &display, &fgint, &bgint); - result = Urm__CW_ReadBitmapFile((char *)(*val), screen, - fgint, bgint, &pixmap, parent); - if (result != MrmSUCCESS) - return (Urm__UT_Error("Urm__CW_ConvertValue", _MrmMMsg_0112, - NULL, NULL, MrmFAILURE)); - *val = (long)pixmap; - break; - - case MrmRtypeFont: - case MrmRtypeFontSet: - fontptr = (RGMFontItemPtr) (*val) ; - fontstg = fontptr->font.font; - dpyandfontstr = Urm__CW_DisplayToString ((char*)&display, - fontstg, strlen(fontstg) + 1); - if ( dpyandfontstr == NULL) - { - return Urm__UT_Error ("Urm__CW_ConvertValue", _MrmMMsg_0069, - NULL, NULL, MrmFAILURE) ; - } - switch (reptype) - { - case MrmRtypeFont: - result = - Urm__WCI_LookupRegisteredName(dpyandfontstr, (XtPointer *)&font); - - if ( result != MrmSUCCESS ) - { - font = XLoadQueryFont (display, fontstg); - if ( font == NULL ) - { - sprintf (err_msg, _MrmMMsg_0070, fontstg); - return Urm__UT_Error ("Urm__CW_ConvertValue", - err_msg, NULL, NULL, MrmNOT_FOUND) ; - } - Urm__WCI_RegisterNames (&dpyandfontstr, (XtPointer *)&font, 1); - { - XmDisplay dd = (XmDisplay) XmGetXmDisplay(display); - if (dd) - XtAddCallback((Widget)dd,XtNdestroyCallback, - DisplayDestroyCallback, (XtPointer) - XtNewString(dpyandfontstr)); - } - } - break; - - case MrmRtypeFontSet: - result = Urm__WCI_LookupRegisteredName(dpyandfontstr, - (XtPointer *)&fontset); - - if ( result != MrmSUCCESS ) - { - fontset = XCreateFontSet(display, fontstg, &missing_csets, - &missing_cset_cnt, &def_string); - if (fontset == NULL) - { - sprintf(err_msg, _MrmMMsg_0071, fontstg); - return Urm__UT_Error ("Urm__CW_ConvertValue", - err_msg, NULL, NULL, MrmNOT_FOUND) ; - } - Urm__WCI_RegisterNames(&dpyandfontstr, - (XtPointer *)&fontset, 1); - } - break; - } - XtFree (dpyandfontstr); - if ( cvttype == MrmRtypeFontList ) - { - switch(reptype) - { - case MrmRtypeFont: - dfontlist = XmFontListCreate (font, fontptr->cset.charset) ; - break; - - case MrmRtypeFontSet: - fontset_entry = XmFontListEntryCreate(fontptr->cset.charset, - XmFONT_IS_FONTSET, - fontset); - dfontlist = XmFontListAppendEntry(NULL, fontset_entry); - break; - } - - if ( ftllist != NULL ) - { - UrmPlistAppendPointer (ftllist, (XtPointer)(long)reptype); - UrmPlistAppendPointer (ftllist, (XtPointer)dfontlist); - } - *val = (long) dfontlist ; - } - else - *val = (long) font ; - break ; - case MrmRtypeFontList: - fontlist = (RGMFontListPtr) (*val) ; - dfontlist = NULL ; - for ( ndx=0 ; ndxcount ; ndx++ ) - { - fontstg = fontlist->item[ndx].font.font; - dpyandfontstr = Urm__CW_DisplayToString((char*)&display, - fontstg, - strlen(fontstg) + 1); - if ( dpyandfontstr == NULL) - { - return Urm__UT_Error ("Urm__CW_ConvertValue", _MrmMMsg_0069, - NULL, NULL, MrmFAILURE) ; - } - - switch (fontlist->item[ndx].type) - { - case MrmRtypeFont: - result = Urm__WCI_LookupRegisteredName(dpyandfontstr, - (XtPointer *)&font); - if ( result != MrmSUCCESS ) - { - font = XLoadQueryFont (display, fontstg); - if ( font == NULL ) - { - sprintf (err_msg, _MrmMMsg_0070, fontstg); - return Urm__UT_Error ("Urm__CW_ConvertValue", - err_msg, NULL, NULL, MrmNOT_FOUND) ; - } - Urm__WCI_RegisterNames(&dpyandfontstr, (XtPointer *)&font, 1); - { - XmDisplay dd = (XmDisplay) XmGetXmDisplay(display); - if (dd) - XtAddCallback((Widget)dd,XtNdestroyCallback, - DisplayDestroyCallback, (XtPointer) - XtNewString(dpyandfontstr)); - } - } - break; - - case MrmRtypeFontSet: - result = Urm__WCI_LookupRegisteredName(dpyandfontstr, - (XtPointer *)&fontset); - if ( result != MrmSUCCESS ) - { - fontset = XCreateFontSet(display, fontstg, &missing_csets, - &missing_cset_cnt, &def_string); - if (fontset == NULL) - { - sprintf(err_msg, _MrmMMsg_0071, fontstg); - return Urm__UT_Error ("Urm__CW_ConvertValue", - err_msg, NULL, NULL, MrmNOT_FOUND) ; - } - - if (missing_csets != NULL) - { - sprintf(err_msg, _MrmMMsg_0072, fontstg); - XFreeStringList(missing_csets); - } - Urm__WCI_RegisterNames(&dpyandfontstr, - (XtPointer *)&fontset, 1); - } - break; - } - - XtFree (dpyandfontstr); - switch(fontlist->item[ndx].type) - { - case MrmRtypeFont: - if ( dfontlist == NULL ) - dfontlist = XmFontListCreate - (font, fontlist->item[ndx].cset.charset) ; - else - dfontlist = XmFontListAdd - (dfontlist, font, fontlist->item[ndx].cset.charset) ; - if ( dfontlist == NULL ) - { - sprintf (err_msg, _MrmMMsg_0073, - fontlist->item[ndx].font.font) ; - return Urm__UT_Error ("Urm__CW_ConvertValue", - err_msg, NULL, NULL, MrmFAILURE) ; - } - break; - case MrmRtypeFontSet: - fontset_entry = - XmFontListEntryCreate(fontlist->item[ndx].cset.charset, - XmFONT_IS_FONTSET, - fontset); - dfontlist = XmFontListAppendEntry(NULL, fontset_entry); - if ( dfontlist == NULL ) - { - sprintf (err_msg, _MrmMMsg_0074, - fontlist->item[ndx].font.font) ; - return Urm__UT_Error ("Urm__CW_ConvertValue", - err_msg, NULL, NULL, MrmFAILURE) ; - } - break; - } - } - - *val = (long) dfontlist ; - /* - * Save only the final fontlist to be freed later. All intermediate - * ones are freed by XmFontListAdd - */ - if ( ftllist != NULL ) - { - UrmPlistAppendPointer (ftllist, (XtPointer)(long)reptype); - UrmPlistAppendPointer (ftllist, (XtPointer)dfontlist); - } - break ; - case MrmRtypeColor: - colorptr = (RGMColorDescPtr) (*val) ; - switch (colorptr->desc_type) - { - case URMColorDescTypeName: - result = Urm__UT_GetNamedColorPixel - (display, (Colormap)0, colorptr, &pix, - XBlackPixelOfScreen(XDefaultScreenOfDisplay(display))) ; - if ( result != MrmSUCCESS ) - { - if (result == MrmPARTIAL_SUCCESS) result = MrmSUCCESS; - sprintf (err_msg, _MrmMMsg_0061, (String)(colorptr->desc.name)) ; - return Urm__UT_Error ("Urm__CW_ConvertValue", - err_msg, NULL, NULL, MrmNOT_FOUND) ; - } - break; - case URMColorDescTypeRGB: - result = Urm__UT_GetColorPixel - (display, (Colormap)0, colorptr, &pix, - XBlackPixelOfScreen(XDefaultScreenOfDisplay(display))) ; - if ( result != MrmSUCCESS ) - { - if (result == MrmPARTIAL_SUCCESS) result = MrmSUCCESS; - sprintf (err_msg, _MrmMMsg_0039, - colorptr->desc.rgb.red, - colorptr->desc.rgb.green, - colorptr->desc.rgb.blue) ; - return Urm__UT_Error ("Urm__CW_ConvertValue", - err_msg, NULL, NULL, MrmNOT_FOUND) ; - } - break; - default: - sprintf(err_msg, _MrmMMsg_0040); - return Urm__UT_Error ("Urm__CW_ConvertValue", - err_msg, NULL, NULL, MrmFAILURE) ; - }; - *val = (long) pix ; - break ; - /* BEGIN OSF Fix CR 4859 */ - case MrmRtypeWideCharacter: - { - RGMWCharEntryPtr wcharentry; - - wcharentry = (RGMWCharEntryPtr)*val; - *val = (long)wcharentry->pointer; - break; - } - /* END OSF Fix CR 4859 */ - case MrmRtypeTransTable: - /* - * WARNING: memory leak created... - */ - trans = XtParseTranslationTable ((String)(*val)) ; - if ( trans == NULL ) - { - sprintf (err_msg, _MrmMMsg_0065, (String)(*val)) ; - return Urm__UT_Error ("Urm__CW_ConvertValue", - err_msg, NULL, NULL, MrmFAILURE) ; - } - *val = (long) trans ; - break ; - case MrmRtypeClassRecName: - clrec = Urm__WCI_GetClRecOfName ((String)*val) ; - if ( clrec == NULL ) - { - sprintf (err_msg, _MrmMMsg_0075, (String)(*val)) ; - return Urm__UT_Error ("Urm__CW_ConvertValue", - err_msg, NULL, NULL, MrmNOT_FOUND) ; - } - *val = (long) clrec ; - break ; - case MrmRtypeKeysym: - xkey = XStringToKeysym ((String)*val); - if ( xkey == NoSymbol ) - { - sprintf (err_msg, _MrmMMsg_0076, (String)(*val)) ; - return Urm__UT_Error ("Urm__CW_ConvertValue", - err_msg, NULL, NULL, MrmNOT_FOUND) ; - } - *val = (long) xkey; - break; - case MrmRtypeHorizontalInteger: - orientation = XmHORIZONTAL; - /* fall through */ - case MrmRtypeVerticalInteger: - if (orientation == XmNO_ORIENTATION) - { - orientation = XmVERTICAL; - } - /* get a screen that we can use */ - screen = DefaultScreenOfDisplay(display); - unitsintvalue = (RGMUnitsIntegerPtr) *val; - if (unitsintvalue->value != 0) - { - *val = _XmConvertUnits(screen, orientation, unitsintvalue->units, - unitsintvalue->value, XmPIXELS); - if (*val == 0) - { - return Urm__UT_Error ("Urm__CW_ConvertValue", - _MrmMMsg_0115, NULL, NULL, MrmNOT_FOUND) ; - } - } - else *val = 0; - break; - case MrmRtypeHorizontalFloat: - orientation = XmHORIZONTAL; - /* fall through */ - case MrmRtypeVerticalFloat: - { - float float_val, int_value; - int int_units, float_units; - - if (orientation == XmNO_ORIENTATION) - { - orientation = XmVERTICAL; - } - /* get a screen that we can use */ - screen = DefaultScreenOfDisplay(display); - unitsfloatvalue = (RGMUnitsFloatPtr) *val; - float_units = unitsfloatvalue->units; - float_val = (float)(*((double *)(&unitsfloatvalue->value[0]))); - - if (float_val != 0) - { - if (_XmConvertFloatUnitsToIntUnits(float_units, float_val, - &int_units, &int_value, - XmPIXELS) == False) - { - return Urm__UT_Error ("Urm__CW_ConvertValue", _MrmMMsg_0116, - NULL, NULL, MrmFAILURE); - } - *val = _XmConvertUnits(screen, orientation, int_units, - MAKEINT(int_value), XmPIXELS); - if (*val == 0) - { - return Urm__UT_Error ("Urm__CW_ConvertValue", _MrmMMsg_0115, - NULL, NULL, MrmFAILURE); - } - } - else *val = 0; - } - break; - default: - break ; - } - - return MrmSUCCESS ; - -} - -/* -** Remove the font from the hash table so it won't later cause a protocol -** error if the display is closed and reopened and the same value is fetched. -*/ -/*ARGSUSED*/ -static void -DisplayDestroyCallback ( Widget w, - XtPointer client_data, - XtPointer call_data ) /* unused */ -{ - String dpyandfontstr = (String) client_data; - XFontStruct *font ; - - if (MrmSUCCESS == Urm__WCI_LookupRegisteredName(dpyandfontstr, - (XtPointer *)&font)) - XFreeFont(XtDisplay(w), font); - Urm__WCI_UnregisterName (dpyandfontstr); - XtFree(dpyandfontstr); -} - - - -/* - *++ - * - * PROCEDURE DESCRIPTION: - * - * This routine copies a value to an 'eternal' block in order - * to guarantee that callback tag values will live forever. - * - * FORMAL PARAMETERS: - * - * val the value to be copied (may be a pointer) - * reptype value representation type - * vec_count number of elements in the vector (for vector types) - * - * IMPLICIT INPUTS: - * - * IMPLICIT OUTPUTS: - * - * FUNCTION VALUE: - * - * SIDE EFFECTS: - * - *-- - */ - -static char* staticNull = NULL; - -void -Urm__CW_SafeCopyValue (long *val, - MrmType reptype, - URMPointerListPtr cblist, - int vec_count, - int vec_size) -{ - /* - * Local variables - */ - int *int_src ; /* to copy integer values */ - int *int_dst ; - String char8_src ; /* to copy string values */ - String char8_dst ; - float *single_float_src ; /* to copy FP values */ - float *single_float_dst ; - double *float_src ; /* to copy FP values */ - double *float_dst ; - XmString cstr_src ; /* to copy compound strings */ - XmString *cstr_table_src; /* to copy compound string table */ - XmString *cstr_table_dst ; - String *char8_table_src ; /* to coy string table */ - String *char8_table_dst ; - wchar_t *wchar_src; /* to copy wide character strings */ - wchar_t *wchar_dst; - size_t size; - int cnt ; - - /* - * Make copies of all primitive data structures. Note this has the side - * effect of converting integer values to by-reference. - */ - switch ( reptype ) - { - case MrmRtypeIntegerVector: - int_src = (int *) *val ; - int_dst = (int *) XtMalloc ((unsigned int)vec_size) ; - UrmBCopy (int_src, int_dst, vec_size) ; - *val = (long) int_dst ; - if (cblist != NULL) - { - UrmPlistAppendPointer (cblist, (XtPointer)(long)reptype); - UrmPlistAppendPointer (cblist, (XtPointer)*val); - } - break ; - - case MrmRtypeCStringVector: - cstr_table_src = (XmString *)*val; - cstr_table_dst = - (XmString *)XtMalloc(vec_count * sizeof(XmString)) ; - for (cnt=0; cntnum_ptrs ; ndx++) - { - reptype = (MrmType)(long)list_id->ptr_vec[ndx]; - ndx++; - switch ( reptype ) - { - case MrmRtypeCString: - XmStringFree ((XmString)list_id->ptr_vec[ndx]); - break ; - /* BEGIN OSF Fix CR 6224 */ - case MrmRtypeFont: - /* Do not free the fontstruct. */ - break; - /* END OSF Fix CR 6224 */ - case MrmRtypeFontList: - XmFontListFree ((XmFontList)list_id->ptr_vec[ndx]); - break; - default: - /* BEGIN OSF Fix CR 6843 */ - /* Check for duplicates on list before freeing. */ - if (list_id->ptr_vec[ndx] != NULL) - { - for (i = ndx + 1; i < list_id->num_ptrs; ++i) - if (list_id->ptr_vec[ndx] == list_id->ptr_vec[i]) - list_id->ptr_vec[i] = NULL; - - XtFree (list_id->ptr_vec[ndx]); - } - /* END OSF Fix CR 6843 */ - break ; - } - } - - UrmPlistFree (list_id); - -} - - -/* - *++ - * - * PROCEDURE DESCRIPTION: - * - * This routine reads a literal resource from either a hierarchy or - * a file. It returns the resource type and either a pointer to the - * value or its immediate value. - * - * FORMAL PARAMETERS: - * - * resptr resource reference to literal - * hierarchy_id hierarchy from which to read public resource - * file_id file from which to read private resource - * ctxlist list in which to save resource contexts - * type to return representation type - * val to return immediate value or pointer - * vec_count to return number of items if type is a vector - * act_file_id to return id of file from which literal was read - * - * IMPLICIT INPUTS: - * - * IMPLICIT OUTPUTS: - * - * FUNCTION VALUE: - * - * SIDE EFFECTS: - * - * MrmSUCCESS operation succeeded - * other some failure, usually reading the literal - * - *-- - */ - -Cardinal -Urm__CW_ReadLiteral (RGMResourceDescPtr resptr , - MrmHierarchy hierarchy_id , - IDBFile file_id , - URMPointerListPtr ctxlist , - MrmType *type , - long *val , - int *vec_count , - IDBFile *act_file_id , - int *vec_size ) -{ - /* - * Local variables - */ - Cardinal result ; /* function results */ - URMResourceContextPtr context_id ; /* context for reading literal */ - char err_msg[300] ; - long *bufptr ; /* context buffer */ - - /* - * Acquire a context and read the literal into it. - */ - UrmGetResourceContext ((char *(*)())NULL, (void(*)())NULL, 0, &context_id) ; - switch ( resptr->type ) - { - case URMrIndex: - if ( resptr->access == URMaPublic ) - result = Urm__HGetIndexedLiteral - (hierarchy_id, resptr->key.index, context_id, act_file_id) ; - else - result = UrmGetIndexedLiteral - (file_id, resptr->key.index, context_id) ; - if ( result != MrmSUCCESS ) - { - UrmFreeResourceContext (context_id) ; - sprintf (err_msg, _MrmMMsg_0077, resptr->key.index) ; - return Urm__UT_Error ("Urm__CW_ReadLiteral", err_msg, - NULL, NULL, result) ; - } - break ; - case URMrRID: - result = UrmGetRIDLiteral (file_id, resptr->key.id, context_id) ; - *act_file_id = file_id ; - if ( result != MrmSUCCESS ) - { - UrmFreeResourceContext (context_id) ; - sprintf (err_msg, _MrmMMsg_0078, resptr->key.id) ; - return Urm__UT_Error ("Urm__CW_ReadLiteral", err_msg, - NULL, NULL, result) ; - } - break ; - default: - result = MrmFAILURE ; - UrmFreeResourceContext (context_id) ; - sprintf ( err_msg, _MrmMMsg_0079, resptr->type) ; - return Urm__UT_Error ("Urm__CW_ReadLiteral", err_msg, - NULL, NULL, result) ; - } - - /* - * return the rep type, size, and value. Save the resource context. - */ - *type = UrmRCType (context_id) ; - *vec_size = UrmRCSize(context_id); - *vec_count = 0; - bufptr = (long *) UrmRCBuffer (context_id) ; - *val = Urm__CW_EvaluateValOrOffset (*type, (XtPointer)bufptr, *bufptr, 0) ; - UrmPlistAppendPointer (ctxlist, (XtPointer)context_id) ; - - /* - * Handle literals which may have further embedded literal references. Note - * that the file for private references is the local file, possibly changed - * by the HGetIndexedLiteral - */ - switch ( *type ) - { - case MrmRtypeIntegerVector: - *vec_count = ((RGMIntegerVectorPtr)*val)->count ; - break; - case MrmRtypeChar8Vector: - case MrmRtypeCStringVector: - *vec_count = ((RGMTextVectorPtr)*val)->count ; - break; - case MrmRtypeIconImage: - result = Urm__CW_LoadIconImage ((RGMIconImagePtr)*val, - (XtPointer)*val, hierarchy_id, - *act_file_id, ctxlist) ; - if ( result != MrmSUCCESS ) return result ; - break ; - } - - return MrmSUCCESS ; - -} - - - -/* - *++ - * - * PROCEDURE DESCRIPTION: - * - * This routine completes the loading and fixup of a URM - * icon image. Iconimages may have several other literal - * resource references embedded within their definition. - * These are all read and turned into memory references. - * - * FORMAL PARAMETERS: - * - * iconptr The (unfixedup) icon image now in memory - * bufptr buffer for offsets - * hierarchy_id hierarchy from which to read public resource - * file_id file from which to read private resource - * ctxlist list in which to save resource contexts - * - * IMPLICIT INPUTS: - * - * IMPLICIT OUTPUTS: - * - * FUNCTION VALUE: - * - * MrmSUCCESS operation succeeded - * other failures from ReadLiteral - * - * SIDE EFFECTS: - * - *-- - */ - -Cardinal -Urm__CW_LoadIconImage (RGMIconImagePtr iconptr , - XtPointer bufptr , - MrmHierarchy hierarchy_id , - IDBFile file_id , - URMPointerListPtr ctxlist ) -{ - /* - * Local variables - */ - Cardinal result ; /* function results */ - RGMResourceDescPtr resptr ; /* to read resource literals */ - RGMColorTablePtr ctable ; /* color table in icon image */ - Cardinal ndx ; /* loop index */ - RGMColorTableEntryPtr citem ; /* color table entry */ - MrmType cttype = MrmRtypeColorTable ; /* expected type */ - XtPointer ctbufptr ; /* buffer base addr for table */ - MrmType ctype ; /* color entry type */ - IDBFile act_file ; /* file from which literals read */ - char err_msg[300] ; - int vec_size ; - Boolean swap_needed = FALSE ; - - /* - * Fixup pointers as required. Read the color table if it is a resource. - * Note that bufptr is reset to a color table resource read in in order - * provide the correct relocation for color items. - */ - if (iconptr->validation != URMIconImageValid) - if ( Urm__SwapValidation(iconptr->validation) == URMIconImageValid ) - { - swapbytes( iconptr->validation ); - swapbytes( iconptr->width ); - swapbytes( iconptr->height ); - swapbytes( iconptr->hot_x ); - swapbytes( iconptr->hot_y ); - swapbytes( iconptr->ct_type ); - swapbytes( iconptr->annex1 ); - swapbytes( iconptr->color_table.ctoff ); - swapbytes( iconptr->pixel_data.pdoff ); - swap_needed = TRUE; - } - else - /* CR9259 */ - return Urm__UT_Error ("Urm__CW_LoadIconImage", - _MrmMMsg_0028, NULL, NULL, MrmNOT_VALID) ; - - iconptr->pixel_data.pdptr = (char *) bufptr+iconptr->pixel_data.pdoff ; - switch ( iconptr->ct_type ) - { - case MrmRtypeColorTable: - iconptr->color_table.ctptr = (RGMColorTablePtr) - ((char *)bufptr+iconptr->color_table.ctoff) ; - ctbufptr = bufptr ; - break ; - case MrmRtypeResource: { - int vec_count; - resptr = (RGMResourceDescPtr) - ((char *)bufptr+iconptr->color_table.ctoff) ; - if ( swap_needed ) Urm__SwapRGMResourceDesc(resptr); - result = Urm__CW_ReadLiteral - (resptr, hierarchy_id, file_id, ctxlist, - &cttype, (long *)(&iconptr->color_table.ctptr), - &vec_count, &act_file, &vec_size) ; - if ( result != MrmSUCCESS ) return result ; - if ( cttype != MrmRtypeColorTable ) - { - sprintf (err_msg, _MrmMMsg_0080, cttype) ; - return Urm__UT_Error ("Urm__CW_LoadIconImage", - err_msg, NULL, NULL, MrmNOT_VALID) ; - } - ctbufptr = (XtPointer) iconptr->color_table.ctptr ; - break ; - } - default: - sprintf (err_msg, _MrmMMsg_0081, iconptr->ct_type) ; - return Urm__UT_Error ("Urm__CW_LoadIconImage", - err_msg, NULL, NULL, MrmNOT_VALID) ; - } - - /* - * Load any resource colors in the color table. - */ - ctable = iconptr->color_table.ctptr ; - if (ctable->validation != URMColorTableValid) - if ( Urm__SwapValidation(ctable->validation) == URMColorTableValid ) - { - swapbytes( ctable->validation ); - swapbytes( ctable->count ); - swap_needed = TRUE; - } - else - /* CR9259 */ - return Urm__UT_Error ("Urm__CW_LoadIconImage", - _MrmMMsg_0028, NULL, NULL, MrmNOT_VALID) ; - - for ( ndx=URMColorTableUserMin ; ndxcount ; ndx++ ) - { - citem = &ctable->item[ndx] ; - if ( swap_needed ) - { - swapbytes( citem->type ); - swapbytes( citem->annex1 ); - swapbytes( citem->color_item.coffs ); - } - switch ( citem->type ) - { - case MrmRtypeColor: - citem->color_item.cptr = (RGMColorDescPtr) - ((char *)ctbufptr+citem->color_item.coffs) ; - break ; - case MrmRtypeResource: { - int vec_count; - resptr = (RGMResourceDescPtr) - ((char *)ctbufptr+citem->color_item.coffs) ; - if ( swap_needed ) Urm__SwapRGMResourceDesc(resptr); - ctype = MrmRtypeColor ; - result = Urm__CW_ReadLiteral - (resptr, hierarchy_id, file_id, - ctxlist, &ctype, (long *)(&citem->color_item.cptr), - &vec_count, &act_file, &vec_size) ; - if ( result != MrmSUCCESS ) return result ; - if ( ctype != MrmRtypeColor ) - { - sprintf (err_msg, _MrmMMsg_0082, ctype) ; - return Urm__UT_Error ("Urm__CW_LoadIconImage", - err_msg, NULL, NULL, MrmNOT_VALID) ; - } - break ; - } - default: - sprintf ( err_msg, _MrmMMsg_0083, citem->type) ; - return Urm__UT_Error ("Urm__CW_LoadIconImage", - err_msg, NULL, NULL, MrmNOT_VALID) ; - } - } - return MrmSUCCESS ; - -} - - - -/* - *++ - * - * PROCEDURE DESCRIPTION: - * - * This routine fixes up a callback list in a record to function - * as the callback list passed to create. It must turn routine - * names into addresses, and evaluate tag values. - * - * FORMAL PARAMETERS: - * - * parent this widget's parent - * bufptr buffer (base address) for resolving offsets - * cbdesc Callback descriptor in record. Its pointers - * must be fixed up and its tag values evaluated. - * ctxlist A pointer list to save contexts created to - * evaluate literals. - * hierarchy_id URM hierarchy from which to read public resources - * file_id URM file from which to read private resources - * wref_id reference structure from which references to - * previously created widgets in the tree can be - * resolved. - * - * IMPLICIT INPUTS: - * - * IMPLICIT OUTPUTS: - * - * FUNCTION VALUE: - * - * MrmSUCCESS operation succeeded - * MrmUNRESOLVED_REFS unresolved references to widgets remain - * other conversion or resource evaluation failure - * - * SIDE EFFECTS: - * - *-- - */ - -Cardinal -Urm__CW_FixupCallback (Widget parent , - XtPointer bufptr , - RGMCallbackDescPtr cbdesc , - URMPointerListPtr ctxlist , - URMPointerListPtr cblist , - MrmHierarchy hierarchy_id , - IDBFile file_id , - URMResourceContextPtr wref_id) -{ - /* - * Local variables - */ - Cardinal result ; /* function results */ - int ndx ; /* loop index */ - RGMCallbackItemPtr itmptr ; /* current list item */ - String rtn_name ; /* routine name in item */ - MrmType reptype ; /* arg value representation type */ - RGMResourceDescPtr resptr ; /* resource descriptor in tag */ - IDBFile act_file ; /* file from which literals read */ - XtPointer rtn_addr ; /* routine address */ - long tag_val ; /* to save value */ - int vec_count ; /* number of items in the vector */ - char err_msg[300] ; - MrmCount unres_ref_count = 0; /* num unres. widgets in cblist */ - String ref_name; /* referenced widget name */ - Widget ref_id ; /* referenced widget id */ - int vec_size ; - RGMFontListPtr fontlist; /* for converting old style fontlist */ - Boolean swap_needed = FALSE; - - /* - * Loop through all the items in the callback list - */ - for ( ndx=0 ; ndxcount ; ndx++ ) - { - itmptr = &cbdesc->item[ndx] ; - - /* - * Set the routine pointer to the actual routine address. This - * routine name must be a registered URM callback. - */ - rtn_name = (String) bufptr + itmptr->cb_item.routine ; - result = Urm__LookupNameInHierarchy (hierarchy_id, rtn_name, &rtn_addr) ; - if ( result != MrmSUCCESS ) - { - sprintf (err_msg, _MrmMMsg_0084, rtn_name) ; - return Urm__UT_Error ("Urm__CW_FixupCallback", - err_msg, NULL, NULL, result) ; - } - - /* - * Evaluate the tag value, and set in the item. - */ - reptype = itmptr->cb_item.rep_type ; - tag_val = Urm__CW_EvaluateValOrOffset (reptype, bufptr, - itmptr->cb_item.datum.ival, - itmptr->cb_item.datum.offset) ; - switch ( reptype ) - { - case MrmRtypeResource: - resptr = (RGMResourceDescPtr) tag_val ; - switch ( resptr->res_group ) - { - case URMgWidget: - /* Do we need to worry about subtree resources here? */ - if (resptr->type != URMrIndex) - { - Urm__UT_Error("Urm__CW_FixupCallback", _MrmMMsg_0085, - NULL, NULL, MrmNOT_VALID); - continue; - } - ref_name = (String) resptr->key.index; - /* See if reference can be resolved immediatetly. */ - result = Urm__CW_FindWRef(wref_id, ref_name, &ref_id) ; - if ( result == MrmSUCCESS ) tag_val = (long)ref_id; - else { /* Save to resolve later */ - itmptr->runtime.resolved = FALSE; - itmptr->runtime.wname = Urm__UT_AllocString(ref_name); - tag_val = 0L; - unres_ref_count++; - } - break; - - case URMgLiteral: - result = Urm__CW_ReadLiteral - (resptr, hierarchy_id, file_id, ctxlist, - &reptype, &tag_val, &vec_count, &act_file, &vec_size); - if ( result != MrmSUCCESS ) continue ; - - if ((reptype == MrmRtypeFontList) && - (strcmp(file_id->db_version, URM1_1version) <= 0)) - { - int count = ((OldRGMFontListPtr)tag_val)->count; - - fontlist = (RGMFontListPtr) - XtMalloc(sizeof(RGMFontList) + - (sizeof(RGMFontItem) * (count - 1))); - result = Urm__CW_FixupValue((long)fontlist, reptype, - (XtPointer)tag_val, file_id, - &swap_needed); - XtFree((char *)tag_val); - tag_val = (long)fontlist; - } - else - result = Urm__CW_FixupValue (tag_val, reptype, - (XtPointer)tag_val, file_id, - &swap_needed) ; - - if ( result != MrmSUCCESS ) continue ; - result = Urm__CW_ConvertValue - (parent, &tag_val, reptype, (MrmType)0, XtDisplay(parent), - hierarchy_id, NULL) ; - if ( result != MrmSUCCESS ) continue ; - - switch (reptype) - { - case MrmRtypeChar8Vector: - case MrmRtypeCStringVector: - vec_size -= (sizeof ( RGMTextVector ) - - sizeof ( RGMTextEntry )); - break; - default: - break; - } - - Urm__CW_SafeCopyValue (&tag_val, reptype, cblist, - vec_count, vec_size) ; - itmptr->runtime.resolved = TRUE; - break ; - default: - return Urm__UT_Error ("Urm__CW_FixupCallback", _MrmMMsg_0063, - NULL, NULL, MrmFAILURE) ; - } - break ; - default: - result = Urm__CW_FixupValue (tag_val, reptype, bufptr, file_id, - &swap_needed) ; - if ( result != MrmSUCCESS ) continue ; - result = Urm__CW_ConvertValue - (parent, &tag_val, reptype, (MrmType)0, XtDisplay(parent), - hierarchy_id, NULL) ; - Urm__CW_SafeCopyValue (&tag_val, reptype, cblist, 0, 0) ; - itmptr->runtime.resolved = TRUE; - break ; - } - - itmptr->runtime.callback.callback = (XtCallbackProc)rtn_addr; - itmptr->runtime.callback.closure = (XtPointer) tag_val ; - } - - cbdesc->unres_ref_count = unres_ref_count; - if (unres_ref_count == 0) - /* - * callback list successfully fixed up - */ - return MrmSUCCESS ; - else return MrmUNRESOLVED_REFS; - -} - - -/* - *++ - * - * PROCEDURE DESCRIPTION: - * - * This routine evaluates a resource reference to a widget by loading - * the widget definition and instantiating the widget tree. It returns - * the widget id. - * This routine evaluates a resource reference, resulting in setting - * - * FORMAL PARAMETERS: - * - * parent parent of the widget being created - * widgetrec widget record pointer - * resptr the resource to be evaluated - * ctxlist A pointer list to save contexts created to - * evaluate literals. - * hierarchy_id URM hierarchy from which to read public resources - * file_id URM file from which to read private resources - * wref_id widget reference structure - * svlist SetValues descriptor list - * val to return the value (widget id) - * - * IMPLICIT INPUTS: - * - * IMPLICIT OUTPUTS: - * - * FUNCTION VALUE: - * - * MrmSUCCESS operation succeeded - * other load or instantiate failure - * - * SIDE EFFECTS: - * - *-- - */ - -/*ARGSUSED*/ -Cardinal -Urm__CW_LoadWidgetResource (Widget parent , - RGMWidgetRecordPtr widgetrec , /* unused */ - RGMResourceDescPtr resptr , - URMPointerListPtr ctxlist , /* unused */ - MrmHierarchy hierarchy_id , - IDBFile file_id , - URMPointerListPtr *svlist , - URMResourceContextPtr wref_id , - long *val ) - -{ - /* - * Local variables - */ - Cardinal result ; /* function results */ - URMResourceContextPtr context_id ; /* context for widget record */ - IDBFile loc_fileid = file_id ; /* file id from HGet */ - char err_msg[300] ; /* to format error messages */ - - - /* - * Acquire a context, then load the widget and instantiate the tree. - * An HGet call may replace the file for private references. - */ - UrmGetResourceContext ((char *(*)())NULL, (void(*)())NULL, 0, &context_id) ; - switch ( resptr->type ) - { - case URMrIndex: - if ( resptr->access == URMaPublic ) - result = UrmHGetWidget - (hierarchy_id, resptr->key.index, context_id, &loc_fileid) ; - else - result = UrmGetIndexedWidget - (file_id, resptr->key.index, context_id) ; - if ( result != MrmSUCCESS ) - sprintf (err_msg, _MrmMMsg_0086, resptr->key.index) ; - break ; - - case URMrRID: - result = UrmGetRIDWidget (file_id, resptr->key.id, context_id) ; - if ( result != MrmSUCCESS ) - sprintf (err_msg, _MrmMMsg_0087, resptr->key.id) ; - break ; - - default: - result = MrmFAILURE ; - sprintf ( err_msg, _MrmMMsg_0088, resptr->type) ; - } - - if ( result != MrmSUCCESS ) - { - UrmFreeResourceContext (context_id) ; - return Urm__UT_Error ("Urm__CW_LoadWidgetResource", - err_msg, NULL, NULL, result) ; - } - - /* - * Now create the widget subtree. The pointer result is the widget id of - * the widget we now have (the root of the tree). - */ - result = UrmCreateWidgetTree - (context_id, parent, hierarchy_id, loc_fileid, NULL, NULL, 0, - resptr->type, resptr->key.index, resptr->key.id, MrmManageDefault, - (URMPointerListPtr *)svlist, wref_id, (Widget *)val) ; - if ( result != MrmSUCCESS ) - Urm__UT_Error ("Urm__CW_LoadWidgetResource", _MrmMMsg_0089, - NULL, NULL, result) ; - UrmFreeResourceContext (context_id) ; - return result ; - -} - - - -/* - *++ - * - * PROCEDURE DESCRIPTION: - * - * This routine returns parameters needed to create a pixmap from - * an IconImage. It extracts the screen and display from the given - * widget. It then determines the foreground and background colors - * for the widget. The setting of these values is idiosyncratic, due - * to the fact that all widgets have a Background attribute from core, - * but are not guaranteed to have a Foreground attribute. - * - if value is already set, do nothing - * - else choose the value for the widget if available - * - else choose white/black PixelOfScreen - * - make sure we haven't ended up with identical values - * for both foreground and background. If we have, accept - * the background value and set the foreground to something - * else (black or white). - * - * FORMAL PARAMETERS: - * - * w widget to use for default values - * screen to return screen for pixmap - * display to return display for pixmap - * fgint to return foreground value for pixmap. A value of - * -1 on input means this must be set; else ignored - * bgint to return background value for pixmap. -1 is used - * as above to signal value needed - * - * IMPLICIT INPUTS: - * - * IMPLICIT OUTPUTS: - * - * FUNCTION VALUE: - * - * SIDE EFFECTS: - * - *-- - */ - -void -Urm__CW_GetPixmapParms (Widget w , - Screen **screen , - Display **display , - Pixel *fgint , - Pixel *bgint ) -{ - /* - * Local variables - */ - Arg pixarg[2] ; /* to read FG/BG values */ - Cardinal pcnt = 0 ; /* # entries in arglist */ - - /* - * Screen and display come straight from widget - */ - *screen = XtScreen (w) ; - *display = XtDisplay (w) ; - - /* - * Else load the foreground and background pixel values from the - * widget. Fallback to Black/WhitePixelOfScreen if the widget - * doesn't have these values. - */ - if ( *fgint == -1 ) - { - XtSetArg (pixarg[pcnt], XmNforeground, fgint) ; - pcnt += 1 ; - } - if ( *bgint == -1 ) - { - XtSetArg (pixarg[pcnt], XmNbackground, bgint) ; - pcnt += 1 ; - } - if ( pcnt > 0 ) - XtGetValues (w, pixarg, pcnt) ; - - /* - * Fall back on ...PixelOfScreen - */ - if ( *fgint == -1 ) - *fgint = BlackPixelOfScreen (*screen) ; - if ( *bgint == -1 ) - *bgint = WhitePixelOfScreen (*screen) ; - - /* - * Make sure we haven't ended with identical values - */ - if ( *fgint == *bgint ) - { - if ( *bgint == BlackPixelOfScreen(*screen) ) - *fgint = WhitePixelOfScreen (*screen) ; - else - *fgint = BlackPixelOfScreen (*screen) ; - } - -} - - - -/* - *++ - * - * PROCEDURE DESCRIPTION: - * - * This routine translates an RGMCallbackDescPtr stored in a 1.1 uid - * file into the equivalent 1.2+ structure. This routine allocates - * memory which must later be freed using XtFree. - * - * FORMAL PARAMETERS: - * - * oldptr Pointer into the buffer where the 1.1 callback - * descriptor starts. - * - * IMPLICIT INPUTS: - * - * IMPLICIT OUTPUTS: - * - * FUNCTION VALUE: - * - * This function returns a pointer to a new RGMCallbackDesc containing - * all the information from the structure stored in the uid file. - * - * SIDE EFFECTS: - * - * Memory is allocated which must be freed using XtFree. - * - *-- - */ - -RGMCallbackDescPtr -Urm__CW_TranslateOldCallback (OldRGMCallbackDescPtr oldptr) -{ - /* - * Local variables - */ - RGMCallbackDescPtr cbptr; /* pointer to new callback descriptor */ - RGMCallbackItemPtr itmptr; /* current callback item */ - OldRGMCallbackItemPtr olditmptr; /* callback item being converted */ - int ndx; /* loop index */ - - cbptr = (RGMCallbackDescPtr) XtMalloc(sizeof(RGMCallbackDesc) + - oldptr->count*sizeof(RGMCallbackItem)); - - cbptr->validation = oldptr->validation; - cbptr->count = oldptr->count; - - /* Loop through all items in old callback list copying to new. */ - for (ndx = 0; ndx <= cbptr->count; ndx++) - /* <= so that null item is copied. */ - { - olditmptr = &oldptr->item[ndx]; - itmptr = &cbptr->item[ndx]; - - itmptr->cb_item.routine = olditmptr->cb_item.routine; - itmptr->cb_item.rep_type = olditmptr->cb_item.rep_type; - itmptr->cb_item.datum = olditmptr->cb_item.datum; - } - - return cbptr; -} - diff --git a/lib/Xm/ColorS.c b/lib/Xm/ColorS.c index 22224ae..6baf2e3 100644 --- a/lib/Xm/ColorS.c +++ b/lib/Xm/ColorS.c @@ -146,7 +146,7 @@ static XtResource resources[] = { XmNrgbFile, XmCString, XmRString, sizeof(String), XtOffsetOf(XmColorSelectorRec, cs.rgb_file), - XmRString, (XtPointer) "/usr/share/X11/rgb.txt" + XmRString, (XtPointer) "/usr/lib/X11/rgb.txt" }, #endif { diff --git a/lib/Xm/ColorS.c.rgbtxt b/lib/Xm/ColorS.c.rgbtxt deleted file mode 100644 index 6baf2e3..0000000 --- a/lib/Xm/ColorS.c.rgbtxt +++ /dev/null @@ -1,1859 +0,0 @@ -/* - * Motif - * - * Copyright (c) 1987-2012, The Open Group. All rights reserved. - * - * These libraries and programs are free software; you can - * redistribute them and/or modify them under the terms of the GNU - * Lesser General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) - * any later version. - * - * These libraries and programs are distributed in the hope that - * they will be useful, but WITHOUT ANY WARRANTY; without even the - * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU Lesser General Public License for more - * details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with these librararies and programs; if not, write - * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth - * Floor, Boston, MA 02110-1301 USA - * - */ - -/************************************************************ - * INCLUDE FILES - ************************************************************/ -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include -#include - -#include "ColorSP.h" - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include "XmI.h" - -/************************************************************ - * TYPEDEFS AND DEFINES - ************************************************************/ - -#define SUPERCLASS ((WidgetClass) &xmManagerClassRec) - -/************************************************************ - * MACROS - ************************************************************/ - -/************************************************************ - * GLOBAL DECLARATIONS - ************************************************************/ - -extern void XmeNavigChangeManaged(Widget); - -/************************************************************ - * STATIC FUNCTION DECLARATIONS - ************************************************************/ - -static void ChangeManaged(Widget w); -static void ClassInitialize(void), Destroy(Widget), Resize(Widget); -static void ClassPartInitialize(WidgetClass w_class); -static void Initialize(Widget, Widget, ArgList, Cardinal *); -static Boolean SetValues(Widget, Widget, Widget, ArgList, Cardinal *); -static XtGeometryResult GeometryHandler(Widget, XtWidgetGeometry *, - XtWidgetGeometry *); -static XtGeometryResult QueryGeometry(Widget, XtWidgetGeometry *, - XtWidgetGeometry *); - -static Boolean UpdateColorWindow(XmColorSelectorWidget, Boolean); -static Boolean color_name_changed(XmColorSelectorWidget, char *); -static Boolean FindColor(XmColorSelectorWidget, int *); -static Boolean CvtStringToColorMode(Display *, XrmValuePtr, Cardinal, - XrmValuePtr, XrmValuePtr, XtPointer *); -static Boolean DefaultVisualDisplay(XmColorSelectorWidget, Pixel, XColor, char *); - -static void CalcPreferredSize(XmColorSelectorWidget, Dimension *, Dimension *); -static void SelectColor(XmColorSelectorWidget); -static void slider_changed(Widget, XtPointer, XtPointer); -static void list_selected(Widget, XtPointer, XtPointer); -static void change_mode(Widget, XtPointer, XtPointer); -static void new_mode(XmColorSelectorWidget, XmColorMode); -static void compute_size(XmColorSelectorWidget); -static void read_rgb_file(XmColorSelectorWidget, ArgList, Cardinal, Boolean); -static void SetSliders(XmColorSelectorWidget); - -static void CreateColorSliders(XmColorSelectorWidget, ArgList, Cardinal); -static void CreateSelectorRadio(XmColorSelectorWidget, ArgList, Cardinal); -static void CreateColorWindow(XmColorSelectorWidget, ArgList, Cardinal); -static void NoPrivateColormaps(XmColorSelectorWidget, Pixel, XColor, char *); -static void PrivateColormaps(XmColorSelectorWidget, Pixel, XColor, char *); - -#ifdef notdef -static void CreateTypes(XmColorSelectorWidget, Widget, ArgList, Cardinal); -#endif - -static int CmpColors(const void *, const void *); -static char *find_name(char *); -static int GetVisual(XmColorSelectorWidget); - -static void GetValues_XmNredSliderLabel ( Widget w, int n, XtArgVal *value) ; -static void GetValues_XmNgreenSliderLabel( Widget w, int n, XtArgVal *value) ; -static void GetValues_XmNblueSliderLabel( Widget w, int n, XtArgVal *value) ; -static void GetValues_XmNcolorListTogLabel( Widget w, int n, XtArgVal *value) ; -static void GetValues_XmNsliderTogLabel( Widget w, int n, XtArgVal *value) ; -static void GetValues_XmNnoCellError( Widget w, int n, XtArgVal *value) ; -static void GetValues_XmNfileReadError( Widget w, int n, XtArgVal *value) ; - -/************************************************************ - * STATIC DECLARATIONS - ************************************************************/ - -static XtResource resources[] = -{ - { - XmNcolorMode, XmCColorMode, XmRXmColorMode, - sizeof(XmColorMode), XtOffsetOf(XmColorSelectorRec, cs.color_mode), - XmRImmediate, (XtPointer) XmScaleMode - }, - - { - XmNcolorName, XmCString, XmRString, - sizeof(String), XtOffsetOf(XmColorSelectorRec, cs.color_name), - XmRString, "White" - }, -#ifdef VMS - { - XmNrgbFile, XmCString, XmRString, - sizeof(String), XtOffsetOf(XmColorSelectorRec, cs.rgb_file), - XmRString, (XtPointer) "sys$manager:decw$rgb.dat" - }, -#else - { - XmNrgbFile, XmCString, XmRString, - sizeof(String), XtOffsetOf(XmColorSelectorRec, cs.rgb_file), - XmRString, (XtPointer) "/usr/lib/X11/rgb.txt" - }, -#endif - { - XmNmarginWidth, XmCMargin, XmRHorizontalDimension, - sizeof(Dimension), XtOffsetOf(XmColorSelectorRec, cs.margin_width), - XmRImmediate, (XtPointer) 2 - }, - - { - XmNmarginHeight, XmCMargin, XmRVerticalDimension, - sizeof(Dimension), XtOffsetOf(XmColorSelectorRec, cs.margin_height), - XmRImmediate, (XtPointer) 2 - }, - - { - XmNredSliderLabel, XmCSliderLabel, XmRXmString, - sizeof(XmString), XtOffsetOf(XmColorSelectorRec, cs.strings.slider_labels[0]), - XmRString, (XtPointer) "Red" - }, - - { - XmNgreenSliderLabel, XmCSliderLabel, XmRXmString, - sizeof(XmString), XtOffsetOf(XmColorSelectorRec, cs.strings.slider_labels[1]), - XmRString, (XtPointer) "Green" - }, - - { - XmNblueSliderLabel, XmCSliderLabel, XmRXmString, - sizeof(XmString), XtOffsetOf(XmColorSelectorRec, cs.strings.slider_labels[2]), - XmRString, (XtPointer) "Blue" - }, - - { - XmNcolorListTogLabel, XmCTogLabel, XmRXmString, - sizeof(XmString), XtOffsetOf(XmColorSelectorRec, cs.strings.tog_labels[0]), - XmRString, (XtPointer) "Color List" - }, - - { - XmNsliderTogLabel, XmCTogLabel, XmRXmString, - sizeof(XmString), XtOffsetOf(XmColorSelectorRec, cs.strings.tog_labels[1]), - XmRString,(XtPointer)"Color Sliders" - }, - - { - XmNnoCellError, XmCNoCellError, XmRXmString, - sizeof(XmString), XtOffsetOf(XmColorSelectorRec, cs.strings.no_cell_error), - XmRString, (XtPointer)"\n\nNo Color Cell Available!" - }, - - { - XmNfileReadError, XmCFileReadError, XmRXmString, - sizeof(XmString), XtOffsetOf(XmColorSelectorRec, cs.strings.file_read_error), - XmRString, (XtPointer)"Could not read rgb.txt file:" - } -}; - -static XmSyntheticResource get_resources[] = -{ - { - XmNmarginWidth, sizeof(Dimension), - XtOffsetOf(XmColorSelectorRec, cs.margin_width), - XmeFromHorizontalPixels, (XmImportProc) XmeToHorizontalPixels - }, - - { - XmNmarginHeight, sizeof(Dimension), - XtOffsetOf(XmColorSelectorRec, cs.margin_height), - XmeFromVerticalPixels, (XmImportProc) XmeToVerticalPixels - }, - - { - XmNredSliderLabel, sizeof(XmString), - XtOffsetOf(XmColorSelectorRec, cs.strings.slider_labels[0]), - GetValues_XmNredSliderLabel, NULL - }, - - { - XmNgreenSliderLabel, sizeof(XmString), - XtOffsetOf(XmColorSelectorRec, cs.strings.slider_labels[1]), - GetValues_XmNgreenSliderLabel, NULL - }, - - { - XmNblueSliderLabel, sizeof(XmString), - XtOffsetOf(XmColorSelectorRec, cs.strings.slider_labels[2]), - GetValues_XmNblueSliderLabel, NULL - }, - - { - XmNcolorListTogLabel, sizeof(XmString), - XtOffsetOf(XmColorSelectorRec, cs.strings.tog_labels[0]), - GetValues_XmNcolorListTogLabel, NULL - }, - - { - XmNsliderTogLabel, sizeof(XmString), - XtOffsetOf(XmColorSelectorRec, cs.strings.tog_labels[1]), - GetValues_XmNsliderTogLabel, NULL - }, - - { - XmNnoCellError, sizeof(XmString), - XtOffsetOf(XmColorSelectorRec, cs.strings.no_cell_error), - GetValues_XmNnoCellError, NULL - }, - - { - XmNfileReadError, sizeof(XmString), - XtOffsetOf(XmColorSelectorRec, cs.strings.file_read_error), - GetValues_XmNfileReadError, NULL - } -}; - -XmColorSelectorClassRec xmColorSelectorClassRec = { - { /* core fields */ - /* superclass */ SUPERCLASS, - /* class_name */ "XmColorSelector", - /* widget_size */ sizeof(XmColorSelectorRec), - /* class_initialize */ ClassInitialize, - /* class_part_initialize */ ClassPartInitialize, - /* class_inited */ False, - /* initialize */ Initialize, - /* initialize_hook */ NULL, - /* realize */ XtInheritRealize, - /* actions */ NULL, - /* num_actions */ (Cardinal)0, - /* resources */ (XtResource*)resources, - /* num_resources */ XtNumber(resources), - /* xrm_class */ NULLQUARK, - /* compress_motion */ True, - /* compress_exposure */ True, - /* compress_enterleave */ True, - /* visible_interest */ False, - /* destroy */ Destroy, - /* resize */ Resize, - /* expose */ NULL, - /* set_values */ SetValues, - /* set_values_hook */ NULL, - /* set_values_almost */ XtInheritSetValuesAlmost, - /* get_values_hook */ NULL, - /* accept_focus */ NULL, - /* version */ XtVersion, - /* callback_private */ NULL, - /* tm_table */ XtInheritTranslations, - /* query_geometry */ (XtGeometryHandler) QueryGeometry, - /* display_accelerator */ XtInheritDisplayAccelerator, - /* extension */ NULL, - }, - { /* composite_class fields */ - /* geometry_manager */ GeometryHandler, - /* change_managed */ ChangeManaged, - /* insert_child */ XtInheritInsertChild, - /* delete_child */ XtInheritDeleteChild, - /* extension */ NULL, - }, - { /* constraint_class fields */ - /* resource list */ NULL, - /* num resources */ 0, - /* constraint size */ sizeof(XmColorSelectorConstraintRec), - /* destroy proc */ NULL, - /* init proc */ NULL, - /* set values proc */ NULL, - /* extension */ NULL, - }, - { /* manager_class fields */ - /* default translations */ XtInheritTranslations, - /* syn_resources */ get_resources, - /* num_syn_resources */ XtNumber(get_resources), - /* syn_cont_resources */ NULL, - /* num_syn_cont_resources */ 0, - /* parent_process */ NULL, - /* extension */ NULL, - }, - { /* color_selector_class fields */ - /* mumble */ NULL, - } -}; - -WidgetClass xmColorSelectorWidgetClass = (WidgetClass)&xmColorSelectorClassRec; - -/************************************************************ - * STATIC CODE - ************************************************************/ - -/* Function Name: ClassInitialize - * Description: Called to initialize class specific information. - * Arguments: widget_class - the widget class. - * Returns: none. - */ - -static void -ClassInitialize(void) -{ - XmColorSelectorClassRec *wc = &xmColorSelectorClassRec; - - XtSetTypeConverter(XmRString, XmRXmColorMode, - (XtTypeConverter) CvtStringToColorMode, - NULL, (Cardinal) 0, XtCacheAll, NULL); -} - -/* - * ClassPartInitialize sets up the fast subclassing for the widget. - */ -static void -#ifdef _NO_PROTO -ClassPartInitialize(w_class) - WidgetClass w_class ; -#else -ClassPartInitialize(WidgetClass w_class) -#endif /* _NO_PROTO */ -{ - _XmFastSubclassInit (w_class, XmCOLORSELECTOR_BIT); -} - - - -/* Function Name: Initialize - * Description: Called to initialize information specific - * to this widget. - * Arguments: request - what was originally requested. - * set - what will be created (our superclasses have - * already mucked with this) - * args, num_args - The arguments passed to - * the creation call. - * Returns: none. - */ - -/* ARGSUSED */ -static void -Initialize(Widget request, Widget set, ArgList args, Cardinal *num_args) -{ - XmColorSelectorWidget csw = (XmColorSelectorWidget)set; - Dimension width, height; - String temp; - char message_buffer[BUFSIZ]; - ArgList f_args; - Cardinal f_num_args; - Widget button; - - _XmFilterArgs(args, *num_args, xm_std_filter, &f_args, &f_num_args); - - /* - * Initialize important values. - */ - - XmColorS_good_cell(csw) = False; - - temp = XmColorS_color_name(csw); - XmColorS_color_name(csw) = NULL; - XmColorS_list(csw) = NULL; - - CreateColorSliders(csw, f_args, f_num_args); - CreateSelectorRadio(csw, f_args, f_num_args); - CreateColorWindow(csw, f_args, f_num_args); - - XmColorS_rgb_file(csw) = XtNewString(XmColorS_rgb_file(csw)); - XmColorS_colors(csw) = NULL; - read_rgb_file(csw, f_args, f_num_args, True); - - if (!color_name_changed(csw, temp)) { - snprintf(message_buffer, BUFSIZ, XmNunparsableColorMsg, temp); - XmeWarning((Widget)set, message_buffer); - - (void) color_name_changed(csw, "White"); - } - - slider_changed(NULL, (XtPointer) csw, NULL); - - CalcPreferredSize(csw, &width, &height); - - if ( csw->core.width < 1 ) - csw->core.width = width; - - if ( csw->core.height < 1 ) - csw->core.height = height; - - new_mode(csw, XmColorS_color_mode(csw)); - button = XmColorS_chose_mode(csw)[XmColorS_color_mode(csw)]; - XmToggleButtonSetState(button, True, False); - - XtFree((XtPointer) f_args); - - { - int i; - for( i = 0; i < 3; i++ ) - XmColorS_strings(csw).slider_labels[i] = XmStringCopy(XmColorS_strings(csw).slider_labels[i]); - for (i = 0; i< XmColorSelector_NUM_TOGGLES; i++) - XmColorS_strings(csw).tog_labels[i] = XmStringCopy(XmColorS_strings(csw).tog_labels[i]); - XmColorS_strings(csw).file_read_error = XmStringCopy(XmColorS_strings(csw).file_read_error); - XmColorS_strings(csw).no_cell_error = XmStringCopy(XmColorS_strings(csw).no_cell_error); - } - -} - -/* Function Name: Destroy - * Description: Called to destroy this widget. - * Arguments: w - Color Selector Widget to destroy. - * Returns: none. - */ - -/* ARGSUSED */ -static void -Destroy(Widget w) -{ - XmColorSelectorWidget csw = (XmColorSelectorWidget)w; - - if (XmColorS_good_cell(csw)) { - XFreeColors(XtDisplay(csw), csw->core.colormap, - &XmColorS_color_pixel(csw), 1, 0); - } - - XtFree((char*) XmColorS_colors(csw)); - XtFree((char*) XmColorS_color_name(csw)); - XtFree((char*) XmColorS_rgb_file(csw)); - - { - int i; - for( i = 0; i < 3; i++ ) - XmStringFree(XmColorS_strings(csw).slider_labels[i]); - for (i = 0; i< XmColorSelector_NUM_TOGGLES; i++) - XmStringFree(XmColorS_strings(csw).tog_labels[i]); - XmStringFree(XmColorS_strings(csw).file_read_error); - XmStringFree(XmColorS_strings(csw).no_cell_error); - } -} - -/* Function Name: Resize - * Description: Called when this widget has been resized. - * Arguments: w - Color Selector Widget to realize. - * Returns: none. - */ - -/* ARGSUSED */ -static void -Resize(Widget w) -{ - compute_size((XmColorSelectorWidget)w); -} - -static Boolean AreDiff(char *s1, char *s2) -{ - if (s1 && !s2) return True; - if (s2 && !s1) return True; - if (!s1 && !s2) return False; - /* they exist; now safe to do strcmp */ - return strcmp(s1, s2); -} - -/* Function Name: SetValues - * Description: Called when some widget data needs to be modified on- - * the-fly. - * Arguments: current - the current (old) widget values. - * request - before superclassed have changed things. - * set - what will acutally be the new values. - * args, num_args - the arguments in the list. - * Returns: none - */ - -/* ARGSUSED */ -static Boolean -SetValues(Widget current, Widget request, Widget set, - ArgList args, Cardinal *num_args) -{ - XmColorSelectorWidget csw = (XmColorSelectorWidget)set; - XmColorSelectorWidget curr = (XmColorSelectorWidget)current; - - /* - * Pass argument list through to all children. - */ - - { - ArgList f_args; - Cardinal f_num_args; - - _XmFilterArgs(args, *num_args, xm_std_filter, &f_args, &f_num_args); - _XmSetValuesOnChildren(set, f_args, f_num_args); - XtFree((XtPointer) f_args); - } - - if (XmColorS_color_mode(curr) != XmColorS_color_mode(csw)) - { - new_mode(csw, XmColorS_color_mode(csw)); - XmToggleButtonSetState(XmColorS_chose_mode(csw)[XmColorS_color_mode(csw)], - True, True); - } - - /* - ** Don't compare pointers; they are allocated, so passing the same file - ** in twice will trip this expensive function unless we compare the - ** values of the strings (when they exist) - */ - if (AreDiff(XmColorS_rgb_file(curr), XmColorS_rgb_file(csw))) - { - read_rgb_file(csw, NULL, 0, False); - } - if (XmColorS_rgb_file(curr) != XmColorS_rgb_file(csw)) - { - XtFree((char*) XmColorS_rgb_file(curr)); - XmColorS_rgb_file(csw) = XtNewString(XmColorS_rgb_file(csw)); - } - - if ((XmColorS_margin_height(curr) != XmColorS_margin_height(csw)) || - (XmColorS_margin_width(curr) != XmColorS_margin_width(csw))) - { - compute_size(csw); - } - - if (XmColorS_color_name(curr) != XmColorS_color_name(csw)) - { - String oldValue; /* old color name, will free. */ - String newValue; /* new color name, allocate */ - char string_buffer[BUFSIZ]; - - oldValue = XmColorS_color_name(curr); - newValue = XmColorS_color_name(csw); - - if (!streq(newValue, oldValue)) - { - /* - * Color name changed will automatically free the old - * value on success... - */ - - XmColorS_color_name(csw) = oldValue; /* so it free's the right thing. */ - if (!color_name_changed(csw, newValue)) { - snprintf(string_buffer, BUFSIZ, XmNunparsableColorMsg, newValue); - XmeWarning(set, string_buffer); - - XmColorS_color_name(csw) = oldValue; - } - } - else { - XtFree(oldValue); - XmColorS_color_name(csw) = XtNewString(newValue); - } - } - - { - int i; - for( i = 0; i < 3; i++ ) - { - if (XmColorS_strings(curr).slider_labels[i] != XmColorS_strings(csw).slider_labels[i]) - { - XmStringFree(XmColorS_strings(curr).slider_labels[i]); - XmColorS_strings(csw).slider_labels[i] = XmStringCopy(XmColorS_strings(csw).slider_labels[i]); - XtVaSetValues(XmColorS_sliders(csw)[i], XmNtitleString, XmColorS_strings(csw).slider_labels[i], NULL); - } - } - for (i = 0; i< XmColorSelector_NUM_TOGGLES; i++) - { - if (XmColorS_strings(curr).tog_labels[i] != XmColorS_strings(csw).tog_labels[i]) - { - XmStringFree(XmColorS_strings(curr).tog_labels[i]); - XmColorS_strings(csw).tog_labels[i] = XmStringCopy(XmColorS_strings(csw).tog_labels[i]); - XtVaSetValues(XmColorS_chose_mode(csw)[i], XmNlabelString, XmColorS_strings(csw).tog_labels[i], NULL); - } - } - - if (XmColorS_strings(curr).file_read_error != XmColorS_strings(csw).file_read_error) - { - XmStringFree(XmColorS_strings(curr).file_read_error); - XmColorS_strings(csw).file_read_error = XmStringCopy(XmColorS_strings(csw).file_read_error); - } - if (XmColorS_strings(curr).no_cell_error != XmColorS_strings(csw).no_cell_error) - { - XmStringFree(XmColorS_strings(curr).no_cell_error); - XmColorS_strings(csw).no_cell_error = XmStringCopy(XmColorS_strings(csw).no_cell_error); - } - } - - return FALSE; -} - -/* Function Name: GeometryHandler - * Description: handles request from children for size changes. - * Arguments: child - the child to change. - * request - desired geometry of child. - * result - what will be allowed if almost. - * Returns: status. - */ - -/* ARGSUSED */ -static XtGeometryResult -GeometryHandler(Widget w, XtWidgetGeometry *request, XtWidgetGeometry *result) -{ - return(XtGeometryNo); -} - -/* Function Name: QueryGeometry - * Description: Called when my parent wants to know what size - * I would like to be. - * Arguments: w - the widget to check. - * indended - constriants imposed by the parent. - * preferred - what I would like. - * Returns: See Xt Manual. - */ - -static XtGeometryResult -QueryGeometry(Widget w,XtWidgetGeometry *intended, XtWidgetGeometry *preferred) -{ - CalcPreferredSize((XmColorSelectorWidget) w, - &(preferred->width), &(preferred->height)); - - return(_XmHWQuery(w, intended, preferred)); -} - -/* Function Name: ChangeManaged - * Description: Called when a management change happens. - * Arguments: w - the csw widget. - * Returns: none - */ - -static void -ChangeManaged(Widget w) -{ - compute_size((XmColorSelectorWidget) w); - - XmeNavigChangeManaged(w); -} - -/************************************************************ - * Type Converters. - ************************************************************/ - -/* Function Name: CvtStringToColorMode - * Description: Converts a string to a ColorMode - * Arguments: dpy - the X Display. - * args, num_args - *** NOT USED *** - * from - contains the string to convert. - * to - contains the converted node state. - * junk - *** NOT USED *** . - * Returns: - */ - -/* ARGSUSED */ -static Boolean -CvtStringToColorMode(Display *dpy, XrmValuePtr args, Cardinal num_args, - XrmValuePtr from, XrmValuePtr to, XtPointer * junk) -{ - static XmColorMode mode; - char lowerName[BUFSIZ]; - - XmCopyISOLatin1Lowered(lowerName, (char *)from->addr); - - if (streq(lowerName, "listmode")) - mode = XmListMode; - else if (streq(lowerName, "scalemode")) - mode = XmScaleMode; - else { - XtDisplayStringConversionWarning(dpy, from->addr, XmRXmColorMode); - return(False); /* Conversion failed. */ - } - - to->size = sizeof(XmColorMode); - if ( to->addr == NULL ) { - to->addr = (XtPointer)&mode; - return(True); - } - else if ( to->size >= sizeof(XmColorMode) ) { - XmColorMode *state = (XmColorMode *) to->addr; - - *state = mode; - return(True); - } - - return(False); -} - -/************************************************************ - * LOCAL CODE - ************************************************************/ - -/* Function Name: CalcPreferredSize - * Description: Calculates the size this widget would prefer to be. - * Arguments: csw - the color selector widget. - * RETURNED width, height - preferred size of the color selector. - * Returns: none. - */ - -static void -CalcPreferredSize(XmColorSelectorWidget csw, - Dimension *width, Dimension *height) -{ - XtWidgetGeometry geo; - Widget *childP; - - *height = *width = 0; - ForAllChildren(csw, childP) { - if (*childP == XmColorS_bb(csw)) - continue; - - (void)XtQueryGeometry(*childP, NULL, &geo); - - ASSIGN_MAX(*width, (geo.width + (2 * geo.border_width))); - - geo.height += 2 * geo.border_width; - if ( *childP == XtParent(XmColorS_color_window(csw)) ) - continue; - else if ( *childP == XmColorS_scrolled_list(csw) ) - *height += (int)(4 * geo.height)/3; - else - *height += geo.height; - - *height += XmColorS_margin_height(csw); - } - - *width += 2 * XmColorS_margin_width(csw); - *height += 2 * XmColorS_margin_height(csw); -} - -/* Function Name: color_name_changed - * Description: Change in the color name string. - * Arguments: csw - the color selector widget. - * name - the color name. - * Returns: True if successful - */ - -/* ARGSUSED */ -static Boolean -color_name_changed(XmColorSelectorWidget csw, char *name) -{ - String old_val = XmColorS_color_name(csw); - - if ( name == NULL ) { - XmColorS_color_name(csw) = NULL; - XtFree((XtPointer) old_val); - return(True); - } - - XmColorS_color_name(csw) = XtNewString(name); - - if (!UpdateColorWindow(csw, True)) { - XtFree((XtPointer) XmColorS_color_name(csw)); - XmColorS_color_name(csw) = old_val; - return(False); - } - - SetSliders(csw); - SelectColor(csw); - XtFree((XtPointer) old_val); - return(True); -} - -/* Function Name: SetSliders - * Description: Sets the values in the color sliders. - * Arguments: csw - the color selector widget. - * Returns: none - */ - -static void -SetSliders(XmColorSelectorWidget csw) -{ - static Arg args[] = { - { XmNvalue, (XtArgVal) NULL }, - }; - - args[0].value = (XtArgVal) XmColorS_slider_red(csw); - XtSetValues(XmColorS_sliders(csw)[0], args, XtNumber(args)); - - args[0].value = (XtArgVal) XmColorS_slider_green(csw); - XtSetValues(XmColorS_sliders(csw)[1], args, XtNumber(args)); - - args[0].value = (XtArgVal) XmColorS_slider_blue(csw); - XtSetValues(XmColorS_sliders(csw)[2], args, XtNumber(args)); -} - -/* Function Name: SelectColor - * Description: Selects the color in the list that corrosponds - * to the current values of the RGB sliders. - * Arguments: csw - the color selector widget. - * Returns: none. - */ - -static void -SelectColor(XmColorSelectorWidget csw) -{ - int color_num; - - if (FindColor(csw, &color_num)) { - XmListSelectPos(XmColorS_list(csw), color_num + 1, False); - XmListSetBottomPos(XmColorS_list(csw), color_num + 1); - } - else - XmListDeselectAllItems(XmColorS_list(csw)); -} - - -/* Function Name: EndsInDigits - * Description: Determines if a string ends in a digit - * Returns: True if it does - */ - -static int -EndsInDigits(char *str) -{ - register char *c = str; - while(*c != '\0') c++; /* advance to end of string marker */ - c--; /* back to the last character */ - if(c >= str && isascii(*c) && isdigit(*c)) - return True; - - return False; -} - -/* Function Name: FindColor - * Description: Finds the index into the colors array associated with - * the current slider values. Attempts to find the slot - * with a the best matching name. - * Arguments: csw - The color selector widget. - * RETURNED color_num - The color index that was found. - * Returns: True if color was found, false otherwise. - * - * NOTE: if False is returned then color_num has an undefined value. - */ - -static Boolean -FindColor(XmColorSelectorWidget csw, int *color_num) -{ - register ColorInfo *ptr; - register int i, red, green, blue; - - /* - * Obtain the color settings from the ColorSelector - * data structure - */ - red = XmColorS_slider_red(csw); - green = XmColorS_slider_green(csw); - blue = XmColorS_slider_blue(csw); - ptr = XmColorS_colors(csw); - - /* - * Flag for finding color value - */ - *color_num = -1; - - /* - * Find color within the exisiting colormap assigned to - * ColorSelector - */ - for (i = 0; i < XmColorS_num_colors(csw); i++, ptr++) - { - if ((ptr->red == red) && (ptr->green == green) && (ptr->blue == blue)) - { - if( *color_num < 0 ) - *color_num = i; - - /* Only change the selected color if it is better in some way */ - if(XmColorS_color_name(csw)) { - if(XmColorS_color_name(csw)[0] == '#') - *color_num = i; - - if(streq(XmColorS_color_name(csw), ptr->name) || - streq(XmColorS_color_name(csw), ptr->no_space_lower_name)) - { - *color_num = i; - return(True); - } - } - if(! EndsInDigits(ptr->name)) { - *color_num = i; - return(True); - } - } - } - - return(*color_num >= 0); -} - -/* Function Name: slider_changed - * Description: One of the sliders was pressed - * Arguments: w - the slider widget. - * csw - the color selector. - * scale - the scale widget callback struct. - * Returns: none. - */ - -/* ARGSUSED */ -static void -slider_changed(Widget w, XtPointer csw_ptr, XtPointer scale_ptr) -{ - XmColorSelectorWidget csw = (XmColorSelectorWidget) csw_ptr; - XmScaleCallbackStruct *scale = (XmScaleCallbackStruct *) scale_ptr; - - if (scale_ptr != NULL) { /* Set a new value. */ - if (w == XmColorS_sliders(csw)[0]) - XmColorS_slider_red(csw) = scale->value; - else if(w == XmColorS_sliders(csw)[1]) - XmColorS_slider_green(csw) = scale->value; - else if(w == XmColorS_sliders(csw)[2]) - XmColorS_slider_blue(csw) = scale->value; - } - - UpdateColorWindow(csw, False); -} - -/* Function Name: UpdateColorWindow - * Description: Updates the color window display. - * Arguments: csw - the color selector widget. - * use_name - if TRUE then use the color name to update. - * if FALSE then use the color sliders to update. - * Returns: True if successful - */ - -static Boolean -UpdateColorWindow(XmColorSelectorWidget csw, Boolean use_name) -{ - int index; - XColor color; - Pixel foreground; - char buf[XmColorSelector_COLOR_NAME_SIZE], new_label[BUFSIZ]; - - if (!use_name) /* Update color names */ - { - char *freeMe; - - freeMe = XmColorS_color_name(csw); - sprintf(buf, "#%02x%02x%02x", XmColorS_slider_red(csw), - XmColorS_slider_green(csw), XmColorS_slider_blue(csw)); - - if (FindColor(csw, &index)) - { - XmColorS_color_name(csw) = XtNewString(XmColorS_colors(csw)[index].name); - sprintf(new_label, "%s (%s)", XmColorS_color_name(csw), buf); - } - else - { - XmColorS_color_name(csw) = XtNewString(buf); - sprintf(new_label, "%s", buf); - } - - XtFree((XtPointer)freeMe ); - color.red = XmColorS_slider_red(csw) * 256; - color.green = XmColorS_slider_green(csw) * 256; - color.blue = XmColorS_slider_blue(csw) * 256; - } - else /* Update color slider */ - { - if(XParseColor(XtDisplay(csw), csw->core.colormap, - XmColorS_color_name(csw), &color) == 0) - { - return(False); - } - - XmColorS_slider_red(csw) = color.red / 256; - XmColorS_slider_green(csw) = color.green / 256; - XmColorS_slider_blue(csw) = color.blue / 256; - - /* - * Attempt to replace a name that begins with a # with a real color - * name. - */ - - if ((XmColorS_color_name(csw)[0] == '#') && FindColor(csw, &index)) - { - XtFree(XmColorS_color_name(csw)); - XmColorS_color_name(csw) = XtNewString(XmColorS_colors(csw)[index].name); - } - sprintf(buf, "#%02x%02x%02x", color.red/256, color.green/256, color.blue/256); - sprintf(new_label, "%s (%s)", XmColorS_color_name(csw), buf); - } - - { - long test = (long) color.red; - test += (long) color.green; - test += (long) color.blue; - - if (test/3 > 0x7000) - { - foreground = BlackPixelOfScreen(XtScreen((Widget) csw)); - } - else - { - foreground = WhitePixelOfScreen(XtScreen((Widget) csw)); - } - } - - /* - * Check on the default visual - */ - if (DefaultVisualDisplay(csw, foreground, color, (char *)new_label)) - { - return True; - } else - { - return False; - } -} - - -/* Function Name: list_selected - * Description: One of the list widgets was selected. - * Arguments: w - the slider widget. - * csw - the color selector. - * list - the list widget callback struct. - * Returns: none. - */ - -/* ARGSUSED */ -static void -list_selected(Widget w, XtPointer csw_ptr, XtPointer list_ptr) -{ - XmColorSelectorWidget csw = (XmColorSelectorWidget) csw_ptr; - XmListCallbackStruct *list = (XmListCallbackStruct *) list_ptr; - - XtFree(XmColorS_color_name(csw)); - - XmColorS_color_name(csw) = - XmStringUnparse(list->item, - NULL, XmCHARSET_TEXT, XmCHARSET_TEXT, NULL, 0, XmOUTPUT_ALL); - -/* deprecated - XmStringGetLtoR(list->item, XmFONTLIST_DEFAULT_TAG, - &(XmColorS_color_name(csw))); -*/ - - UpdateColorWindow(csw, True); -} - -/* Function Name: change_mode - * Description: One of the change mode buttons was pressed. - * Arguments: w - the slider widget. - * csw_ptr - the color selector. - * tp - the toggle widget callback struct. - * Returns: none. - */ - -/* ARGSUSED */ -static void -change_mode(Widget w, XtPointer csw_ptr, XtPointer tp) -{ - XmColorSelectorWidget csw = (XmColorSelectorWidget) csw_ptr; - XmToggleButtonCallbackStruct *toggle = (XmToggleButtonCallbackStruct *) tp; - - /* - * Ignore unsets. - */ - - if (toggle->reason == XmCR_VALUE_CHANGED && toggle->set) { - /* - * Change the mode if it is different. - */ - - if ((w == XmColorS_chose_mode(csw)[XmListMode]) && - (XmColorS_color_mode(csw) != XmListMode)) - { - new_mode(csw, XmListMode); - } - else if ((w == XmColorS_chose_mode(csw)[XmScaleMode]) && - (XmColorS_color_mode(csw) != XmScaleMode)) - { - new_mode(csw, XmScaleMode); - } - } -} - -/* Function Name: new_mode - * Description: mode has changed - * Arguments: csw - the color selector. - * mode - the new mode. - * Returns: none. - */ - -/* ARGSUSED */ -static void -new_mode(XmColorSelectorWidget csw, XmColorMode mode) -{ - XmColorS_color_mode(csw) = mode; - - if (mode == XmScaleMode) { - SetSliders(csw); - - XtUnmanageChild(XmColorS_scrolled_list(csw)); - XtManageChild(XmColorS_bb(csw)); - } - else { - SelectColor(csw); /* Select the current color in the list. */ - - XtUnmanageChild(XmColorS_bb(csw)); - XtManageChild(XmColorS_scrolled_list(csw)); - } -} - -/* Function Name: compute_size - * Description: Do all the size and position computing. - * Arguments: csw - the color selector. - * Returns: none. - */ - -/* ARGSUSED */ -static void -compute_size(XmColorSelectorWidget csw) -{ - XtWidgetGeometry input, radio_geom, color_geom; - Dimension width, height; - Position x,y; /* positions */ - - /* - * First size and place the button box and scrolled list. - */ - - y = XmColorS_margin_height(csw); - x = XmColorS_margin_width(csw); - width = csw->core.width - (2 * XmColorS_margin_width(csw)); - - input.width = width; - input.request_mode = CWWidth; - - (void) XtQueryGeometry(XmColorS_chose_radio(csw), NULL, &radio_geom); - (void) XtQueryGeometry(XmColorS_color_window(csw), &input, &color_geom); - - height = (csw->core.height - 4 * XmColorS_margin_height(csw) - - (radio_geom.height + 2 * radio_geom.border_width)); - - /* - * Leave space for the margins and make the color area 1/3 the height - * of the scrolled list and button box. - */ - - color_geom.height = height / 4; - height -= color_geom.height; - color_geom.height -= 2 * color_geom.border_width; - - _XmConfigureWidget(XmColorS_bb(csw), x, y, width, height, 0); - _XmConfigureWidget(XmColorS_scrolled_list(csw), x, y, width, height, 0); - - y += height + XmColorS_margin_height(csw); - - /* - * Place the radio box. - */ - - if ( radio_geom.width < csw->core.width ) - x = (int)(csw->core.width - radio_geom.width) / 2; - else - x = XmColorS_margin_width(csw); - - _XmConfigureWidget(XmColorS_chose_radio(csw), x, y, radio_geom.width, - radio_geom.height, radio_geom.border_width); - - y += radio_geom.height + XmColorS_margin_height(csw); - - /* - * Lastly, place the color window - */ - - _XmConfigureWidget(XtParent(XmColorS_color_window(csw)), XmColorS_margin_width(csw), y, - width, color_geom.height, color_geom.border_width); -} - -/* Function Name: read_rgb_file - * Description: Read in all the color names and add them to the list. - * Arguments: csw - the color selector. - * cargs, cnum_args - a filtered arg list that was - * passed to create the color selector. - * Returns: none. - */ - -/* ARGSUSED */ -static void -read_rgb_file(XmColorSelectorWidget csw, ArgList cargs, Cardinal cnum_args, Boolean initial) -{ - FILE *file; - char buf[BUFSIZ]; - char string_buffer[BUFSIZ]; - char *color_name; - ColorInfo * color_info = NULL; - register int i; - Arg *margs, args[20]; - - /* - * Create new list if needed, or delete any old list items. - */ - if (XmColorS_list(csw) == NULL) - { - i = 0; - XtSetArg(args[i], XmNlistSizePolicy, XmCONSTANT); i++; - XtSetArg(args[i], XmNvisibleItemCount, 15); i++; - margs = XtMergeArgLists(args, i, cargs, cnum_args); - XmColorS_list(csw) = XmCreateScrolledList((Widget) csw, "list", - margs, i + cnum_args); - - XtManageChild(XmColorS_list(csw)); - XmColorS_scrolled_list(csw) = XtParent(XmColorS_list(csw)); - - if (XmColorS_color_mode(csw) != XmListMode) - { - /* Hide the scrolled list until it need be visible... */ - XtUnmanageChild(XmColorS_scrolled_list(csw)); - } - - XtFree((XtPointer) margs); - } - else - { - XmListDeleteAllItems(XmColorS_list(csw)); - } - - /* - ** Because of the internal functioning of the XmList, it is better to - ** zero out the selected item list rather than to let the item currently - ** selected be re-selected by the XmList when the new list of colors is - ** assigned. As is, the XmList iteratively searches through the list of - ** selected items for each item added. Resetting the selectedItem list to - ** NULL/0 ensures that we don't have O(n*m) XmStringCompare operations - ** done when setting the new list below. - ** Also, resetting the list saves us in the case in which the rgb_file - ** is invalid or doesn't contain this selected string. - */ - XtVaSetValues(XmColorS_list(csw), - XmNselectedItems, NULL, XmNselectedItemCount, 0, NULL); - - /* - * Read in all the colornames. - */ - if ((file = fopen(XmColorS_rgb_file(csw), "r")) != NULL) { - register int alloc, count, len; - register char *name; - - alloc = count = 0; - - while(fgets(buf, BUFSIZ, file)) { - /* - * Skip any comment lines in the file - */ - if ( buf[0] == '!' ) continue; - - if (count >= alloc) { - if (0 == alloc) - alloc = 755; /* rather than stat the file and determine a good value to use, just use enough for X11R5, X11R6, and OpenWindows3 */ - else - { -#define ALLOC_INC 20 - alloc += ALLOC_INC; - } - color_info = (ColorInfo *)XtRealloc((XtPointer) color_info, - sizeof(ColorInfo) * alloc); - } - - sscanf(buf, "%hu %hu %hu", &(color_info[count].red), - &(color_info[count].green), &(color_info[count].blue)); - - if ((color_name = find_name(buf)) == NULL) - continue; - - len = strlen(color_name); - if (len > XmColorSelector_COLOR_NAME_SIZE) { - color_name[XmColorSelector_COLOR_NAME_SIZE - 1] = '\0'; - snprintf(string_buffer, BUFSIZ, - XmNcolorNameTooLongMsg, buf, color_name); - XmeWarning((Widget)csw, string_buffer); - } - - name = color_info[count].no_space_lower_name; - for (i = 0; i < len; i++) { - register char c = color_name[i]; - - /* - * Copy in all characters that are ascii and non-spaces. - */ - if (!isascii(c)) - continue; - if (!isspace(c)) - *name++ = tolower(c); - } - *name = '\0'; - - name = color_info[count].name; - color_name[0] = toupper(color_name[0]); - for (i = 0; i < len; i++) { - register char c = color_name[i]; - - /* - * Capitalize all characters after a space. - */ - - if (!isascii(c)) - continue; - if (isspace(c) && ((i + 1) < len)) { - color_name[i + 1] = toupper(color_name[i + 1]); - } - - *name++ = c; - } - *name = '\0'; - - count++; - } - fclose(file); - - qsort(color_info, count, sizeof(ColorInfo), CmpColors); - - /* - * Remove duplicates. - */ - i = 0; - while (i < (count - 1)) { - if (streq(color_info[i].no_space_lower_name, - color_info[i + 1].no_space_lower_name)) - { - register int j; - register ColorInfo *ptr; - - ptr = color_info + i; - j = i; - - /* - * This makes sure that the one with the space is - * left in place in favor of the one without. - */ - if (strchr(ptr->name, ' ') != NULL) { - j++; - ptr++; - } - - while ( ++j < count) { - ptr[0] = ptr[1]; - ptr++; - } - - count--; /*Something has been removed, decrement count*/ - } - else - i++; - } - - { - XmString *strs = (XmString*)XtMalloc(sizeof(XmString)*count); - for (i = 0; i < count; i++) - strs[i] = XmStringCreateLocalized(color_info[i].name); - XtVaSetValues(XmColorS_list(csw), - XmNitems, strs, - XmNitemCount, count, - NULL); - for (i = 0; i < count; i++) - XmStringFree(strs[i]); - XtFree((char*)strs); - } - - XtFree((char*)XmColorS_colors(csw)); - XmColorS_colors(csw) = color_info; - XmColorS_num_colors(csw) = count; - - /* It would be better if we had cached the current index number so - ** we could just reset the list to the string corresponding to that - ** value, but instead wind up going through FindColor to reestablish - ** the selected string - */ - if (!initial) - SelectColor(csw); - } - else { - XmString str; - - XmListAddItem(XmColorS_list(csw), XmColorS_strings(csw).file_read_error, 0); - - str = XmStringCreateLocalized(XmColorS_rgb_file(csw)); - XmListAddItem(XmColorS_list(csw), str, 0); - XmStringFree(str); - - XtFree((char*)XmColorS_colors(csw)); - XmColorS_colors(csw) = NULL; - XmColorS_num_colors(csw) = 0; - } - - XtAddCallback(XmColorS_list(csw), XmNsingleSelectionCallback, - list_selected, csw); - XtAddCallback(XmColorS_list(csw), XmNbrowseSelectionCallback, - list_selected, csw); -} - -/* Function Name: CmpColors - * Description: Compares two colors. - * Arguments: ptr_1, ptr_2 - two colors too compare. - * Returns: none - */ - -static int -CmpColors(const void * ptr_1, const void * ptr_2) -{ - ColorInfo *color1, *color2; - - color1 = (ColorInfo *) ptr_1; - color2 = (ColorInfo *) ptr_2; - - return(strcmp(color1->no_space_lower_name, color2->no_space_lower_name)); -} - -/* Function Name: find_name - * Description: Go through the buffer for looking for the name - * of a color string. - * Arguments: buffer - list of color names. - * Returns: pointer in the buffer where the string begins. - */ - -static char* -find_name(char *buffer) -{ - register char *curr, *temp; /* current pointer */ - - for (curr = buffer; curr != NULL && *curr != '\0'; curr++) { - /* - * Look for first non number, non space or tab. - */ - - if (isascii(*curr) && (isdigit(*curr) || isspace(*curr))) - continue; - - temp = (char *) strchr(curr, '\n'); - *temp = '\0'; - - return(curr); - } - return(NULL); -} - -/* Function Name: CreateColorSliders - * Description: creates a button with three sliders (Red, Green, Blue). - * Arguments: csw - the color selector widget. - * cargs, cnum_args - a filtered arg list that was - * passed to create the color selector. - * Returns: none. - */ - -/* ARGSUSED */ -static void -CreateColorSliders(XmColorSelectorWidget csw, - ArgList cargs, Cardinal cnum_args) -{ - register int i; - Cardinal num_args, title; - Arg *margs, args[10]; - - num_args = 0; - XtSetArg(args[num_args], XmNborderWidth, 0); num_args++; - XtSetArg(args[num_args], XmNorientation, XmVERTICAL); num_args++; - XtSetArg(args[num_args], XmNfillOption, XmFillMinor); num_args++; - margs = XtMergeArgLists(args, num_args, cargs, cnum_args); - XmColorS_bb(csw) = XtCreateManagedWidget("buttonBox", xmButtonBoxWidgetClass, - (Widget) csw, - margs, cnum_args + num_args); - XtFree((XtPointer) margs); - - num_args = 0; - XtSetArg(args[num_args], XmNmaximum, 255); num_args++; - XtSetArg(args[num_args], XmNorientation, XmHORIZONTAL); num_args++; - XtSetArg(args[num_args], XmNshowValue, True); num_args++; - XtSetArg(args[num_args], XmNprocessingDirection, XmMAX_ON_RIGHT); - num_args++; - XtSetArg(args[num_args], XmNtitleString, NULL); title = num_args++; - - margs = XtMergeArgLists(args, num_args, cargs, cnum_args); - - for( i = 0; i < 3; i++ ) { - margs[title].value = (XtArgVal) XmColorS_strings(csw).slider_labels[i]; - XmColorS_sliders(csw)[i] = XtCreateManagedWidget("scale", - xmScaleWidgetClass, - XmColorS_bb(csw), margs, - num_args + cnum_args); - - XtAddCallback(XmColorS_sliders(csw)[i], XmNdragCallback, - slider_changed, csw); - XtAddCallback(XmColorS_sliders(csw)[i], XmNvalueChangedCallback, - slider_changed, csw); - } - XtFree((XtPointer) margs); -} - -/* Function Name: CreateSelectorRadio - * Description: creates a radio box with two toggles for selector - * type. - * Arguments: csw - the color selector widget. - * cargs, cnum_args - a filtered arg list that was - * passed to create the color selector. - * Returns: none. - */ - -/* ARGSUSED */ -static void -CreateSelectorRadio(XmColorSelectorWidget csw, - ArgList cargs, Cardinal cnum_args) -{ - Widget w; - Cardinal i, label; - Arg *margs, args[5]; - int count; - static String names[] = { "colorListToggle", "colorSlidersToggle" }; - - i = 0; - XtSetArg(args[i], XmNradioBehavior, True); i++; - XtSetArg(args[i], XmNpacking, XmPACK_COLUMN); i++; - XtSetArg(args[i], XmNnumColumns, 2); i++; - margs = XtMergeArgLists(args, i, cargs, cnum_args); - w = XtCreateManagedWidget("radioBox", xmRowColumnWidgetClass, - (Widget) csw, margs, i + cnum_args); - XmColorS_chose_radio(csw) = w; - XtFree((XtPointer) margs); - - i = 0; - XtSetArg(args[i], XmNlabelString, NULL); label = i++; - margs = XtMergeArgLists(args, i, cargs, cnum_args); - - for (count = 0; count < XmColorSelector_NUM_TOGGLES; count++) { - margs[label].value = (XtArgVal) XmColorS_strings(csw).tog_labels[count]; - - w = XtCreateManagedWidget(names[count], xmToggleButtonWidgetClass, - XmColorS_chose_radio(csw), margs, i + cnum_args); - XmColorS_chose_mode(csw)[count] = w; - - XtAddCallback(w, XmNvalueChangedCallback, change_mode, csw); - } - - XtFree((XtPointer) margs); -} - -/* Function Name: CreateColorWindow - * Description: creates a label in a frame to display the - * currently selected color. - * Arguments: csw - the color selector widget. - * cargs, cnum_args - a filtered arg list that was - * passed to create the color selector. - * Returns: none. - */ - -/* ARGSUSED */ -static void -CreateColorWindow(XmColorSelectorWidget csw,ArgList cargs, Cardinal cnum_args) -{ - Widget fr; - Arg *margs, args[10]; - Cardinal n; - - fr = XtCreateManagedWidget("colorFrame", xmFrameWidgetClass, - (Widget) csw, cargs, cnum_args); - - n = 0; - XtSetArg(args[n], XmNrecomputeSize, False); n++; - margs = XtMergeArgLists(args, n, cargs, cnum_args); - XmColorS_color_window(csw) = XtCreateManagedWidget("colorWindow", - xmLabelWidgetClass, - fr, margs, n + cnum_args); - XtFree((XtPointer) margs); -} - -/* ARGSUSED */ -static void GetValues_XmNredSliderLabel ( Widget w, int n, XtArgVal *value) -{ - (*value) = (XtArgVal) XmStringCopy(XmColorS_strings(w).slider_labels[0]); -} -/* ARGSUSED */ -static void GetValues_XmNgreenSliderLabel( Widget w, int n, XtArgVal *value) -{ - (*value) = (XtArgVal) XmStringCopy(XmColorS_strings(w).slider_labels[1]); -} -/* ARGSUSED */ -static void GetValues_XmNblueSliderLabel( Widget w, int n, XtArgVal *value) -{ - (*value) = (XtArgVal) XmStringCopy(XmColorS_strings(w).slider_labels[2]); -} -/* ARGSUSED */ -static void GetValues_XmNcolorListTogLabel( Widget w, int n, XtArgVal *value) -{ - (*value) = (XtArgVal) XmStringCopy(XmColorS_strings(w).tog_labels[0]); -} -/* ARGSUSED */ -static void GetValues_XmNsliderTogLabel( Widget w, int n, XtArgVal *value) -{ - (*value) = (XtArgVal) XmStringCopy(XmColorS_strings(w).tog_labels[1]); -} -/* ARGSUSED */ -static void GetValues_XmNnoCellError( Widget w, int n, XtArgVal *value) -{ - (*value) = (XtArgVal) XmStringCopy(XmColorS_strings(w).no_cell_error); -} -/* ARGSUSED */ -static void GetValues_XmNfileReadError( Widget w, int n, XtArgVal *value) -{ - (*value) = (XtArgVal) XmStringCopy(XmColorS_strings(w).file_read_error); -} - -/* Function Name: GetVisual - * Description: Gets the defaults visual of the screen - * Arguments: csw - the color selector widget. - * Returns: Visual id. - */ - -/* ARGSUSED */ -static int -GetVisual(XmColorSelectorWidget csw) -{ - Visual * vis; - int visual; - - vis = DefaultVisual(XtDisplay(csw), XDefaultScreen(XtDisplay(csw))); - visual = vis->class; - - return visual; -} - -/* Function Name: NoPrivateColormaps - * Description: Determines the color to be used. - * Arguments: csw - the color selector widget. - * foreground - default color for the ColorSelector. - * color - Current color attributes. - * str - label for the ColorSelector. - * Returns: None. - */ - -/* ARGSUSED */ -static void -NoPrivateColormaps(XmColorSelectorWidget csw, Pixel foreground, - XColor color, char *str) -{ - Arg args[5]; - XmString xm_str; - Cardinal num_args; - - xm_str = XmStringCreateLocalized(str); - num_args = 0; - - if (!XmColorS_good_cell(csw)) - { - if(XAllocColor(XtDisplay(csw), csw->core.colormap, &color) ) - { - XmColorS_color_pixel(csw) = color.pixel; - XmColorS_good_cell(csw) = True; - } - } else { - if (XAllocColor(XtDisplay(csw), csw->core.colormap, &color) ) - { - XmColorS_color_pixel(csw) = color.pixel; - XmColorS_good_cell(csw) = True; - } - else - { - XmString out; - out = XmStringConcatAndFree(xm_str, XmColorS_strings(csw).no_cell_error); - xm_str = out; - } - } - - if (XmColorS_good_cell(csw)) - { - color.flags = DoRed | DoGreen | DoBlue; - color.pixel = XmColorS_color_pixel(csw); - XtSetArg(args[num_args], XmNforeground, foreground); num_args++; - XtSetArg(args[num_args], XmNbackground, XmColorS_color_pixel(csw)); - num_args++; - XtSetValues(XmColorS_color_window(csw), args, num_args); - } - - XtSetArg(args[num_args], XmNlabelString, xm_str); num_args++; - XtSetValues(XmColorS_color_window(csw), args, num_args); - XmStringFree(xm_str); -} - -/* Function Name: DoPrivateColormaps - * Description: Determines the color to be used. - * Arguments: csw - the color selector widget. - * foreground - default color for the ColorSelector. - * color - Current color attributes. - * str - label for the ColorSelector. - * Returns: None. - */ - -/* ARGSUSED */ -static void -PrivateColormaps(XmColorSelectorWidget csw, Pixel foreground, XColor color, char *str) -{ - Arg args[5]; - XmString xm_str; - Cardinal num_args; - - xm_str = XmStringCreateLocalized(str); - num_args = 0; - - if (!XmColorS_good_cell(csw)) { - if(XAllocColorCells(XtDisplay(csw), csw->core.colormap, - 0, 0, 0, &(XmColorS_color_pixel(csw)), 1)) - { - XmColorS_good_cell(csw) = True; - } - else { - XmString out; - - out = XmStringConcatAndFree(xm_str, XmColorS_strings(csw).no_cell_error); - xm_str = out; - } - } - - if (XmColorS_good_cell(csw)) { - color.flags = DoRed | DoGreen | DoBlue; - color.pixel = XmColorS_color_pixel(csw); - XStoreColor(XtDisplay((Widget) csw), csw->core.colormap, &color); - XtSetArg(args[num_args], XmNforeground, foreground); num_args++; - XtSetArg(args[num_args], XmNbackground, XmColorS_color_pixel(csw)); - num_args++; - } - - XtSetArg(args[num_args], XmNlabelString, xm_str); num_args++; - XtSetValues(XmColorS_color_window(csw), args, num_args); - XmStringFree(xm_str); -} - -/* - * Function Name: DefaultVisualDisplay - * Description: Determines the default visual and allocates - * the color depending upon the visual classes - * Arguments: csw - the color selector widget. - * foreground - default color for the ColorSelector. - * color - Current color attributes. - * str - label for the ColorSelector. - * Returns: Returns true on a valid visual class. - * False otherwise. - */ - -/* ARGSUSED */ -static Boolean -DefaultVisualDisplay(XmColorSelectorWidget csw, Pixel foreground, XColor color, char *str) -{ - int visual = 0; - visual = GetVisual(csw); - - /* - * Obtain a valid color cell. In case, if one not available - */ - if ( visual == StaticColor || visual == TrueColor || \ - visual == StaticGray ) - { - NoPrivateColormaps(csw, foreground, color, str); - return True; - } else if ( visual == PseudoColor || visual == DirectColor || \ - visual == GrayScale ) - { - PrivateColormaps(csw, foreground, color, str); - return True; - } else - { - return False; - } -} - -/************************************************************ - * - * Public functions. - * - ************************************************************/ - -/* Function Name: XmCreateColorSelector - * Description: Creation Routine for UIL and ADA. - * Arguments: parent - the parent widget. - * name - the name of the widget. - * args, num_args - the number and list of args. - * Returns: The created widget. - */ - -Widget -XmCreateColorSelector(Widget parent, String name, - ArgList args, Cardinal num_args) -{ - return(XtCreateWidget(name, xmColorSelectorWidgetClass, - parent, args, num_args)); -} - -Widget -XmVaCreateColorSelector( - Widget parent, - char *name, - ...) -{ - register Widget w; - va_list var; - int count; - - Va_start(var,name); - count = XmeCountVaListSimple(var); - va_end(var); - - - Va_start(var, name); - w = XmeVLCreateWidget(name, - xmColorSelectorWidgetClass, - parent, False, - var, count); - va_end(var); - return w; -} - -Widget -XmVaCreateManagedColorSelector( - Widget parent, - char *name, - ...) -{ - Widget w = NULL; - va_list var; - int count; - - Va_start(var, name); - count = XmeCountVaListSimple(var); - va_end(var); - - Va_start(var, name); - w = XmeVLCreateWidget(name, - xmColorSelectorWidgetClass, - parent, True, - var, count); - va_end(var); - return w; -} diff --git a/lib/Xm/XmosP.h b/lib/Xm/XmosP.h index d77c82a..4b33e3b 100644 --- a/lib/Xm/XmosP.h +++ b/lib/Xm/XmosP.h @@ -175,7 +175,7 @@ extern "C" { #define XMBINDDIR "XMBINDDIR" #ifndef XMBINDDIR_FALLBACK -#define XMBINDDIR_FALLBACK "/usr/share/X11/bindings" +#define XMBINDDIR_FALLBACK "/usr/lib/Xm/bindings" #endif #define XMBINDFILE "xmbind.alias" #define MOTIFBIND ".motifbind" diff --git a/lib/Xm/XmosP.h.bindings b/lib/Xm/XmosP.h.bindings deleted file mode 100644 index 4b33e3b..0000000 --- a/lib/Xm/XmosP.h.bindings +++ /dev/null @@ -1,216 +0,0 @@ -/* - * Motif - * - * Copyright (c) 1987-2012, The Open Group. All rights reserved. - * - * These libraries and programs are free software; you can - * redistribute them and/or modify them under the terms of the GNU - * Lesser General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) - * any later version. - * - * These libraries and programs are distributed in the hope that - * they will be useful, but WITHOUT ANY WARRANTY; without even the - * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU Lesser General Public License for more - * details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with these librararies and programs; if not, write - * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth - * Floor, Boston, MA 02110-1301 USA -*/ -/* - * HISTORY -*/ -/* $TOG: XmosP.h /main/15 1997/03/25 14:45:55 dbl $ */ -/* (c) Copyright 1989, DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS. */ -/* (c) Copyright 1987, 1988, 1989, 1990, 1991, 1992 HEWLETT-PACKARD COMPANY */ -#ifndef _XmosP_h -#define _XmosP_h - -/* Some SVR4 systems don't have bzero. */ -#include /* for bzero et al */ - -/* - * Fix for 8975 - using LOGNAME instead of USER on SYSV and SVR4 -*/ - -#ifndef USER_VAR -#if defined(SYSV) || defined(SVR4) -#define USER_VAR "LOGNAME" -#else -#define USER_VAR "USER" -#endif -#endif - -/* - * Fix for 5222 - if NO_MEMMOVE is defined, some systems will still - * require stdlib.h. - */ -#ifdef NO_MEMMOVE -#ifdef bcopy -#undef bcopy -#endif -#ifdef memmove -#undef memmove -#endif -#define memmove( p1, p2, p3 ) bcopy( p2, p1, p3 ) -#endif - -#ifndef X_NOT_STDC_ENV -#include /* Needed for MB_CUR_MAX, mbtowc, mbstowcs and mblen */ -#endif - -/* On Sun systems, mblen is broken. It doesn't return 0 when the - string is empty. Here's a patch. NOTE: On Sun systems, mblen - is a macro wrapper around mbtowc. Hence the implementation below. */ -#if defined(sun) -#undef mblen -#define mblen(ptr, size) \ - ((ptr && *(ptr) == '\0') ? 0 : mbtowc((wchar_t *)0, (ptr), (size))) -#endif - -#include /* for MB_LEN_MAX et al */ - -#ifndef INT_MAX -#define INT_MAX 2147483647 -#endif -#ifndef LONG_MAX -#define LONG_MAX 2147483647 -#endif -#ifdef BOGUS_MB_MAX /* some systems don't properly set MB_[CUR|LEN]_MAX */ -#undef MB_LEN_MAX -#define MB_LEN_MAX 1 /* temp fix for ultrix */ -#undef MB_CUR_MAX -#define MB_CUR_MAX 1 /* temp fix for ultrix */ -#endif /* BOGUS_MB_MAX */ - -/**********************************************************************/ -/* here we duplicate Xtos.h, since we can't include this private file */ - -#if defined(INCLUDE_ALLOCA_H) || defined(HAVE_ALLOCA_H) -#include -#endif - -#ifdef CRAY -#define WORD64 -#endif - -/* Don't Use Alloca On Solaris */ -#if defined(sun) -#define NO_ALLOCA -#endif - -/* stolen from server/include/os.h */ -#ifndef NO_ALLOCA -/* - * os-dependent definition of local allocation and deallocation - * If you want something other than XtMalloc/XtFree for ALLOCATE/DEALLOCATE - * LOCAL then you add that in here. - */ -#if defined(__HIGHC__) - -#if HCVERSION < 21003 -#define ALLOCATE_LOCAL(size) alloca(size) -pragma on(alloca); -#else /* HCVERSION >= 21003 */ -#define ALLOCATE_LOCAL(size) _Alloca(size) -#endif /* HCVERSION < 21003 */ - -#define DEALLOCATE_LOCAL(ptr) /* as nothing */ - -#endif /* defined(__HIGHC__) */ - - -#ifdef __GNUC__ - -#ifndef alloca /* gnu itself might have done that already */ -#define alloca __builtin_alloca -#endif - -#define ALLOCATE_LOCAL(size) alloca(size) -#define DEALLOCATE_LOCAL(ptr) /* as nothing */ -#else /* ! __GNUC__ */ -/* - * warning: mips alloca is unsuitable, do not use. - */ -#if defined(vax) || defined(sun) || defined(apollo) || defined(stellar) -/* - * Some System V boxes extract alloca.o from libPW.a; if you - * decide that you don't want to use alloca, you might want to fix it here. - */ -char *alloca(); -#define ALLOCATE_LOCAL(size) alloca(size) -#define DEALLOCATE_LOCAL(ptr) /* as nothing */ -#endif /* who does alloca */ -#endif /* __GNUC__ */ - -#endif /* NO_ALLOCA */ - -#ifndef ALLOCATE_LOCAL -#define ALLOCATE_LOCAL(size) XtMalloc(size) -#define DEALLOCATE_LOCAL(ptr) XtFree(ptr) -#endif /* ALLOCATE_LOCAL */ - -/* End of Xtos.h */ -/*****************/ - -#include - -/* For padding structures in Mrm we need to know how big pointers are. */ -#if !defined(CRAY) && !defined(__alpha) -#define MrmShortPtr -#endif - -#ifdef __cplusplus -extern "C" { -#endif - - -#define MATCH_CHAR 'P' /* referenced in InitPath strings and in the files - that uses it (ImageCache.c and Mrmhier.c) */ - -/* OS-dependent file info for VirtKeys */ - -#define XMBINDDIR "XMBINDDIR" -#ifndef XMBINDDIR_FALLBACK -#define XMBINDDIR_FALLBACK "/usr/lib/Xm/bindings" -#endif -#define XMBINDFILE "xmbind.alias" -#define MOTIFBIND ".motifbind" - -typedef enum { - XmOS_METHOD_NULL, - XmOS_METHOD_DEFAULTED, - XmOS_METHOD_REPLACED -} XmOSMethodStatus; - -typedef XmDirection (*XmCharDirectionProc)(XtPointer /* char */, - XmTextType /* type */, - XmStringTag /* locale */); - -typedef Status (*XmInitialDirectionProc)(XtPointer /* chars */, - XmTextType /* type */, - XmStringTag /* locale */, - unsigned int * /* num_bytes */, - XmDirection * /* direction */); - - -/******** Private Function Declarations ********/ - -extern XmOSMethodStatus XmOSGetMethod(Widget w, - String method_name, - XtPointer * method, - XtPointer * os_data); - -/******** End Private Function Declarations ********/ - - -#ifdef __cplusplus -} /* Close scope of 'extern "C"' declaration which encloses file. */ -#endif - - -#endif /* _XmosP_h */ -/* DON'T ADD ANYTHING AFTER THIS #endif */ diff --git a/tools/wml/wmldbcreate.c b/tools/wml/wmldbcreate.c index 6de585a..07c0a3c 100644 --- a/tools/wml/wmldbcreate.c +++ b/tools/wml/wmldbcreate.c @@ -425,7 +425,7 @@ int table_id; { fprintf (afile, "%d, ", entry_vec[j]); } - fprintf (afile, "%s", "\n"); + fprintf (afile, "\n"); } } } diff --git a/tools/wml/wmldbcreate.c.format-security b/tools/wml/wmldbcreate.c.format-security deleted file mode 100644 index 07c0a3c..0000000 --- a/tools/wml/wmldbcreate.c.format-security +++ /dev/null @@ -1,687 +0,0 @@ -/* - * Motif - * - * Copyright (c) 1987-2012, The Open Group. All rights reserved. - * - * These libraries and programs are free software; you can - * redistribute them and/or modify them under the terms of the GNU - * Lesser General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) - * any later version. - * - * These libraries and programs are distributed in the hope that - * they will be useful, but WITHOUT ANY WARRANTY; without even the - * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU Lesser General Public License for more - * details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with these librararies and programs; if not, write - * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth - * Floor, Boston, MA 02110-1301 USA -*/ -/* - * HISTORY -*/ -#ifdef REV_INFO -#ifndef lint -static char rcsid[] = "$TOG: wmldbcreate.c /main/8 1997/04/14 12:55:30 dbl $" -#endif -#endif - -#ifdef HAVE_CONFIG_H -#include -#endif - - -/* -* (c) Copyright 1989, 1990, DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS. */ - -/* - * This is the program creates binary databases from WML output. - */ - - -#include -#ifndef X_NOT_STDC_ENV -#include -#endif - -#include -#include -#include - -#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
- - - -/* - * User supplied widget public.h and/or private.h files are to be added here - * #ifdef for automatic use in uilwmdcreate script file - */ - - -/* - * End of User supplied widget files - */ - - -#include "UilDBDef.h" -#include "UilLexPars.h" - -#include "UilSymGen.h" /* from WML */ -#include "UilSymArTy.h" /* from WML */ -#include "UilSymRArg.h" /* from WML */ -#include "UilSymArTa.h" /* from WML */ -#include "UilSymReas.h" /* from WML */ -#include "UilSymCtl.h" /* from WML */ -#include "UilConst.h" /* from WML */ -#include "UilSymNam.h" /* from WML */ -#include "UilSymEnum.h" /* from WML */ -#include "UilSymCSet.h" /* from WML */ -#include "UilUrmClas.h" /* from WML */ -#include "UilKeyTab.h" /* from WML */ -#include "UilSymChCl.h" /* from WML */ -#include "UilSymChTa.h" /* from WML */ - -void emit_globals(); -void emit_header(_db_header_ptr header); -void emit_chars(int table_id); -void emit_ints_and_string( int table_id); -void emit_char_table( int table_id); -void emit_length_and_string( int table_id); -void emit_shorts( int table_id); -void emit_int_and_table_shorts( int table_id); -void emit_ints( int table_id); - -FILE *bfile, *afile; -int DEBUG=FALSE; -char outfilename[80]; -char debugfilename[80]; - -int main(argc, argv) -int argc; -char **argv; -{ - _db_header header; - - strcpy(outfilename, "motif.wmd"); - strcpy(debugfilename, "motif.dbg"); - - for (argc--, argv++; argc; argc--, argv++) - { - if (strcmp("-debug", *argv) == 0) - { - DEBUG=TRUE; - } - else if ((strcmp("-o", *argv) == 0)) - { - strcpy(outfilename, argv[1]); - } - } - - bfile = fopen(outfilename, "w"); - if (bfile == (FILE *) NULL) - { - printf("\nCouldnt't open %s", outfilename); - exit (1); - } - if (DEBUG) - { - afile = fopen(debugfilename, "w"); - if (afile == (FILE *) NULL) - { - printf("\nCouldn't open %s", debugfilename); - exit (1); - } - } - - emit_globals(); - -/* - * UilConst - * UilSymArty - * UilSymCset - parts of it - * UilSymChCl - */ - emit_chars(Constraint_Tab); - emit_chars(Argument_Type_Table_Value); - emit_chars(Charset_Wrdirection_Table); - emit_chars(Charset_Parsdirection_Table); - emit_chars(Charset_Charsize_Table); - emit_chars(Child_Class_Table); -/* - * UilKeyTab - */ - emit_ints_and_string (Key_Table); - emit_ints_and_string (Key_Table_Case_Ins); -/* - * UilSymArTa - * UilSymCtl - * UilSymReas - * UilSymChTa - */ - emit_char_table (Allowed_Argument_Table); - emit_char_table (Allowed_Control_Table); - emit_char_table (Allowed_Reason_Table); - emit_char_table (Allowed_Child_Table); -/* - * UilSymCset - * UilSymNam - * UilUrmClas - */ - emit_length_and_string (Charset_Xmstring_Names_Table); - emit_length_and_string (Charset_Lang_Names_Table); - emit_length_and_string (Uil_Widget_Names); - emit_length_and_string (Uil_Argument_Names); - emit_length_and_string (Uil_Reason_Names); - emit_length_and_string (Uil_Enumval_names); - emit_length_and_string (Uil_Charset_Names); - emit_length_and_string (Uil_Widget_Funcs); - emit_length_and_string (Uil_Argument_Toolkit_Names); - emit_length_and_string (Uil_Reason_Toolkit_Names); - emit_length_and_string (Uil_Children_Names); -/* - * UilSymCset - * UilSymEnum - * UilSymRArg - * UilUrmClas - */ - emit_shorts (Charset_Lang_Codes_Table); - emit_shorts (Argument_Enum_Set_Table); - emit_shorts (Related_Argument_Table); - emit_shorts (Uil_Gadget_Funcs); - emit_shorts (Uil_Urm_Nondialog_Class); - emit_shorts (Uil_Urm_Subtree_Resource); -/* - * UilSymEnum - */ - emit_int_and_table_shorts(Enum_Set_Table); -/* - * UilSymEnum - */ - emit_ints (Enumval_Values_Table); - - exit (0); - - return 0; /* make compiler happy */ -} - - -void emit_globals() -{ - _db_globals globals; - - globals.version = DB_Compiled_Version; - globals.uil_max_arg = uil_max_arg; - globals.uil_max_charset = uil_max_charset; - globals.charset_lang_table_max = charset_lang_table_max; - globals.uil_max_object = uil_max_object; - globals.uil_max_reason = uil_max_reason; - globals.uil_max_enumval = uil_max_enumval; - globals.uil_max_enumset = uil_max_enumset; - globals.key_k_keyword_count = key_k_keyword_count; - globals.key_k_keyword_max_length = key_k_keyword_max_length; - globals.uil_max_child = uil_max_child; - - fwrite (&globals, sizeof (_db_globals), 1, bfile); - if (DEBUG) - fprintf(afile, "%d %d %d %d %d %d %d %d %d %d ", globals.version, - globals.uil_max_arg, globals.uil_max_charset, - globals.charset_lang_table_max, globals.uil_max_object, - globals.uil_max_reason, globals.uil_max_enumval, - globals.uil_max_enumset, globals.key_k_keyword_count, - globals.key_k_keyword_max_length); - } - - - -void emit_header(header) -_db_header_ptr header; -{ - - fwrite (header, sizeof(_db_header), 1, bfile); - if (DEBUG) - fprintf(afile, - "\n\nTableId=%d, NumEntries=%d, TableSize=%d \n", - header->table_id, header->num_items, header->table_size); - } - - - -void emit_chars(table_id) - int table_id; -{ - _db_header header; - unsigned char *ptr; - int i; - - switch (table_id) - { - case Constraint_Tab: - /* - * NOTE: The first entry is not used but we copy it anyway - */ - header.table_size = sizeof(constraint_tab_vec); - header.num_items = header.table_size; - header.table_id = Constraint_Tab; - ptr = constraint_tab; - break; - case Argument_Type_Table_Value: - /* - * NOTE: The first entry is not used but we copy it anyway - */ - header.table_size = sizeof(argument_type_table_vec); - header.num_items = header.table_size; - header.table_id = Argument_Type_Table_Value; - ptr = argument_type_table; - break; - case Charset_Wrdirection_Table: - /* - * NOTE: The first entry is not used but we copy it anyway - */ - header.table_size = sizeof(charset_wrdirection_table_vec); - header.num_items = header.table_size; - header.table_id = Charset_Wrdirection_Table; - ptr = charset_writing_direction_table; - break; - case Charset_Parsdirection_Table: - /* - * NOTE: The first entry is not used but we copy it anyway - */ - header.table_size = sizeof(charset_parsdirection_table_vec); - header.num_items = header.table_size; - header.table_id = Charset_Parsdirection_Table; - ptr = charset_parsing_direction_table; - break; - case Charset_Charsize_Table: - /* - * NOTE: The first entry is not used but we copy it anyway - */ - header.table_size = sizeof(charset_charsize_table_vec); - header.num_items = header.table_size; - header.table_id = Charset_Charsize_Table; - ptr = charset_character_size_table; - break; - case Child_Class_Table: - /* - * NOTE: The first entry is not used but we copy it anyway - */ - header.table_size = sizeof(child_class_table_vec); - header.num_items = header.table_size; - header.table_id = Child_Class_Table; - ptr = child_class_table; - break; - } - - emit_header(&header); - - fwrite (ptr, header.table_size, 1, bfile); - if (DEBUG) - { - for (i=0; i<=header.num_items; i++) - { - fprintf(afile, "%d ", ptr[i]); - } - } -} - - -void emit_ints_and_string(table_id) - int table_id; -{ - _db_header header; - key_keytable_entry_type *table; - int i; - - switch (table_id) - { - /* - * All tables are zero based unless otherwise noted - */ - case Key_Table: - header.table_size = sizeof(key_table_vec); - header.num_items = key_k_keyword_count; - header.table_id = Key_Table; - table = key_table; - break; - case Key_Table_Case_Ins: - header.table_size = sizeof(key_table_case_ins_vec); - header.num_items = key_k_keyword_count; - header.table_id = Key_Table_Case_Ins; - table = key_table_case_ins; - break; - } - emit_header(&header); - - fwrite (table, header.table_size, 1, bfile); - for (i=0; icnt ; ndx++ ) { clsobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[ndx].objptr; @@ -244,7 +244,7 @@ for ( ndx=0 ; ndxcnt ; ndx++ ) /* * Define the sym_k_..._reason literals */ -fprintf (outfil, "%s", canned3); +fprintf (outfil, canned3); for ( ndx=0 ; ndxcnt ; ndx++ ) { resobj = (WmlResourceDefPtr) wml_obj_reason_ptr->hvec[ndx].objptr; @@ -258,7 +258,7 @@ for ( ndx=0 ; ndxcnt ; ndx++ ) /* * Define the sym_k_..._arg literals */ -fprintf (outfil, "%s", canned4); +fprintf (outfil, canned4); for ( ndx=0 ; ndxcnt ; ndx++ ) { resobj = (WmlResourceDefPtr) wml_obj_arg_ptr->hvec[ndx].objptr; @@ -272,7 +272,7 @@ for ( ndx=0 ; ndxcnt ; ndx++ ) /* * Define the sym_k_..._enumset structs and literals */ -fprintf (outfil, "%s", canned5); +fprintf (outfil, canned5); for ( ndx=0 ; ndxcnt ; ndx++ ) { enumsetobj = (WmlEnumSetDefPtr) wml_obj_enumset_ptr->hvec[ndx].objptr; @@ -286,7 +286,7 @@ for ( ndx=0 ; ndxcnt ; ndx++ ) /* * Define the sym_k_..._enumval literals */ -fprintf (outfil, "%s", canned6); +fprintf (outfil, canned6); for ( ndx=0 ; ndxcnt ; ndx++ ) { enumvalobj = (WmlEnumValueDefPtr) wml_obj_enumval_ptr->hvec[ndx].objptr; @@ -301,7 +301,7 @@ for ( ndx=0 ; ndxcnt ; ndx++ ) * Define the sym_k_..._charsize literals * Define the sym_k_..._charset literals */ -fprintf (outfil, "%s", canned7); +fprintf (outfil, canned7); for ( ndx=0 ; ndxcnt ; ndx++ ) { charsetobj = (WmlCharSetDefPtr) wml_obj_charset_ptr->hvec[ndx].objptr; @@ -315,7 +315,7 @@ for ( ndx=0 ; ndxcnt ; ndx++ ) /* * Define the sym_k_..._child literals */ -fprintf (outfil, "%s", canned8); +fprintf (outfil, canned8); for ( ndx=0 ; ndxcnt ; ndx++ ) { childobj = (WmlChildDefPtr) wml_obj_child_ptr->hvec[ndx].objptr; @@ -379,12 +379,12 @@ if ( outfil == (FILE *) NULL ) printf ("\nCouldn't open UilSymChCL.h"); return; } -fprintf (outfil, "%s", canned_warn); +fprintf (outfil, canned_warn); /* * Create table entries, similar to writing sym_k... */ -fprintf (outfil, "%s", canned1); +fprintf (outfil, canned1); for ( ndx=0 ; ndxcnt ; ndx++ ) { childobj = (WmlChildDefPtr) wml_obj_child_ptr->hvec[ndx].objptr; @@ -392,7 +392,7 @@ for ( ndx=0 ; ndxcnt ; ndx++ ) fprintf (outfil, " sym_k_%s_object,\n", classobj->tkname); } -fprintf (outfil, "%s", canned1a); +fprintf (outfil, canned1a); /* * close the output file @@ -446,12 +446,12 @@ if ( outfil == (FILE *) NULL ) printf ("\nCouldn't open UilSymArTy.h"); return; } -fprintf (outfil, "%s", canned_warn); +fprintf (outfil, canned_warn); /* * Create table entries, similar to writing sym_k... */ -fprintf (outfil, "%s", canned1); +fprintf (outfil, canned1); for ( ndx=0 ; ndxcnt ; ndx++ ) { resobj = (WmlResourceDefPtr) wml_obj_arg_ptr->hvec[ndx].objptr; @@ -459,7 +459,7 @@ for ( ndx=0 ; ndxcnt ; ndx++ ) fprintf (outfil, " sym_k_%s_value,\n", datobj->tkname); } -fprintf (outfil, "%s", canned1a); +fprintf (outfil, canned1a); /* * close the output file @@ -509,19 +509,19 @@ if ( outfil == (FILE *) NULL ) printf ("\nCouldn't open UilSymRArg.h"); return; } -fprintf (outfil, "%s", canned_warn); +fprintf (outfil, canned_warn); /* * Create table entries, similar to writing sym_k... */ -fprintf (outfil, "%s", canned1); +fprintf (outfil, canned1); for ( ndx=0 ; ndxcnt ; ndx++ ) { resobj = (WmlResourceDefPtr) wml_obj_arg_ptr->hvec[ndx].objptr; fprintf (outfil, " %d,\n", resobj->related_code); } -fprintf (outfil, "%s", canned1a); +fprintf (outfil, canned1a); /* * close the output file @@ -621,12 +621,12 @@ if ( outfil == (FILE *) NULL ) printf ("\nCouldn't open UilUrmClas.h"); return; } -fprintf (outfil, "%s", canned_warn); +fprintf (outfil, canned_warn); /* * Write entries for widgets */ -fprintf (outfil, "%s", canned1); +fprintf (outfil, canned1); for ( ndx=0 ; ndxcnt ; ndx++ ) { clsobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[ndx].objptr; @@ -637,7 +637,7 @@ for ( ndx=0 ; ndxcnt ; ndx++ ) else fprintf (outfil, " \"%s\",\t\n", synobj->convfunc); } -fprintf (outfil, "%s", canned2); +fprintf (outfil, canned2); /* * Write entries for gadget variants of widget classes @@ -661,7 +661,7 @@ for ( ndx=0 ; ndxcnt ; ndx++ ) synobj->name); } } -fprintf (outfil, "%s", canned3); +fprintf (outfil, canned3); /* * Write entries for non-dialog widgets @@ -685,7 +685,7 @@ for ( ndx=0 ; ndxcnt ; ndx++ ) synobj->name); } } -fprintf (outfil, "%s", canned4); +fprintf (outfil, canned4); /* * Write entries for the resource a widget's controls map to @@ -701,7 +701,7 @@ for ( ndx=0 ; ndxcnt ; ndx++ ) else fprintf (outfil, " sym_k_%s_arg,\n", mapresobj->tkname); } -fprintf (outfil, "%s", canned5); +fprintf (outfil, canned5); /* * Write entries for arguments @@ -714,7 +714,7 @@ for ( ndx=0 ; ndxcnt ; ndx++ ) fprintf (outfil, " %s,\n", synres->resliteral); } -fprintf (outfil, "%s", canned6); +fprintf (outfil, canned6); /* * Write entries for reasons @@ -727,7 +727,7 @@ for ( ndx=0 ; ndxcnt ; ndx++ ) fprintf (outfil, " %s,\n", synres->resliteral); } -fprintf (outfil, "%s", canned7); +fprintf (outfil, canned7); /* * close the output file @@ -781,13 +781,13 @@ if ( outfil == (FILE *) NULL ) printf ("\nCouldn't open UilConst.h"); return; } -fprintf (outfil, "%s", canned_warn); +fprintf (outfil, canned_warn); /* * Process the arguments in code order. We start with 1, and write out * the mask after processing 8 codes. */ -fprintf (outfil, "%s", canned1); +fprintf (outfil, canned1); strcpy (maskbuf, "0"); for ( ndx=0 ; ndxcnt ; ndx++ ) { @@ -805,7 +805,7 @@ for ( ndx=0 ; ndxcnt ; ndx++ ) } if ( bitno != 8 ) fprintf (outfil, "%s", maskbuf); -fprintf (outfil, "%s", canned1a); +fprintf (outfil, canned1a); /* * close the output file @@ -878,8 +878,8 @@ if ( outfil == (FILE *) NULL ) printf ("\nCouldn't open UilSymReas.h"); return; } -fprintf (outfil, "%s", canned_warn); -fprintf (outfil, "%s", canned1); +fprintf (outfil, canned_warn); +fprintf (outfil, canned1); /* * Generate the bit vectors for each class. Outer loop on the reason code, @@ -919,19 +919,19 @@ for ( resndx=0 ; resndxcnt ; resndx++ ) if ( itemno != 0 ) fprintf (outfil, "%s 0};\n", maskbuf); else - fprintf (outfil, "%s", "};\n"); + fprintf (outfil, "};\n"); } /* * Write the vector of vectors. */ -fprintf (outfil, "%s", canned2); +fprintf (outfil, canned2); for ( resndx=0 ; resndxcnt ; resndx++ ) { resobj = (WmlResourceDefPtr) wml_obj_reason_ptr->hvec[resndx].objptr; fprintf (outfil, " reason_class_vec%d,\n", resobj->sym_code); } -fprintf (outfil, "%s", canned3); +fprintf (outfil, canned3); /* * close the output file @@ -1004,8 +1004,8 @@ if ( outfil == (FILE *) NULL ) printf ("\nCouldn't open UilSymArTa.h"); return; } -fprintf (outfil, "%s", canned_warn); -fprintf (outfil, "%s", canned1); +fprintf (outfil, canned_warn); +fprintf (outfil, canned1); /* * Generate the bit vectors for each class. Outer loop on the argument code, @@ -1045,19 +1045,19 @@ for ( resndx=0 ; resndxcnt ; resndx++ ) if ( itemno != 0 ) fprintf (outfil, "%s 0};\n", maskbuf); else - fprintf (outfil, "%s", "};\n"); + fprintf (outfil, "};\n"); } /* * Write the vector of vectors. */ -fprintf (outfil, "%s", canned2); +fprintf (outfil, canned2); for ( resndx=0 ; resndxcnt ; resndx++ ) { resobj = (WmlResourceDefPtr) wml_obj_arg_ptr->hvec[resndx].objptr; fprintf (outfil, " arg_class_vec%d,\n", resobj->sym_code); } -fprintf (outfil, "%s", canned3); +fprintf (outfil, canned3); /* * close the output file @@ -1129,8 +1129,8 @@ if ( outfil == (FILE *) NULL ) printf ("\nCouldn't open UilSymChTa.h"); return; } -fprintf (outfil, "%s", canned_warn); -fprintf (outfil, "%s", canned1); +fprintf (outfil, canned_warn); +fprintf (outfil, canned1); /* * Generate the bit vectors for each class. Outer loop on the child code, @@ -1168,19 +1168,19 @@ for ( childndx=0 ; childndxcnt ; childndx++ ) if ( itemno != 0 ) fprintf (outfil, "%s 0};\n", maskbuf); else - fprintf (outfil, "%s", "};\n"); + fprintf (outfil, "};\n"); } /* * Write the vector of vectors. */ -fprintf (outfil, "%s", canned2); +fprintf (outfil, canned2); for ( childndx=0 ; childndxcnt ; childndx++ ) { childobj = (WmlChildDefPtr) wml_obj_child_ptr->hvec[childndx].objptr; fprintf (outfil, " child_class_vec%d,\n", childobj->sym_code); } -fprintf (outfil, "%s", canned3); +fprintf (outfil, canned3); /* * close the output file @@ -1251,8 +1251,8 @@ if ( outfil == (FILE *) NULL ) printf ("\nCouldn't open UilSymCtl.h"); return; } -fprintf (outfil, "%s", canned_warn); -fprintf (outfil, "%s", canned1); +fprintf (outfil, canned_warn); +fprintf (outfil, canned1); /* * Generate the bit vectors for each class. Outer loop on the class code, @@ -1290,19 +1290,19 @@ for ( ctlndx=0 ; ctlndxcnt ; ctlndx++ ) if ( itemno != 0 ) fprintf (outfil, "%s 0};\n", maskbuf); else - fprintf (outfil, "%s", "};\n"); + fprintf (outfil, "};\n"); } /* * Write the vector of vectors. */ -fprintf (outfil, "%s", canned2); +fprintf (outfil, canned2); for ( ctlndx=0 ; ctlndxcnt ; ctlndx++ ) { clsobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[ctlndx].objptr; fprintf (outfil, " object_class_vec%d,\n", clsobj->sym_code); } -fprintf (outfil, "%s", canned3); +fprintf (outfil, canned3); /* * close the output file @@ -1438,7 +1438,7 @@ if ( outfil == (FILE *) NULL ) printf ("\nCouldn't open UilSymNam.h"); return; } -fprintf (outfil, "%s", canned_warn); +fprintf (outfil, canned_warn); /* * Write entries for widgets @@ -1517,7 +1517,7 @@ for ( ndx=0 ; ndxcnt ; ndx++ ) fprintf (outfil, " \"%s\",\n", synch->name); } -fprintf (outfil, "%s", canned7); +fprintf (outfil, canned7); /* * close the output file @@ -1621,12 +1621,12 @@ if ( outfil == (FILE *) NULL ) printf ("\nCouldn't open UilSymEnum.h"); return; } -fprintf (outfil, "%s", canned_warn); +fprintf (outfil, canned_warn); /* * Generate the enumeration value vectors for each enumeration set. */ -fprintf (outfil, "%s", canned1); +fprintf (outfil, canned1); for ( ndx=0 ; ndxcnt ; ndx++ ) { enumsetobj = (WmlEnumSetDefPtr) wml_obj_enumset_ptr->hvec[ndx].objptr; @@ -1637,13 +1637,13 @@ for ( ndx=0 ; ndxcnt ; ndx++ ) fprintf (outfil, " %d,\n", evobj->sym_code); } - fprintf (outfil, "%s", " };\n"); + fprintf (outfil, " };\n"); } /* * Generate the enumeration set tables */ -fprintf (outfil, "%s", canned3); +fprintf (outfil, canned3); for ( ndx=0 ; ndxcnt ; ndx++ ) { enumsetobj = (WmlEnumSetDefPtr) wml_obj_enumset_ptr->hvec[ndx].objptr; @@ -1655,7 +1655,7 @@ for ( ndx=0 ; ndxcnt ; ndx++ ) /* * Create enumset table entries for arguments, similar to writing sym_k... */ -fprintf (outfil, "%s", canned4); +fprintf (outfil, canned4); for ( ndx=0 ; ndxcnt ; ndx++ ) { resobj = (WmlResourceDefPtr) wml_obj_arg_ptr->hvec[ndx].objptr; @@ -1669,13 +1669,13 @@ for ( ndx=0 ; ndxcnt ; ndx++ ) /* * Create the enumval values table. */ -fprintf (outfil, "%s", canned5); +fprintf (outfil, canned5); for ( ndx=0 ; ndxcnt ; ndx++ ) { evobj = (WmlEnumValueDefPtr) wml_obj_enumval_ptr->hvec[ndx].objptr; fprintf (outfil, " %s,\n", evobj->syndef->enumlit); } -fprintf (outfil, "%s", canned5a); +fprintf (outfil, canned5a); /* * close the output file @@ -1813,12 +1813,12 @@ if ( outfil == (FILE *) NULL ) printf ("\nCouldn't open UilSymCSet.h"); return; } -fprintf (outfil, "%s", canned_warn); +fprintf (outfil, canned_warn); /* * Generate the standards name table */ -fprintf (outfil, "%s", canned1); +fprintf (outfil, canned1); for ( ndx=0 ; ndxcnt ; ndx++ ) { csobj = (WmlCharSetDefPtr) wml_obj_charset_ptr->hvec[ndx].objptr; @@ -1836,7 +1836,7 @@ for ( ndx=0 ; ndxcnt ; ndx++ ) /* * Generate the writing direction table */ -fprintf (outfil, "%s", canned2); +fprintf (outfil, canned2); for ( ndx=0 ; ndxcnt ; ndx++ ) { csobj = (WmlCharSetDefPtr) wml_obj_charset_ptr->hvec[ndx].objptr; @@ -1858,7 +1858,7 @@ for ( ndx=0 ; ndxcnt ; ndx++ ) /* * Generate the parsing direction table */ -fprintf (outfil, "%s", canned3); +fprintf (outfil, canned3); for ( ndx=0 ; ndxcnt ; ndx++ ) { csobj = (WmlCharSetDefPtr) wml_obj_charset_ptr->hvec[ndx].objptr; @@ -1880,7 +1880,7 @@ for ( ndx=0 ; ndxcnt ; ndx++ ) /* * Generate the character size table */ -fprintf (outfil, "%s", canned4); +fprintf (outfil, canned4); for ( ndx=0 ; ndxcnt ; ndx++ ) { csobj = (WmlCharSetDefPtr) wml_obj_charset_ptr->hvec[ndx].objptr; @@ -1906,7 +1906,7 @@ for ( ndx=0 ; ndxcnt ; ndx++ ) /* * Generate the $LANG name recognition table */ -fprintf (outfil, "%s", canned5); +fprintf (outfil, canned5); lang_max = 0; for ( ndx=0 ; ndxcnt ; ndx++ ) { @@ -1936,7 +1936,7 @@ for ( ndx=0 ; ndxcnt ; ndx++ ) /* * Generate the $LANG code lookup table, in upper case */ -fprintf (outfil, "%s", canned6); +fprintf (outfil, canned6); for ( ndx=0 ; ndxcnt ; ndx++ ) { csobj = (WmlCharSetDefPtr) wml_obj_charset_ptr->hvec[ndx].objptr; diff --git a/tools/wml/wmlouth.c.format-security b/tools/wml/wmlouth.c.format-security deleted file mode 100644 index d2330e3..0000000 --- a/tools/wml/wmlouth.c.format-security +++ /dev/null @@ -1,1964 +0,0 @@ -/* - * Motif - * - * Copyright (c) 1987-2012, The Open Group. All rights reserved. - * - * These libraries and programs are free software; you can - * redistribute them and/or modify them under the terms of the GNU - * Lesser General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) - * any later version. - * - * These libraries and programs are distributed in the hope that - * they will be useful, but WITHOUT ANY WARRANTY; without even the - * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU Lesser General Public License for more - * details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with these librararies and programs; if not, write - * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth - * Floor, Boston, MA 02110-1301 USA -*/ -/* - * HISTORY -*/ -#ifdef REV_INFO -#ifndef lint -static char rcsid[] = "$XConsortium: wmlouth.c /main/8 1995/08/29 11:10:46 drk $" -#endif -#endif - -#ifdef HAVE_CONFIG_H -#include -#endif - - -/* -* (c) Copyright 1989, 1990, DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS. */ - -/* - * This module contains routines responsible for writing the .h files - * produced by WML. All files are written into the current directory. - * - * Input: - * The resolved objects - * - * Output: - * UilSymGen.h - * UilSymArTy.h - * UilSymChCl.h - * UilSymRArg.h - * UilUrmClas.h - * UilConst.h - * UilSymReas.h - * UilSymArTa.h - * UilSymChTa.h - * UilSymCtl.h - * UilSymNam.h - * UilSymEnum.h - * UilSymCSet.h - */ - - -#include "wml.h" - -#if defined(__STDC__) -#include -#endif -#include - - -/* - * Routines used only in this module - */ -void wmlOutputUilSymGen (); -void wmlOutputUilSymArTy (); -void wmlOutputUilSymChCl (); -void wmlOutputUilSymRArg (); -void wmlOutputUilUrmClas (); -void wmlOutputUilConst (); -void wmlOutputUilSymReas (); -void wmlOutputUilSymArTa (); -void wmlOutputUilSymChTa (); -void wmlOutputUilSymCtl (); -void wmlOutputUilSymNam (); -void wmlOutputUilSymEnum (); -void wmlOutputUilSymCSet (); -int wmlResolveCtlIsMember (WmlClassDefPtr, WmlClassCtrlDefPtr); - -/* - * globals - */ - -static char *canned_warn = -"/*\n\ -**\tThis file is automatically generated. Do not edit it by hand.\n\ -**/\n"; - -/* - * Used to create masks for bytes in bit vectors. Accessed by bit numbers - * from 1 - 8. - */ -static char *bit_masks[] = {"" - ," | 1" /* bit 1 */ - ," | 2" /* bit 2 */ - ," | 4" /* bit 3 */ - ," | 8" /* bit 4 */ - ," | 16" /* bit 5 */ - ," | 32" /* bit 6 */ - ," | 64" /* bit 7 */ - ," | 128"}; /* bit 8 */ - -/* - * To pick up maximum code values - */ -static int max_object_code = 0; -static int max_reason_code = 0; -static int max_arg_code = 0; -static int max_enumset_code = 0; -static int max_enumval_code = 0; -static int max_charset_code = 0; -static int max_child_code = 0; - - - -/* - * Output control routine, which simply outputs each .h file in turn. - */ - -void wmlOutputHFiles () - -{ - -wmlOutputUilSymGen (); -wmlOutputUilSymArTy (); -wmlOutputUilSymChCl (); -wmlOutputUilSymRArg (); -wmlOutputUilUrmClas (); -wmlOutputUilConst (); -wmlOutputUilSymReas (); -wmlOutputUilSymArTa (); -wmlOutputUilSymChTa (); -wmlOutputUilSymCtl (); -wmlOutputUilSymNam (); -wmlOutputUilSymEnum (); -wmlOutputUilSymCSet (); - -} - - - -/* - * Routine to write out UilSymGen.h - * - * This file defines the sym_k... literals for UIL. Each set of literals - * typiclly increases monotonically from 1, with 0 used as en error value. - * - * sym_k__object - * is widget class name in lexicographic order - * gadgets are not include. - * - * bit masks for table access - * - * sym_k__reason - * literals specifying all reasons, lexicographically ordered - * - * sym_k__arg - * literals for all arguments, lexicographically ordered. - * Constraints are included, and ordered with the arguments. - * - * sym_k__child - * literals for all automatic children, lexicographically ordered. - * - * sym_k__enumset - * literals naming each enumeration set, lexicographically ordered - * - * Fixed literals naming character set character sizes - * sym_k__charset - * literals naming each character set, lexicographically ordered - */ - -void wmlOutputUilSymGen () - -{ - -char *canned1 = -"\n/* Define literals for objects */\n"; - - -char *canned3 = -"\n/* Define literals for reasons */\n\n"; - - -char *canned4 = -"\n/* Define literals for arguments */\n\n"; - -char *canned5 = -"\n/* Define literals for enumeration sets */\n\n"; - -char *canned6 = -"\n/* Define literals for enumeration values */\n\n"; - -char *canned7 = -"\n/* Define literals for character sets */\n\n"; - -char *canned8 = -"\n/* Define literals for automatic children */\n\n"; - -FILE *outfil; /* output file */ -int ndx; /* loop index */ -WmlClassDefPtr clsobj; /* class object */ -WmlDataTypeDefPtr datobj; /* data type object */ -WmlResourceDefPtr resobj; /* resource object */ -WmlEnumSetDefPtr enumsetobj; /* enumeration set object */ -WmlEnumValueDefPtr enumvalobj; /* enumeration value object */ -WmlCharSetDefPtr charsetobj; /* character set object */ -WmlChildDefPtr childobj; /* child object */ - -/* - * Open the output file. Write the canned header stuff - */ -outfil = fopen ("UilSymGen.h", "w"); -if ( outfil == (FILE *) NULL ) - { - printf ("\nCouldn't open UilSymGen.h"); - return; - } -fprintf (outfil, canned_warn); - -/* - * Write the sym_k..._object literals - */ -fprintf (outfil, canned1); -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - clsobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[ndx].objptr; - fprintf (outfil, "#define sym_k_%s_object\t%d\n", - clsobj->tkname, - clsobj->sym_code); - if ( clsobj->sym_code > max_object_code ) - max_object_code = clsobj->sym_code; - } - -/* - * Define the sym_k_..._reason literals - */ -fprintf (outfil, canned3); -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - resobj = (WmlResourceDefPtr) wml_obj_reason_ptr->hvec[ndx].objptr; - fprintf (outfil, "#define sym_k_%s_reason\t%d\n", - resobj->tkname, - resobj->sym_code); - if ( resobj->sym_code > max_reason_code ) - max_reason_code = resobj->sym_code; - } - -/* - * Define the sym_k_..._arg literals - */ -fprintf (outfil, canned4); -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - resobj = (WmlResourceDefPtr) wml_obj_arg_ptr->hvec[ndx].objptr; - fprintf (outfil, "#define sym_k_%s_arg\t%d\n", - resobj->tkname, - resobj->sym_code); - if ( resobj->sym_code > max_arg_code ) - max_arg_code = resobj->sym_code; - } - -/* - * Define the sym_k_..._enumset structs and literals - */ -fprintf (outfil, canned5); -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - enumsetobj = (WmlEnumSetDefPtr) wml_obj_enumset_ptr->hvec[ndx].objptr; - fprintf (outfil, "#define sym_k_%s_enumset\t%d\n", - enumsetobj->tkname, - enumsetobj->sym_code); - if ( enumsetobj->sym_code > max_enumset_code ) - max_enumset_code = enumsetobj->sym_code; - } - -/* - * Define the sym_k_..._enumval literals - */ -fprintf (outfil, canned6); -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - enumvalobj = (WmlEnumValueDefPtr) wml_obj_enumval_ptr->hvec[ndx].objptr; - fprintf (outfil, "#define sym_k_%s_enumval\t%d\n", - enumvalobj->syndef->name, - enumvalobj->sym_code); - if ( enumvalobj->sym_code > max_enumval_code ) - max_enumval_code = enumvalobj->sym_code; - } - -/* - * Define the sym_k_..._charsize literals - * Define the sym_k_..._charset literals - */ -fprintf (outfil, canned7); -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - charsetobj = (WmlCharSetDefPtr) wml_obj_charset_ptr->hvec[ndx].objptr; - fprintf (outfil, "#define sym_k_%s_charset\t%d\n", - charsetobj->syndef->name, - charsetobj->sym_code); - if ( charsetobj->sym_code > max_charset_code ) - max_charset_code = charsetobj->sym_code; - } - -/* - * Define the sym_k_..._child literals - */ -fprintf (outfil, canned8); -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - childobj = (WmlChildDefPtr) wml_obj_child_ptr->hvec[ndx].objptr; - fprintf (outfil, "#define sym_k_%s_child\t%d\n", - childobj->syndef->name, - childobj->sym_code); - if ( childobj->sym_code > max_child_code ) - max_child_code = childobj->sym_code; - } - -/* - * close the output file - */ -printf ("\nCreated UilSymGen.h"); -fclose (outfil); - -} - - - -/* - * Routine to write out UilSymChCl.h - * - * A table of classes accessed by child type (sym_k__child, in - * the form - * ... - * sym_k__class, - */ - -void wmlOutputUilSymChCl () - -{ - -char *canned1 = -"/* Table of the class type of children\n\ - The table is indexed by child with each entry the\n\ - permitted class for that child.\n\ -*/\n\ -\n\ -static unsigned char child_class_table_vec[] =\n\ - {\n\ - 0,\n"; - -char *canned1a = -" };\n\ -externaldef(uil_sym_glbl) unsigned char *child_class_table =\n\ -\t child_class_table_vec;\n"; - -FILE *outfil; /* output file */ -int ndx; /* loop index */ -WmlClassDefPtr classobj; /* data type object */ -WmlChildDefPtr childobj; /* resource object */ - - -/* - * Open the output file. Write canned header. - */ -outfil = fopen ( "UilSymChCl.h", "w"); -if ( outfil == (FILE *) NULL ) - { - printf ("\nCouldn't open UilSymChCL.h"); - return; - } -fprintf (outfil, canned_warn); - -/* - * Create table entries, similar to writing sym_k... - */ -fprintf (outfil, canned1); -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - childobj = (WmlChildDefPtr) wml_obj_child_ptr->hvec[ndx].objptr; - classobj = childobj->class; - fprintf (outfil, " sym_k_%s_object,\n", - classobj->tkname); - } -fprintf (outfil, canned1a); - -/* - * close the output file - */ -printf ("\nCreated UilSymChCl.h"); -fclose (outfil); - -} - - -/* - * Routine to write out UilSymArTy.h - * - * A table of data types accessed by argument type (sym_k__arg, in - * the form - * ... - * sym_k__value, - */ - -void wmlOutputUilSymArTy () - -{ - -char *canned1 = -"/* Table of the types of arguments\n\ - The table is indexed by argument with each entry the\n\ - permitted type for that argument.\n\ -*/\n\ -\n\ -static unsigned char argument_type_table_vec[] =\n\ - {\n\ - 0,\n"; - -char *canned1a = -" };\n\ -externaldef(uil_sym_glbl) unsigned char *argument_type_table =\n\ -\t argument_type_table_vec;\n"; - -FILE *outfil; /* output file */ -int ndx; /* loop index */ -WmlDataTypeDefPtr datobj; /* data type object */ -WmlResourceDefPtr resobj; /* resource object */ - - -/* - * Open the output file. Write canned header. - */ -outfil = fopen ( "UilSymArTy.h", "w"); -if ( outfil == (FILE *) NULL ) - { - printf ("\nCouldn't open UilSymArTy.h"); - return; - } -fprintf (outfil, canned_warn); - -/* - * Create table entries, similar to writing sym_k... - */ -fprintf (outfil, canned1); -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - resobj = (WmlResourceDefPtr) wml_obj_arg_ptr->hvec[ndx].objptr; - datobj = resobj->dtype_def; - fprintf (outfil, " sym_k_%s_value,\n", - datobj->tkname); - } -fprintf (outfil, canned1a); - -/* - * close the output file - */ -printf ("\nCreated UilSymArTy.h"); -fclose (outfil); - -} - - - -/* - * Routine to write out UilSymRArg.h - * - * Related argument table - */ - -void wmlOutputUilSymRArg () - -{ - -char *canned1 = -"/* Related argument table. Each non-zero entry is the code\n\ - of the related argument.\n\ - */\n\ -\n\ -static unsigned short int related_argument_table_vec[] =\n\ - {\n\ - 0,\n"; - -char *canned1a = -" };\n\ -externaldef(uil_sym_glbl) unsigned short int *related_argument_table =\n\ -\t\trelated_argument_table_vec;\n"; - -FILE *outfil; /* output file */ -int ndx; /* loop index */ -WmlResourceDefPtr resobj; /* resource object */ - - -/* - * Open the output file. Write canned header. - */ -outfil = fopen ( "UilSymRArg.h", "w"); -if ( outfil == (FILE *) NULL ) - { - printf ("\nCouldn't open UilSymRArg.h"); - return; - } -fprintf (outfil, canned_warn); - -/* - * Create table entries, similar to writing sym_k... - */ -fprintf (outfil, canned1); -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - resobj = (WmlResourceDefPtr) wml_obj_arg_ptr->hvec[ndx].objptr; - fprintf (outfil, " %d,\n", - resobj->related_code); - } -fprintf (outfil, canned1a); - -/* - * close the output file - */ -printf ("\nCreated UilSymRArg.h"); -fclose (outfil); - -} - - - -/* - * Routine to write out UilUrmClas.h - * - * Table of convenience function names indexed by the sym_k_ literal - * for both widgets and gadgets - * Table of resource names indexed by the sym_k__arg and - * sym_k__reason codes. - */ - -void wmlOutputUilUrmClas () - -{ - -char *canned1 = -"\n/* Define mapping of UIL widget types to convenience functions. */\n\ -static char *uil_widget_funcs_vec[] = {\n\ - \"\",\t /* NOT USED */\n"; - -char *canned2 = -"};\n\ -externaldef(uil_sym_glbl) char **uil_widget_funcs = uil_widget_funcs_vec;\n\ -\n\ -/* Define mapping of UIL widget classes to matching gadget class. */\n\ -static unsigned short int uil_gadget_variants_vec[] = {\n\ - 0,\t /* NOT USED */\n"; - -char *canned3 = -"};\n\ -externaldef(uil_sym_glbl) unsigned short int *uil_gadget_variants =\n\ -\t\tuil_gadget_variants_vec;\n\ -\n\ -/* Define mapping of dialog types to non-dialog URM widget classes. */\n\ -static unsigned short int uil_urm_nondialog_class_vec[] = {\n\ - 0,\t/* NOT USED */\n"; - -char *canned4 = -"};\n\ -externaldef(uil_sym_glbl) unsigned short int *uil_urm_nondialog_class =\n\ -\t\tuil_urm_nondialog_class_vec;\n\ -\n\ -/* Define mapping of widget controls to a (subtree) resource. */\n\ -static unsigned short int uil_urm_subtree_resource_vec[] = {\n\ - 0,\t/* NOT USED */\n"; - -char *canned5 = -"};\n\ -externaldef(uil_sym_glbl) unsigned short int *uil_urm_subtree_resource =\n\ -\t\tuil_urm_subtree_resource_vec;\n\ -\n\ -/* Define mapping of arguments to toolkit names. */\n\ -static char *uil_argument_toolkit_names_vec[] = {\n\ - \"\",\t /* NOT USED */\n"; - -char *canned6 = -"};\n\ -externaldef(uil_sym_glbl) char **uil_argument_toolkit_names =\n\ -\t\tuil_argument_toolkit_names_vec;\n\ -\n\ -/* Define mapping of reasons to toolkit names. */\n\ -static char *uil_reason_toolkit_names_vec[] = {\n\ - \"\",\t/* NOT USED */\n"; - -char *canned7 = -"};\n\ -externaldef(uil_sym_glbl) char **uil_reason_toolkit_names =\n\ -\t\tuil_reason_toolkit_names_vec;\n"; - - - -FILE *outfil; /* output file */ -int ndx; /* loop index */ -WmlClassDefPtr clsobj; /* class object */ -WmlSynClassDefPtr synobj; /* syntactic object */ -WmlClassDefPtr varobj; /* variant (widget) class object */ -WmlResourceDefPtr resobj; /* argument/reason object */ -WmlSynResourceDefPtr synres; /* arg/reason syntactic object */ -WmlResourceDefPtr mapresobj; /* controls map to resource object */ - - -/* - * Open the output file. Write canned header. - */ -outfil = fopen ( "UilUrmClas.h", "w"); -if ( outfil == (FILE *) NULL ) - { - printf ("\nCouldn't open UilUrmClas.h"); - return; - } -fprintf (outfil, canned_warn); - -/* - * Write entries for widgets - */ -fprintf (outfil, canned1); -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - clsobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[ndx].objptr; - if ( clsobj->sym_code == 0 ) continue; - synobj = clsobj->syndef; - if ( synobj->int_lit != NULL ) - fprintf (outfil, " \"%s\",\n", synobj->convfunc); - else - fprintf (outfil, " \"%s\",\t\n", synobj->convfunc); - } -fprintf (outfil, canned2); - -/* - * Write entries for gadget variants of widget classes - */ -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - clsobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[ndx].objptr; - if ( clsobj->sym_code == 0 ) continue; - varobj = clsobj->variant; - synobj = clsobj->syndef; - if ( varobj==NULL || synobj->type==WmlClassTypeGadget ) - fprintf (outfil, " 0,\n"); - else - { - synobj = varobj->syndef; - if ( synobj->int_lit != NULL ) - fprintf (outfil, " sym_k_%s_object,\n", - synobj->int_lit); - else - fprintf (outfil, " sym_k_%s_object,\n", - synobj->name); - } - } -fprintf (outfil, canned3); - -/* - * Write entries for non-dialog widgets - */ -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - clsobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[ndx].objptr; - if ( clsobj->sym_code == 0 ) continue; - varobj = clsobj->nondialog; - synobj = clsobj->syndef; - if ( varobj == NULL ) - fprintf (outfil, " 0,\n"); - else - { - synobj = varobj->syndef; - if ( synobj->int_lit != NULL ) - fprintf (outfil, " sym_k_%s_object,\n", - synobj->int_lit); - else - fprintf (outfil, " sym_k_%s_object,\n", - synobj->name); - } - } -fprintf (outfil, canned4); - -/* - * Write entries for the resource a widget's controls map to - */ -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - clsobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[ndx].objptr; - if ( clsobj->sym_code == 0 ) continue; - synobj = clsobj->syndef; - mapresobj = clsobj->ctrlmapto; - if ( mapresobj == NULL ) - fprintf (outfil, " 0,\n"); - else - fprintf (outfil, " sym_k_%s_arg,\n", mapresobj->tkname); - } -fprintf (outfil, canned5); - -/* - * Write entries for arguments - */ -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - resobj = (WmlResourceDefPtr) wml_obj_arg_ptr->hvec[ndx].objptr; - synres = resobj->syndef; - if ( resobj->sym_code == 0 ) continue; - fprintf (outfil, " %s,\n", - synres->resliteral); - } -fprintf (outfil, canned6); - -/* - * Write entries for reasons - */ -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - resobj = (WmlResourceDefPtr) wml_obj_reason_ptr->hvec[ndx].objptr; - synres = resobj->syndef; - if ( resobj->sym_code == 0 ) continue; - fprintf (outfil, " %s,\n", - synres->resliteral); - } -fprintf (outfil, canned7); - -/* - * close the output file - */ -printf ("\nCreated UilUrmClas.h"); -fclose (outfil); - -} - - - -/* - * Routine to write out UilConst.h - * - * A bit vector showing which arguments are constraints. - */ - -void wmlOutputUilConst () - -{ - -char *canned1 = -"/* Table indexed by argument indicating whether\n\ - argument is a constraint (TRUE) or a regular\n\ - argument (FALSE). Each entry is one bit.\n\ - Index and mask macros are defined to simplify\n\ - access to the table\n\ -*/\n\ -\n\ -static unsigned char constraint_tab_vec[] = {\n"; - -char *canned1a = -"};\n\ -externaldef(uil_sym_glbl) unsigned char *constraint_tab =\n\ -\t\tconstraint_tab_vec;\n"; - - -FILE *outfil; /* output file */ -int ndx; /* loop index */ -WmlResourceDefPtr resobj; /* resource object */ -WmlSynResourceDefPtr synobj; /* syntactic object */ -char maskbuf[100]; /* to constuct each mask */ -int bitno; /* current bit number, from code */ - -/* - * Open the output file. Write canned header. - */ -outfil = fopen ( "UilConst.h", "w"); -if ( outfil == (FILE *) NULL ) - { - printf ("\nCouldn't open UilConst.h"); - return; - } -fprintf (outfil, canned_warn); - -/* - * Process the arguments in code order. We start with 1, and write out - * the mask after processing 8 codes. - */ -fprintf (outfil, canned1); -strcpy (maskbuf, "0"); -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - resobj = (WmlResourceDefPtr) wml_obj_arg_ptr->hvec[ndx].objptr; - synobj = resobj->syndef; - bitno = resobj->sym_code % 8; - if ( bitno == 0 ) bitno = 8; - if ( synobj->type == WmlResourceTypeConstraint ) - strcat (maskbuf, bit_masks[bitno]); - if ( bitno == 8 ) - { - fprintf (outfil, "%s,\n", maskbuf); - strcpy (maskbuf, "0"); - } - } -if ( bitno != 8 ) - fprintf (outfil, "%s", maskbuf); -fprintf (outfil, canned1a); - -/* - * close the output file - */ -printf ("\nCreated UilConst.h"); -fclose (outfil); - -} - - - -/* - * Routine to write out UilSymReas.h - * - * This file defines the reasons supported by each class. For each - * reason, there is a bit vector with the bit for each supporting class - * turned on if the reason is supported. There is then a vector pointing - * to these bit vectors for all reasons. This vector is accessed by - * sym_k_..._reason to find the reasons bit vector, then by sym_k_..._object - * to check the bit. - */ - -void wmlOutputUilSymReas () - -{ - -char *canned1 = -"\n/*\n\ - * Bit vectors for each reason. The entries in the vector correspond\n\ - * to each class.\n\ - */\n"; - -char *bvechdr = -"\n\ -/* sym_k_%s_reason */\n\ -static unsigned char reason_class_vec%d[] =\n\ - {\n"; - -char *canned2 = -"\n/*\n\ - * Table of bit vectors accessed by sym_k_..._reason\n\ - */\n\ -static unsigned char *allowed_reason_table_vec[] =\n\ - {\n\ - NULL,\t/* UNUSED */\n"; - -char *canned3 = -" };\n\ -externaldef(uil_sym_glbl) unsigned char **allowed_reason_table =\n\ -\t\tallowed_reason_table_vec;\n"; - -FILE *outfil; /* output file */ -int resndx; /* outer loop index */ -WmlResourceDefPtr resobj; /* current reason */ -int clsndx; /* inner loop index */ -WmlClassDefPtr clsobj; /* current class object */ -WmlClassResDefPtr resref; /* class' resource reference */ -int itemno; /* item in bye */ -char maskbuf[500]; /* current mask buffer */ -char itembuf[100]; /* for current item */ -int donl; /* TRUE if append \n to mask */ - - -/* - * Open the output file. Write canned header. - */ -outfil = fopen ( "UilSymReas.h", "w"); -if ( outfil == (FILE *) NULL ) - { - printf ("\nCouldn't open UilSymReas.h"); - return; - } -fprintf (outfil, canned_warn); -fprintf (outfil, canned1); - -/* - * Generate the bit vectors for each class. Outer loop on the reason code, - * inner loop on the class code. - */ -for ( resndx=0 ; resndxcnt ; resndx++ ) - { - resobj = (WmlResourceDefPtr) wml_obj_reason_ptr->hvec[resndx].objptr; - fprintf (outfil, bvechdr, resobj->tkname, resobj->sym_code); - - /* - * inner loop on widget class. - */ - strcpy (maskbuf, " "); - for ( clsndx=0 ; clsndxcnt ; clsndx++ ) - { - clsobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[clsndx].objptr; - itemno = (clsobj->sym_code+1) % 8; - donl = FALSE; - resref = wmlResolveResIsMember (resobj, clsobj->reasons); - if ( resref != NULL ) - if ( resref->exclude != WmlAttributeTrue ) - { - sprintf (itembuf, " _BIT_MASK(sym_k_%s_object) |", - clsobj->tkname); - strcat (maskbuf, itembuf); - donl = TRUE; - } - if ( donl ) - strcat (maskbuf, "\n "); - if ( itemno == 0 ) - { - fprintf (outfil, "%s 0", maskbuf); - strcpy (maskbuf, ","); - } - } - if ( itemno != 0 ) - fprintf (outfil, "%s 0};\n", maskbuf); - else - fprintf (outfil, "};\n"); - } - -/* - * Write the vector of vectors. - */ -fprintf (outfil, canned2); -for ( resndx=0 ; resndxcnt ; resndx++ ) - { - resobj = (WmlResourceDefPtr) wml_obj_reason_ptr->hvec[resndx].objptr; - fprintf (outfil, " reason_class_vec%d,\n", resobj->sym_code); - } -fprintf (outfil, canned3); - -/* - * close the output file - */ -printf ("\nCreated UilSymReas.h"); -fclose (outfil); - -} - - - -/* - * Routine to write out UilSymArTa.h - * - * This file defines the arguments supported by each class. For each - * argument, there is a bit vector with the bit for each supporting class - * turned on if the argument is supported. There is then a vector pointing - * to these bit vectors for all arguments. This vector is accessed by - * sym_k_..._arg to find the arguments bit vector, then by sym_k_..._object - * to check the bit. - */ - -void wmlOutputUilSymArTa () - -{ - -char *canned1 = -"\n/*\n\ - * Bit vectors for each argument. The entries in the vector correspond\n\ - * to each class.\n\ - */\n"; - -char *bvechdr = -"\n\ -/* sym_k_%s_arg */\n\ -static unsigned char arg_class_vec%d[] =\n\ - {\n"; - -char *canned2 = -"\n/*\n\ - * Table of bit vectors accessed by sym_k_..._arg\n\ - */\n\ -static unsigned char *allowed_argument_table_vec[] =\n\ - {\n\ - NULL,\t/* UNUSED */\n"; - -char *canned3 = -" };\n\ -externaldef(uil_sym_glbl) unsigned char **allowed_argument_table =\n\ -\t\tallowed_argument_table_vec;\n"; - -FILE *outfil; /* output file */ -int resndx; /* outer loop index */ -WmlResourceDefPtr resobj; /* current argument */ -int clsndx; /* inner loop index */ -WmlClassDefPtr clsobj; /* current class object */ -WmlClassResDefPtr resref; /* class' resource reference */ -int itemno; /* item in bye */ -char maskbuf[500]; /* current mask buffer */ -char itembuf[100]; /* for current item */ -int donl; /* TRUE if append \n to mask */ - - -/* - * Open the output file. Write canned header. - */ -outfil = fopen ( "UilSymArTa.h", "w"); -if ( outfil == (FILE *) NULL ) - { - printf ("\nCouldn't open UilSymArTa.h"); - return; - } -fprintf (outfil, canned_warn); -fprintf (outfil, canned1); - -/* - * Generate the bit vectors for each class. Outer loop on the argument code, - * inner loop on the class code. - */ -for ( resndx=0 ; resndxcnt ; resndx++ ) - { - resobj = (WmlResourceDefPtr) wml_obj_arg_ptr->hvec[resndx].objptr; - fprintf (outfil, bvechdr, resobj->tkname, resobj->sym_code); - - /* - * inner loop on widget class. - */ - strcpy (maskbuf, " "); - for ( clsndx=0 ; clsndxcnt ; clsndx++ ) - { - clsobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[clsndx].objptr; - itemno = (clsobj->sym_code+1) % 8; - donl = FALSE; - resref = wmlResolveResIsMember (resobj, clsobj->arguments); - if ( resref != NULL ) - if ( resref->exclude != WmlAttributeTrue ) - { - sprintf (itembuf, " _BIT_MASK(sym_k_%s_object) |", - clsobj->tkname); - strcat (maskbuf, itembuf); - donl = TRUE; - } - if ( donl ) - strcat (maskbuf, "\n "); - if ( itemno == 0 ) - { - fprintf (outfil, "%s 0", maskbuf); - strcpy (maskbuf, ","); - } - } - if ( itemno != 0 ) - fprintf (outfil, "%s 0};\n", maskbuf); - else - fprintf (outfil, "};\n"); - } - -/* - * Write the vector of vectors. - */ -fprintf (outfil, canned2); -for ( resndx=0 ; resndxcnt ; resndx++ ) - { - resobj = (WmlResourceDefPtr) wml_obj_arg_ptr->hvec[resndx].objptr; - fprintf (outfil, " arg_class_vec%d,\n", resobj->sym_code); - } -fprintf (outfil, canned3); - -/* - * close the output file - */ -printf ("\nCreated UilSymArTa.h"); -fclose (outfil); - -} - - -/* - * Routine to write out UilSymChTa.h - * - * This file defines the automatic children supported by each class. For each - * child, there is a bit vector with the bit for each supporting class - * turned on if the child is supported. There is then a vector pointing - * to these bit vectors for all children. This vector is accessed by - * sym_k_..._child to find the child's bit vector, then by sym_k_..._object - * to check the bit. - */ - -void wmlOutputUilSymChTa () - -{ - -char *canned1 = -"\n/*\n\ - * Bit vectors for each child. The entries in the vector correspond\n\ - * to each class.\n\ - */\n"; - -char *bvechdr = -"\n\ -/* sym_k_%s_child */\n\ -static unsigned char child_class_vec%d[] =\n\ - {\n"; - -char *canned2 = -"\n/*\n\ - * Table of bit vectors accessed by sym_k_..._child\n\ - */\n\ -static unsigned char *allowed_child_table_vec[] =\n\ - {\n\ - NULL,\t/* UNUSED */\n"; - -char *canned3 = -" };\n\ -externaldef(uil_sym_glbl) unsigned char **allowed_child_table =\n\ -\t\tallowed_child_table_vec;\n"; - -FILE *outfil; /* output file */ -int childndx; /* outer loop index */ -WmlChildDefPtr childobj; /* current argument */ -int clsndx; /* inner loop index */ -WmlClassDefPtr clsobj; /* current class object */ -WmlClassChildDefPtr childref; /* class' child reference */ -int itemno; /* item in byte */ -char maskbuf[500]; /* current mask buffer */ -char itembuf[100]; /* for current item */ -int donl; /* TRUE if append \n to mask */ - - -/* - * Open the output file. Write canned header. - */ -outfil = fopen ( "UilSymChTa.h", "w"); -if ( outfil == (FILE *) NULL ) - { - printf ("\nCouldn't open UilSymChTa.h"); - return; - } -fprintf (outfil, canned_warn); -fprintf (outfil, canned1); - -/* - * Generate the bit vectors for each class. Outer loop on the child code, - * inner loop on the class code. - */ -for ( childndx=0 ; childndxcnt ; childndx++ ) - { - childobj = (WmlChildDefPtr) wml_obj_child_ptr->hvec[childndx].objptr; - fprintf (outfil, bvechdr, childobj->tkname, childobj->sym_code); - - /* - * inner loop on widget class. - */ - strcpy (maskbuf, " "); - for ( clsndx=0 ; clsndxcnt ; clsndx++ ) - { - clsobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[clsndx].objptr; - itemno = (clsobj->sym_code+1) % 8; - donl = FALSE; - childref = wmlResolveChildIsMember (childobj, clsobj->children); - if ( childref != NULL ) - { - sprintf (itembuf, " _BIT_MASK(sym_k_%s_object) |", clsobj->tkname); - strcat (maskbuf, itembuf); - donl = TRUE; - } - if ( donl ) - strcat (maskbuf, "\n "); - if ( itemno == 0 ) - { - fprintf (outfil, "%s 0", maskbuf); - strcpy (maskbuf, ","); - } - } - if ( itemno != 0 ) - fprintf (outfil, "%s 0};\n", maskbuf); - else - fprintf (outfil, "};\n"); - } - -/* - * Write the vector of vectors. - */ -fprintf (outfil, canned2); -for ( childndx=0 ; childndxcnt ; childndx++ ) - { - childobj = (WmlChildDefPtr) wml_obj_child_ptr->hvec[childndx].objptr; - fprintf (outfil, " child_class_vec%d,\n", childobj->sym_code); - } -fprintf (outfil, canned3); - -/* - * close the output file - */ -printf ("\nCreated UilSymChTa.h"); -fclose (outfil); - -} - - -/* - * Routine to write out UilSymCtl.h - * - * This file defines the controls supported by each class. For each - * object, there is a bit vector with the bit for each supporting class - * turned on if the object is supported. There is then a vector pointing - * to these bit vectors for all objects. This vector is accessed by - * sym_k_..._object to find the objects bit vector, then by sym_k_..._object - * to check the bit. - */ - -void wmlOutputUilSymCtl () - -{ - -char *canned1 = -"\n/*\n\ - * Bit vectors for each control. The entries in the vector correspond\n\ - * to each class.\n\ - */\n"; - -char *bvechdr = -"\n\ -/* sym_k_%s_object */\n\ -static unsigned char object_class_vec%d[] =\n\ - {\n"; - -char *canned2 = -"\n/*\n\ - * Table of bit vectors accessed by sym_k_..._object\n\ - */\n\ -static unsigned char *allowed_control_table_vec[] =\n\ - {\n\ - NULL,\t/* UNUSED */\n"; - -char *canned3 = -" };\n\ -externaldef(uil_sym_glbl) unsigned char **allowed_control_table =\n\ -\t\tallowed_control_table_vec;\n"; - -FILE *outfil; /* output file */ -int ctlndx; /* outer loop index */ -WmlClassDefPtr ctlobj; /* current class allowing controls */ -int clsndx; /* inner loop index */ -WmlClassDefPtr clsobj; /* current class object */ -int itemno; /* item in bye */ -char maskbuf[500]; /* current mask buffer */ -char itembuf[100]; /* for current item */ -int donl; /* TRUE if append \n to mask */ - - -/* - * Open the output file. Write canned header. - */ -outfil = fopen ( "UilSymCtl.h", "w"); -if ( outfil == (FILE *) NULL ) - { - printf ("\nCouldn't open UilSymCtl.h"); - return; - } -fprintf (outfil, canned_warn); -fprintf (outfil, canned1); - -/* - * Generate the bit vectors for each class. Outer loop on the class code, - * inner loop on the class code. - */ -for ( ctlndx=0 ; ctlndxcnt ; ctlndx++ ) - { - clsobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[ctlndx].objptr; - fprintf (outfil, bvechdr, clsobj->tkname, clsobj->sym_code); - - /* - * inner loop on widget class. - */ - strcpy (maskbuf, " "); - for ( clsndx=0 ; clsndxcnt ; clsndx++ ) - { - ctlobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[clsndx].objptr; - itemno = (ctlobj->sym_code+1) % 8; - donl = FALSE; - if ( wmlResolveCtlIsMember(clsobj,ctlobj->controls) == TRUE) - { - sprintf (itembuf, " _BIT_MASK(sym_k_%s_object) |", - ctlobj->tkname); - strcat (maskbuf, itembuf); - donl = TRUE; - } - if ( donl ) - strcat (maskbuf, "\n "); - if ( itemno == 0 ) - { - fprintf (outfil, "%s 0", maskbuf); - strcpy (maskbuf, ","); - } - } - if ( itemno != 0 ) - fprintf (outfil, "%s 0};\n", maskbuf); - else - fprintf (outfil, "};\n"); - } - -/* - * Write the vector of vectors. - */ -fprintf (outfil, canned2); -for ( ctlndx=0 ; ctlndxcnt ; ctlndx++ ) - { - clsobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[ctlndx].objptr; - fprintf (outfil, " object_class_vec%d,\n", clsobj->sym_code); - } -fprintf (outfil, canned3); - -/* - * close the output file - */ -printf ("\nCreated UilSymCtl.h"); -fclose (outfil); - -} - - - -/* - * Predicate to indicate if a class object is in a controls list. - */ - -int wmlResolveCtlIsMember (ctlobj, ctlref) - WmlClassDefPtr ctlobj; - WmlClassCtrlDefPtr ctlref; - -{ - -while ( ctlref != NULL ) - { - if ( ctlref->ctrl == ctlobj ) return TRUE; - ctlref = ctlref->next; - } -return FALSE; - -} - - - -/* - * Routine to write out UilSymNam.h - * - * Tables of names of object indexed by their various sym_k_ literals. - */ - -void wmlOutputUilSymNam () - -{ - -char *canned1 = -"/* Define mapping of sym_k_..._object codes to widget names. */\n\ -\n\ -externaldef(uil_sym_glbl) int uil_max_object = %d;\n\ -static char *uil_widget_names_vec[] = {\n\ - \"\",\t/* NOT USED */\n"; - -char *canned2 = -"};\n\ -externaldef(uil_sym_glbl) char **uil_widget_names =\n\ -\t\tuil_widget_names_vec;\n\ -\n\n\ -/* Define mapping of sym_k_..._arg codes to argument names. */\n\ -\n\ -externaldef(uil_sym_glbl) int uil_max_arg = %d;\n\ -static char *uil_argument_names_vec[] = {\n\ - \"\",\t/* NOT USED */\n"; - -char *canned3 = -"};\n\ -externaldef(uil_sym_glbl) char **uil_argument_names =\n\ -\t\tuil_argument_names_vec;\n\ -\n\n\ -/* Define mapping of sym_k_..._reason to reason names. */\n\ -\n\ -externaldef(uil_sym_glbl) int uil_max_reason = %d;\n\ -static char *uil_reason_names_vec[] = {\n\ - \"\",\t/* NOT USED */\n"; - -char *canned4 = -"};\n\ -externaldef(uil_sym_glbl) char **uil_reason_names =\n\ -\t\tuil_reason_names_vec;\n\ -\n\n\ -/* Define mapping of sym_k_..._enumval to enumeration value names. */\n\ -\n\ -externaldef(uil_sym_glbl) int uil_max_enumset = %d;\n\ -externaldef(uil_sym_glbl) int uil_max_enumval = %d;\n\ -static char *uil_enumval_names_vec[] = {\n\ - \"\",\t/* NOT USED */\n"; - -char *canned5 = -"};\n\ -externaldef(uil_sym_glbl) char **uil_enumval_names =\n\ -\t\tuil_enumval_names_vec;\n\ -\n\n\ -/* Define mapping of sym_k_..._charset to enumeration value names. */\n\ -\n\ -externaldef(uil_sym_glbl) int uil_max_charset = %d;\n\ -static char *uil_charset_names_vec[] = {\n\ - \"\",\t/* NOT USED */\n\ - \"\",\n"; - -char *canned6 = -"};\n\ -externaldef(uil_sym_glbl) char **uil_charset_names =\n\ -\t\tuil_charset_names_vec;\n\ -\n\n\ -/* Define mapping of sym_k_..._child codes to child names. */\n\ -\n\ -externaldef(uil_sym_glbl) int uil_max_child = %d;\n\ -static char *uil_child_names_vec[] = {\n\ - \"\",\t/* NOT USED */\n"; - -char *canned7 = -"};\n\ -externaldef(uil_sym_glbl) char **uil_child_names =\n\ -\t\tuil_child_names_vec;\n"; - - -FILE *outfil; /* output file */ -int ndx; /* loop index */ -WmlClassDefPtr clsobj; /* class object */ -WmlClassDefPtr varobj; /* gadget class object */ -WmlSynClassDefPtr synobj; /* syntactic object */ -WmlResourceDefPtr resobj; /* argument/reason object */ -WmlSynResourceDefPtr synres; /* arg/reason syntactic object */ -WmlEnumValueDefPtr evobj; /* enumeration value object */ -WmlSynEnumValueDefPtr synev; /* enumeration value syntactic obj */ -WmlCharSetDefPtr csobj; /* character set object */ -WmlSynCharSetDefPtr syncs; /* character set syntactic obj */ -WmlChildDefPtr chobj; /* child object */ -WmlSynChildDefPtr synch; /* child syntactic object */ - -/* - * Open the output file. Write canned header. - */ -outfil = fopen ( "UilSymNam.h", "w"); -if ( outfil == (FILE *) NULL ) - { - printf ("\nCouldn't open UilSymNam.h"); - return; - } -fprintf (outfil, canned_warn); - -/* - * Write entries for widgets - */ -fprintf (outfil, canned1, max_object_code); -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - clsobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[ndx].objptr; - if ( clsobj->sym_code == 0 ) continue; - synobj = clsobj->syndef; - fprintf (outfil, " \"%s\",\n", - synobj->name); - } - -/* - * Write entries for arguments - */ -fprintf (outfil, canned2, max_arg_code); -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - resobj = (WmlResourceDefPtr) wml_obj_arg_ptr->hvec[ndx].objptr; - synres = resobj->syndef; - if ( resobj->sym_code == 0 ) continue; - fprintf (outfil, " \"%s\",\n", - synres->name); - } - -/* - * Write entries for reasons - */ -fprintf (outfil, canned3, max_reason_code); -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - resobj = (WmlResourceDefPtr) wml_obj_reason_ptr->hvec[ndx].objptr; - synres = resobj->syndef; - if ( resobj->sym_code == 0 ) continue; - fprintf (outfil, " \"%s\",\n", - synres->name); - } - -/* - * Write entries for enumeration values - */ -fprintf (outfil, canned4, max_enumset_code, max_enumval_code); -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - evobj = (WmlEnumValueDefPtr) wml_obj_enumval_ptr->hvec[ndx].objptr; - synev = evobj->syndef; - if ( evobj->sym_code == 0 ) continue; - fprintf (outfil, " \"%s\",\n", - synev->name); - } - -/* - * Write entries for character sets - */ -fprintf (outfil, canned5, max_charset_code); -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - csobj = (WmlCharSetDefPtr) wml_obj_charset_ptr->hvec[ndx].objptr; - syncs = csobj->syndef; - if ( csobj->sym_code == 0 ) continue; - fprintf (outfil, " \"%s\",\n", - syncs->name); - } - -/* - * Write entries for children - */ -fprintf (outfil, canned6, max_child_code); -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - chobj = (WmlChildDefPtr) wml_obj_child_ptr->hvec[ndx].objptr; - synch = chobj->syndef; - if ( chobj->sym_code == 0 ) continue; - fprintf (outfil, " \"%s\",\n", - synch->name); - } -fprintf (outfil, canned7); - -/* - * close the output file - */ -printf ("\nCreated UilSymNam.h"); -fclose (outfil); - -} - - - -/* - * Routine to write out UilSymEnum.h - * - * This file defines the enumeration sets recognized by UIL. There is an - * entry in this file for each enumeration set. The definitions are accessed - * by the sym_k_..._enumset code. Each consists of a structure containing - * a vector of enumeration value descriptors, each of which is the name - * of the value and its value. - * - * UilSymEnum.h contains: - * - Vectors of value descriptors for each table entry - * - The table itself. - * - A table given the sym_k_..._enumset code for each argument which - * has an enumeration set. - * - A table accessed by sym_k_..._enumval code giving the actual value - * for each enumeration value. - * - * The typedefs for the tables are in UilSymGen.h - */ - -void wmlOutputUilSymEnum () - -{ - -char *canned1 = -"\n\ -/*\n\ - * Enumeration value vectors for each enumeration set\n\ - */\n\ -\n"; - -char *valhdr = -"\n\ -static unsigned short int enum_value_vec%d[] =\n\ - {\n"; - -char *canned3 = -"\n\ -/*\n\ - * Enumeration set descriptor table\n\ - */\n\ -static UilEnumSetDescDef enum_set_table_vec[] =\n\ - {\n\ - {0,NULL},\n"; - -char *canned4 = -" };\n\ -externaldef(uil_sym_glbl) UilEnumSetDescDef *enum_set_table =\n\ -\t\tenum_set_table_vec;\n\ -/*\n\ - * Enumeration set table, accessed by sym_k_..._arg code. Each non-zero entry\n\ - * is the sym_k_..._enumset code for the argument's enumeration set.\n\ - */\n\ -static unsigned short int argument_enumset_table_vec[] =\n\ - {\n\ - 0,\n"; - -char *canned5 = -" };\n\ -externaldef(uil_sym_glbl) unsigned short int *argument_enumset_table =\n\ -\t\targument_enumset_table_vec;\n\ -/*\n\ - * Enumeration value table, accessed by sym_k_..._enumval code. Each entry is\n\ - * the actual value associated with the code.\n\ - */\n\ -static int enumval_values_table_vec[] =\n\ - {\n\ - 0,\n"; - -char *canned5a = -" };\n\ -externaldef(uil_sym_glbl) int *enumval_values_table =\n\ -\t\tenumval_values_table_vec;\n"; - - -FILE *outfil; /* output file */ -int ndx; /* loop index */ -WmlEnumSetDefPtr enumsetobj; /* enumeration set object */ -WmlEnumSetValDefPtr esvobj; /* current enum set value list element */ -WmlEnumValueDefPtr evobj; /* current enumeration value object */ -WmlResourceDefPtr resobj; /* resource object */ - - -/* - * Open the output file. Write the canned header stuff - */ -outfil = fopen ("UilSymEnum.h", "w"); -if ( outfil == (FILE *) NULL ) - { - printf ("\nCouldn't open UilSymEnum.h"); - return; - } -fprintf (outfil, canned_warn); - -/* - * Generate the enumeration value vectors for each enumeration set. - */ -fprintf (outfil, canned1); -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - enumsetobj = (WmlEnumSetDefPtr) wml_obj_enumset_ptr->hvec[ndx].objptr; - fprintf (outfil, valhdr, enumsetobj->sym_code); - for ( esvobj=enumsetobj->values ; esvobj!=NULL ; esvobj=esvobj->next ) - { - evobj = esvobj->value; - fprintf (outfil, " %d,\n", - evobj->sym_code); - } - fprintf (outfil, " };\n"); - } - -/* - * Generate the enumeration set tables - */ -fprintf (outfil, canned3); -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - enumsetobj = (WmlEnumSetDefPtr) wml_obj_enumset_ptr->hvec[ndx].objptr; - fprintf (outfil, " {%d,enum_value_vec%d},\n", - enumsetobj->values_cnt, - enumsetobj->sym_code); - } - -/* - * Create enumset table entries for arguments, similar to writing sym_k... - */ -fprintf (outfil, canned4); -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - resobj = (WmlResourceDefPtr) wml_obj_arg_ptr->hvec[ndx].objptr; - if ( resobj->enumset_def == NULL ) - fprintf (outfil, " 0,\n"); - else - fprintf (outfil, " %d,\n", - resobj->enumset_def->sym_code); - } - -/* - * Create the enumval values table. - */ -fprintf (outfil, canned5); -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - evobj = (WmlEnumValueDefPtr) wml_obj_enumval_ptr->hvec[ndx].objptr; - fprintf (outfil, " %s,\n", evobj->syndef->enumlit); - } -fprintf (outfil, canned5a); - -/* - * close the output file - */ -printf ("\nCreated UilSymEnum.h"); -fclose (outfil); - -} - - - -/* - * Routine to write out UilSymCSet.h - * - * This file specifies the various attributes for the character sets - * recognized by UIL. There is a table for each of the following - * attributes: - * - Standards name associated with the character set - * - Writing direction, from XmSTRING_DIRECTION_... - * - Parsing direction, from XmSTRING_DIRECTION_... - * - Bytes per character, from sym_k_..._charsize (in UilSymGen.h) - * - A pair of tables for recognizing $LANG settings: - * o a table of all names under which a character set might - * be legally recognized (upper case). - * o the sym_k_..._charset code for each entry - * o a variable giving the number of entries in the table - * - * All tables are accessed by the sym_k_..._charset - * - */ - -void wmlOutputUilSymCSet () - -{ - -char *canned1 = -"\n\ -/*\n\ - * Character set XmString name table, accessed by sym_k_..._charset code.\n\ - * Each entry is the name which identifies the character set in a XmString.\n\ - */\n\ -static char *charset_xmstring_names_table_vec[] =\n\ - {\n\ - 0,\n\ - \"\",\n"; - -char *canned2 = -"};\n\ -externaldef(uil_sym_glbl) char **charset_xmstring_names_table =\n\ -\t\tcharset_xmstring_names_table_vec;\n\ -/*\n\ - * Character set writing direction table, accessed by sym_k_..._charset code.\n\ - * Each entry is the XmSTRING_DIRECTION_... code which identifies the\n\ - * writing direction for the character set in a XmString.\n\ - */\n\ -static unsigned char charset_wrdirection_table_vec[] =\n\ - {\n\ - 0,\n\ - 0,\t/* userdefined */\n"; - -char *canned3 = -"};\n\ -externaldef(uil_sym_glbl) unsigned char *charset_writing_direction_table =\n\ -\t\tcharset_wrdirection_table_vec;\n\ -/*\n\ - * Character set parsing direction table, accessed by sym_k_..._charset code.\n\ - * Each entry is the XmSTRING_DIRECTION_... code which identifies the\n\ - * parsing direction for the character set in a XmString.\n\ - */\n\ -static unsigned char charset_parsdirection_table_vec[] =\n\ - {\n\ - 0,\n\ - 0,\t/* userdefined */\n"; - -char *canned4 = -"};\n\ -externaldef(uil_sym_glbl) unsigned char *charset_parsing_direction_table =\n\ -\t\tcharset_parsdirection_table_vec;\n\ -/*\n\ - * Character set character size table, accessed by sym_k_..._charset code.\n\ - * Each entry is the sym_k_..._charsize literal which names the character\n\ - * size for the character set in a XmString.\n\ - */\n\ -static unsigned char charset_charsize_table_vec[] =\n\ - {\n\ - 0,\n\ - 0,\t/* userdefined */\n"; - -char *canned5 = -"};\n\ -externaldef(uil_sym_glbl) unsigned char *charset_character_size_table =\n\ -\t\tcharset_charsize_table_vec;\n\ -/*\n\ - * All the names under which a character set may be legally named in a \n\ - * $LANG variable (upper case).\n\ - */\n\ -static char *charset_lang_names_table_vec[] =\n\ - {\n"; - -char *canned6 = -"};\n\ -externaldef(uil_sym_glbl) char **charset_lang_names_table =\n\ -\t\tcharset_lang_names_table_vec;\n\ -/*\n\ - * The sym_k_..._charset codes for charset_lang_names\n\ - */\n\ -static unsigned short int charset_lang_codes_table_vec[] =\n\ - {\n"; - -char *canned7 = -"};\n\ -externaldef(uil_sym_glbl) unsigned short int *charset_lang_codes_table =\n\ -\t\tcharset_lang_codes_table_vec;\n\ -/*\n\ - * The number of entries in charset_lang_..._table tables\n\ - */\n\ -externaldef(uil_sym_glbl) unsigned short int charset_lang_table_max = %d;\n"; - - -FILE *outfil; /* output file */ -int ndx; /* loop index */ -WmlCharSetDefPtr csobj; /* character set object */ -WmlSynCharSetDefPtr syncs; /* character set syntactic obj */ -int lang_max; /* max value for $LANG tables */ -int alias_ndx; /* alias loop index */ -char uname[200]; /* name converted to upper case */ - - -/* - * Open the output file. Write the canned header stuff - */ -outfil = fopen ("UilSymCSet.h", "w"); -if ( outfil == (FILE *) NULL ) - { - printf ("\nCouldn't open UilSymCSet.h"); - return; - } -fprintf (outfil, canned_warn); - -/* - * Generate the standards name table - */ -fprintf (outfil, canned1); -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - csobj = (WmlCharSetDefPtr) wml_obj_charset_ptr->hvec[ndx].objptr; - syncs = csobj->syndef; - if ( csobj->sym_code == 0 ) continue; - if ((strcmp(syncs->xms_name, "XmFONTLIST_DEFAULT_TAG") == 0) || - (strcmp(syncs->xms_name, "_MOTIF_DEFAULT_LOCALE") == 0)) - fprintf (outfil, " %s,\t/* %s */\n", - syncs->xms_name, syncs->name); - else - fprintf (outfil, " \"%s\",\t/* %s */\n", - syncs->xms_name, syncs->name); - } - -/* - * Generate the writing direction table - */ -fprintf (outfil, canned2); -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - csobj = (WmlCharSetDefPtr) wml_obj_charset_ptr->hvec[ndx].objptr; - syncs = csobj->syndef; - if ( csobj->sym_code == 0 ) continue; - switch ( syncs->direction ) - { - case WmlCharSetDirectionLtoR: - fprintf (outfil, " XmSTRING_DIRECTION_L_TO_R,\t/* %s */\n", - syncs->name); - break; - case WmlCharSetDirectionRtoL: - fprintf (outfil, " XmSTRING_DIRECTION_R_TO_L,\t/* %s */\n", - syncs->name); - break; - } - } - -/* - * Generate the parsing direction table - */ -fprintf (outfil, canned3); -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - csobj = (WmlCharSetDefPtr) wml_obj_charset_ptr->hvec[ndx].objptr; - syncs = csobj->syndef; - if ( csobj->sym_code == 0 ) continue; - switch ( syncs->parsedirection ) - { - case WmlCharSetDirectionLtoR: - fprintf (outfil, " XmSTRING_DIRECTION_L_TO_R,\t/* %s */\n", - syncs->name); - break; - case WmlCharSetDirectionRtoL: - fprintf (outfil, " XmSTRING_DIRECTION_R_TO_L,\t/* %s */\n", - syncs->name); - break; - } - } - -/* - * Generate the character size table - */ -fprintf (outfil, canned4); -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - csobj = (WmlCharSetDefPtr) wml_obj_charset_ptr->hvec[ndx].objptr; - syncs = csobj->syndef; - if ( csobj->sym_code == 0 ) continue; - switch ( syncs->charsize ) - { - case WmlCharSizeOneByte: - fprintf (outfil, " sym_k_onebyte_charsize,\t/* %s */\n", - syncs->name); - break; - case WmlCharSizeTwoByte: - fprintf (outfil, " sym_k_twobyte_charsize,\t/* %s */\n", - syncs->name); - break; - case WmlCharSizeMixed1_2Byte: - fprintf (outfil, " sym_k_mixed1_2byte_charsize,\t/* %s */\n", - syncs->name); - break; - } - } - -/* - * Generate the $LANG name recognition table - */ -fprintf (outfil, canned5); -lang_max = 0; -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - csobj = (WmlCharSetDefPtr) wml_obj_charset_ptr->hvec[ndx].objptr; - syncs = csobj->syndef; - if ( csobj->sym_code == 0 ) continue; - strcpy (uname, syncs->name); - wmlUpperCaseString (uname); - fprintf (outfil, " \"%s\",\t/* %s */\n", - uname, syncs->name); - lang_max += 1; - strcpy (uname, syncs->xms_name); - wmlUpperCaseString (uname); - fprintf (outfil, " \"%s\",\t/* %s */\n", - uname, syncs->name); - lang_max += 1; - for ( alias_ndx=0 ; alias_ndxalias_cnt ; alias_ndx++ ) - { - strcpy (uname, syncs->alias_list[alias_ndx]); - wmlUpperCaseString (uname); - fprintf (outfil, " \"%s\",\t/* %s */\n", - uname, syncs->name); - lang_max += 1; - } - } - -/* - * Generate the $LANG code lookup table, in upper case - */ -fprintf (outfil, canned6); -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - csobj = (WmlCharSetDefPtr) wml_obj_charset_ptr->hvec[ndx].objptr; - syncs = csobj->syndef; - if ( csobj->sym_code == 0 ) continue; - fprintf (outfil, " sym_k_%s_charset,\n", syncs->name); - fprintf (outfil, " sym_k_%s_charset,\n", syncs->name); - for ( alias_ndx=0 ; alias_ndxalias_cnt ; alias_ndx++ ) - fprintf (outfil, " sym_k_%s_charset,\n", syncs->name); - } - -/* - * Generate the number of entries in the previous two tables - */ -fprintf (outfil, canned7, lang_max); - -/* - * close the output file - */ -printf ("\nCreated UilSymCSet.h"); -fclose (outfil); - -} - - diff --git a/tools/wml/wmloutkey.c b/tools/wml/wmloutkey.c index 4c14728..af42f22 100644 --- a/tools/wml/wmloutkey.c +++ b/tools/wml/wmloutkey.c @@ -574,16 +574,16 @@ if ( outfil == NULL ) printf ("\nCouldn't open UilKeyTab.h"); return; } -fprintf (outfil, "%s", canned_warn); +fprintf (outfil, canned_warn); /* * Print the case sensitive and insensitive tables */ -fprintf (outfil, "%s", canned1); +fprintf (outfil, canned1); wmlOutputUilKeyTabBody (outfil, wml_tok_sens_ptr, &maxlen, &maxkey); fprintf (outfil, canned2, maxlen, maxkey); wmlOutputUilKeyTabBody (outfil, wml_tok_insens_ptr, &maxlen, &maxkey); -fprintf (outfil, "%s", canned3); +fprintf (outfil, canned3); /* * close the output file @@ -812,8 +812,8 @@ if ( outfil == NULL ) printf ("\nCouldn't open UilTokName.h"); return; } -fprintf (outfil, "%s", canned_warn); -fprintf (outfil, "%s", canned1); +fprintf (outfil, canned_warn); +fprintf (outfil, canned1); /* * Print the token name entries diff --git a/tools/wml/wmloutkey.c.format-security b/tools/wml/wmloutkey.c.format-security deleted file mode 100644 index af42f22..0000000 --- a/tools/wml/wmloutkey.c.format-security +++ /dev/null @@ -1,838 +0,0 @@ -/* - * Motif - * - * Copyright (c) 1987-2012, The Open Group. All rights reserved. - * - * These libraries and programs are free software; you can - * redistribute them and/or modify them under the terms of the GNU - * Lesser General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) - * any later version. - * - * These libraries and programs are distributed in the hope that - * they will be useful, but WITHOUT ANY WARRANTY; without even the - * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU Lesser General Public License for more - * details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with these librararies and programs; if not, write - * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth - * Floor, Boston, MA 02110-1301 USA -*/ -/* - * HISTORY -*/ -#ifdef REV_INFO -#ifndef lint -static char rcsid[] = "$TOG: wmloutkey.c /main/8 1997/04/14 12:55:51 dbl $" -#endif -#endif - -#ifdef HAVE_CONFIG_H -#include -#endif - - -/* -* (c) Copyright 1989, 1990, DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS. */ - -/* - * This module contains routines responsible for writing the .h files which - * define the UIL lexer's keyword (token) tables. All files are written - * into the current directory. - * - * Input: - * The resolved objects - * .dat files required to specify objects defined in Uil.y: - * keyword.dat - * reserved.dat - * - * Output: - * UilKeyTab.h - * - */ - - -#include "wml.h" - -#if defined(__STDC__) -#include -#include -#endif -#include - - -/* - * Routines used only in this module - */ -void wmlKeyWBuildTables (); -void wmlKeyWClassTokens (); -void wmlKeyWGrammarTokens (); -int wmlKeyWGrammarClass (); -void wmlKeyWArgTokens (); -void wmlKeyWReasonTokens (); -void wmlKeyWCharsetTokens (); -void wmlKeyWEnumvalTokens (); -void wmlKeyWChildTokens (); -void wmlKeyWMakeTokens (); -void wmlOutputUilKeyTab (); -void wmlOutputUilKeyTabBody (); -void wmlTokenClassString (); -void wmlTokenSymKString (); -void wmlTokenTokenString (); -void wmlOutputUilTokName (); - -/* - * globals - */ - -static char *canned_warn = -"/*\n\ -**\tThis file is automatically generated. Do not edit it by hand.\n\ -**/\n\n"; - -#define GrTokenMax 200 /* limit on grammar tokens */ -static int grtok_max_val = 0; -static WmlGrammarTokenPtr grtok_vec[GrTokenMax]; - - - -/* - * Output control routine - */ - -void wmlOutputKeyWordFiles () - -{ - -wmlKeyWBuildTables (); -wmlOutputUilKeyTab (); -wmlOutputUilTokName (); - -} - - - -/* - * Routine to construct token tables for building UilKeyTab.h - * - * This routine constructs token entries for each token class which appears - * in UilKeyTab.h (the token classes are defined in UilKeyDef.h). These - * tokens are defined both by WML objects in object vectors, and by - * tokens defined in Uil.y. - */ - -void wmlKeyWBuildTables () - -{ - -int ndx; - - -/* - * Initialize the token vectors - */ -wmlInitHList (wml_tok_sens_ptr, 1000, TRUE); -wmlInitHList (wml_tok_insens_ptr, 1000, TRUE); -for ( ndx=0 ; ndx true/TRUE - * UILFALSE -> false/FALSE - * UILfile -> file/FILE - * UILeof -> eof/EOF - */ -infil = fopen ("tokens.dat", "r"); -if ( infil == NULL ) - { - printf ("\nCouldn't open tokens.dat"); - return; - } - -while ( TRUE ) - { - scanres = fscanf (infil, "%s %d %s", token, &tokval, class); - if ( scanres == EOF ) break; - if ( scanres != 3 ) - { - printf ("\nBadly formatted at line %d in tokens.dat", lineno); - continue; - } - lineno += 1; - -/* - * Convert the token class, and construct a grammar token. - */ - grtok = (WmlGrammarTokenPtr) malloc(sizeof(WmlGrammarToken)); - grtok->class = wmlKeyWGrammarClass (class); - grtok->token = wmlAllocateString (token); - grtok->val = tokval; - -/* - * Save the token in the grammar token vector, indexed by its value - * (for UilTokName.h) - */ -if ( grtok->val < GrTokenMax ) - { - grtok_vec[grtok->val] = grtok; - if ( grtok->val > grtok_max_val ) - grtok_max_val = grtok->val; - } -else - printf ("\nToken id %d for %s exceed GrTokenMax", - grtok->val, grtok->token); - -/* - * Enter tokens which appear in the keyword tables as keyword tokens. - * These have their lower case names entered as the case-insensitive - * keyword token string. Do special token literal mapping. - */ - switch ( grtok->class ) - { - case WmlTokenClassKeyword: - case WmlTokenClassReserved: - strcpy (sens_name, grtok->token); - for ( ndx=0 ; ndx<(int)strlen(sens_name) ; ndx++ ) - sens_name[ndx] = _lower(sens_name[ndx]); - if ( strcmp(sens_name,"uiltrue") == 0 ) - strcpy (sens_name, "true"); - if ( strcmp(sens_name,"uilfalse") == 0 ) - strcpy (sens_name, "false"); - if ( strcmp(sens_name,"uilfile") == 0 ) - strcpy (sens_name, "file"); - if ( strcmp(sens_name,"uileof") == 0 ) - strcpy (sens_name, "eof"); - wmlKeyWMakeTokens (sens_name, grtok->class, (ObjectPtr)grtok); - } - } - -fclose (infil); - -} - - - -/* - * This routine translates a string identifying a token class into - * its matching internal literal. - */ -int wmlKeyWGrammarClass (token) - char *token; - -{ - -if ( strcmp(token,"argument") == 0 ) - return WmlTokenClassArgument; -if ( strcmp(token,"charset") == 0 ) - return WmlTokenClassCharset; -if ( strcmp(token,"color") == 0 ) - return WmlTokenClassColor; -if ( strcmp(token,"enumval") == 0 ) - return WmlTokenClassEnumval; -if ( strcmp(token,"font") == 0 ) - return WmlTokenClassFont; -if ( strcmp(token,"identifier") == 0 ) - return WmlTokenClassIdentifier; -if ( strcmp(token,"keyword") == 0 ) - return WmlTokenClassKeyword; -if ( strcmp(token,"literal") == 0 ) - return WmlTokenClassLiteral; -if ( strcmp(token,"reason") == 0 ) - return WmlTokenClassReason; -if ( strcmp(token,"reserved") == 0 ) - return WmlTokenClassReserved; -if ( strcmp(token,"special") == 0 ) - return WmlTokenClassSpecial; -if ( strcmp(token,"unused") == 0 ) - return WmlTokenClassUnused; -if ( strcmp(token,"class") == 0 ) - return WmlTokenClassClass; -if (strcmp(token,"child") == 0) return WmlTokenClassChild; - -printf ("\nUnrecognized token class %s", token); -return 0; - -} - - - -/* - * Routine to process the class objects and enter them in the token tables. - * Aliases are also entered, under their own names. - */ - -void wmlKeyWClassTokens () - -{ - -int ndx; /* loop index */ -WmlClassDefPtr clsobj; /* class object */ -WmlSynClassDefPtr synobj; /* syntactic object */ -int alias_ndx; /* alias loop index */ - - -/* - * Make tokens for all class entries - */ -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - clsobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[ndx].objptr; - synobj = clsobj->syndef; - wmlKeyWMakeTokens (synobj->name, WmlTokenClassClass, (ObjectPtr)clsobj); - for ( alias_ndx=0 ; alias_ndxalias_cnt ; alias_ndx++ ) - wmlKeyWMakeTokens (synobj->alias_list[alias_ndx], - WmlTokenClassClass, - (ObjectPtr)clsobj); - } - -} - - - -/* - * Routine to process the argument objects and enter them in the token tables. - * Aliases are also entered, under their own names. - */ - -void wmlKeyWArgTokens () - -{ - -int ndx; /* loop index */ -WmlResourceDefPtr resobj; /* resource object */ -WmlSynResourceDefPtr synobj; /* syntactic object */ -int alias_ndx; /* alias loop index */ - - -/* - * Make tokens for all argument entries - */ -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - resobj = (WmlResourceDefPtr) wml_obj_arg_ptr->hvec[ndx].objptr; - synobj = resobj->syndef; - wmlKeyWMakeTokens (synobj->name, WmlTokenClassArgument, (ObjectPtr)resobj); - for ( alias_ndx=0 ; alias_ndxalias_cnt ; alias_ndx++ ) - wmlKeyWMakeTokens (synobj->alias_list[alias_ndx], - WmlTokenClassArgument, - (ObjectPtr)resobj); - } - -} - - - -/* - * Routine to process the reason objects and enter them in the token tables. - */ - -void wmlKeyWReasonTokens () - -{ - -int ndx; /* loop index */ -WmlResourceDefPtr resobj; /* resource object */ -WmlSynResourceDefPtr synobj; /* syntactic object */ -int alias_ndx; /* alias loop index */ - - -/* - * Make tokens for all reason entries - */ -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - resobj = (WmlResourceDefPtr) wml_obj_reason_ptr->hvec[ndx].objptr; - synobj = resobj->syndef; - wmlKeyWMakeTokens (synobj->name, WmlTokenClassReason, (ObjectPtr)resobj); - for ( alias_ndx=0 ; alias_ndxalias_cnt ; alias_ndx++ ) - wmlKeyWMakeTokens (synobj->alias_list[alias_ndx], - WmlTokenClassReason, - (ObjectPtr)resobj); - } - -} - - -/* - * Routine to process the child objects and enter them in the token tables. - */ - -void wmlKeyWChildTokens () - -{ - -int ndx; /* loop index */ -WmlChildDefPtr childobj; /* child object */ -WmlSynChildDefPtr synobj; /* syntactic object */ - -/* - * Make tokens for all child entries - */ -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - childobj = (WmlChildDefPtr) wml_obj_child_ptr->hvec[ndx].objptr; - synobj = childobj->syndef; - wmlKeyWMakeTokens (synobj->name, WmlTokenClassChild, (ObjectPtr)childobj); - } - -} - - - -/* - * Routine to process the charset objects and enter them in the token tables. - */ - -void wmlKeyWCharsetTokens () - -{ - -int ndx; /* loop index */ -WmlCharSetDefPtr csobj; /* character set object */ -WmlSynCharSetDefPtr synobj; /* syntactic object */ -int alias_ndx; /* alias loop index */ - - -/* - * Make tokens for all charset entries - */ -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - csobj = (WmlCharSetDefPtr) wml_obj_charset_ptr->hvec[ndx].objptr; - synobj = csobj->syndef; - wmlKeyWMakeTokens (synobj->name, WmlTokenClassCharset, (ObjectPtr)csobj); - for ( alias_ndx=0 ; alias_ndxalias_cnt ; alias_ndx++ ) - wmlKeyWMakeTokens (synobj->alias_list[alias_ndx], - WmlTokenClassCharset, - (ObjectPtr)csobj); - } - -} - - - -/* - * Routine to process the enumval objects and enter them in the token tables. - */ - -void wmlKeyWEnumvalTokens () - -{ - -int ndx; /* loop index */ -WmlEnumValueDefPtr esobj; /* enumeration value object */ -WmlSynEnumValueDefPtr synobj; /* syntactic object */ - - -/* - * Make tokens for all enumval entries - */ -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - esobj = (WmlEnumValueDefPtr) wml_obj_enumval_ptr->hvec[ndx].objptr; - synobj = esobj->syndef; - wmlKeyWMakeTokens (synobj->name, WmlTokenClassEnumval, (ObjectPtr)esobj); - } - -} - - - -/* - * Routine to create tokens and enter them in the token list. - * - * This routine constructs a case-sensitive and a case-insensitive token - * and enters them the token vectors. - */ -void wmlKeyWMakeTokens (sens_name, class, obj) - char *sens_name; - int class; - ObjectPtr obj; - -{ - -WmlKeyWTokenPtr senstok; /* case-sensitive token */ -WmlKeyWTokenPtr insenstok; /* case-insensitive token */ -char insens_name[100]; -int ndx; - - -/* - * Create both tokens, with one having an upper-case name. The names are - * entered only in the order vector, not in the token itself. - */ -senstok = (WmlKeyWTokenPtr) malloc (sizeof(WmlKeyWToken)); -insenstok = (WmlKeyWTokenPtr) malloc (sizeof(WmlKeyWToken)); -senstok->class = class; -senstok->objdef = obj; -insenstok->class = class; -insenstok->objdef = obj; - -strcpy (insens_name, sens_name); -for ( ndx=0 ; ndx<(int)strlen(insens_name) ; ndx++ ) - insens_name[ndx] = _upper (insens_name[ndx]); - -wmlInsertInKeyList(wml_tok_sens_ptr, sens_name, senstok); -wmlInsertInKeyList(wml_tok_insens_ptr, insens_name, insenstok); -} - - -/* - * Routine to output UilKeyTab.h - * - * This routine dumps the tokens defined in the token tables into - * UilKeyTab.h. Both the case-sensitive and case-insensitive token - * lists are used. - */ - -void wmlOutputUilKeyTab () - -{ - -char *canned1 = -"\n/* case sensitive keyword table */\n\ -static key_keytable_entry_type key_table_vec[] =\n\ - {\n"; - -char *canned2 = -" };\n\ -externaldef(uil_sym_glbl) key_keytable_entry_type *key_table =\n\ -\t\tkey_table_vec;\n\n\ -/* Maximum length of a keyword, and table size */\n\ -externaldef(uil_sym_glbl) int key_k_keyword_max_length = %d;\n\ -externaldef(uil_sym_glbl) int key_k_keyword_count = %d;\n\n\ -/* case insensitive keyword table */\n\ -static key_keytable_entry_type key_table_case_ins_vec[] =\n\ - {\n"; - -char *canned3 = -" };\n\ -externaldef(uil_sym_glbl) key_keytable_entry_type *key_table_case_ins =\n\ -\t\tkey_table_case_ins_vec;\n"; - - -FILE *outfil; /* output file */ -int ndx; /* loop index */ -int maxlen = 0; /* max keyword length */ -int maxkey = 0; /* # entries in keyword table */ - - -/* - * Open the output file. - */ -outfil = fopen ("UilKeyTab.h", "w"); -if ( outfil == NULL ) - { - printf ("\nCouldn't open UilKeyTab.h"); - return; - } -fprintf (outfil, canned_warn); - -/* - * Print the case sensitive and insensitive tables - */ -fprintf (outfil, canned1); -wmlOutputUilKeyTabBody (outfil, wml_tok_sens_ptr, &maxlen, &maxkey); -fprintf (outfil, canned2, maxlen, maxkey); -wmlOutputUilKeyTabBody (outfil, wml_tok_insens_ptr, &maxlen, &maxkey); -fprintf (outfil, canned3); - -/* - * close the output file - */ -printf ("\nCreated UilKeyTab.h"); -fclose (outfil); - -} - - - -/* - * Routine to output the body of a keyword table - */ -void wmlOutputUilKeyTabBody (outfil, tokvec, maxlen, maxkey) - FILE *outfil; - DynamicHandleListDefPtr tokvec; - int *maxlen; - int *maxkey; - -{ - -int ndx; /* loop index */ -WmlKeyWTokenPtr tok; /* current token */ -char *tokstg; /* string for token (keyword) */ -char tkclass[100]; /* token class string */ -char tksym[100]; /* token sym_k string */ -char tktoken[100]; /* token tkn_k_num string */ - - -/* - * Loop over all tokens, and put out an entry for each. - */ -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - tok = (WmlKeyWTokenPtr) tokvec->hvec[ndx].objptr; - tokstg = tokvec->hvec[ndx].objname; - wmlTokenClassString (tkclass, tok); - wmlTokenSymKString (tksym, tok); - wmlTokenTokenString (tktoken, tok); - fprintf (outfil, " {%s, %s, %d, %s, \"%s\"},\n", - tkclass, - tksym, - strlen(tokstg), - tktoken, - tokstg); - if ( (int)strlen(tokstg) > *maxlen ) - *maxlen = strlen (tokstg); - *maxkey += 1; - } - -} - - - -/* - * Routine to return the string for a token class, tkn_k_class_... - */ -void wmlTokenClassString (dststg, tok) - char *dststg; - WmlKeyWTokenPtr tok; - -{ - -switch ( tok->class ) - { - case WmlTokenClassArgument: - strcpy (dststg, "tkn_k_class_argument"); - return; - case WmlTokenClassCharset: - strcpy (dststg, "tkn_k_class_charset"); - return; - case WmlTokenClassEnumval: - strcpy (dststg, "tkn_k_class_enumval"); - return; - case WmlTokenClassKeyword: - strcpy (dststg, "tkn_k_class_keyword"); - return; - case WmlTokenClassReason: - strcpy (dststg, "tkn_k_class_reason"); - return; - case WmlTokenClassReserved: - strcpy (dststg, "tkn_k_class_reserved"); - return; - case WmlTokenClassClass: - strcpy (dststg, "tkn_k_class_class"); - return; - case WmlTokenClassChild: - strcpy (dststg, "tkn_k_class_child"); - return; - } - -} - - - -/* - * Routine to return the string for a sym_k_... for some object - */ -void wmlTokenSymKString (dststg, tok) - char *dststg; - WmlKeyWTokenPtr tok; - -{ - -WmlClassDefPtr clsobj; /* class object */ -WmlResourceDefPtr resobj; /* resource object */ -WmlCharSetDefPtr csobj; /* character set object */ -WmlEnumValueDefPtr esobj; /* enumeration value object */ -WmlChildDefPtr chobj; /* child object */ - - -switch ( tok->class ) - { - case WmlTokenClassArgument: - resobj = (WmlResourceDefPtr) tok->objdef; - sprintf (dststg, "sym_k_%s_arg", resobj->tkname); - return; - case WmlTokenClassCharset: - csobj = (WmlCharSetDefPtr) tok->objdef; - sprintf (dststg, "sym_k_%s_charset", csobj->syndef->name); - return; - case WmlTokenClassEnumval: - esobj = (WmlEnumValueDefPtr) tok->objdef; - sprintf (dststg, "sym_k_%s_enumval", esobj->syndef->name); - return; - case WmlTokenClassKeyword: - strcpy (dststg, "0"); - return; - case WmlTokenClassReason: - resobj = (WmlResourceDefPtr) tok->objdef; - sprintf (dststg, "sym_k_%s_reason", resobj->tkname); - return; - case WmlTokenClassReserved: - strcpy (dststg, "0"); - return; - case WmlTokenClassClass: - clsobj = (WmlClassDefPtr) tok->objdef; - sprintf (dststg, "sym_k_%s_object", clsobj->tkname); - return; - case WmlTokenClassChild: - chobj = (WmlChildDefPtr) tok->objdef; - sprintf (dststg, "sym_k_%s_child", chobj->tkname); - return; - } - -} - - - -/* - * Routine to return the string for a token number, tkn_k_num_... - */ -void wmlTokenTokenString (dststg, tok) - char *dststg; - WmlKeyWTokenPtr tok; - -{ - -WmlGrammarTokenPtr grtok; /* grammar token */ - - -switch ( tok->class ) - { - case WmlTokenClassArgument: - strcpy (dststg, "ARGUMENT_NAME"); - return; - case WmlTokenClassCharset: - strcpy (dststg, "CHARSET_NAME"); - return; - case WmlTokenClassEnumval: - strcpy (dststg, "ENUMVAL_NAME"); - return; - case WmlTokenClassReason: - strcpy (dststg, "REASON_NAME"); - return; - case WmlTokenClassKeyword: - case WmlTokenClassReserved: - grtok = (WmlGrammarTokenPtr) tok->objdef; - strcpy (dststg, grtok->token); - return; - case WmlTokenClassClass: - strcpy (dststg, "CLASS_NAME"); - return; - case WmlTokenClassChild: - strcpy (dststg, "CHILD_NAME"); - return; - } - -} - - - -/* - * routine to output UilTokName.h - */ - -void wmlOutputUilTokName () - -{ - -char *canned1 = -"/*\tToken name table */\n\ -static char *tok_token_name_table_vec[] = \n\ - {\n"; - -char *canned2 = -" };\n\ -externaldef(uil_sym_glbl) char **tok_token_name_table =\n\ -\t\ttok_token_name_table_vec;\n\n\ -/*\tNumber of entries in table */\n\ -externaldef(uil_sym_glbl) int tok_num_tokens = %d;\n"; - - -FILE *outfil; /* output file */ -int ndx; /* loop index */ -WmlGrammarTokenPtr grtok; /* current grammar token */ - - -/* - * Open the output file. - */ -outfil = fopen ("UilTokName.h", "w"); -if ( outfil == NULL ) - { - printf ("\nCouldn't open UilTokName.h"); - return; - } -fprintf (outfil, canned_warn); -fprintf (outfil, canned1); - -/* - * Print the token name entries - * Note: vector size is max_val + 1 for zeroth token - */ -for ( ndx=0 ; ndxtoken); - else - fprintf (outfil, " \"UNKNOWN_TOKEN\",\n"); - } - -/* - * close the output file - */ -fprintf (outfil, canned2, grtok_max_val+1); -printf ("\nCreated UilTokName.h"); -fclose (outfil); - -} diff --git a/tools/wml/wmloutmm.c b/tools/wml/wmloutmm.c index dc8ec09..84a97bb 100644 --- a/tools/wml/wmloutmm.c +++ b/tools/wml/wmloutmm.c @@ -209,9 +209,9 @@ int ctlndx; /* to access ordered vector */ /* * Write out header information */ -fprintf (outfil, "%s", canned1); +fprintf (outfil, canned1); fprintf (outfil, "%s\n", name); -fprintf (outfil, "%s", canned2); +fprintf (outfil, canned2); /* * Alphabetize the controls, reason, and argument lists @@ -264,7 +264,7 @@ while ( ctlref != NULL ) rsnndx = 0; ctlndx = 0; if ( mm_ctl_ptr->cnt == 0 ) - fprintf (outfil, "%s", "No children are supported"); + fprintf (outfil, "No children are supported"); while ( rsnndxcnt || ctlndxcnt ) { if ( ctlndx < mm_ctl_ptr->cnt ) @@ -275,7 +275,7 @@ while ( rsnndxcnt || ctlndxcnt ) ctlndx += 1; } else - fprintf (outfil, "%s", "@"); + fprintf (outfil, "@"); if ( rsnndx < mm_rsn_ptr->cnt ) { @@ -285,9 +285,9 @@ while ( rsnndxcnt || ctlndxcnt ) rsnndx += 1; } else - fprintf (outfil, "%s", "\n"); + fprintf (outfil, "\n"); } -fprintf (outfil, "%s", canned3); +fprintf (outfil, canned3); /* * Write out the argument table @@ -319,11 +319,11 @@ while ( argndx < mm_arg_ptr->cnt ) argref->act_resource->syndef->dflt); } else - fprintf (outfil, "%s", " \n"); + fprintf (outfil, " \n"); } argndx += 1; } -fprintf (outfil, "%s", canned4); +fprintf (outfil, canned4); } diff --git a/tools/wml/wmloutmm.c.format-security b/tools/wml/wmloutmm.c.format-security deleted file mode 100644 index 84a97bb..0000000 --- a/tools/wml/wmloutmm.c.format-security +++ /dev/null @@ -1,331 +0,0 @@ -/* - * Motif - * - * Copyright (c) 1987-2012, The Open Group. All rights reserved. - * - * These libraries and programs are free software; you can - * redistribute them and/or modify them under the terms of the GNU - * Lesser General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) - * any later version. - * - * These libraries and programs are distributed in the hope that - * they will be useful, but WITHOUT ANY WARRANTY; without even the - * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU Lesser General Public License for more - * details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with these librararies and programs; if not, write - * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth - * Floor, Boston, MA 02110-1301 USA -*/ -/* - * HISTORY -*/ -#ifdef REV_INFO -#ifndef lint -static char rcsid[] = "$XConsortium: wmloutmm.c /main/9 1995/08/29 11:10:59 drk $" -#endif -#endif - -#ifdef HAVE_CONFIG_H -#include -#endif - - -/* -* (c) Copyright 1989, 1990, DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS. */ - -/* - * This module contains routines responsible for writing the .mm files - * produced by WML. All files are written into the current directory. - * - * Input: - * The resolved objects - * - * Output: - * wml-uil.mm - * - */ - - -#include "wml.h" - -#if defined(__STDC__) -#include -#endif -#include - - -/* - * Routines used only in this module - */ -void wmlOutputWmlUilMm (); -void wmlOutputWmlUilMmClass (); - -/* - * globals - */ -int tabno = 1; /* table number */ - -/* - * lists re-used repeatedly to order lists for printing - */ -DynamicHandleListDef mm_arg; -DynamicHandleListDefPtr mm_arg_ptr = &mm_arg; -DynamicHandleListDef mm_rsn; -DynamicHandleListDefPtr mm_rsn_ptr = &mm_rsn; -DynamicHandleListDef mm_ctl; -DynamicHandleListDefPtr mm_ctl_ptr = &mm_ctl; - - - -/* - * Output control routine, which simply outputs each .mm file in turn. - */ - -void wmlOutputMmFiles () - -{ - -wmlOutputWmlUilMm (); - -} - - - -/* - * Routine to write out wml-uil.mm - * - * This .mm file contains the tables which are to be included as an - * appendix to the Uil manual. The tables give the arguments with their - * default values, reasons, constraints, and controls for each class - * in the class vectors. - */ - -void wmlOutputWmlUilMm () - -{ - -FILE *outfil; /* output file */ -int ndx; /* loop index */ -WmlClassDefPtr clsobj; /* class object */ - - - -/* - * Open the output file. Write the canned header stuff - */ -outfil = fopen ("wml-uil.mm", "w"); -if ( outfil == NULL ) - { - printf ("\nCouldn't open wml-uil.mm"); - return; - } - -/* - * Initialize order lists for the tables. - */ -wmlInitHList (mm_arg_ptr, 200, TRUE); -wmlInitHList (mm_rsn_ptr, 200, TRUE); -wmlInitHList (mm_ctl_ptr, 200, TRUE); - -/* - * Write out a table for each class, for both widget and gadget variants - */ -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - clsobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[ndx].objptr; - wmlOutputWmlUilMmClass (outfil, clsobj, clsobj->syndef->name); - } - -/* - * close the output file - */ -printf ("\nCreated wml-uil.mm"); -fclose (outfil); - -} - - - -/* - * Routine to write a table for a class entry - */ - -void wmlOutputWmlUilMmClass (outfil, clsobj, name) - FILE *outfil; - WmlClassDefPtr clsobj; - char *name; - -{ - -char *canned1 = -".bp\n\ -.ps 12\n"; - -char *canned2 = -".ps 10\n\ -.vs 12\n\ -.LP\n\ -.TS H\n\ -tab(@);\n\ -lB lB\n\ -l l.\n\ -_\n\ -.sp 6p\n\ -Controls@Reasons\n\ -.sp 6p\n\ -_\n\ -.sp 6p\n\ -.TH\n"; - -char *canned3 = -".TE\n\ -.TS H\n\ -tab(@);\n\ -lB lB lB\n\ -l l l.\n\ -_\n\ -.sp 6p\n\ -UIL Argument Name@Argument Type@Default Value\n\ -.sp 6p\n\ -_\n\ -.sp 6p\n\ -.TH\n"; - -char *canned4 = -".TE\n"; - -WmlClassResDefPtr argref; /* current argument reference */ -WmlClassResDefPtr rsnref; /* current reason reference */ -WmlClassCtrlDefPtr ctlref; /* current controls reference */ -int argndx; /* to access ordered vector */ -int rsnndx; /* to access ordered vector */ -int ctlndx; /* to access ordered vector */ - - -/* - * Write out header information - */ -fprintf (outfil, canned1); -fprintf (outfil, "%s\n", name); -fprintf (outfil, canned2); - -/* - * Alphabetize the controls, reason, and argument lists - */ -wmlClearHList (mm_arg_ptr); -wmlClearHList (mm_rsn_ptr); -wmlClearHList (mm_ctl_ptr); - -argref = clsobj->arguments; -while ( argref!= NULL ) - { - while ( argref != NULL && argref->exclude == WmlAttributeTrue ) - argref = argref->next; - if ( argref != NULL ) - { - wmlInsertInHList (mm_arg_ptr, - argref->act_resource->syndef->name, - (ObjectPtr)argref); - argref = argref->next; - } - } - -rsnref = clsobj->reasons; -while ( rsnref!=NULL ) - { - while ( rsnref != NULL && rsnref->exclude == WmlAttributeTrue ) - rsnref = rsnref->next; - if ( rsnref != NULL ) - { - wmlInsertInHList (mm_rsn_ptr, - rsnref->act_resource->syndef->name, - (ObjectPtr)rsnref); - - rsnref = rsnref->next; - } - } - -ctlref = clsobj->controls; -while ( ctlref != NULL ) - { - wmlInsertInHList (mm_ctl_ptr, - ctlref->ctrl->syndef->name, - (ObjectPtr)ctlref); - ctlref = ctlref->next; - } - -/* - * Write out the controls and reason table. - */ -rsnndx = 0; -ctlndx = 0; -if ( mm_ctl_ptr->cnt == 0 ) - fprintf (outfil, "No children are supported"); -while ( rsnndxcnt || ctlndxcnt ) - { - if ( ctlndx < mm_ctl_ptr->cnt ) - { - ctlref = (WmlClassCtrlDefPtr) mm_ctl_ptr->hvec[ctlndx].objptr; - fprintf (outfil, "%s@", - ctlref->ctrl->syndef->name); - ctlndx += 1; - } - else - fprintf (outfil, "@"); - - if ( rsnndx < mm_rsn_ptr->cnt ) - { - rsnref = (WmlClassResDefPtr) mm_rsn_ptr->hvec[rsnndx].objptr; - fprintf (outfil, "%s\n", - rsnref->act_resource->syndef->name); - rsnndx += 1; - } - else - fprintf (outfil, "\n"); - } -fprintf (outfil, canned3); - -/* - * Write out the argument table - */ -argndx = 0; -while ( argndx < mm_arg_ptr->cnt ) - { - argref = (WmlClassResDefPtr) mm_arg_ptr->hvec[argndx].objptr; - fprintf (outfil, "%s@%s@", - argref->act_resource->syndef->name, - argref->act_resource->dtype_def->syndef->name); - if ( argref->dflt != NULL ) - { - if ( strchr(argref->dflt,' ') != 0 ) - fprintf (outfil, "T{\n%s\nT}\n", - argref->dflt); - else - fprintf (outfil, "%s\n", - argref->dflt); - } - else - { - if (argref->act_resource->syndef->dflt != NULL) { - if ( strchr(argref->act_resource->syndef->dflt,' ') != 0 ) - fprintf (outfil, "T{\n%s\nT}\n", - argref->act_resource->syndef->dflt); - else - fprintf (outfil, "%s\n", - argref->act_resource->syndef->dflt); - } - else - fprintf (outfil, " \n"); - } - argndx += 1; - } -fprintf (outfil, canned4); - -} - - - diff --git a/tools/wml/wmlresolve.c b/tools/wml/wmlresolve.c index 3b8642c..464ef29 100644 --- a/tools/wml/wmlresolve.c +++ b/tools/wml/wmlresolve.c @@ -1340,7 +1340,7 @@ for ( ndx=0 ; ndxcnt ; ndx++ ) /* * close the output file */ -fprintf (outfil, "%s", "\n\n"); +fprintf (outfil, "\n\n"); printf ("\nCreated report file wml.report"); fclose (outfil); @@ -1369,14 +1369,14 @@ fprintf (outfil, "\n\n\nClass %s:", synobj->name); switch ( synobj->type ) { case WmlClassTypeMetaclass: - fprintf (outfil, "%s", "\n Type: Metaclass\t"); + fprintf (outfil, "\n Type: Metaclass\t"); if ( synobj->superclass != NULL ) fprintf (outfil, "Superclass: %s\t", synobj->superclass); if ( synobj->parentclass != NULL ) fprintf (outfil, "Parentclass: %s\t", synobj->parentclass); break; case WmlClassTypeWidget: - fprintf (outfil, "%s", "\n Type: Widget\t"); + fprintf (outfil, "\n Type: Widget\t"); if ( synobj->superclass != NULL ) fprintf (outfil, "Superclass: %s\t", synobj->superclass); if ( synobj->parentclass != NULL ) @@ -1388,7 +1388,7 @@ switch ( synobj->type ) fprintf (outfil, "Convenience function: %s", synobj->convfunc); break; case WmlClassTypeGadget: - fprintf (outfil, "%s", "\n Type: Gadget\t"); + fprintf (outfil, "\n Type: Gadget\t"); if ( synobj->superclass != NULL ) fprintf (outfil, "Superclass: %s\t", synobj->superclass); if ( synobj->parentclass != NULL ) @@ -1414,19 +1414,19 @@ if ( clsobj->nondialog != NULL ) * is intended to match the way resources are printed in the toolkit manual, * so that checking is as easy as possible. */ -fprintf (outfil, "%s", "\n Arguments:"); +fprintf (outfil, "\n Arguments:"); wmlResolvePrintClassArgs (outfil, clsobj); /* * Print the reasons valid in the class */ -fprintf (outfil, "%s", "\n Reasons:"); +fprintf (outfil, "\n Reasons:"); wmlResolvePrintClassReasons (outfil, clsobj); /* * Print the controls valid in the class */ -fprintf (outfil, "%s", "\n Controls:"); +fprintf (outfil, "\n Controls:"); for ( ndx=0 ; ndxcnt ; ndx++ ) { ctrlobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[ndx].objptr; @@ -1512,10 +1512,10 @@ for ( ndx=0 ; ndxcnt ; ndx++ ) switch ( resref->exclude ) { case WmlAttributeTrue: - fprintf (outfil, "%s", "\n\tExclude = True;"); + fprintf (outfil, "\n\tExclude = True;"); break; case WmlAttributeFalse: - fprintf (outfil, "%s", "\n\tExclude = False;"); + fprintf (outfil, "\n\tExclude = False;"); break; } if ( resref->dflt != NULL ) @@ -1558,10 +1558,10 @@ if ( constr ) switch ( resref->exclude ) { case WmlAttributeTrue: - fprintf (outfil, "%s", "\n\tExclude = True;"); + fprintf (outfil, "\n\tExclude = True;"); break; case WmlAttributeFalse: - fprintf (outfil, "%s", "\n\tExclude = False;"); + fprintf (outfil, "\n\tExclude = False;"); break; } if ( resref->dflt != NULL ) @@ -1632,10 +1632,10 @@ for ( ndx=0 ; ndxcnt ; ndx++ ) switch ( resref->exclude ) { case WmlAttributeTrue: - fprintf (outfil, "%s", "\n\tExclude = True;"); + fprintf (outfil, "\n\tExclude = True;"); break; case WmlAttributeFalse: - fprintf (outfil, "%s", "\n\tExclude = False;"); + fprintf (outfil, "\n\tExclude = False;"); break; } resobj->ref_ptr = NULL; diff --git a/tools/wml/wmlresolve.c.format-security b/tools/wml/wmlresolve.c.format-security deleted file mode 100644 index 464ef29..0000000 --- a/tools/wml/wmlresolve.c.format-security +++ /dev/null @@ -1,1828 +0,0 @@ -/* - * Motif - * - * Copyright (c) 1987-2012, The Open Group. All rights reserved. - * - * These libraries and programs are free software; you can - * redistribute them and/or modify them under the terms of the GNU - * Lesser General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) - * any later version. - * - * These libraries and programs are distributed in the hope that - * they will be useful, but WITHOUT ANY WARRANTY; without even the - * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU Lesser General Public License for more - * details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with these librararies and programs; if not, write - * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth - * Floor, Boston, MA 02110-1301 USA -*/ -/* - * HISTORY -*/ -#ifdef REV_INFO -#ifndef lint -static char rcsid[] = "$XConsortium: wmlresolve.c /main/9 1995/08/29 11:11:05 drk $" -#endif -#endif - -#ifdef HAVE_CONFIG_H -#include -#endif - - -/* -* (c) Copyright 1989, 1990, DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS. */ - -/* - * This module contains all routines which perform semantic analysis of - * the parsed WML specification. It is responsible for building all - * ordered structures which can be directly translated into literal - * code values for the various .h files. It is responsible for performing - * inheritance of resources for all classes. - * - * Input: - * the ordered list of syntactic objects in wml_synobj_ptr - * - * Output: - * - */ - - -#include "wml.h" - -#if defined(__STDC__) -#include -#endif -#include - -/* - * Routines used only in this module - */ -void wmlResolveGenerateSymK (); -void wmlResolveValidateClass (); -void wmlResolvePrintReport (); - -void wmlResolveSymKDataType (); -void wmlResolveSymKChild (); -void wmlResolveSymKEnumVal (); -void wmlResolveSymKEnumSet (); -void wmlResolveSymKReason (); -void wmlResolveSymKArgument (); -void wmlResolveSymKRelated (); -void wmlResolveSymKClass (); -void wmlResolveSymKCtrlList (); -void wmlResolveSymKCharSet (); - -void wmlResolveClassInherit (); -void wmlResolveClearRefPointers (); -void wmlResolveInitRefObj (); -void wmlResolveInitChildRefObj (); - -void wmlResolvePrintClass (); -void wmlResolvePrintClassArgs (); -void wmlResolvePrintClassReasons (); - -ObjectPtr wmlResolveFindObject (); -void wmlIssueReferenceError (); -void wmlIssueIllegalReferenceError (); -void wmlIssueError (); - - - -/* - * The control routine for semantic analysis. It calls the various phases. - */ - -void wmlResolveDescriptors () - -{ - -/* - * Perform the code assignment pass. This results in assignment of sym_k_... - * codes to all entities. Also, all objects and cross-linking are validated. - */ -wmlResolveGenerateSymK (); -printf ("\nInitial validation and reference resolution complete"); - -/* - * Perform class inheritance and validation - */ -wmlResolveValidateClass (); -printf ("\nClass validation and inheritance complete"); - -/* - * Print a report - */ -if ( wml_err_count > 0 ) return; -wmlResolvePrintReport (); - -} - - - -/* - * Routine to linearize and assign sym_k... literals for objects. Simply - * a dispatching routine. - */ - -void wmlResolveGenerateSymK () - -{ - -/* - * Process the datatype objects - */ -wmlResolveSymKDataType (); - -/* - * Process the enumeration value and enumeration sets - */ -wmlResolveSymKEnumVal (); -wmlResolveSymKEnumSet (); - -/* - * Process the resources, producing argument and reason vectors. - */ -wmlResolveSymKReason (); -wmlResolveSymKArgument (); - -/* - * Bind related arguments - */ -wmlResolveSymKRelated (); - -/* - * Process the class definitions - */ -wmlResolveSymKClass (); - -/* - * Process the controls list definitions - */ -wmlResolveSymKCtrlList (); - -/* - * Process the charset objects - */ -wmlResolveSymKCharSet (); - -/* Process the child definitions. */ -wmlResolveSymKChild(); - -} - - - -/* - * Routine to linearize data types - * - * - Generate the wml_obj_datatype... vector of resolved data type objects, - * ordered lexicographically. - * Do name processing, and acquire links to any other objects named in - * the syntactic descriptor. - */ - -void wmlResolveSymKDataType () - -{ - -WmlSynDataTypeDefPtr cursyn; /* current syntactic object */ -WmlDataTypeDefPtr newobj; /* new resolved object */ -int ndx; /* loop index */ - -/* - * Initialize the object vector. Then process the syntactic vector, - * processing each datatype object encountered (the vector is ordered). - * create and append a resolved object for each one encountered. This - * will be ordered as well. - */ -wmlInitHList (wml_obj_datatype_ptr, 50, TRUE); -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - cursyn = (WmlSynDataTypeDefPtr) wml_synobj_ptr->hvec[ndx].objptr; - if ( cursyn->validation != WmlDataTypeDefValid ) continue; - -/* - * Create and initialize new object. Append to resolved object vector. - */ - newobj = (WmlDataTypeDefPtr) malloc (sizeof(WmlDataTypeDef)); - newobj->syndef = cursyn; - cursyn->rslvdef = newobj; - if ( cursyn->int_lit != NULL ) - newobj->tkname = cursyn->int_lit; - else - newobj->tkname = cursyn->name; - wmlInsertInHList (wml_obj_datatype_ptr, newobj->tkname, (ObjectPtr)newobj); - -/* - * Validate any object references in the syntactic object - */ - - } - -} - - -/* - * Routine to linearize children - * - * - Generate the wml_obj_child... vector of resolved child objects, - * ordered lexicographically. Assign sym_k_... values while doing so. - * Link child to its class. - */ - -void wmlResolveSymKChild () - -{ - -WmlSynChildDefPtr cursyn; /* current syntactic object */ -WmlChildDefPtr newobj; /* new resolved object */ -int code; /* assigned sym_k code value */ -int ndx; /* loop index */ - -/* - * Initialize the object vector. Then process the syntactic vector, - * processing each child object encountered (the vector is ordered). - * create and append a resolved object for each one encountered. This - * will be ordered as well. - */ -wmlInitHList (wml_obj_child_ptr, 50, TRUE); -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - cursyn = (WmlSynChildDefPtr) wml_synobj_ptr->hvec[ndx].objptr; - if ( cursyn->validation != WmlChildDefValid ) continue; - -/* - * Create and initialize new object. Append to resolved object vector. - */ - newobj = (WmlChildDefPtr) malloc (sizeof(WmlChildDef)); - newobj->syndef = cursyn; - cursyn->rslvdef = newobj; - newobj->tkname = cursyn->name; - wmlInsertInHList (wml_obj_child_ptr, newobj->tkname, (ObjectPtr)newobj); - -/* Link class to the resolved object. */ -if (cursyn->class != NULL) - newobj->class = (WmlClassDefPtr) - wmlResolveFindObject(cursyn->class, WmlClassDefValid, cursyn->name); - } - -/* - * All objects are in the vector. The order is the code order, so - * process it again and assign codes to each object - */ -code = 1; -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - newobj = (WmlChildDefPtr) wml_obj_child_ptr->hvec[ndx].objptr; - newobj->sym_code = code; - code += 1; - } - -} - - - -/* - * Routine to linearize and assign sym_k values to enumeration values - * - * - Generate the wml_obj_datatype... vector of resolved data type objects, - * ordered lexicographically. No sym_k_... values are needed for - * enumeration values, so don't assign any. - */ - -void wmlResolveSymKEnumVal () - -{ - -WmlSynEnumSetDefPtr cures; /* current enumeration set */ -WmlSynEnumSetValDefPtr curesv; /* current enum set value */ -WmlSynEnumValueDefPtr cursyn; /* current syntactic object */ -WmlEnumValueDefPtr newobj; /* new resolved object */ -int ndx; /* loop index */ -int code; /* sym_k_... code */ - - -/* - * Perform defaulting. Process all the enumeration sets, and define a - * syntactic object for every enumeration value named in an enumeration set - * which has no syntactic entry. If there is an error in a name, then - * this error won't be detected until we attempt to compile the output .h files. - */ -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - cures = (WmlSynEnumSetDefPtr) wml_synobj_ptr->hvec[ndx].objptr; - if ( cures->validation != WmlEnumSetDefValid ) continue; - for (curesv=cures->values ; curesv!=NULL ; curesv=curesv->next) - if ( wmlFindInHList(wml_synobj_ptr,curesv->name) < 0 ) - wmlCreateEnumValue (curesv->name); - } - -/* - * Initialize the object vector. Then process the syntactic vector, - * processing each enumeration value object encountered (the vector is ordered). - * create and append a resolved object for each one encountered. This - * will be ordered as well. - */ -wmlInitHList (wml_obj_enumval_ptr, 50, TRUE); -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - cursyn = (WmlSynEnumValueDefPtr) wml_synobj_ptr->hvec[ndx].objptr; - if ( cursyn->validation != WmlEnumValueDefValid ) continue; - -/* - * Create and initialize new object. Append to resolved object vector. - */ - newobj = (WmlEnumValueDefPtr) malloc (sizeof(WmlEnumValueDef)); - newobj->syndef = cursyn; - cursyn->rslvdef = newobj; - wmlInsertInHList (wml_obj_enumval_ptr, cursyn->name, (ObjectPtr)newobj); - } - -/* - * All objects are in the vector. That order is the code order, so - * process it again and assign codes to each object - */ -code = 1; -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - newobj = (WmlEnumValueDefPtr) wml_obj_enumval_ptr->hvec[ndx].objptr; - newobj->sym_code = code; - code += 1; - } - -} - - - -/* - * Routine to linearize and assign sym_k values to enumeration sets - * - * - Generate the wml_obj_datatype... vector of resolved data type objects, - * ordered lexicographically. No sym_k_... values are needed for - * enumeration values, so don't assign any. - */ - -void wmlResolveSymKEnumSet () - -{ - -WmlSynEnumSetDefPtr cursyn; /* current syntactic object */ -WmlEnumSetDefPtr newobj; /* new resolved object */ -int ndx; /* loop index */ -int code; /* sym_k_... code */ -WmlSynEnumSetValDefPtr esvelm; /* current syntactic list element */ -WmlEnumValueDefPtr evobj; /* current enumeration value */ -WmlEnumSetValDefPtr esvobj; /* current list element */ - -/* - * Initialize the object vector. Then process the syntactic vector, - * processing each enumeration set object encountered (the vector is ordered). - * create and append a resolved object for each one encountered. This - * will be ordered as well. - */ -wmlInitHList (wml_obj_enumset_ptr, 20, TRUE); -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - cursyn = (WmlSynEnumSetDefPtr) wml_synobj_ptr->hvec[ndx].objptr; - if ( cursyn->validation != WmlEnumSetDefValid ) continue; - -/* - * Create and initialize new object. Append to resolved object vector. - */ - newobj = (WmlEnumSetDefPtr) malloc (sizeof(WmlEnumSetDef)); - newobj->syndef = cursyn; - cursyn->rslvdef = newobj; - newobj->tkname = cursyn->name; - newobj->dtype_def = (WmlDataTypeDefPtr) - wmlResolveFindObject (cursyn->datatype, - WmlDataTypeDefValid, - cursyn->name); - wmlInsertInHList (wml_obj_enumset_ptr, newobj->tkname, (ObjectPtr)newobj); - } - -/* - * All objects are in the vector. That order is the code order, so - * process it again and assign codes to each object. Simultaneously construct - * a vector of resolved enumeration values, and count them. - */ -code = 1; -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - newobj = (WmlEnumSetDefPtr) wml_obj_enumset_ptr->hvec[ndx].objptr; - newobj->sym_code = code; - code += 1; - -/* - * Validate and construct a resolved enumeration value list - */ - cursyn = newobj->syndef; - newobj->values_cnt = 0; - newobj->values = NULL; - for ( esvelm=cursyn->values ; esvelm!=NULL ; esvelm=esvelm->next ) - { - evobj = (WmlEnumValueDefPtr) - wmlResolveFindObject (esvelm->name, - WmlEnumValueDefValid, - cursyn->name); - if ( evobj == NULL ) continue; - esvobj = (WmlEnumSetValDefPtr) malloc (sizeof(WmlEnumSetValDef)); - esvobj->value = evobj; - esvobj->next = newobj->values; - newobj->values = esvobj; - newobj->values_cnt += 1; - } - } - -} - - - -/* - * Routine to linearize and assign sym_k values to reasons. - * - * - Generate the wml_obj_reason... vector of resolved reason objects, - * ordered lexicographically. Assign a sym_k_... value as this is done. - * Do name processing, and acquire links to any other objects named in - * the syntactic descriptor. - */ - -void wmlResolveSymKReason () - -{ - -WmlSynResourceDefPtr cursyn; /* current syntactic object */ -WmlResourceDefPtr newobj; /* new resolved object */ -int ndx; /* loop index */ -int code; /* assigned sym_k code value */ -char errmsg[300]; - -/* - * Initialize the object vector. Then process the syntactic vector, - * processing each reason resource object encountered (the vector is ordered). - * create and append a resolved object for each one encountered. This - * will be ordered as well. - */ -wmlInitHList (wml_obj_reason_ptr, 100, TRUE); -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - cursyn = (WmlSynResourceDefPtr) wml_synobj_ptr->hvec[ndx].objptr; - if ( cursyn->validation != WmlResourceDefValid ) continue; - if ( cursyn->type != WmlResourceTypeReason ) continue; - newobj = (WmlResourceDefPtr) malloc (sizeof(WmlResourceDef)); - -/* - * Create and initialize new object. Append to resolved object vector. - */ - newobj->syndef = cursyn; - cursyn->rslvdef = newobj; - if ( cursyn->int_lit != NULL ) - newobj->tkname = cursyn->int_lit; - else - newobj->tkname = cursyn->name; - newobj->dtype_def = NULL; - newobj->enumset_def = NULL; - newobj->related_code = 0; - wmlInsertInHList (wml_obj_reason_ptr, newobj->tkname, (ObjectPtr)newobj); - -/* - * Validate any object references in the syntactic object - * Reason can't bind to some objects. - */ - if ( cursyn->datatype != NULL ) - wmlIssueIllegalReferenceError (cursyn->name, "DataType"); - - } - -/* - * All objects are in the vector. That order is the code order, so - * process it again and assign codes to each object - */ -code = 1; -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - newobj = (WmlResourceDefPtr) wml_obj_reason_ptr->hvec[ndx].objptr; - newobj->sym_code = code; - code += 1; - } - -} - - - -/* - * Routine to linearize and assign sym_k values to arguments. - * - * - Generate the wml_obj_arg... vector of resovled reason objects, - * ordered lexicographically. Assign a sym_k_... values while doing so. - * validate the data type for each argument, and link it to its data type - * object. - * Do name processing, and acquire links to any other objects named in - * the syntactic descriptor. - */ - -void wmlResolveSymKArgument () - -{ - - -WmlSynResourceDefPtr cursyn; /* current syntactic object */ -WmlResourceDefPtr newobj; /* new resolved object */ -int ndx; /* loop index */ -int code; /* assigned sym_k code value */ -char errmsg[300]; - -/* - * Initialize the object vector. Then process the syntactic vector, - * processing each reason resource object encountered (the vector is ordered). - * create and append a resolved object for each one encountered. This - * will be ordered as well. - */ -wmlInitHList (wml_obj_arg_ptr, 500, TRUE); -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - cursyn = (WmlSynResourceDefPtr) wml_synobj_ptr->hvec[ndx].objptr; - if ( cursyn->validation != WmlResourceDefValid ) continue; - if ( cursyn->type == WmlResourceTypeReason ) continue; - newobj = (WmlResourceDefPtr) malloc (sizeof(WmlResourceDef)); - -/* - * Create and initialize new object. Append to resolved object vector. - */ - newobj->syndef = cursyn; - cursyn->rslvdef = newobj; - if ( cursyn->int_lit != NULL ) - newobj->tkname = cursyn->int_lit; - else - newobj->tkname = cursyn->name; - newobj->related_code = 0; - newobj->enumset_def = NULL; - wmlInsertInHList (wml_obj_arg_ptr, newobj->tkname, (ObjectPtr)newobj); - -/* - * Validate any object references in the syntactic object - */ - newobj->dtype_def = (WmlDataTypeDefPtr) - wmlResolveFindObject (cursyn->datatype, - WmlDataTypeDefValid, - cursyn->name); - if ( cursyn->enumset != NULL ) - newobj->enumset_def = (WmlEnumSetDefPtr) - wmlResolveFindObject (cursyn->enumset, - WmlEnumSetDefValid, - cursyn->name); - - } - -/* - * All objects are in the vector. The order is the code order, so - * process it again and assign codes to each object - */ -code = 1; -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - newobj = (WmlResourceDefPtr) wml_obj_arg_ptr->hvec[ndx].objptr; - newobj->sym_code = code; - code += 1; - } - -} - - - -/* - * Routine to resolve related argument references. - * - * Search the argument vector for any argument with its related - * argument set. Find the related argument, and bind the relation. - * The binding only goes one way. - */ - -void wmlResolveSymKRelated () - -{ - -WmlResourceDefPtr srcobj; /* object with related reference */ -WmlResourceDefPtr dstobj; /* other object in binding */ -WmlSynResourceDefPtr srcsynobj; /* source syntactic object */ -int ndx; /* loop index */ - - -/* - * Scan all arguments for related argument bindings. - */ -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - srcobj = (WmlResourceDefPtr) wml_obj_arg_ptr->hvec[ndx].objptr; - srcsynobj = srcobj->syndef; - if ( srcsynobj->related != NULL ) - { - dstobj = (WmlResourceDefPtr) - wmlResolveFindObject (srcsynobj->related, - WmlResourceDefValid, - srcsynobj->name); - if ( dstobj != NULL ) - srcobj->related_code = dstobj->sym_code; - } - } -} - - - -/* - * Routine to linearize and assign sym_k values to classes - * - * There are two linearizations of classes: - * - all classes in wml_obj_allclass... - * - all widgets and gadgets in wml_obj_class... - * Create and linearize all class objects into these vectors. Assign sym_k - * codes. Link all subclasses to their superclasses. Perform name processing - * and link to any other named object. - * - * Resources are not inherited and linked at this time. - */ - -void wmlResolveSymKClass () - -{ - -WmlSynClassDefPtr cursyn; /* current syntactic object */ -WmlClassDefPtr newobj; /* new resolved object */ -int ndx; /* loop index */ -int code; /* assigned sym_k code value */ -char errmsg[300]; - - -/* - * Initialize the object vectors. Then process the syntactic vector, - * processing each class object encountered (the vector is ordered). - * create and append a resolved object for each one encountered. This - * will be ordered as well. - */ -wmlInitHList (wml_obj_allclass_ptr, 200, TRUE); -wmlInitHList (wml_obj_class_ptr, 200, TRUE); -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - cursyn = (WmlSynClassDefPtr) wml_synobj_ptr->hvec[ndx].objptr; - if ( cursyn->validation != WmlClassDefValid ) continue; - -/* - * Create and initialize new object. Append to resolved object vector. - */ - newobj = (WmlClassDefPtr) malloc (sizeof(WmlClassDef)); - newobj->syndef = cursyn; - cursyn->rslvdef = newobj; - newobj->superclass = NULL; - newobj->parentclass = NULL; - if ( cursyn->int_lit != NULL ) - newobj->tkname = cursyn->int_lit; - else - newobj->tkname = cursyn->name; - newobj->inherit_done = FALSE; - newobj->arguments = NULL; - newobj->reasons = NULL; - newobj->controls = NULL; - newobj->children = NULL; - newobj->variant = NULL; - newobj->nondialog = NULL; - newobj->ctrlmapto = NULL; - switch ( cursyn->type ) - { - case WmlClassTypeMetaclass: - wmlInsertInHList - (wml_obj_allclass_ptr, newobj->tkname, (ObjectPtr)newobj); - break; - case WmlClassTypeGadget: - case WmlClassTypeWidget: - wmlInsertInHList - (wml_obj_allclass_ptr, newobj->tkname, (ObjectPtr)newobj); - wmlInsertInHList - (wml_obj_class_ptr, newobj->tkname, (ObjectPtr)newobj); - break; - } - -/* - * Require a convenience function name - */ - if ( cursyn->type != WmlClassTypeMetaclass ) - if ( cursyn->convfunc == NULL ) - { - sprintf (errmsg, "Class %s does not have a convenience function", - cursyn->name); - wmlIssueError (errmsg); - } - -/* - * Validate any object references in the syntactic object - */ - if ( cursyn->ctrlmapto != NULL ) - newobj->ctrlmapto = (WmlResourceDefPtr) - wmlResolveFindObject (cursyn->ctrlmapto, - WmlResourceDefValid, - cursyn->name); - - } - -/* - * All objects are in the vector. That order is the code order, so - * process it again and assign codes to each object - */ -code = 1; -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - newobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[ndx].objptr; - newobj->sym_code = code; - code += 1; - } - -} - - - -/* - * Routine to validate controls lists - * - * Construct and linearize resolved controls lists. The linearized list - * is used to resolve references. - */ - -void wmlResolveSymKCtrlList () - -{ - -WmlSynCtrlListDefPtr cursyn; /* current syntactic object */ -WmlCtrlListDefPtr newobj; /* new resolved object */ -WmlSynClassCtrlDefPtr refptr; /* current controls reference */ -WmlClassCtrlDefPtr ctrlobj; /* resolved control reference */ -WmlClassDefPtr classobj; /* the controlled class */ -int ndx; /* loop index */ - - -/* - * Process each control list. Construct a resolved control list for each - */ -wmlInitHList (wml_obj_ctrlist_ptr, 20, TRUE); -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - cursyn = (WmlSynCtrlListDefPtr) wml_synobj_ptr->hvec[ndx].objptr; - if ( cursyn->validation != WmlCtrlListDefValid ) continue; - -/* - * Create and initialize new object. Append to resolved object vector. - */ - newobj = (WmlCtrlListDefPtr) malloc (sizeof(WmlCtrlListDef)); - newobj->syndef = cursyn; - cursyn->rslvdef = newobj; - newobj->controls = NULL; - wmlInsertInHList (wml_obj_ctrlist_ptr, cursyn->name, (ObjectPtr)newobj); - -/* - * Validate and construct a resolved controls reference list. - */ - for ( refptr=cursyn->controls ; refptr!=NULL ; refptr=refptr->next ) - { - classobj = (WmlClassDefPtr) - wmlResolveFindObject (refptr->name, - WmlClassDefValid, - cursyn->name); - if ( classobj == NULL ) continue; - ctrlobj = (WmlClassCtrlDefPtr) malloc (sizeof(WmlClassCtrlDef)); - ctrlobj->next = newobj->controls; - newobj->controls = ctrlobj; - ctrlobj->ctrl = classobj; - } - } - -} - - - -/* - * Routine to linearize and assign sym_k values to character sets - * - * - Generate the wml_obj_charset... vector of resolved data type objects, - * ordered lexicographically. Assign a sym_k... value as this is done. - * Do name processing, and acquire links to any other objects named in - * the syntactic descriptor. - */ - -void wmlResolveSymKCharSet () - -{ - -WmlSynCharSetDefPtr cursyn; /* current syntactic object */ -WmlCharSetDefPtr newobj; /* new resolved object */ -int ndx; /* loop index */ -int code; /* assigned sym_k code value */ -char errmsg[300]; - - -/* - * Initialize the object vector. Then process the syntactic vector, - * processing each charset object encountered (the vector is ordered). - * create and append a resolved object for each one encountered. This - * will be ordered as well. - */ -wmlInitHList (wml_obj_charset_ptr, 50, TRUE); -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - cursyn = (WmlSynCharSetDefPtr) wml_synobj_ptr->hvec[ndx].objptr; - if ( cursyn->validation != WmlCharSetDefValid ) continue; - -/* - * Create and initialize new object. Append to resolved object vector. - */ - newobj = (WmlCharSetDefPtr) malloc (sizeof(WmlCharSetDef)); - newobj->syndef = cursyn; - cursyn->rslvdef = newobj; - if ( cursyn->int_lit != NULL ) - newobj->tkname = cursyn->int_lit; - else - newobj->tkname = cursyn->name; - wmlInsertInHList (wml_obj_charset_ptr, newobj->tkname, (ObjectPtr)newobj); - -/* - * Parsing direction defaults to writing direction if unspecified - */ - if ( cursyn->parsedirection == WmlAttributeUnspecified ) - cursyn->parsedirection = cursyn->direction; - -/* - * Require StandardsName attribute for character set - */ - if ( cursyn->xms_name == NULL ) - { - sprintf (errmsg, "CharacterSet %s does not have a StandardsName", - cursyn->name); - wmlIssueError (errmsg); - } - - } - -/* - * All objects are in the vector. That order is the code order, so - * process it again and assign codes to each object. We start at code - * 2 since 1 is reserved for sym_k_userdefined_charset - */ -code = 2; -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - newobj = (WmlCharSetDefPtr) wml_obj_charset_ptr->hvec[ndx].objptr; - newobj->sym_code = code; - code += 1; - } - -} - - - -/* - * Routine to perform class inheritance and validation. - * - * This routine has two major phases: - * - Complete resolution of class references, and expand out - * controls list. - * - Perform inheritance of resources, partitioning them into - * into arguments and reasons. When complete, the class has - * a list of all its resources, including copies from a - * superclass and possibly a parentclass. - * Excluded resources remain in the list, and are simply marked. - */ - -void wmlResolveValidateClass () - -{ - -int ndx; /* loop index */ -int max; /* maximum code value */ -WmlClassDefPtr clsobj; /* current class object */ -WmlSynClassDefPtr synobj; /* syntactic class object */ -WmlClassDefPtr superobj; /* superclass */ -WmlClassDefPtr parentobj; /* parentclass */ -WmlClassDefPtr widgobj; /* gadget's widget class */ -WmlSynClassCtrlDefPtr refptr; /* current controls reference */ -WmlClassCtrlDefPtr ctrlobj; /* resolved control reference */ -int refndx; /* index in vector */ -WmlClassDefPtr refcls; /* referenced class object */ -WmlCtrlListDefPtr reflist; /* controls list object */ -WmlClassCtrlDefPtr listelem; /* control reference in list */ -char errmsg[300]; - - -/* - * Acquire the superclass pointer for each widget and gadget class - */ -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - clsobj = (WmlClassDefPtr) wml_obj_allclass_ptr->hvec[ndx].objptr; - synobj = clsobj->syndef; - if ( synobj->superclass != NULL ) - { - superobj = (WmlClassDefPtr) - wmlResolveFindObject (synobj->superclass, - WmlClassDefValid, - synobj->name); - if ( superobj == NULL ) continue; - clsobj->superclass = superobj; - } - } - -/* - * Acquire the parentclass pointer (if one exists), - * for each widget and gadget class - */ -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - clsobj = (WmlClassDefPtr) wml_obj_allclass_ptr->hvec[ndx].objptr; - synobj = clsobj->syndef; - if ( synobj->parentclass != NULL ) - { - parentobj = (WmlClassDefPtr) - wmlResolveFindObject (synobj->parentclass, - WmlClassDefValid, - synobj->name); - if ( parentobj == NULL ) continue; - clsobj->parentclass = parentobj; - } - } - -/* - * Link each gadget class with its widget class (both ways). - * Link any class with a non-dialog version to the non-dialog class. - */ -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - clsobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[ndx].objptr; - synobj = clsobj->syndef; - if ( synobj->type == WmlClassTypeGadget ) - { - if ( synobj->widgetclass == NULL ) - { - sprintf (errmsg, "Gadget class %s has no widgetclass reference", - synobj->name); - wmlIssueError (errmsg); - } - else - { - widgobj = (WmlClassDefPtr) - wmlResolveFindObject - (synobj->widgetclass, - WmlClassDefValid, - synobj->name); - if ( widgobj != NULL ) - { - clsobj->variant = widgobj; - widgobj->variant = clsobj; - } - } - } - if ( synobj->dialog == TRUE ) - { - clsobj->nondialog = clsobj->superclass; - while ( clsobj->nondialog->syndef->dialog == TRUE ) - clsobj->nondialog = clsobj->nondialog->superclass; - } - else - if ( clsobj->superclass != NULL ) - { - synobj->dialog = clsobj->superclass->syndef->dialog; - clsobj->nondialog = clsobj->superclass->nondialog; - } - } - -/* - * Construct the list of resolved controls. Control lists are expanded - * in place. - */ -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - clsobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[ndx].objptr; - synobj = clsobj->syndef; - for ( refptr=synobj->controls ; refptr!= NULL ; refptr=refptr->next ) - { - refndx = wmlFindInHList (wml_obj_class_ptr, refptr->name); - if ( refndx >= 0 ) - { - refcls = (WmlClassDefPtr) wml_obj_class_ptr->hvec[refndx].objptr; - ctrlobj = (WmlClassCtrlDefPtr) malloc (sizeof(WmlClassCtrlDef)); - ctrlobj->next = clsobj->controls; - clsobj->controls = ctrlobj; - ctrlobj->ctrl = refcls; - continue; - } - refndx = wmlFindInHList (wml_obj_ctrlist_ptr, refptr->name); - if ( refndx >= 0 ) - { - reflist = (WmlCtrlListDefPtr) - wml_obj_ctrlist_ptr->hvec[refndx].objptr; - for ( listelem=reflist->controls ; - listelem!=NULL ; - listelem=listelem->next) - { - ctrlobj = (WmlClassCtrlDefPtr) - malloc (sizeof(WmlClassCtrlDef)); - ctrlobj->next = clsobj->controls; - clsobj->controls = ctrlobj; - ctrlobj->ctrl = listelem->ctrl; - } - continue; - } - wmlIssueReferenceError (synobj->name, refptr->name); - continue; - } - } - -/* - * Perform resource inheritance for each class. This constructs the - * arguments and reasons reference vectors. - */ -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - clsobj = (WmlClassDefPtr) wml_obj_allclass_ptr->hvec[ndx].objptr; - wmlResolveClassInherit (clsobj); - } - -} - - - -/* - * Routine to perform resource inheritance for a class. - * - * This routine constructs the argument and reason resource and child reference - * vectors for a class. It first ensures the superclass (if any) has - * been inited. It then makes a copy of the superclass lists. It repeats this - * procedure for the parentclass (if any.) Finally, it - * merges in the resources from the syntactic object. It uses the - * resolved resource or child object to point to the matching reference object - * in the list being created as an aid to search doing overrides. This also - * detects whether a resource or child is already in the list (if so, it is - * assumed to be inherited). - */ - -void wmlResolveClassInherit (clsobj) - WmlClassDefPtr clsobj; - -{ - -WmlClassDefPtr superobj; /* superclass object */ -WmlClassDefPtr parentobj; /* parentclass object */ -int ndx; /* loop index */ -WmlResourceDefPtr resobj; /* current resource object */ -WmlClassResDefPtr refobj; /* current resource reference */ -WmlClassResDefPtr srcref; /* source of copy */ -WmlChildDefPtr childobj; /* current child object */ -WmlClassChildDefPtr crefobj; /* current child reference */ -WmlClassChildDefPtr csrcref; /* child source of copy */ -WmlSynClassDefPtr synobj; /* this class' syntactic object */ -WmlSynClassResDefPtr refptr; /* syntactic resource reference */ -WmlSynClassChildDefPtr crefptr; /* syntactic child reference */ - - -/* - * Done if inheritance previously performed. Ensure the superclass is - * done. - */ -if ( clsobj == NULL ) return; -if ( clsobj->inherit_done ) return; -superobj = clsobj->superclass; -wmlResolveClassInherit (superobj); -parentobj = clsobj->parentclass; -wmlResolveClassInherit (parentobj); -synobj = clsobj->syndef; - -/* - * Clear the active reference pointer in the resolved resource objects. - */ -wmlResolveClearRefPointers (); - -/* - * Copy the superclass resources, setting the reference pointer as we go. - */ -if ( superobj != NULL ) - { - for ( srcref=superobj->arguments ; srcref!=NULL ; srcref=srcref->next ) - { - refobj = (WmlClassResDefPtr) malloc (sizeof(WmlClassResDef)); - refobj->next = clsobj->arguments; - clsobj->arguments = refobj; - wmlResolveInitRefObj (refobj, srcref); - } - for ( srcref=superobj->reasons ; srcref!=NULL ; srcref=srcref->next ) - { - refobj = (WmlClassResDefPtr) malloc (sizeof(WmlClassResDef)); - refobj->next = clsobj->reasons; - clsobj->reasons = refobj; - wmlResolveInitRefObj (refobj, srcref); - } - for (csrcref = superobj->children ; csrcref!=NULL ; csrcref=csrcref->next) - { - crefobj = (WmlClassChildDefPtr) malloc (sizeof(WmlClassChildDef)); - crefobj->next = clsobj->children; - clsobj->children = crefobj; - wmlResolveInitChildRefObj (crefobj, csrcref); - } - } - -/* - * Copy the parentclass resources, setting the reference pointer as we go. - */ -if ( parentobj != NULL ) - { - for ( srcref=parentobj->arguments ; srcref!=NULL ; srcref=srcref->next ) - { - if (srcref->act_resource->ref_ptr == NULL) - { - refobj = (WmlClassResDefPtr) malloc (sizeof(WmlClassResDef)); - refobj->next = clsobj->arguments; - clsobj->arguments = refobj; - wmlResolveInitRefObj (refobj, srcref); - } - } - for ( srcref=parentobj->reasons ; srcref!=NULL ; srcref=srcref->next ) - { - if (srcref->act_resource->ref_ptr == NULL) - { - refobj = (WmlClassResDefPtr) malloc (sizeof(WmlClassResDef)); - refobj->next = clsobj->reasons; - clsobj->reasons = refobj; - wmlResolveInitRefObj (refobj, srcref); - } - } - for (csrcref = parentobj->children ; csrcref!=NULL ; csrcref=csrcref->next) - { - if (csrcref->act_child->ref_ptr == NULL) - { - crefobj = (WmlClassChildDefPtr) malloc (sizeof(WmlClassChildDef)); - crefobj->next = clsobj->children; - clsobj->children = crefobj; - wmlResolveInitChildRefObj (crefobj, csrcref); - } - } - } - -/* - * Process the resources belonging to this class. They may either be - * new resources, or override ones already in the list. Partition them - * into arguments and reasons. - */ -for ( refptr=synobj->resources ; refptr!=NULL ; refptr=refptr->next ) - { - resobj = (WmlResourceDefPtr) wmlResolveFindObject (refptr->name, - WmlResourceDefValid, - synobj->name); - if ( resobj == NULL ) continue; - - /* - * Acquire the resolved resource object, and the resource reference. - * New references are linked in to the proper list, and have their - * defaults set. - */ - if ( resobj->ref_ptr != NULL ) - refobj = resobj->ref_ptr; - else - { - refobj = (WmlClassResDefPtr) malloc (sizeof(WmlClassResDef)); - refobj->act_resource = resobj; - resobj->ref_ptr = refobj; - refobj->over_dtype = NULL; - refobj->dflt = NULL; - refobj->exclude = WmlAttributeUnspecified; - if ( resobj->syndef->type == WmlResourceTypeReason ) - { - refobj->next = clsobj->reasons; - clsobj->reasons = refobj; - } - else - { - refobj->next = clsobj->arguments; - clsobj->arguments = refobj; - } - } - - /* - * Override any values in the reference which are explicit in the - * syntactic reference. - */ - if ( refptr->type != NULL ) - refobj->over_dtype = (WmlDataTypeDefPtr) - wmlResolveFindObject (refptr->type, - WmlDataTypeDefValid, - synobj->name); - if ( refptr->dflt != NULL ) - refobj->dflt = refptr->dflt; - if ( refptr->exclude != WmlAttributeUnspecified ) - refobj->exclude = refptr->exclude; - } - -/* - * Process the children belonging to this class. - */ -for ( crefptr = synobj->children ; crefptr!=NULL ; crefptr = crefptr->next ) - { - childobj = (WmlChildDefPtr) wmlResolveFindObject (crefptr->name, - WmlChildDefValid, - synobj->name); - if ( childobj == NULL ) continue; - - /* - * Acquire the resolved child object, and the child reference. - * New references are linked in to the proper list, and have their - * defaults set. - */ - if ( childobj->ref_ptr != NULL ) - crefobj = childobj->ref_ptr; - else - { - crefobj = (WmlClassChildDefPtr) malloc (sizeof(WmlClassChildDef)); - crefobj->act_child = childobj; - childobj->ref_ptr = crefobj; - crefobj->next = clsobj->children; - clsobj->children = crefobj; - } - } - -/* - * inheritance complete - */ -clsobj->inherit_done = TRUE; - -} - - - -/* - * Routine to copy a resource reference - */ - -void wmlResolveInitRefObj (dstobj, srcobj) - WmlClassResDefPtr dstobj; - WmlClassResDefPtr srcobj; - -{ - -WmlResourceDefPtr resobj; - - -resobj = srcobj->act_resource; -dstobj->act_resource = resobj; -resobj->ref_ptr = dstobj; -dstobj->over_dtype = srcobj->over_dtype; -dstobj->dflt = srcobj->dflt; -dstobj->exclude = srcobj->exclude; - -} - - -/* - * Routine to copy a child reference - */ - -void wmlResolveInitChildRefObj (dstobj, srcobj) - WmlClassChildDefPtr dstobj; - WmlClassChildDefPtr srcobj; - -{ - -WmlChildDefPtr childobj; - -childobj = srcobj->act_child; -dstobj->act_child = childobj; -childobj->ref_ptr = dstobj; - -} - - - -/* - * Routine to print a report in a file. - * - * This routine dumps the developed database into the file 'wml.report' - */ - -void wmlResolvePrintReport () - -{ - -FILE *outfil; /* output file */ -int ndx; /* loop index */ -WmlClassDefPtr clsobj; /* current class */ - - -/* - * Open the output file. - */ -outfil = fopen ( "wml.report", "w"); -if ( outfil == NULL ) - { - printf ("\nCouldn't open wml.report"); - return; - } - -/* - * Go through all classes. Print basic information, then dump their - * resources. The main purpose of this report is to show the actual - * resources and controls for the class. - */ - -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - clsobj = (WmlClassDefPtr) wml_obj_allclass_ptr->hvec[ndx].objptr; - wmlMarkReferencePointers (clsobj); - wmlResolvePrintClass (outfil, clsobj); - } - - -/* - * close the output file - */ -fprintf (outfil, "\n\n"); -printf ("\nCreated report file wml.report"); -fclose (outfil); - -} - - - -/* - * Print the information for a class - */ - -void wmlResolvePrintClass (outfil, clsobj) - FILE *outfil; - WmlClassDefPtr clsobj; - -{ - -int ndx; /* loop index */ -WmlSynClassDefPtr synobj; /* syntactic object */ -WmlClassCtrlDefPtr ctrlref; /* controls reference */ -WmlClassDefPtr ctrlobj; /* current class in control */ - - -synobj = clsobj->syndef; -fprintf (outfil, "\n\n\nClass %s:", synobj->name); -switch ( synobj->type ) - { - case WmlClassTypeMetaclass: - fprintf (outfil, "\n Type: Metaclass\t"); - if ( synobj->superclass != NULL ) - fprintf (outfil, "Superclass: %s\t", synobj->superclass); - if ( synobj->parentclass != NULL ) - fprintf (outfil, "Parentclass: %s\t", synobj->parentclass); - break; - case WmlClassTypeWidget: - fprintf (outfil, "\n Type: Widget\t"); - if ( synobj->superclass != NULL ) - fprintf (outfil, "Superclass: %s\t", synobj->superclass); - if ( synobj->parentclass != NULL ) - fprintf (outfil, "Parentclass: %s\t", synobj->parentclass); - if ( clsobj->variant != NULL ) - fprintf (outfil, "\n Associated gadget class: %s\t", - clsobj->variant->syndef->name); - if ( synobj->convfunc != NULL ) - fprintf (outfil, "Convenience function: %s", synobj->convfunc); - break; - case WmlClassTypeGadget: - fprintf (outfil, "\n Type: Gadget\t"); - if ( synobj->superclass != NULL ) - fprintf (outfil, "Superclass: %s\t", synobj->superclass); - if ( synobj->parentclass != NULL ) - fprintf (outfil, "Parentclass: %s\t", synobj->parentclass); - if ( clsobj->variant != NULL ) - fprintf (outfil, "\n Associated widget class: %s\t", - clsobj->variant->syndef->name); - if ( synobj->convfunc != NULL ) - fprintf (outfil, "Convenience function: %s", synobj->convfunc); - break; - } - -/* - * Print associated non-dialog class - */ -if ( clsobj->nondialog != NULL ) - fprintf (outfil, "\n DialogClass: True\tNon-dialog ancestor: %s\t", - clsobj->nondialog->syndef->name); - -/* - * Print the arguments valid in the class. First the new resources for the - * class are printed, then each ancestor's contribution is printed. This - * is intended to match the way resources are printed in the toolkit manual, - * so that checking is as easy as possible. - */ -fprintf (outfil, "\n Arguments:"); -wmlResolvePrintClassArgs (outfil, clsobj); - -/* - * Print the reasons valid in the class - */ -fprintf (outfil, "\n Reasons:"); -wmlResolvePrintClassReasons (outfil, clsobj); - -/* - * Print the controls valid in the class - */ -fprintf (outfil, "\n Controls:"); -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - ctrlobj = (WmlClassDefPtr) wml_obj_class_ptr->hvec[ndx].objptr; - if ( ctrlobj->ref_ptr == NULL ) continue; - fprintf (outfil, "\n %s", ctrlobj->syndef->name); - } - -} - - - -/* - * Routine to print the arguments for a class - * - * This routine prints out the currently marked arguments which are - * present in this class. Each argument which is printed is remarked - * so that it won't be printed again. This routine first prints the - * superclass arguments, so that the printing order becomes the top-down - * inheritance order. - */ - -void wmlResolvePrintClassArgs (outfil, clsobj) - FILE *outfil; - WmlClassDefPtr clsobj; - -{ - -int prthdr = TRUE; /* print header line */ -int ndx; /* loop index */ -WmlSynClassDefPtr synobj; /* syntactic object */ -WmlClassResDefPtr resref; /* resource reference */ -int constr = FALSE; /* check for constraints */ -WmlResourceDefPtr resobj; /* current resource */ -WmlSynResourceDefPtr synres; /* syntactic resource object */ - - -/* - * Print the superclass arguments - */ -if ( clsobj->superclass != NULL ) - wmlResolvePrintClassArgs (outfil, clsobj->superclass); - -/* - * Print the parentclass arguments - */ -if ( clsobj->parentclass != NULL ) - wmlResolvePrintClassArgs (outfil, clsobj->parentclass); - -/* - * Print the arguments for this class. Unmark the reference so it won't - * be printed again. - */ -synobj = clsobj->syndef; -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - resobj = (WmlResourceDefPtr) wml_obj_arg_ptr->hvec[ndx].objptr; - resref = resobj->ref_ptr; - if ( resref == NULL ) continue; - if ( wmlResolveResIsMember(resobj,clsobj->arguments) == NULL ) continue; - synres = resobj->syndef; - switch ( synres->type ) - { - case WmlResourceTypeArgument: - case WmlResourceTypeSubResource: - break; - case WmlResourceTypeConstraint: - constr = TRUE; - break; - default: - continue; - break; - } - if ( prthdr ) - { - fprintf (outfil, "\n %s argument set:", synobj->name); - prthdr = FALSE; - } - - fprintf (outfil, "\n %s", synres->name); - fprintf (outfil, "\n\tType = %s", resobj->dtype_def->syndef->name); - if ( strcmp(synres->name,synres->resliteral) != 0 ) - fprintf (outfil, "\tResourceLiteral = %s", synres->resliteral); - switch ( resref->exclude ) - { - case WmlAttributeTrue: - fprintf (outfil, "\n\tExclude = True;"); - break; - case WmlAttributeFalse: - fprintf (outfil, "\n\tExclude = False;"); - break; - } - if ( resref->dflt != NULL ) - fprintf (outfil, "\n\tDefault = \"%s\"", resref->dflt); - else - if ( synres->dflt != NULL ) - fprintf (outfil, "\n\tDefault = \"%s\"", synres->dflt); - resobj->ref_ptr = NULL; - } - -/* - * Print the constraints valid in the class - */ -if ( constr ) - { - prthdr = TRUE; - for ( ndx=0 ; ndxcnt ; ndx++ ) - { - resobj = (WmlResourceDefPtr) wml_obj_arg_ptr->hvec[ndx].objptr; - resref = resobj->ref_ptr; - if ( resref == NULL ) continue; - if ( wmlResolveResIsMember(resobj,clsobj->arguments) == NULL ) continue; - synres = resobj->syndef; - switch ( synres->type ) - { - case WmlResourceTypeConstraint: - break; - default: - continue; - break; - } - if ( prthdr ) - { - fprintf (outfil, "\n %s constraint set:", synobj->name); - prthdr = FALSE; - } - fprintf (outfil, "\n %s", synres->name); - if ( strcmp(synres->name,synres->resliteral) != 0 ) - fprintf (outfil, "\tResourceLiteral = %s", synres->resliteral); - switch ( resref->exclude ) - { - case WmlAttributeTrue: - fprintf (outfil, "\n\tExclude = True;"); - break; - case WmlAttributeFalse: - fprintf (outfil, "\n\tExclude = False;"); - break; - } - if ( resref->dflt != NULL ) - fprintf (outfil, "\n\tDefault = \"%s\"", resref->dflt); - else - if ( synres->dflt != NULL ) - fprintf (outfil, "\n\tDefault = \"%s\"", synres->dflt); - resobj->ref_ptr = NULL; - } - } - -} - - - -/* - * Routine to print reasons in a class. - * - * Like printing arguments, only reasons instead. - */ - -void wmlResolvePrintClassReasons (outfil, clsobj) - FILE *outfil; - WmlClassDefPtr clsobj; - -{ - -int prthdr = TRUE; /* print header flag */ -int ndx; /* loop index */ -WmlSynClassDefPtr synobj; /* syntactic object */ -WmlClassResDefPtr resref; /* resource reference */ -WmlResourceDefPtr resobj; /* current resource */ -WmlSynResourceDefPtr synres; /* syntactic resource object */ - - -/* - * Print the superclass reasons - */ -if ( clsobj->superclass != NULL ) - wmlResolvePrintClassReasons (outfil, clsobj->superclass); - -/* - * Print the parentclass reasons - */ -if ( clsobj->parentclass != NULL ) - wmlResolvePrintClassReasons (outfil, clsobj->parentclass); - -/* - * Print the reasons for this class. Unmark the reference so it won't - * be printed again. - */ -synobj = clsobj->syndef; -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - resobj = (WmlResourceDefPtr) wml_obj_reason_ptr->hvec[ndx].objptr; - resref = resobj->ref_ptr; - if ( resref == NULL ) continue; - if ( wmlResolveResIsMember(resobj,clsobj->reasons) == NULL ) continue; - synres = resobj->syndef; - if ( prthdr ) - { - fprintf (outfil, "\n %s reason set:", synobj->name); - prthdr = FALSE; - } - fprintf (outfil, "\n %s", synres->name); - if ( strcmp(synres->name,synres->resliteral) != 0 ) - fprintf (outfil, "\tResourceLiteral = %s", synres->resliteral); - switch ( resref->exclude ) - { - case WmlAttributeTrue: - fprintf (outfil, "\n\tExclude = True;"); - break; - case WmlAttributeFalse: - fprintf (outfil, "\n\tExclude = False;"); - break; - } - resobj->ref_ptr = NULL; - } -} - - - -/* - * Routine to mark reference pointers for a class - * - * This routine clears all reference pointers, then marks the class and - * resource objects to flag those contained in the current class. This - * allows processing of the widget and resource vectors in order to produce - * bit masks or reports. - */ - -void wmlMarkReferencePointers (clsobj) - WmlClassDefPtr clsobj; - -{ - -int ndx; /* loop index */ -WmlClassDefPtr mrkcls; /* class object to mark */ -WmlResourceDefPtr mrkres; /* resource object to mark */ -WmlClassResDefPtr resref; /* resource reference */ -WmlClassCtrlDefPtr ctrlref; /* controls reference */ - - -/* - * Clear the reference pointers. Then go through the arguments, reasons, - * and controls lists, and mark the referenced classes. - */ -wmlResolveClearRefPointers (); -for ( resref=clsobj->arguments ; resref!= NULL ; resref=resref->next ) - resref->act_resource->ref_ptr = resref; -for ( resref=clsobj->reasons ; resref!= NULL ; resref=resref->next ) - resref->act_resource->ref_ptr = resref; -for ( ctrlref=clsobj->controls ; ctrlref!=NULL ; ctrlref=ctrlref->next ) - ctrlref->ctrl->ref_ptr = ctrlref; - -} - - - -/* - * Routine to clear reference pointers - */ - -void wmlResolveClearRefPointers () - -{ - -int ndx; /* loop index */ -WmlClassDefPtr mrkcls; /* class object to mark */ -WmlResourceDefPtr mrkres; /* resource object to mark */ -WmlChildDefPtr mrkcld; /* child object to mark */ - -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - mrkcls = (WmlClassDefPtr) wml_obj_allclass_ptr->hvec[ndx].objptr; - mrkcls->ref_ptr = NULL; - } -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - mrkres = (WmlResourceDefPtr) wml_obj_reason_ptr->hvec[ndx].objptr; - mrkres->ref_ptr = NULL; - } -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - mrkres = (WmlResourceDefPtr) wml_obj_arg_ptr->hvec[ndx].objptr; - mrkres->ref_ptr = NULL; - } -for ( ndx=0 ; ndxcnt ; ndx++ ) - { - mrkcld = (WmlChildDefPtr) wml_obj_child_ptr->hvec[ndx].objptr; - mrkcld->ref_ptr = NULL; - } - -} - - - -/* - * Routine to find an object for binding. The name is always looked - * in the syntactic object list, since all references made by the - * user are in that list (resolved objects may be entered under - * an internal literal, and not be found). This routine always attempts to - * return a resolved object (which depends on object type). It also guarantees - * that the object it finds matches the given type. - * - * name the object to be found - * type type the object should match - * requester requester name, for error messages - * - * Returns: pointer to the object found - */ - -ObjectPtr wmlResolveFindObject (name, type, requester) - char *name; - int type; - char *requester; - -{ - -int objndx; /* the object index in the list */ -WmlSynDefPtr synobj; /* syntactic object */ -char errmsg[300]; - - -objndx = wmlFindInHList (wml_synobj_ptr, name); -if ( objndx < 0 ) - { - wmlIssueReferenceError (requester, name); - return NULL; - } -synobj = (WmlSynDefPtr) wml_synobj_ptr ->hvec[objndx].objptr; -if ( synobj->validation != type ) - { - sprintf (errmsg, - "Object %s references object %s\n\tin a context where a different type of object is required", - requester, name); - wmlIssueError (errmsg); - return NULL; - } -switch ( synobj->validation ) - { - case WmlClassDefValid: - case WmlResourceDefValid: - case WmlDataTypeDefValid: - case WmlCtrlListDefValid: - case WmlEnumSetDefValid: - case WmlEnumValueDefValid: - case WmlChildDefValid: - return (ObjectPtr) synobj->rslvdef; - break; - default: - return (ObjectPtr) synobj; - } - -} - - -/* - * Report an object reference error - * - * srcname the object making the reference - * badname the missing object - */ - -void wmlIssueReferenceError (srcname, badname) - char *srcname; - char *badname; - -{ - -printf ("\nObject %s references undefined object %s", srcname, badname); -wml_err_count += 1; - -} - - -/* - * Report an attempt to make a reference which is not supported. - */ - -void wmlIssueIllegalReferenceError (srcname, badname) - char *srcname; - char *badname; - -{ - -printf ("\nObject %s cannot reference a %s object", srcname, badname); -wml_err_count += 1; - -} - - -/* - * Report an error string. - */ -void wmlIssueError (errstg) - char *errstg; - -{ - -printf ("\n%s", errstg); -wml_err_count += 1; - -}