home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
x
/
volume15
/
olvwm-3.0
/
part03
< prev
next >
Wrap
Internet Message Format
|
1992-02-03
|
57KB
Path: uunet!sun-barr!ames!pasteur!nntp
From: scott.oaks@East.Sun.COM (Scott Oaks)
Newsgroups: comp.sources.x
Subject: v15i149: OpenLook Virtual Window Mgr (3.0), Part03/21
Message-ID: <1992Feb4.135427.6797@pasteur.Berkeley.EDU>
Date: 4 Feb 92 13:54:27 GMT
References: <csx-15i147-olvwm-3.0@uunet.UU.NET>
Sender: dcmartin@msi.com (David C. Martin - Moderator)
Organization: University of California, at Berkeley
Lines: 2105
Approved: dcmartin@msi.com
Nntp-Posting-Host: postgres.berkeley.edu
Submitted-by: scott.oaks@East.Sun.COM (Scott Oaks)
Posting-number: Volume 15, Issue 149
Archive-name: olvwm-3.0/part03
# This is a shell archive. Remove anything before this line, then feed it
# into a shell via "sh file" or similar. To overwrite existing files,
# type "sh file -c".
# The tool that generated this appeared in the comp.sources.unix newsgroup;
# send mail to comp-sources-unix@uunet.uu.net if you want that tool.
# If this archive is complete, you will see the following message at the end:
# "End of archive 3 (of 21)."
# Contents: i18n.h resources.c slots.h
# Wrapped by dcmartin@fascet on Tue Jan 14 05:54:42 1992
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'i18n.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'i18n.h'\"
else
echo shar: Extracting \"'i18n.h'\" \(356 characters\)
sed "s/^X//" >'i18n.h' <<'END_OF_FILE'
X/*
X * (c) Copyright 1990 Sun Microsystems, Inc. Sun design patents
X * pending in the U.S. and foreign countries. See LEGAL NOTICE
X * file for terms of the license.
X */
X
X#ident "@(#)i18n.h 1.6 91/09/14 SMI"
X
X#ifndef i18n_DEFINED
X#define i18n_DEFINED
X
X#ifdef OW_I18N_L3
X
Xextern char *gettext();
X
X#else
X
X#define gettext(s) s
X
X#endif
X
X#endif i18n_DEFINED
X
X
END_OF_FILE
if test 356 -ne `wc -c <'i18n.h'`; then
echo shar: \"'i18n.h'\" unpacked with wrong size!
fi
# end of 'i18n.h'
fi
if test -f 'resources.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'resources.c'\"
else
echo shar: Extracting \"'resources.c'\" \(49362 characters\)
sed "s/^X//" >'resources.c' <<'END_OF_FILE'
X/*
X * (c) Copyright 1990 Sun Microsystems, Inc. Sun design patents
X * pending in the U.S. and foreign countries. See LEGAL_NOTICE
X * file for terms of the license.
X */
X
X#ident "@(#)resources.c 26.45 91/10/04 SMI"
X
X#ifdef SYSV
X#include <sys/types.h>
X#endif
X#include <ctype.h>
X#include <errno.h>
X#include <memory.h>
X#include <stdio.h>
X#include <string.h>
X#include <sys/file.h>
X#include <X11/Xos.h>
X#include <X11/Xlib.h>
X#include <X11/Xutil.h>
X#include <X11/Xresource.h>
X#include <X11/keysym.h>
X#include <X11/cursorfont.h>
X
X#include <olgx/olgx.h>
X
X#include "i18n.h"
X#include "ollocale.h"
X#include "mem.h"
X#include "olwm.h"
X#include "win.h"
X#include "menu.h"
X#include "defaults.h"
X#include "globals.h"
X#include "resources.h"
X#include "olcursor.h"
X#include "events.h"
X#include "virtual.h"
X
X
X/* converters */
X
Xstatic Bool cvtBeepStatus();
Xstatic Bool cvtBoolean();
Xstatic Bool cvtClickTimeout();
Xstatic Bool cvtCursorFont();
Xstatic Bool cvtFocusStyle();
Xstatic Bool cvtFont();
Xstatic Bool cvtIconLocation();
Xstatic Bool cvtInteger();
Xstatic Bool cvtKey();
Xstatic Bool cvtMouseless();
Xstatic Bool cvtString();
Xstatic Bool cvtStringList();
Xstatic Bool cvtGridEnum();
Xstatic Bool cvtImageType();
X
X/* internationalization stuff */
X
X#ifdef OW_I18N_L3
Xstatic Bool OLLCUpdated = False;
X
Xstatic void GRVLCInit();
Xstatic Bool cvtOLLC();
Xstatic Bool cvtOLLCCL();
X#endif /* OW_I18N_L3 */
X
X
X/* updaters */
X
Xstatic void updButtonFont();
X void UpdFocusStyle(); /* yes, this one's global */
Xstatic void updGlyphFont();
Xstatic void updIconFont();
Xstatic void updIconLocation();
Xstatic void updMouseless();
Xstatic void updString();
Xstatic void updStringList();
Xstatic void updSync();
Xstatic void updTextFont();
Xstatic void updTitleFont();
Xstatic void updWorkspace();
Xstatic void updWindow();
Xstatic void updForeground();
Xstatic void updBackground();
Xstatic void updBorder();
Xstatic void updVirtualDesktop();
Xstatic void updVirtualGeometry();
Xstatic void updVirtualFont();
Xstatic void updVirtualMap();
Xstatic void updVirtualMapColor();
Xstatic void updVirtualBgColor();
Xstatic void updVirtualFgColor();
Xstatic void updVirtualIconGeometry();
Xstatic void updVirtualFontColor();
Xstatic void updVirtualScale();
Xstatic void updVirtualGridColor();
Xstatic void updInputFocusColor();
X
Xextern void setScreenVirtualForegroundColor();
Xextern void setScreenVirtualBackgroundColor();
Xextern void setScreenVirtualFontColor();
Xextern void setScreenVirtualGridColor();
Xextern void setScreenInputFocusColor();
Xextern void updateScreenVirtualFont();
Xextern void updateScreenVirtualMap();
Xextern void updateScreenVirtualGeometry();
Xextern void updateScreenVirtualDesktop();
Xextern void updateScreenVirtualIconGeometry();
Xextern void updateScreenVirtualScale();
Xextern void setScreenVirtualPixmapColor();
Xextern void setScreenInputFocusColor();
X
X/* resource table */
X
Xtypedef struct _resourceitem {
X char *instance;
X char *class;
X char *defaultString;
X void *addr;
X Bool (*converter)();
X void (*updater)();
X XrmQuark instanceQ;
X XrmQuark classQ;
X} ResourceItem;
X
XResourceItem ResourceTable[] = {
X
X{ "titleFont", "TitleFont",
X "-b&h-lucida-bold-r-normal-sans-*-120-*-*-*-*-*-*",
X &(GRV.TitleFontInfo), cvtFont, updTitleFont },
X{ "textFont", "TextFont",
X "-b&h-lucida-medium-r-normal-sans-*-120-*-*-*-*-*-*",
X &(GRV.TextFontInfo), cvtFont, updTextFont },
X{ "buttonFont", "ButtonFont",
X "-b&h-lucida-medium-r-normal-sans-*-120-*-*-*-*-*-*",
X &(GRV.ButtonFontInfo), cvtFont, updButtonFont },
X{ "iconFont", "IconFont",
X "-b&h-lucida-medium-r-normal-sans-*-120-*-*-*-*-*-*",
X &(GRV.IconFontInfo), cvtFont, updIconFont },
X{ "glyphFont", "GlyphFont",
X "-sun-open look glyph-*-*-*-*-*-120-*-*-*-*-*-*",
X &(GRV.GlyphFontInfo), cvtFont, updGlyphFont },
X{ "cursorFont", "CursorFont",
X "-sun-open look cursor-*-*-*-*-*-120-*-*-*-*-*-*",
X &(GRV.BasicPointer), cvtCursorFont, NULL },
X
X{ "foreground", "Foreground", "#000000",
X &(GRV.ForegroundColor), cvtString, updForeground },
X{ "background", "Background", "#ffffff",
X &(GRV.BackgroundColor), cvtString, updBackground },
X{ "reverseVideo", "ReverseVideo", "False",
X &(GRV.ReverseVideo), cvtBoolean, NULL },
X{ "borderColor", "BorderColor", "#000000",
X &(GRV.BorderColor), cvtString, updBorder },
X{ "windowColor", "WindowColor", "#cccccc",
X &(GRV.WindowColor), cvtString, updWindow },
X{ "workspaceColor", "WorkspaceColor", "#40a0c0",
X &(GRV.WorkspaceColor), cvtString, updWorkspace },
X{ "paintWorkspace", "PaintWorkspace", "True",
X &(GRV.PaintWorkspace), cvtBoolean, NULL },
X{ "use3D", "Use3D", "True",
X &(GRV.F3dUsed), cvtBoolean, NULL },
X{ "setInput", "SetInput", "Select",
X &(GRV.FocusFollowsMouse), cvtFocusStyle, UpdFocusStyle },
X{ "defaultTitle", "DefaultTitle", "No Name",
X &(GRV.DefaultWinName), cvtString, updString },
X{ "flashFrequency", "FlashFrequency", "100000",
X &(GRV.FlashTime), cvtInteger, NULL },
X{ "flashTime", "FlashTime", "100000",
X &(GRV.FlashTime), cvtInteger, NULL },
X{ "iconLocation", "IconLocation", "bottom",
X &(GRV.IconPlacement), cvtIconLocation, updIconLocation },
X{ "focusLenience", "FocusLenience", "False",
X &(GRV.FocusLenience), cvtBoolean, NULL },
X{ "dragWindow", "DragWindow", "False",
X &(GRV.DragWindow), cvtBoolean, NULL },
X{ "autoRaise", "AutoRaise", "False",
X &(GRV.AutoRaise), cvtBoolean, NULL },
X{ "autoRaiseDelay", "AutoRaiseDelay", "0",
X &(GRV.AutoRaiseDelay), cvtInteger, NULL },
X{ "dragRightDistance", "DragRightDistance", "100",
X &(GRV.DragRightDistance), cvtInteger, NULL },
X{ "moveThreshold", "MoveThreshold", "5",
X &(GRV.MoveThreshold), cvtInteger, NULL },
X{ "dragThreshold", "DragThreshold", "5",
X &(GRV.MoveThreshold), cvtInteger, NULL },
X{ "clickMoveThreshold", "ClickMoveThreshold", "5",
X &(GRV.ClickMoveThreshold), cvtInteger, NULL },
X{ "multiClickTimeout", "MultiClickTimeout", "5",
X &(GRV.DoubleClickTime), cvtClickTimeout, NULL },
X{ "frontKey", "FrontKey", "Any L5",
X &(GRV.FrontKey), cvtKey, NULL },
X{ "helpKey", "HelpKey", "Help",
X &(GRV.HelpKey), cvtKey, NULL },
X{ "openKey", "OpenKey", "Any L7",
X &(GRV.OpenKey), cvtKey, NULL },
X{ "confirmKey", "ConfirmKey", "Return",
X &(GRV.ConfirmKey), cvtKey, NULL },
X{ "printOrphans", "PrintOrphans", "False",
X &(GRV.PrintOrphans), cvtBoolean, NULL },
X{ "printAll", "PrintAll", "False",
X &(GRV.PrintAll), cvtBoolean, NULL },
X{ "synchronize", "Synchronize", "False",
X &(GRV.Synchronize), cvtBoolean, updSync },
X{ "snapToGrid", "SnapToGrid", "False",
X &(GRV.FSnapToGrid), cvtBoolean, NULL },
X{ "saveWorkspaceTimeout", "SaveWorkspaceTimeout", "30",
X &(GRV.SaveWorkspaceTimeout), cvtInteger, NULL },
X{ "popupJumpCursor", "PopupJumpCursor", "True",
X &(GRV.PopupJumpCursor), cvtBoolean, NULL },
X{ "cancelKey", "CancelKey", "Escape",
X &(GRV.CancelKey), cvtKey, NULL },
X{ "colorLockKey", "ColorLockKey", "Control L2",
X &(GRV.ColorLockKey), cvtKey, NULL },
X{ "colorUnlockKey", "ColorUnlockKey", "Control L4",
X &(GRV.ColorUnlockKey), cvtKey, NULL },
X{ "colorFocusLocked", "ColorFocusLocked", "False",
X &(GRV.ColorLocked), cvtBoolean, NULL },
X{ "edgeMoveThreshold", "EdgeMoveThreshold", "10",
X &(GRV.EdgeThreshold), cvtInteger, NULL },
X{ "rubberBandThickness", "RubberBandThickness", "2",
X &(GRV.RubberBandThickness), cvtInteger, NULL },
X{ "beep", "Beep", "always",
X &(GRV.Beep), cvtBeepStatus, NULL },
X{ "pPositionCompat", "PPositionCompat", "false",
X &(GRV.PPositionCompat), cvtBoolean, NULL },
X{ "minimalDecor", "MinimalDecor", "",
X &(GRV.Minimals), cvtStringList, updStringList },
X{ "use3DFrames", "Use3DFrames", "False",
X &(GRV.F3dFrames), cvtBoolean, NULL },
X{ "use3DResize", "Use3DResize", "True",
X &(GRV.F3dResize), cvtBoolean, NULL },
X{ "refreshRecursively", "RefreshRecursively", "True",
X &(GRV.RefreshRecursively), cvtBoolean, NULL },
X{ "mouseChordTimeout", "MouseChordTimeout", "100",
X &(GRV.MouseChordTimeout), cvtInteger, NULL },
X{ "singleScreen", "SingleScreen", "False",
X &(GRV.SingleScreen), cvtBoolean, NULL },
X{ "autoReReadMenuFile", "AutoReReadMenuFile", "True",
X &(GRV.AutoReReadMenuFile), cvtBoolean, NULL },
X{ "keepTransientsAbove", "KeepTransientsAbove", "True",
X &(GRV.KeepTransientsAbove), cvtBoolean, NULL },
X{ "transientsSaveUnder", "TransientsSaveUnder", "True",
X &(GRV.TransientsSaveUnder), cvtBoolean, NULL },
X{ "transientsTitled", "TransientsTitled", "True",
X &(GRV.TransientsTitled), cvtBoolean, NULL },
X{ "selectWindows", "SelectWindows", "True",
X &(GRV.SelectWindows), cvtBoolean, NULL },
X{ "showMoveGeometry", "ShowMoveGeometry", "False",
X &(GRV.ShowMoveGeometry), cvtBoolean, NULL },
X{ "showResizeGeometry", "ShowResizeGeometry", "False",
X &(GRV.ShowResizeGeometry), cvtBoolean, NULL },
X{ "invertFocusHighlighting", "InvertFocusHighlighting", "False",
X &(GRV.InvertFocusHighlighting), cvtBoolean, NULL },
X{ "runSlaveProcess", "RunSlaveProcess", "True",
X &(GRV.RunSlaveProcess), cvtBoolean, NULL },
X{ "selectToggleStacking", "SelectToggleStacking","False",
X &(GRV.SelectToggleStacking),cvtBoolean, NULL },
X{ "flashCount", "FlashCount", "6",
X &(GRV.FlashCount), cvtInteger, NULL },
X{ "defaultIconImage", "DefaultIconImage", NULL,
X &(GRV.DefaultIconImage), cvtString, NULL },
X{ "defaultIconMask", "DefaultIconMask", NULL,
X &(GRV.DefaultIconMask), cvtString, NULL },
X{ "serverGrabs", "ServerGrabs", "True",
X &(GRV.ServerGrabs), cvtBoolean, NULL },
X{ "iconFlashCount", "IconFlashCount", "3",
X &(GRV.IconFlashCount), cvtInteger, NULL },
X{ "selectDisplaysMenu", "SelectDisplaysMenu", "False",
X &(GRV.SelectDisplaysMenu), cvtBoolean, NULL },
X{ "selectionFuzz", "SelectionFuzz", "1",
X &(GRV.SelectionFuzz), cvtInteger, NULL },
X{ "autoInputFocus", "AutoInputFocus", "False",
X &(GRV.AutoInputFocus), cvtBoolean, NULL },
X{ "autoColorFocus", "AutoColorFocus", "False",
X &(GRV.AutoColorFocus), cvtBoolean, NULL },
X{ "colorTracksInputFocus", "ColorTracksInputFocus","False",
X &(GRV.ColorTracksInputFocus),cvtBoolean, NULL },
X{ "iconFlashOnTime", "IconFlashOnTime", "20000",
X &(GRV.IconFlashOnTime), cvtInteger, NULL },
X{ "iconFlashOffTime", "IconFlashOffTime", "1",
X &(GRV.IconFlashOffTime), cvtInteger, NULL },
X{ "keyboardCommands", "KeyboardCommands", "Basic",
X &(GRV.Mouseless), cvtMouseless, updMouseless },
X{ "raiseOnActivate", "RaiseOnActivate", "True",
X &(GRV.RaiseOnActivate), cvtBoolean, NULL },
X{ "restackWhenWithdraw", "RestackWhenWithdraw", "True",
X &(GRV.RestackWhenWithdraw), cvtBoolean, NULL },
X
X#ifdef OW_I18N_L3
X
X{ "basicLocale", "BasicLocale", NULL,
X &(GRV.LC.BasicLocale), cvtOLLC, NULL },
X{ "basicLocaleCL", "BasicLocaleCL", NULL,
X &(GRV.LC.BasicLocale), cvtOLLCCL, NULL },
X
X{ "displayLang", "DisplayLang", NULL,
X &(GRV.LC.DisplayLang), cvtOLLC, NULL },
X{ "displayLangCL", "DisplayLangCL", NULL,
X &(GRV.LC.DisplayLang), cvtOLLCCL, NULL },
X
X{ "inputLang", "InputLang", NULL,
X &(GRV.LC.InputLang), cvtOLLC, NULL },
X{ "inputLangCL", "InputLangCL", NULL,
X &(GRV.LC.InputLang), cvtOLLCCL, NULL },
X
X{ "numeric", "Numeric", NULL,
X &(GRV.LC.Numeric), cvtOLLC, NULL },
X{ "numericCL", "NumericCL", NULL,
X &(GRV.LC.Numeric), cvtOLLCCL, NULL },
X
X{ "dateFormat", "DateFormat", NULL,
X &(GRV.LC.DateFormat), cvtOLLC, NULL },
X{ "dateFormatCL", "DateFormatCL", NULL,
X &(GRV.LC.DateFormat), cvtOLLCCL, NULL },
X
X#endif /* OW_I18N_L3 */
X
X{ "virtualDesktop", "VirtualDesktop", "3x2",
X &(GRV.VirtualDesktop), cvtString, updVirtualDesktop },
X{ "pannerScale", "PannerScale", "15",
X &(GRV.VDMScale), cvtInteger, updVirtualScale },
X{ "allowMoveIntoDesktop", "AllowMoveIntoDesktop", "True",
X &(GRV.AllowMoveIntoDesktop),cvtBoolean, NULL },
X{ "allowArrowInRoot", "AllowArrowInRoot", "True",
X &(GRV.ArrowInRoot), cvtBoolean, NULL },
X{ "virtualGeometry", "VirtualGeometry", "",
X &(GRV.VirtualGeometry), cvtString, updVirtualGeometry },
X{ "virtualFont", "VirtualFont", "5x8",
X &(GRV.VirtualFontName), cvtString, updVirtualFont },
X{ "virtualBackgroundMap", "VirtualBackgroundMap", NULL,
X &(GRV.VirtualBackgroundMap),cvtString, updVirtualMap },
X{ "virtualBackgroundColor", "VirtualBackgroundColor", NULL,
X &(GRV.VirtualBackgroundColor),cvtString, updVirtualBgColor },
X{ "virtualPixmapColor", "VirtualPixmapColor", NULL,
X &(GRV.VirtualPixmapColor), cvtString, updVirtualMapColor },
X{ "virtualIconGeometry", "VirtualIconGeometry", "",
X &(GRV.VirtualIconGeometry), cvtString, updVirtualIconGeometry},
X{ "virtualForegroundColor", "VirtualForegroundColor", NULL,
X &(GRV.VirtualForegroundColor),cvtString, updVirtualFgColor },
X{ "virtualFontColor", "VirtualFontColor", NULL,
X &(GRV.VirtualFontColor), cvtString, updVirtualFontColor },
X{ "virtualIconic", "VirtualIconic", "False",
X &(GRV.VirtualIconic), cvtBoolean, NULL },
X{ "virtualSticky", "VirtualSticky", "",
X &(GRV.StickyList), cvtStringList, NULL, },
X{ "relativePosition", "RelativePosition", "True",
X &(GRV.UseRelativePosition), cvtBoolean, NULL },
X{ "grabVirtualKeys", "GrabVirtualKeys", "True",
X &(GRV.GrabVirtualKeys), cvtBoolean, NULL },
X{ "virtualGrid", "VirtualGrid", "Visible",
X &(GRV.VirtualGrid), cvtGridEnum, NULL },
X{ "virtualGridColor", "VirtualGridColor", "Black",
X &(GRV.VirtualGridColor), cvtString, updVirtualGridColor },
X{ "raiseOnMove", "RaiseOnMove", "False",
X &(GRV.VirtualRaiseOnMove), cvtBoolean, NULL },
X{ "virtualRaiseVDM", "VirtualRaiseVDM", "False",
X &(GRV.VirtualRaiseVDM), cvtBoolean, NULL },
X{ "AutoShowRootMenu", "AutoShowRootMenu", "False",
X &(GRV.AutoShowRootMenu), cvtBoolean, NULL },
X{ "AutoRootMenuX", "AutoRootMenuX", "0",
X &(GRV.AutoRootMenuX), cvtInteger, NULL },
X{ "AutoRootMenuY", "AutoRootMenuY", "0",
X &(GRV.AutoRootMenuY), cvtInteger, NULL },
X{ "inputFocusColor", "InputFocusColor", NULL,
X &(GRV.InputFocusColor), cvtString, updInputFocusColor },
X{ "fullSizeZoomX", "FullSizeZoomX", "False",
X &(GRV.FullSizeZoomX), cvtBoolean, NULL },
X{ "noDecor", "NoDecor", "",
X &(GRV.NoDecors), cvtStringList, NULL },
X{ "resizeMoveGeometry", "ResizeMoveGeometry", "0+0",
X &(GRV.ResizePosition), cvtString, NULL },
X{ "useImages", "UseImages", "UseVDM",
X &(GRV.UseImageMenu), cvtImageType, NULL },
X{ "virtualMoveGroup", "VirtualMoveGroup", "True",
X &(GRV.VirtualMoveGroups), cvtBoolean, NULL },
X};
X
X#define NRESOURCEITEMS (sizeof(ResourceTable)/sizeof(ResourceItem))
X
X
X/* ===== Utilities ======================================================== */
X
X
X/*
X * Copy a string, converting it to lower case.
X */
Xstatic void
Xstrnlower(dest, src, n)
X char *dest;
X char *src;
X int n;
X{
X char *p;
X
X strncpy(dest, src, n);
X dest[n-1] = '\0'; /* force null termination */
X
X for (p = dest; *p; ++p)
X if (isupper(*p))
X *p = tolower(*p);
X}
X
X
X#define BSIZE 100
X
X/*
X * Determine whether value matches pattern, irrespective of case.
X * This routine is necessary because not all systems have strcasecmp().
X */
XBool
XMatchString(value, pattern)
X char *value;
X char *pattern;
X{
X char buf[BSIZE];
X
X strnlower(buf, value, BSIZE);
X return (0 == strcmp(buf, pattern));
X}
X
X
X/*
X * Match any of the following booleans: yes, no, 1, 0, on, off, t, nil,
X * true, false. Pass back the boolean matched in ret, and return True.
X * Otherwise, return False. Matches are case-insensitive.
X */
Xstatic Bool
XmatchBool(value, ret)
X char *value;
X Bool *ret;
X{
X char buf[BSIZE];
X
X strnlower(buf, value, BSIZE);
X
X if (0 == strcmp(buf, "yes") ||
X 0 == strcmp(buf, "on") ||
X 0 == strcmp(buf, "t") ||
X 0 == strcmp(buf, "true") ||
X 0 == strcmp(buf, "1"))
X {
X *ret = True;
X return True;
X }
X
X if (0 == strcmp(buf, "no") ||
X 0 == strcmp(buf, "off") ||
X 0 == strcmp(buf, "nil") ||
X 0 == strcmp(buf, "false") ||
X 0 == strcmp(buf, "0"))
X {
X *ret = False;
X return True;
X }
X
X return False;
X}
X
X
X/*
X * BoolString() - return Bool based on string, returning the default value if
X * the string can't be converted.
X */
XBool
XBoolString(s, dflt)
X char *s;
X Bool dflt;
X{
X Bool b;
X
X if (matchBool(s,&b))
X return b;
X else
X return dflt;
X}
X
X
X/*
X * Match any of the following input focus keywords: followmouse, follow, f,
X * select, s, click, clicktotype, c. Pass back True for focusfollows or
X * False for clicktotype in ret (since FocusFollowsMouse is the global
X * corresponding to this resource), and return True.
X * Otherwise, return False.
X */
Xstatic Bool
XmatchFocusKeyword(value, ret)
X char *value;
X Bool *ret;
X{
X char buf[BSIZE];
X
X strnlower(buf, value, BSIZE);
X
X if (0 == strcmp(buf, "followmouse") ||
X 0 == strcmp(buf, "follow") ||
X 0 == strcmp(buf, "f"))
X {
X *ret = True;
X return True;
X }
X
X if (0 == strcmp(buf, "select") ||
X 0 == strcmp(buf, "click") ||
X 0 == strcmp(buf, "clicktotype") ||
X 0 == strcmp(buf, "c") ||
X 0 == strcmp(buf, "s"))
X {
X *ret = False;
X return True;
X }
X
X return False;
X}
X
X
X/*
X * Match any of the three possible beep keywords: always, never, or notices.
X * Pass back the BeepStatus value by reference, and return True, if
X * a match was found; otherwise return False and do not disturb the
X * passed value.
X */
Xstatic Bool
XmatchBeepKeyword(value, ret)
X char *value;
X BeepStatus *ret;
X{
X if (MatchString(value,"always"))
X {
X *ret = BeepAlways;
X return True;
X }
X if (MatchString(value,"never"))
X {
X *ret = BeepNever;
X return True;
X }
X if (MatchString(value,"notices"))
X {
X *ret = BeepNotices;
X return True;
X }
X return False;
X}
X
X
X/*
X * Match an icon placement keyword. Store matched value in ret and return
X * True, or return False if no match occurred.
X */
Xstatic Bool
XmatchIconPlace( value, ret )
Xchar *value;
XIconPreference *ret;
X{
X if (MatchString(value, "top"))
X {
X *ret = AlongTop;
X return True;
X }
X if (MatchString(value, "bottom"))
X {
X *ret = AlongBottom;
X return True;
X }
X if (MatchString(value, "right"))
X {
X *ret = AlongRight;
X return True;
X }
X if (MatchString(value, "left"))
X {
X *ret = AlongLeft;
X return True;
X }
X if (MatchString(value, "top-lr"))
X {
X *ret = AlongTop;
X return True;
X }
X if (MatchString(value, "top-rl"))
X {
X *ret = AlongTopRL;
X return True;
X }
X if (MatchString(value, "bottom-lr"))
X {
X *ret = AlongBottom;
X return True;
X }
X if (MatchString(value, "bottom-rl"))
X {
X *ret = AlongBottomRL;
X return True;
X }
X if (MatchString(value, "right-tb"))
X {
X *ret = AlongRight;
X return True;
X }
X if (MatchString(value, "right-bt"))
X {
X *ret = AlongRightBT;
X return True;
X }
X if (MatchString(value, "left-tb"))
X {
X *ret = AlongLeft;
X return True;
X }
X if (MatchString(value, "left-bt"))
X {
X *ret = AlongLeftBT;
X return True;
X }
X
X return False;
X}
X
X
Xstatic Bool
XmatchMouselessKeyword(str, ret)
X char *str;
X MouselessMode *ret;
X{
X if (0 == strcmp(str, "SunView1")) {
X *ret = KbdSunView;
X return True;
X } else if (0 == strcmp(str, "Basic")) {
X *ret = KbdBasic;
X return True;
X } else if (0 == strcmp(str, "Full")) {
X *ret = KbdFull;
X return True;
X }
X return False;
X}
X
X
X/*
X * Parse a key specification of the form
X *
X * [modifier ...] keysym
X *
X * For example, "Control Shift F7". Returns True if a valid keyspec was
X * parsed, otherwise False. The modifier mask is returned in modmask, and the
X * keycode is returned in keycode.
X */
Xstatic Bool
XparseKeySpec(dpy, str, modmask, keycode)
X Display *dpy;
X char *str;
X unsigned int *modmask;
X KeyCode *keycode;
X{
X char line[100];
X char *word;
X extern unsigned int FindModiferMask();
X int kc, m;
X int mask = 0;
X int code = 0;
X KeySym ks;
X
X strcpy(line, str);
X word = strtok(line, " \t");
X if (word == NULL)
X return False;
X
X while (word != NULL) {
X ks = XStringToKeysym(word);
X if (ks == NoSymbol) {
X if (strcmp(word, "Any") == 0) {
X mask = AnyModifier;
X word = strtok(NULL, " \t");
X continue;
X } else if (strcmp(word, "Shift") == 0)
X ks = XK_Shift_L;
X else if (strcmp(word, "Control") == 0)
X ks = XK_Control_L;
X else if (strcmp(word, "Meta") == 0)
X ks = XK_Meta_L;
X else if (strcmp(word, "Alt") == 0)
X ks = XK_Alt_L;
X else if (strcmp(word, "Super") == 0)
X ks = XK_Super_L;
X else if (strcmp(word, "Hyper") == 0)
X ks = XK_Hyper_L;
X else
X return False;
X }
X
X kc = XKeysymToKeycode(dpy, ks);
X if (kc == 0)
X return False;
X
X m = FindModifierMask(kc);
X if (m == 0) {
X code = kc;
X break;
X }
X mask |= m;
X word = strtok(NULL, " \t");
X }
X
X if (code == 0)
X return False;
X
X *keycode = code;
X *modmask = mask;
X return True;
X}
X
X
X#ifdef OW_I18N_L3
X
Xstatic void
XsetOLLCPosix()
X{
X register OLLCItem *ollci, *ollci_end;
X register char *current;
X
X
X ollci = &(GRV.LC.BasicLocale);
X ollci_end = &ollci[OLLC_LC_MAX];
X for (ollci++; ollci < ollci_end; ollci++)
X {
X if ((ollci->locale == NULL
X || ollci->priority >= OLLC_SRC_POSIX)
X && ollci->posix_category >= 0)
X {
X ollci->locale = strdup(setlocale(
X ollci->posix_category, NULL));
X OLLCUpdated = True;
X }
X }
X}
X
X#endif /* OW_I18N_L3 */
X
X
X/* ===== Converters ======================================================= */
X
X
X/*
X * static Bool cvtWhatever(dpy, item, string, addr)
X *
X * The job of the converter is to take a string and convert it into the value
X * appropriate for storage into a global variable. If the conversion is
X * successful, the value is stored at addr and True is returned. Otherwise,
X * False is returned. NOTE: the converted global variable shouldn't have any
X * pointers into the resource database. If it's necessary to keep a handle on
X * this data, the converter should allocate memory and make a copy. See also
X * the note about memory allocation in the comment at the top of the updaters
X * section, below.
X */
X
X
Xstatic Bool
XcvtBoolean(dpy, item, string, addr)
X Display *dpy;
X ResourceItem *item;
X char *string;
X void *addr;
X{
X return matchBool(string, (Bool *)addr);
X}
X
X
Xstatic Bool
XcvtFont(dpy, item, string, addr)
X Display *dpy;
X ResourceItem *item;
X char *string;
X void *addr;
X{
X XFontStruct **dest = addr;
X XFontStruct *info;
X
X info = XLoadQueryFont(dpy, string);
X
X if (info == NULL)
X return False;
X
X *dest = info;
X return True;
X}
X
X
X/*
X * cvtCursorFont -- set up ALL cursors from cursor font specified.
X *
X * NOTE that CursorColor and Bg1Color must be set before the cursors!
X *
X * Notice that six cursors are set up (and stored in six separate GRV
X * elements) from this single resource. REMIND: this is kind of bogus.
X * Ideally, all six cursors would have fonts and character indexes specifiable
X * independently. Further, addr isn't used; GRV is stored directly.
X *
X * REMIND: this appears to have a resource leak, in that cursorFont is loaded
X * but never unloaded.
X */
Xstatic Bool
XcvtCursorFont(dpy, item, string, addr)
X Display *dpy;
X ResourceItem *item;
X char *string;
X void *addr;
X{
X Font cursorFont;
X int ii;
X Cursor *tmpVariable;
X unsigned int tmpFontIndex;
X unsigned int defaultIndex;
X XColor foreColor, backColor;
X
X cursorFont = XLoadFont(dpy, string);
X
X /*
X * REMIND: the following doesn't make any sense. XLoadFont() simply
X * allocates an ID, sends the LoadFont requst, and returns the ID. There
X * is no error indication in the return value from XLoadFont(). This
X * needs to be fixed. Perhaps using XLoadQueryFont() would be the right
X * thing.
X */
X
X if (cursorFont == NULL)
X return False;
X
X /*
X * REMIND: in the future, we will probably want to set up some scheme for
X * customizing cursor colors. For now, use black and white.
X */
X
X foreColor.red = foreColor.green = foreColor.blue = 0; /* black */
X backColor.red = backColor.green = backColor.blue = 65535; /* white */
X
X for (ii = 0; ii < NUM_CURSORS; ++ii) {
X
X switch (ii) {
X
X case BASICPTR:
X tmpVariable = &GRV.BasicPointer;
X tmpFontIndex = OLC_basic;
X defaultIndex = XC_left_ptr;
X break;
X
X case MOVEPTR:
X tmpVariable = &GRV.MovePointer;
X tmpFontIndex = OLC_basic;
X defaultIndex = XC_left_ptr;
X break;
X
X case BUSYPTR:
X tmpVariable = &GRV.BusyPointer;
X tmpFontIndex = OLC_busy;
X defaultIndex = XC_watch;
X break;
X
X case ICONPTR:
X tmpVariable = &GRV.IconPointer;
X tmpFontIndex = OLC_basic;
X defaultIndex = XC_left_ptr;
X break;
X
X case RESIZEPTR:
X tmpVariable = &GRV.ResizePointer;
X tmpFontIndex = OLC_beye;
X defaultIndex = XC_tcross;
X break;
X
X case MENUPTR:
X tmpVariable = &GRV.MenuPointer;
X tmpFontIndex = OLC_basic;
X defaultIndex = XC_sb_right_arrow;
X break;
X
X case QUESTIONPTR:
X tmpVariable = &GRV.QuestionPointer;
X tmpFontIndex = OLC_basic;
X defaultIndex = XC_question_arrow;
X break;
X
X case TARGETPTR:
X tmpVariable = &GRV.TargetPointer;
X tmpFontIndex = OLC_basic;
X defaultIndex = XC_circle;
X break;
X
X case PANPTR:
X tmpVariable = &GRV.PanPointer;
X tmpFontIndex = OLC_panning;
X defaultIndex = XC_sb_v_double_arrow;
X break;
X }
X
X if (cursorFont == 0 ||
X 0 == (*tmpVariable = XCreateGlyphCursor(dpy, cursorFont,
X cursorFont, tmpFontIndex, tmpFontIndex+1,
X &foreColor, &backColor)))
X {
X /* use default */
X *tmpVariable = XCreateFontCursor( dpy, defaultIndex );
X#ifdef LATER
X XRecolorCursor(dpy, tmpVariable, &foreColor, &backColor);
X#endif
X }
X }
X
X return True;
X}
X
X
X/*
X * Converting a string simply means making a copy of it.
X */
Xstatic Bool
XcvtString(dpy, item, string, addr)
X Display *dpy;
X ResourceItem *item;
X char *string;
X void *addr;
X{
X char **str = addr;
X
X if (string == NULL)
X return False;
X
X *str = MemNewString(string);
X return True;
X}
X
X
Xstatic Bool
XcvtFloat(dpy, item, string, addr)
X Display *dpy;
X ResourceItem *item;
X char *string;
X void *addr;
X{
X return (1 == sscanf(string, "%f", (float *)addr));
X}
X
X
X/*
X * Convert an integer. Note that %i converts from decimal, octal, and
X * hexadecimal representations.
X */
Xstatic Bool
XcvtInteger(dpy, item, string, addr)
X Display *dpy;
X ResourceItem *item;
X char *string;
X void *addr;
X{
X return (1 == sscanf(string, "%i", (int *)addr));
X}
X
X
X/*
X * Convert a string representing tenths of a second into milliseconds.
X */
Xstatic Bool
XcvtClickTimeout(dpy, item, string, addr)
X Display *dpy;
X ResourceItem *item;
X char *string;
X void *addr;
X{
X int intval;
X int *dest = addr;
X
X if (1 != sscanf(string, "%d", &intval))
X return False;
X
X intval *= 100; /* convert to milliseconds */
X
X /*
X * It's nearly impossible for typical mouse hardware to generate two
X * clicks in less than 100ms. We special-case this and make the minimum
X * timeout value be 150ms.
X */
X if (intval < 150)
X intval = 150;
X
X *dest = intval;
X return True;
X}
X
X
Xstatic Bool
XcvtFocusStyle(dpy, item, string, addr)
X Display *dpy;
X ResourceItem *item;
X char *string;
X void *addr;
X{
X return matchFocusKeyword(string, (Bool *)addr);
X}
X
X
Xstatic Bool
XcvtBeepStatus(dpy, item, string, addr)
X Display *dpy;
X ResourceItem *item;
X char *string;
X void *addr;
X{
X return matchBeepKeyword(string, (BeepStatus *)addr);
X}
X
X
Xstatic Bool
XcvtMouseless(dpy, item, string, addr)
X Display *dpy;
X ResourceItem *item;
X char *string;
X void *addr;
X{
X return matchMouselessKeyword(string, (MouselessMode *)addr);
X}
X
X
Xstatic Bool
XcvtIconLocation(dpy, item, string, addr)
X Display *dpy;
X ResourceItem *item;
X char *string;
X void *addr;
X{
X return matchIconPlace(string, (IconPreference *)addr);
X}
X
X
X/*
X * Convert a key specification. REMIND: this needs to be reconciled with the
X * key specification stuff in evbind.c.
X */
Xstatic Bool
XcvtKey(dpy, item, string, addr)
X Display *dpy;
X ResourceItem *item;
X char *string;
X void *addr;
X{
X KeySpec *keyspec = addr;
X unsigned int modmask;
X KeyCode keycode;
X
X if (!parseKeySpec(dpy, string, &modmask, &keycode))
X return False;
X
X keyspec->modmask = modmask;
X keyspec->keycode = keycode;
X return True;
X}
X
X
X/*
X * buildStringList -- parse a string into words and build a linked list of
X * them.
X */
Xstatic void
XbuildStringList(str, pplist)
Xchar *str;
XList **pplist;
X{
X char *swork, *swork2;
X List *l = NULL_LIST;
X
X swork2 = swork = MemNewString(str);
X
X while ((swork2 = strtok(swork2, " \t")) != NULL) {
X l = ListCons(MemNewString(swork2),l);
X swork2 = NULL;
X }
X MemFree(swork);
X *pplist = l;
X}
X
X
Xstatic void *
XfreeStringList(str,junk)
Xchar *str;
Xvoid *junk;
X{
X MemFree(str);
X return NULL;
X}
X
X
Xstatic Bool
XcvtStringList(dpy, item, string, addr)
X Display *dpy;
X ResourceItem *item;
X char *string;
X void *addr;
X{
X List **dest = addr;
X List *newl = NULL_LIST;
X
X buildStringList(string, &newl);
X *dest = newl;
X return True;
X}
X
X
X#ifdef OW_I18N_L3
X
X/*
X * REMIND: somewhat strange. This function always returns True, so the
X * default value in the Resource Table is never used. Further, this function
X * handles both the conversion and update functions itself.
X */
Xstatic Bool
X_cvtOLLC(dpy, item, string, addr, priority)
X Display *dpy;
X ResourceItem *item;
X char *string;
X void *addr;
X{
X OLLCItem *ollcitem = addr;
X char *newlocale;
X
X if (priority < ollcitem->priority)
X return True;
X
X#ifdef notdef
X fprintf(stderr,
X"_cvtOLLC locale#%d, newpri=%d, curpri=%d, newlocale %s, curlocale %s\n",
X ollcitem->posix_category, priority, ollcitem->priority,
X string, ollcitem->locale);
X#endif
X
X /* don't need to do anything if the new locale is the same as the old */
X
X if ((string == NULL && ollcitem->locale == NULL) ||
X (string != NULL && ollcitem->locale != NULL &&
X 0 == strcmp(string, ollcitem->locale)))
X {
X return True;
X }
X
X /* they differ; update the locale */
X
X if (string == NULL)
X newlocale = NULL;
X else
X newlocale = MemNewString(string);
X
X if (ollcitem->locale != NULL)
X MemFree(ollcitem->locale);
X
X ollcitem->locale = newlocale;
X ollcitem->priority = priority;
X
X OLLCUpdated = True;
X
X#ifdef notdef
X fprintf(stderr, "_cvtOLLC: locale#%d -> %s\n",
X ollcitem->posix_category, ollcitem->locale);
X#endif
X
X return True;
X}
X
X
Xstatic Bool
XcvtOLLC(dpy, item, string, addr)
X Display *dpy;
X ResourceItem *item;
X char *string;
X void *addr;
X{
X return _cvtOLLC(dpy, item, string, addr, OLLC_SRC_RESOURCE);
X}
X
X
Xstatic Bool
XcvtOLLCCL(dpy, item, string, addr)
X Display *dpy;
X ResourceItem *item;
X char *string;
X void *addr;
X{
X return _cvtOLLC(dpy, item, string, addr, OLLC_SRC_COMMAND_LINE);
X}
X
X#endif /* OW_I18N_L3 */
X
X
X
X/* ===== Updaters ========================================================= */
X
X
X/*
X * static void updWhatever(dpy, item, cur, new);
X *
X * The job of the updater is to compare the current value and newly converted
X * values, and update the current value if they differ. It is responsible
X * for all changes in global state, such as grabbing and ungrabbing keys.
X * NOTE: if the converter has allocated memory, the updater must free it
X * appropriately. Since the updater is called with old and new values,
X * exactly one of them should be freed by the updater, otherwise a memory leak
X * will result.
X */
X
Xstatic void
XupdString(dpy, item, cur, new)
X Display *dpy;
X ResourceItem *item;
X char **cur, **new;
X{
X MemFree(*cur);
X *cur = *new;
X}
X
X
Xstatic void
XupdStringList(dpy, item, cur, new)
X Display *dpy;
X ResourceItem *item;
X List **cur, **new;
X{
X ListApply(*cur, freeStringList, NULL);
X ListDestroy(*cur);
X *cur = *new;
X}
X
X
Xstatic void
XupdWorkspace(dpy, item, cur, new)
X Display *dpy;
X ResourceItem *item;
X char **cur, **new;
X{
X MemFree(*cur);
X *cur = *new;
X SetWorkspaceColor(dpy);
X}
X
X
Xstatic void
XupdWindow(dpy, item, cur, new)
X Display *dpy;
X ResourceItem *item;
X char **cur, **new;
X{
X MemFree(*cur);
X *cur = *new;
X SetWindowColor(dpy);
X}
X
X
Xstatic void
XupdForeground(dpy, item, cur, new)
X Display *dpy;
X ResourceItem *item;
X char **cur, **new;
X{
X MemFree(*cur);
X *cur = *new;
X SetForegroundColor(dpy);
X}
X
Xstatic void
XupdBackground(dpy, item, cur, new)
X Display *dpy;
X ResourceItem *item;
X char **cur, **new;
X{
X MemFree(*cur);
X *cur = *new;
X SetBackgroundColor(dpy);
X}
X
Xstatic void
XupdBorder(dpy, item, cur, new)
X Display *dpy;
X ResourceItem *item;
X char **cur, **new;
X{
X MemFree(*cur);
X *cur = *new;
X SetBorderColor(dpy);
X}
X
X
Xstatic void
XupdSync(dpy, item, cur, new)
X Display *dpy;
X ResourceItem *item;
X Bool *cur, *new;
X{
X if (*cur != *new) {
X (void) XSynchronize(dpy, *new);
X *cur = *new;
X }
X}
X
X
Xstatic void
XupdTitleFont(dpy, item, cur, new)
X Display *dpy;
X ResourceItem *item;
X XFontStruct **cur, **new;
X{
X XFree((char *) *cur);
X *cur = *new;
X SetTitleFont(dpy);
X}
X
X
Xstatic void
XupdTextFont(dpy, item, cur, new)
X Display *dpy;
X ResourceItem *item;
X XFontStruct **cur, **new;
X{
X XFree((char *) *cur);
X *cur = *new;
X SetTextFont(dpy);
X}
X
X
Xstatic void
XupdButtonFont(dpy, item, cur, new)
X Display *dpy;
X ResourceItem *item;
X XFontStruct **cur, **new;
X{
X XFree((char *) *cur);
X *cur = *new;
X SetButtonFont(dpy);
X}
X
X
Xstatic void
XupdIconFont(dpy, item, cur, new)
X Display *dpy;
X ResourceItem *item;
X XFontStruct **cur, **new;
X{
X XFree((char *) *cur);
X *cur = *new;
X SetIconFont(dpy);
X}
X
X
Xstatic void
XupdGlyphFont(dpy, item, cur, new)
X Display *dpy;
X ResourceItem *item;
X XFontStruct **cur, **new;
X{
X XFree((char *) *cur);
X *cur = *new;
X SetGlyphFont(dpy);
X}
X
X
Xstatic void
XupdIconLocation(dpy, item, cur, new)
X Display *dpy;
X ResourceItem *item;
X IconPreference *cur, *new;
X{
X if (*cur != *new) {
X *cur = *new;
X SetIconLocation(dpy);
X }
X}
X
X
Xstatic void
XupdMouseless(dpy, item, cur, new)
X Display *dpy;
X ResourceItem *item;
X MouselessMode *cur, *new;
X{
X if (*cur != *new) {
X *cur = *new;
X RefreshKeyGrabs(dpy);
X }
X}
X
X
X/*
X * unconfigureFocus
X *
X * Tell a client to remove any grabs it may have set up according to the focus
X * mode. If this client is the focus, tell it to draw in its unfocused state.
X */
Xstatic void *
XunconfigureFocus(cli)
X Client *cli;
X{
X if (cli->framewin == NULL)
X return NULL;
X FrameSetupGrabs(cli, cli->framewin->core.self, False);
X if (cli->isFocus) {
X cli->isFocus = False;
X WinCallDraw((WinGeneric *)cli->framewin);
X cli->isFocus = True;
X }
X return NULL;
X}
X
X
X/*
X * reconfigureFocus
X *
X * Tell a client to restore any grabs it may need for the new focus mode. If
X * this client is the focus, tell it to draw using the proper highlighting for
X * the new focus mode.
X */
Xstatic void *
XreconfigureFocus(cli)
X Client *cli;
X{
X if (cli->framewin == NULL)
X return NULL;
X FrameSetupGrabs(cli, cli->framewin->core.self, True);
X if (cli->isFocus) {
X WinCallDraw((WinGeneric *)cli->framewin);
X }
X return NULL;
X}
X
X
X/*
X * UpdFocusStyle -- change the focus style on the fly
X *
X * If focus style needs updating, call unconfigureFocus on every client. This
X * will clear grabs and highlighting and such while the old focus mode is
X * still in effect. Update the global value, and then call reconfigureFocus
X * on every client to set up stuff for the new focus mode.
X *
X * REMIND: This function is global because it's called from FlipFocusFunc in
X * services.c. This call passes NULL for item. This needs to be cleaned up.
X */
Xvoid
XUpdFocusStyle(dpy, item, cur, new)
X Display *dpy;
X ResourceItem *item;
X Bool *cur, *new;
X{
X if (*cur != *new) {
X ListApply(ActiveClientList, unconfigureFocus, 0);
X *cur = *new;
X ListApply(ActiveClientList, reconfigureFocus, 0);
X }
X}
X
X
X/* ===== Global Functions ================================================= */
X
X
X/*
X * InitGlobals -- probe OlwmDB for resources and store values into global
X * variables. Called once at startup time.
X */
Xvoid
XInitGlobals(dpy)
X Display *dpy;
X{
X ResourceItem *item;
X int i;
X XrmRepresentation type;
X XrmValue value;
X XrmQuark classes[3];
X XrmQuark instances[3];
X char buf[1000];
X Bool found;
X
X (void) memset((char *) &GRV, 0, sizeof(GRV));
X
X#ifdef OW_I18N_L3
X GRVLCInit();
X#endif /* OW_I18N_L3 */
X
X classes[2] = instances[2] = NULLQUARK;
X instances[0] = TopInstanceQ;
X
X for (i = 0; i < NRESOURCEITEMS; ++i) {
X classes[0] = OpenWinQ;
X
X item = &ResourceTable[i];
X classes[1] = item->classQ = XrmStringToQuark(item->class);
X instances[1] = item->instanceQ = XrmStringToQuark(item->instance);
X
X /*
X * Probe the database. If the probe fails, or if the probe succeeds
X * but the resulting value cannot be converted, convert the default
X * value into the global variable.
X *
X * In olvwm, if we don't find the resource then look up the
X * resource using the olwm class. This is arguably wrong, but
X * it allows previously specified olwm resources to work without
X * changing their name.
X */
X
X if (!XrmQGetResource(OlwmDB, instances, classes, &type, &value)) {
X classes[0] = OlwmQ;
X found = XrmQGetResource(OlwmDB, instances, classes, &type, &value);
X }
X else found = True;
X if (found)
X found = (*item->converter)(dpy, item,
X (char *)value.addr, item->addr);
X if (!found)
X (void) (*item->converter)(dpy, item, item->defaultString,
X item->addr);
X }
X
X /*
X * Special case for glyph font: if we couldn't find a valid glyph font,
X * it's a fatal error.
X */
X if (GRV.GlyphFontInfo == NULL)
X ErrorGeneral(gettext("can't open glyph font"));
X /*NOTREACHED*/
X
X#ifdef OW_I18N_L3
X setOLLCPosix();
X#endif /* OW_I18N_L3 */
X}
X
X
Xtypedef union _datum {
X int intval;
X void *pointer;
X KeySpec keyspec;
X#ifdef OW_I18N_L3
X OLLCItem ollcitem;
X#endif /* OW_I18N_L3 */
X} Datum;
X
X
Xstatic XrmBinding Bindings[] = { XrmBindTightly, XrmBindTightly };
X
X
X/*
X * UpdateGlobals -- handle updates to the server's resource database. Called
X * every time the server's RESOURCE_MANAGER property changes. stringdb is the
X * contents of this property. Creates a new database and probes into it. For
X * entries that have changed, convert the entry into a value and call the
X * update function. If there is no update function, convert the entry
X * directly into the global variable. Destroys the new database after
X * processing it.
X */
Xvoid
XUpdateGlobals(dpy, stringdb)
X Display *dpy;
X char *stringdb;
X{
X Datum datum;
X ResourceItem *item;
X int i;
X XrmDatabase newDB;
X XrmRepresentation type;
X XrmValue newvalue, oldvalue;
X XrmQuark classes[3];
X XrmQuark instances[3];
X void *dest;
X
X newDB = XrmGetStringDatabase(stringdb);
X
X classes[0] = OpenWinQ;
X instances[0] = TopInstanceQ;
X classes[2] = instances[2] = NULLQUARK;
X
X for (i = 0; i < NRESOURCEITEMS; ++i) {
X
X item = &ResourceTable[i];
X
X classes[1] = item->classQ;
X instances[1] = item->instanceQ;
X
X if (XrmQGetResource(newDB, instances, classes, &type, &newvalue)) {
X if (XrmQGetResource(OlwmDB, instances, classes, &type, &oldvalue) &&
X 0 == strcmp((char *)newvalue.addr, (char *)oldvalue.addr))
X {
X /* old and new values the same; ignore */
X continue;
X }
X
X XrmQPutStringResource(&OlwmDB, Bindings, instances,
X (char *)newvalue.addr);
X
X if (item->updater == NULL) {
X (void) (*item->converter)(dpy, item, (char *)newvalue.addr,
X item->addr);
X } else {
X (void) memset((char *) &datum, 0, sizeof(datum));
X if ((*item->converter)(dpy, item, (char *)newvalue.addr, &datum))
X (*item->updater)(dpy, item, item->addr, &datum);
X }
X }
X else {
X /*
X * use olwm resources; check above
X */
X classes[0] = OlwmQ;
X if (XrmQGetResource(newDB, instances, classes, &type, &newvalue)) {
X if (XrmQGetResource(OlwmDB, instances, classes,
X &type, &oldvalue) &&
X 0 == strcmp((char *)newvalue.addr, (char *)oldvalue.addr))
X {
X /* old and new values the same; ignore */
X classes[0] = OpenWinQ;
X continue;
X }
X
X XrmQPutStringResource(&OlwmDB, Bindings, instances,
X (char *)newvalue.addr);
X
X if (item->updater == NULL) {
X (void) (*item->converter)(dpy, item, (char *)newvalue.addr,
X item->addr);
X } else {
X (void) memset((char *) &datum, 0, sizeof(datum));
X if ((*item->converter)(dpy, item,
X (char *)newvalue.addr, &datum))
X (*item->updater)(dpy, item, item->addr, &datum);
X }
X }
X classes[0] = OpenWinQ;
X }
X }
X
X UpdateBindings(dpy, newDB);
X
X#ifdef OW_I18N_L3
X EffectOLLC(dpy);
X#endif /* OW_I18N_L3 */
X
X XrmDestroyDatabase(newDB);
X}
X
X
X#ifdef OW_I18N_L3
X
X /*
X * GRVLCInit: Here is the table for OPEN LOOK locale and POSIX/ANSI-C
X * locale categories.
X */
Xstatic void
XGRVLCInit()
X{
X GRV.LC.BasicLocale.posix_category = LC_CTYPE;
X GRV.LC.DisplayLang.posix_category = LC_MESSAGES;
X GRV.LC.InputLang.posix_category = -1;
X GRV.LC.Numeric.posix_category = LC_NUMERIC;
X GRV.LC.DateFormat.posix_category = LC_TIME;
X}
X
X/*
X * ReInitAllUserMenus -- Reinitalize the user menus for each screen
X */
Xstatic void
XReInitAllUserMenus(dpy, force)
X Display *dpy;
X Bool force;
X{
XScreenInfo *si;
Xextern List *ScreenInfoList;
XList *l = ScreenInfoList;
X
X for (si = ListEnum(&l); si; si = ListEnum(&l))
X ReInitUserMenu(dpy, si, force);
X}
X
Xvoid
XEffectOLLC(dpy)
XDisplay *dpy;
X{
X register OLLCItem *ollci, *ollci_end, *ollci_basic;
X register char *current;
X register int require_all_update;
X int messages_updated;
X
X
X if (!OLLCUpdated)
X return;
X
X require_all_update = False;
X messages_updated = False;
X ollci_basic = &(GRV.LC.BasicLocale);
X ollci_end = &ollci_basic[OLLC_LC_MAX];
X
X /*
X * This is silly restriction, but works well for Sundae1.0
X * environment.
X */
X current = setlocale(LC_CTYPE, NULL);
X if (strcmp(current, "C") == 0
X && ollci_basic->locale != NULL
X && strcmp(current, ollci_basic->locale) != 0)
X {
X /*
X * I'm doing LC_ALL rather only LC_CTYPE, becuase
X * there are some locale category which does not
X * covered by current OLLC spec.
X */
X#ifdef notdef
X fprintf(stderr, "Basic Locale -> %s\n", ollci_basic->locale);
X#endif
X setlocale(LC_ALL, ollci_basic->locale);
X require_all_update = True;
X }
X
X
X for (ollci = ollci_basic + 1; ollci < ollci_end; ollci++)
X {
X if (ollci->posix_category < 0)
X continue;
X current = setlocale(ollci->posix_category, NULL);
X if (strcmp(current, ollci->locale) != 0
X || require_all_update == True)
X {
X /*
X * Again, we need following silly restriction
X * in order to work well with EUC based
X * environment.
X */
X if (strcmp(current, "C") == 0
X || strcmp(ollci->locale, "C") == 0
X || strcmp(ollci->locale, ollci_basic->locale) == 0)
X {
X#ifdef notdef
X fprintf(stderr, "locale#%d -> %s\n", ollci->posix_category, ollci->locale);
X#endif
X setlocale(ollci->posix_category,
X ollci->locale);
X if (ollci->posix_category == LC_MESSAGES)
X messages_updated = True;
X }
X }
X }
X OLLCUpdated = False;
X
X if (messages_updated == True) {
X WindowMenuDestroy(dpy);
X WindowMenuCreate(dpy);
X ReInitAllUserMenus(dpy,True);
X }
X}
X
X#endif /* OW_I18N_L3 */
X
X/*
X * SetVirtualScreenAttribute - set the given attribute for each vdm
X */
Xstatic void
XsetVirtualScreenAttribute(dpy, f)
X Display *dpy;
X FuncPtr f;
X{
XScreenInfo *si;
Xextern List *ScreenInfoList;
XList *l = ScreenInfoList;
X
X for (si = ListEnum(&l); si; si = ListEnum(&l)) {
X (*f)(dpy,si);
X RedrawVDM(si->vdm);
X }
X}
X
Xstatic void
XupdVirtualFgColor(dpy, item, cur, new)
X Display *dpy;
X ResourceItem *item;
X char **cur, **new;
X{
X MemFree(*cur);
X *cur = *new;
X setVirtualScreenAttribute(dpy, setScreenVirtualForegroundColor);
X}
X
Xstatic void
XupdVirtualBgColor(dpy, item, cur, new)
X Display *dpy;
X ResourceItem *item;
X char **cur, **new;
X{
X MemFree(*cur);
X *cur = *new;
X setVirtualScreenAttribute(dpy, setScreenVirtualBackgroundColor);
X}
X
Xstatic void
XupdVirtualFontColor(dpy, item, cur, new)
X Display *dpy;
X ResourceItem *item;
X char **cur, **new;
X{
X MemFree(*cur);
X *cur = *new;
X setVirtualScreenAttribute(dpy, setScreenVirtualFontColor);
X}
X
Xstatic void
XupdVirtualGridColor(dpy, item, cur, new)
X Display *dpy;
X ResourceItem *item;
X char **cur, **new;
X{
X MemFree(*cur);
X *cur = *new;
X setVirtualScreenAttribute(dpy, setScreenVirtualGridColor);
X}
X
Xstatic void
XupdInputFocusColor(dpy, item, cur, new)
X Display *dpy;
X ResourceItem *item;
X char **cur, **new;
X{
X MemFree(*cur);
X *cur = *new;
X setVirtualScreenAttribute(dpy, setScreenInputFocusColor);
X}
X
Xstatic void
XupdVirtualFont(dpy, item, cur, new)
X Display *dpy;
X ResourceItem *item;
X char **cur, **new;
X{
X MemFree(*cur);
X *cur = *new;
X setVirtualScreenAttribute(dpy, updateScreenVirtualFont);
X}
X
Xstatic void
XupdVirtualGeometry(dpy, item, cur, new)
X Display *dpy;
X ResourceItem *item;
X char **cur, **new;
X{
X MemFree(*cur);
X *cur = *new;
X setVirtualScreenAttribute(dpy, updateScreenVirtualGeometry);
X}
X
Xstatic void
XupdVirtualMap(dpy, item, cur, new)
X Display *dpy;
X ResourceItem *item;
X char **cur, **new;
X{
X MemFree(*cur);
X *cur = *new;
X setVirtualScreenAttribute(dpy, updateScreenVirtualMap);
X}
X
Xstatic void
XupdVirtualMapColor(dpy, item, cur, new)
X Display *dpy;
X ResourceItem *item;
X char **cur, **new;
X{
X MemFree(*cur);
X *cur = *new;
X setVirtualScreenAttribute(dpy, setScreenVirtualPixmapColor);
X}
X
Xstatic void
XupdVirtualDesktop(dpy, item, cur, new)
X Display *dpy;
X ResourceItem *item;
X char **cur, **new;
X{
X MemFree(*cur);
X *cur = *new;
X setVirtualScreenAttribute(dpy, updateScreenVirtualDesktop);
X}
X
Xstatic void
XupdVirtualIconGeometry(dpy, item, cur, new)
X Display *dpy;
X ResourceItem *item;
X char **cur, **new;
X{
X MemFree(*cur);
X *cur = *new;
X setVirtualScreenAttribute(dpy, updateScreenVirtualIconGeometry);
X}
X
Xstatic void
XupdVirtualScale(dpy, item, cur, new)
X Display *dpy;
X ResourceItem *item;
X char **cur, **new;
X{
X MemFree(*cur);
X *cur = *new;
X setVirtualScreenAttribute(dpy, updateScreenVirtualScale);
X}
X
Xstatic Bool
X/* ARGSUSED */
XcvtGridEnum(dpy, item, value, ret)
X Display *dpy;
X ResourceItem *item;
X char *value;
X VirtualGridType *ret;
X{
X if (MatchString(value,"none"))
X {
X *ret = GridNone;
X return True;
X }
X if (MatchString(value,"invisible"))
X {
X *ret = GridInvisible;
X return True;
X }
X if (MatchString(value,"visible"))
X {
X *ret = GridVisible;
X return True;
X }
X return False;
X}
X
Xstatic Bool
X/* ARGSUSED */
XcvtImageType(dpy, item, value, ret)
X Display *dpy;
X ResourceItem *item;
X char *value;
X ImageType *ret;
X{
X if (MatchString(value,"useall"))
X {
X *ret = UseAll;
X return True;
X }
X if (MatchString(value,"usenone"))
X {
X *ret = UseNone;
X return True;
X }
X if (MatchString(value,"usevdm"))
X {
X *ret = UseVDM;
X return True;
X }
X return False;
X}
END_OF_FILE
if test 49362 -ne `wc -c <'resources.c'`; then
echo shar: \"'resources.c'\" unpacked with wrong size!
fi
# end of 'resources.c'
fi
if test -f 'slots.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'slots.h'\"
else
echo shar: Extracting \"'slots.h'\" \(1970 characters\)
sed "s/^X//" >'slots.h' <<'END_OF_FILE'
X/*
X * (c) Copyright 1990 Sun Microsystems, Inc. Sun design patents
X * pending in the U.S. and foreign countries. See LEGAL_NOTICE
X * file for terms of the license.
X */
X
X#ident "@(#)slots.h 26.7 91/09/14 SMI"
X
X#ifndef _OLWM_SLOT_H
X#define _OLWM_SLOT_H
X
Xtypedef enum {SOTopToBottom, SOBottomToTop, SOLeftToRight, SORightToLeft} SlotOrder;
X
Xtypedef struct _iconSlot {
X int ma, mi, maw, miw;
X Bool positioned;
X int off_x, off_y;
X} IconSlot;
X
Xtypedef struct _iconGrid {
X SlotOrder SOmajor,SOminor;
X int *occupancy;
X int minoccupancy;
X List *iconList;
X int maslots,mislots;
X int slotshoriz,slotsvert;
X int pixhoriz,pixvert;
X} IconGrid;
X
Xextern IconGrid *SlotInit(); /* Display *dpy, int screeno */
X /* initialises the Slots package; should be called for
X * each screen
X */
X
Xextern struct _iconSlot *SlotAlloc(); /* WinIcon *, Bool, Bool */
X /* given a sized and possibly positioned icon window, allocate
X * the appropriate slots for it. If the window is positioned,
X * True should be passed for the second parameter, and the x,y
X * position will be honoured. If the window is not positioned, it
X * will be positioned by this function to the appropriate slots(s).
X * If the icon is being manually positioned and should be positioned
X * according to the icon grid, True should be passed for the third
X * parameter; False should be passed otherwise.
X */
X
Xextern Bool SlotFree(); /* WinIcon * */
X /* An icon is going away, so its references to slots should also go
X * away.
X */
X
Xextern Bool SlotSetLocations(); /* Display *dpy */
X /* sets the order in which slots are allocated for icons which are
X * not explicitly positioned. The new order is obtained from the
X * global resource vector.
X * For example, the AlongBottom order is expressed as
X * major BottomToTop, minor LeftToRight. Any icons which were
X * automatically positioned are repositioned to equivalent positions
X * in the new order.
X */
X
X#endif /* _OLWM_SLOT_H */
END_OF_FILE
if test 1970 -ne `wc -c <'slots.h'`; then
echo shar: \"'slots.h'\" unpacked with wrong size!
fi
# end of 'slots.h'
fi
echo shar: End of archive 3 \(of 21\).
cp /dev/null ark3isdone
MISSING=""
for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 ; do
if test ! -f ark${I}isdone ; then
MISSING="${MISSING} ${I}"
fi
done
if test "${MISSING}" = "" ; then
echo You have unpacked all 21 archives.
rm -f ark[1-9]isdone ark[1-9][0-9]isdone
else
echo You still need to unpack the following archives:
echo " " ${MISSING}
fi
## End of shell archive.
exit 0
--
Molecular Simulations, Inc. mail: dcmartin@postgres.berkeley.edu
796 N. Pastoria Avenue uucp: uwvax!ucbvax!dcmartin
Sunnyvale, California 94086 at&t: 408/522-9236