home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / x / volume15 / olvwm-3.0 / part03 < prev    next >
Internet Message Format  |  1992-02-03  |  57KB

  1. Path: uunet!sun-barr!ames!pasteur!nntp
  2. From: scott.oaks@East.Sun.COM (Scott Oaks)
  3. Newsgroups: comp.sources.x
  4. Subject: v15i149: OpenLook Virtual Window Mgr (3.0), Part03/21
  5. Message-ID: <1992Feb4.135427.6797@pasteur.Berkeley.EDU>
  6. Date: 4 Feb 92 13:54:27 GMT
  7. References: <csx-15i147-olvwm-3.0@uunet.UU.NET>
  8. Sender: dcmartin@msi.com (David C. Martin - Moderator)
  9. Organization: University of California, at Berkeley
  10. Lines: 2105
  11. Approved: dcmartin@msi.com
  12. Nntp-Posting-Host: postgres.berkeley.edu
  13.  
  14. Submitted-by: scott.oaks@East.Sun.COM (Scott Oaks)
  15. Posting-number: Volume 15, Issue 149
  16. Archive-name: olvwm-3.0/part03
  17.  
  18. # This is a shell archive.  Remove anything before this line, then feed it
  19. # into a shell via "sh file" or similar.  To overwrite existing files,
  20. # type "sh file -c".
  21. # The tool that generated this appeared in the comp.sources.unix newsgroup;
  22. # send mail to comp-sources-unix@uunet.uu.net if you want that tool.
  23. # If this archive is complete, you will see the following message at the end:
  24. #        "End of archive 3 (of 21)."
  25. # Contents:  i18n.h resources.c slots.h
  26. # Wrapped by dcmartin@fascet on Tue Jan 14 05:54:42 1992
  27. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  28. if test -f 'i18n.h' -a "${1}" != "-c" ; then 
  29.   echo shar: Will not clobber existing file \"'i18n.h'\"
  30. else
  31. echo shar: Extracting \"'i18n.h'\" \(356 characters\)
  32. sed "s/^X//" >'i18n.h' <<'END_OF_FILE'
  33. X/*
  34. X *    (c) Copyright 1990 Sun Microsystems, Inc. Sun design patents 
  35. X *    pending in the U.S. and foreign countries. See LEGAL NOTICE 
  36. X *    file for terms of the license.
  37. X */
  38. X
  39. X#ident    "@(#)i18n.h    1.6    91/09/14 SMI"
  40. X
  41. X#ifndef i18n_DEFINED
  42. X#define i18n_DEFINED
  43. X
  44. X#ifdef OW_I18N_L3
  45. X
  46. Xextern    char    *gettext();
  47. X
  48. X#else
  49. X
  50. X#define     gettext(s)    s
  51. X
  52. X#endif
  53. X
  54. X#endif i18n_DEFINED
  55. X
  56. X
  57. END_OF_FILE
  58. if test 356 -ne `wc -c <'i18n.h'`; then
  59.     echo shar: \"'i18n.h'\" unpacked with wrong size!
  60. fi
  61. # end of 'i18n.h'
  62. fi
  63. if test -f 'resources.c' -a "${1}" != "-c" ; then 
  64.   echo shar: Will not clobber existing file \"'resources.c'\"
  65. else
  66. echo shar: Extracting \"'resources.c'\" \(49362 characters\)
  67. sed "s/^X//" >'resources.c' <<'END_OF_FILE'
  68. X/*
  69. X *      (c) Copyright 1990 Sun Microsystems, Inc. Sun design patents
  70. X *      pending in the U.S. and foreign countries. See LEGAL_NOTICE
  71. X *      file for terms of the license.
  72. X */
  73. X
  74. X#ident "@(#)resources.c    26.45    91/10/04 SMI"
  75. X
  76. X#ifdef SYSV
  77. X#include <sys/types.h>
  78. X#endif
  79. X#include <ctype.h>
  80. X#include <errno.h>
  81. X#include <memory.h>
  82. X#include <stdio.h>
  83. X#include <string.h>
  84. X#include <sys/file.h>
  85. X#include <X11/Xos.h>
  86. X#include <X11/Xlib.h>
  87. X#include <X11/Xutil.h>
  88. X#include <X11/Xresource.h>
  89. X#include <X11/keysym.h>
  90. X#include <X11/cursorfont.h>
  91. X
  92. X#include <olgx/olgx.h>
  93. X
  94. X#include "i18n.h"
  95. X#include "ollocale.h"
  96. X#include "mem.h"
  97. X#include "olwm.h"
  98. X#include "win.h"
  99. X#include "menu.h"
  100. X#include "defaults.h"
  101. X#include "globals.h"
  102. X#include "resources.h"
  103. X#include "olcursor.h"
  104. X#include "events.h"
  105. X#include "virtual.h"
  106. X
  107. X
  108. X/* converters */
  109. X
  110. Xstatic Bool cvtBeepStatus();
  111. Xstatic Bool cvtBoolean();
  112. Xstatic Bool cvtClickTimeout();
  113. Xstatic Bool cvtCursorFont();
  114. Xstatic Bool cvtFocusStyle();
  115. Xstatic Bool cvtFont();
  116. Xstatic Bool cvtIconLocation();
  117. Xstatic Bool cvtInteger();
  118. Xstatic Bool cvtKey();
  119. Xstatic Bool cvtMouseless();
  120. Xstatic Bool cvtString();
  121. Xstatic Bool cvtStringList();
  122. Xstatic Bool cvtGridEnum();
  123. Xstatic Bool cvtImageType();
  124. X
  125. X/* internationalization stuff */
  126. X
  127. X#ifdef OW_I18N_L3
  128. Xstatic Bool OLLCUpdated = False;
  129. X
  130. Xstatic void GRVLCInit();
  131. Xstatic Bool cvtOLLC();
  132. Xstatic Bool cvtOLLCCL();
  133. X#endif /* OW_I18N_L3 */
  134. X
  135. X
  136. X/* updaters */
  137. X
  138. Xstatic void updButtonFont();
  139. X       void UpdFocusStyle();            /* yes, this one's global */
  140. Xstatic void updGlyphFont();
  141. Xstatic void updIconFont();
  142. Xstatic void updIconLocation();
  143. Xstatic void updMouseless();
  144. Xstatic void updString();
  145. Xstatic void updStringList();
  146. Xstatic void updSync();
  147. Xstatic void updTextFont();
  148. Xstatic void updTitleFont();
  149. Xstatic void updWorkspace();
  150. Xstatic void updWindow();
  151. Xstatic void updForeground();
  152. Xstatic void updBackground();
  153. Xstatic void updBorder();
  154. Xstatic void updVirtualDesktop();
  155. Xstatic void updVirtualGeometry();
  156. Xstatic void updVirtualFont();
  157. Xstatic void updVirtualMap();
  158. Xstatic void updVirtualMapColor();
  159. Xstatic void updVirtualBgColor();
  160. Xstatic void updVirtualFgColor();
  161. Xstatic void updVirtualIconGeometry();
  162. Xstatic void updVirtualFontColor();
  163. Xstatic void updVirtualScale();
  164. Xstatic void updVirtualGridColor();
  165. Xstatic void updInputFocusColor();
  166. X
  167. Xextern void setScreenVirtualForegroundColor();
  168. Xextern void setScreenVirtualBackgroundColor();
  169. Xextern void setScreenVirtualFontColor();
  170. Xextern void setScreenVirtualGridColor();
  171. Xextern void setScreenInputFocusColor();
  172. Xextern void updateScreenVirtualFont();
  173. Xextern void updateScreenVirtualMap();
  174. Xextern void updateScreenVirtualGeometry();
  175. Xextern void updateScreenVirtualDesktop();
  176. Xextern void updateScreenVirtualIconGeometry();
  177. Xextern void updateScreenVirtualScale();
  178. Xextern void setScreenVirtualPixmapColor();
  179. Xextern void setScreenInputFocusColor();
  180. X
  181. X/* resource table */
  182. X
  183. Xtypedef struct _resourceitem {
  184. X    char *instance;
  185. X    char *class;
  186. X    char *defaultString;
  187. X    void *addr;
  188. X    Bool (*converter)();
  189. X    void (*updater)();
  190. X    XrmQuark instanceQ;
  191. X    XrmQuark classQ;
  192. X} ResourceItem;
  193. X
  194. XResourceItem ResourceTable[] = {
  195. X
  196. X{   "titleFont",        "TitleFont",
  197. X    "-b&h-lucida-bold-r-normal-sans-*-120-*-*-*-*-*-*",
  198. X    &(GRV.TitleFontInfo),    cvtFont,        updTitleFont },
  199. X{   "textFont",            "TextFont",
  200. X    "-b&h-lucida-medium-r-normal-sans-*-120-*-*-*-*-*-*",
  201. X    &(GRV.TextFontInfo),    cvtFont,        updTextFont },
  202. X{   "buttonFont",        "ButtonFont",
  203. X    "-b&h-lucida-medium-r-normal-sans-*-120-*-*-*-*-*-*",
  204. X    &(GRV.ButtonFontInfo),    cvtFont,        updButtonFont },
  205. X{   "iconFont",            "IconFont",
  206. X    "-b&h-lucida-medium-r-normal-sans-*-120-*-*-*-*-*-*",
  207. X    &(GRV.IconFontInfo),    cvtFont,        updIconFont },
  208. X{   "glyphFont",        "GlyphFont",
  209. X    "-sun-open look glyph-*-*-*-*-*-120-*-*-*-*-*-*",
  210. X    &(GRV.GlyphFontInfo),    cvtFont,        updGlyphFont },
  211. X{   "cursorFont",        "CursorFont",
  212. X    "-sun-open look cursor-*-*-*-*-*-120-*-*-*-*-*-*",
  213. X    &(GRV.BasicPointer),    cvtCursorFont,        NULL },
  214. X
  215. X{   "foreground",        "Foreground",        "#000000",
  216. X    &(GRV.ForegroundColor),    cvtString,        updForeground },
  217. X{   "background",        "Background",        "#ffffff",
  218. X    &(GRV.BackgroundColor),    cvtString,        updBackground },
  219. X{   "reverseVideo",        "ReverseVideo",        "False",
  220. X    &(GRV.ReverseVideo),    cvtBoolean,        NULL },
  221. X{   "borderColor",        "BorderColor",        "#000000",
  222. X    &(GRV.BorderColor),        cvtString,        updBorder },
  223. X{   "windowColor",        "WindowColor",        "#cccccc",
  224. X    &(GRV.WindowColor),        cvtString,        updWindow },
  225. X{   "workspaceColor",        "WorkspaceColor",    "#40a0c0",
  226. X    &(GRV.WorkspaceColor),    cvtString,        updWorkspace },
  227. X{   "paintWorkspace",        "PaintWorkspace",    "True",
  228. X    &(GRV.PaintWorkspace),    cvtBoolean,        NULL },
  229. X{   "use3D",            "Use3D",        "True", 
  230. X    &(GRV.F3dUsed),        cvtBoolean,        NULL },
  231. X{   "setInput",            "SetInput",        "Select",
  232. X    &(GRV.FocusFollowsMouse),    cvtFocusStyle,        UpdFocusStyle },
  233. X{   "defaultTitle",        "DefaultTitle",        "No Name", 
  234. X    &(GRV.DefaultWinName),    cvtString,        updString },
  235. X{   "flashFrequency",        "FlashFrequency",    "100000", 
  236. X    &(GRV.FlashTime),        cvtInteger,        NULL },
  237. X{   "flashTime",        "FlashTime",        "100000",
  238. X    &(GRV.FlashTime),        cvtInteger,        NULL },
  239. X{   "iconLocation",        "IconLocation",     "bottom",
  240. X    &(GRV.IconPlacement),    cvtIconLocation,    updIconLocation },
  241. X{   "focusLenience",        "FocusLenience",     "False",
  242. X    &(GRV.FocusLenience),    cvtBoolean,        NULL },
  243. X{   "dragWindow",        "DragWindow",         "False",
  244. X    &(GRV.DragWindow),        cvtBoolean,        NULL },
  245. X{   "autoRaise",        "AutoRaise",        "False",
  246. X    &(GRV.AutoRaise),        cvtBoolean,        NULL },
  247. X{   "autoRaiseDelay",        "AutoRaiseDelay",    "0",
  248. X    &(GRV.AutoRaiseDelay),    cvtInteger,        NULL },
  249. X{   "dragRightDistance",    "DragRightDistance",    "100",
  250. X    &(GRV.DragRightDistance),    cvtInteger,        NULL },
  251. X{   "moveThreshold",        "MoveThreshold",    "5",
  252. X    &(GRV.MoveThreshold),    cvtInteger,        NULL },
  253. X{   "dragThreshold",        "DragThreshold",    "5",
  254. X    &(GRV.MoveThreshold),    cvtInteger,        NULL },
  255. X{   "clickMoveThreshold",    "ClickMoveThreshold",    "5",
  256. X    &(GRV.ClickMoveThreshold),    cvtInteger,        NULL },
  257. X{   "multiClickTimeout",    "MultiClickTimeout",    "5",
  258. X    &(GRV.DoubleClickTime),    cvtClickTimeout,    NULL },
  259. X{   "frontKey",            "FrontKey",        "Any L5",
  260. X    &(GRV.FrontKey),        cvtKey,            NULL },
  261. X{   "helpKey",            "HelpKey",        "Help",
  262. X    &(GRV.HelpKey),        cvtKey,            NULL },
  263. X{   "openKey",            "OpenKey",        "Any L7",
  264. X    &(GRV.OpenKey),        cvtKey,            NULL },
  265. X{   "confirmKey",        "ConfirmKey",        "Return",
  266. X    &(GRV.ConfirmKey),        cvtKey,            NULL },
  267. X{   "printOrphans",        "PrintOrphans",        "False", 
  268. X    &(GRV.PrintOrphans),    cvtBoolean,        NULL },
  269. X{   "printAll",            "PrintAll",        "False", 
  270. X    &(GRV.PrintAll),        cvtBoolean,        NULL },
  271. X{   "synchronize",        "Synchronize",        "False", 
  272. X    &(GRV.Synchronize),        cvtBoolean,        updSync },
  273. X{   "snapToGrid",        "SnapToGrid",        "False",
  274. X    &(GRV.FSnapToGrid),        cvtBoolean,        NULL },
  275. X{   "saveWorkspaceTimeout",    "SaveWorkspaceTimeout", "30",
  276. X    &(GRV.SaveWorkspaceTimeout), cvtInteger,        NULL },
  277. X{   "popupJumpCursor",        "PopupJumpCursor",    "True",
  278. X    &(GRV.PopupJumpCursor),    cvtBoolean,        NULL },
  279. X{   "cancelKey",        "CancelKey",        "Escape",
  280. X    &(GRV.CancelKey),        cvtKey,            NULL },
  281. X{   "colorLockKey",        "ColorLockKey",        "Control L2",
  282. X    &(GRV.ColorLockKey),    cvtKey,            NULL },
  283. X{   "colorUnlockKey",        "ColorUnlockKey",    "Control L4",
  284. X    &(GRV.ColorUnlockKey),    cvtKey,            NULL },
  285. X{   "colorFocusLocked",        "ColorFocusLocked",    "False",
  286. X    &(GRV.ColorLocked),        cvtBoolean,        NULL },
  287. X{   "edgeMoveThreshold",    "EdgeMoveThreshold",     "10",
  288. X    &(GRV.EdgeThreshold),    cvtInteger,        NULL },
  289. X{   "rubberBandThickness",    "RubberBandThickness",    "2",
  290. X    &(GRV.RubberBandThickness),    cvtInteger,        NULL },
  291. X{   "beep",            "Beep",            "always",
  292. X    &(GRV.Beep),        cvtBeepStatus,        NULL },
  293. X{   "pPositionCompat",        "PPositionCompat",    "false",
  294. X    &(GRV.PPositionCompat),    cvtBoolean,        NULL },
  295. X{   "minimalDecor",        "MinimalDecor",        "",
  296. X    &(GRV.Minimals),        cvtStringList,        updStringList },
  297. X{   "use3DFrames",        "Use3DFrames",        "False", 
  298. X    &(GRV.F3dFrames),        cvtBoolean,        NULL },
  299. X{   "use3DResize",        "Use3DResize",        "True",
  300. X    &(GRV.F3dResize),        cvtBoolean,        NULL },
  301. X{   "refreshRecursively",    "RefreshRecursively",    "True",
  302. X    &(GRV.RefreshRecursively),    cvtBoolean,        NULL },
  303. X{   "mouseChordTimeout",    "MouseChordTimeout",    "100",
  304. X    &(GRV.MouseChordTimeout),    cvtInteger,        NULL },
  305. X{   "singleScreen",        "SingleScreen",        "False",
  306. X    &(GRV.SingleScreen),    cvtBoolean,        NULL },
  307. X{   "autoReReadMenuFile",        "AutoReReadMenuFile",  "True",
  308. X    &(GRV.AutoReReadMenuFile),  cvtBoolean,        NULL },
  309. X{   "keepTransientsAbove",    "KeepTransientsAbove",    "True",
  310. X    &(GRV.KeepTransientsAbove),    cvtBoolean,        NULL },
  311. X{   "transientsSaveUnder",    "TransientsSaveUnder",    "True",
  312. X    &(GRV.TransientsSaveUnder),    cvtBoolean,        NULL },
  313. X{   "transientsTitled",        "TransientsTitled",    "True",
  314. X    &(GRV.TransientsTitled),    cvtBoolean,        NULL },
  315. X{   "selectWindows",        "SelectWindows",    "True",
  316. X    &(GRV.SelectWindows),    cvtBoolean,        NULL },
  317. X{   "showMoveGeometry",        "ShowMoveGeometry",    "False",
  318. X    &(GRV.ShowMoveGeometry),    cvtBoolean,        NULL },
  319. X{   "showResizeGeometry",    "ShowResizeGeometry",    "False",
  320. X    &(GRV.ShowResizeGeometry),    cvtBoolean,        NULL },
  321. X{   "invertFocusHighlighting",    "InvertFocusHighlighting", "False",
  322. X    &(GRV.InvertFocusHighlighting), cvtBoolean,        NULL },
  323. X{   "runSlaveProcess",        "RunSlaveProcess",    "True",
  324. X    &(GRV.RunSlaveProcess),    cvtBoolean,        NULL },
  325. X{   "selectToggleStacking",    "SelectToggleStacking","False",
  326. X    &(GRV.SelectToggleStacking),cvtBoolean,        NULL },
  327. X{   "flashCount",        "FlashCount",        "6",
  328. X    &(GRV.FlashCount),        cvtInteger,        NULL },
  329. X{   "defaultIconImage",        "DefaultIconImage",    NULL,
  330. X    &(GRV.DefaultIconImage),    cvtString,        NULL },
  331. X{   "defaultIconMask",        "DefaultIconMask",    NULL,
  332. X    &(GRV.DefaultIconMask),    cvtString,        NULL },
  333. X{   "serverGrabs",        "ServerGrabs",        "True",
  334. X    &(GRV.ServerGrabs),        cvtBoolean,        NULL },
  335. X{   "iconFlashCount",        "IconFlashCount",    "3",
  336. X    &(GRV.IconFlashCount),    cvtInteger,        NULL },
  337. X{   "selectDisplaysMenu",    "SelectDisplaysMenu",    "False",
  338. X    &(GRV.SelectDisplaysMenu),    cvtBoolean,        NULL },
  339. X{   "selectionFuzz",        "SelectionFuzz",    "1",
  340. X    &(GRV.SelectionFuzz),    cvtInteger,        NULL },
  341. X{   "autoInputFocus",        "AutoInputFocus",    "False",
  342. X    &(GRV.AutoInputFocus),    cvtBoolean,        NULL },
  343. X{   "autoColorFocus",        "AutoColorFocus",    "False",
  344. X    &(GRV.AutoColorFocus),    cvtBoolean,        NULL },
  345. X{   "colorTracksInputFocus",    "ColorTracksInputFocus","False",
  346. X    &(GRV.ColorTracksInputFocus),cvtBoolean,        NULL },
  347. X{   "iconFlashOnTime",        "IconFlashOnTime",    "20000",
  348. X    &(GRV.IconFlashOnTime),    cvtInteger,        NULL },
  349. X{   "iconFlashOffTime",        "IconFlashOffTime",    "1",
  350. X    &(GRV.IconFlashOffTime),    cvtInteger,        NULL },
  351. X{   "keyboardCommands",        "KeyboardCommands",    "Basic",
  352. X    &(GRV.Mouseless),        cvtMouseless,        updMouseless },
  353. X{   "raiseOnActivate",        "RaiseOnActivate",    "True",
  354. X    &(GRV.RaiseOnActivate),    cvtBoolean,        NULL },
  355. X{   "restackWhenWithdraw",    "RestackWhenWithdraw",    "True",
  356. X    &(GRV.RestackWhenWithdraw),    cvtBoolean,        NULL },
  357. X
  358. X#ifdef OW_I18N_L3
  359. X
  360. X{   "basicLocale",        "BasicLocale",        NULL,
  361. X    &(GRV.LC.BasicLocale),      cvtOLLC,                NULL },
  362. X{   "basicLocaleCL",        "BasicLocaleCL",    NULL,
  363. X    &(GRV.LC.BasicLocale),      cvtOLLCCL,              NULL },
  364. X
  365. X{   "displayLang",        "DisplayLang",        NULL,
  366. X    &(GRV.LC.DisplayLang),      cvtOLLC,                NULL },
  367. X{   "displayLangCL",        "DisplayLangCL",    NULL,
  368. X    &(GRV.LC.DisplayLang),      cvtOLLCCL,              NULL },
  369. X
  370. X{   "inputLang",        "InputLang",        NULL,
  371. X    &(GRV.LC.InputLang),        cvtOLLC,                NULL },
  372. X{   "inputLangCL",        "InputLangCL",        NULL,
  373. X    &(GRV.LC.InputLang),        cvtOLLCCL,              NULL },
  374. X
  375. X{   "numeric",            "Numeric",        NULL,
  376. X    &(GRV.LC.Numeric),          cvtOLLC,                NULL },
  377. X{   "numericCL",        "NumericCL",        NULL,
  378. X    &(GRV.LC.Numeric),          cvtOLLCCL,              NULL },
  379. X
  380. X{   "dateFormat",        "DateFormat",        NULL,
  381. X    &(GRV.LC.DateFormat),       cvtOLLC,                NULL },
  382. X{   "dateFormatCL",        "DateFormatCL",        NULL,
  383. X    &(GRV.LC.DateFormat),       cvtOLLCCL,              NULL },
  384. X
  385. X#endif /* OW_I18N_L3 */
  386. X
  387. X{   "virtualDesktop",        "VirtualDesktop",    "3x2",
  388. X    &(GRV.VirtualDesktop),    cvtString,        updVirtualDesktop },
  389. X{   "pannerScale",        "PannerScale",        "15",
  390. X    &(GRV.VDMScale),        cvtInteger,        updVirtualScale },
  391. X{   "allowMoveIntoDesktop",    "AllowMoveIntoDesktop",    "True",
  392. X    &(GRV.AllowMoveIntoDesktop),cvtBoolean,        NULL         },
  393. X{   "allowArrowInRoot",        "AllowArrowInRoot",    "True",
  394. X    &(GRV.ArrowInRoot),        cvtBoolean,        NULL         },
  395. X{   "virtualGeometry",        "VirtualGeometry",    "",
  396. X    &(GRV.VirtualGeometry),    cvtString,        updVirtualGeometry },
  397. X{   "virtualFont",        "VirtualFont",        "5x8",
  398. X    &(GRV.VirtualFontName),    cvtString,        updVirtualFont    },
  399. X{   "virtualBackgroundMap",    "VirtualBackgroundMap",    NULL,
  400. X    &(GRV.VirtualBackgroundMap),cvtString,        updVirtualMap    },
  401. X{   "virtualBackgroundColor",    "VirtualBackgroundColor",    NULL,
  402. X    &(GRV.VirtualBackgroundColor),cvtString,        updVirtualBgColor },
  403. X{   "virtualPixmapColor",    "VirtualPixmapColor",    NULL,
  404. X    &(GRV.VirtualPixmapColor),    cvtString,        updVirtualMapColor },
  405. X{   "virtualIconGeometry",    "VirtualIconGeometry",    "",
  406. X    &(GRV.VirtualIconGeometry),    cvtString,        updVirtualIconGeometry},
  407. X{   "virtualForegroundColor",    "VirtualForegroundColor",    NULL,
  408. X    &(GRV.VirtualForegroundColor),cvtString,        updVirtualFgColor },
  409. X{   "virtualFontColor",        "VirtualFontColor",    NULL,
  410. X    &(GRV.VirtualFontColor),    cvtString,        updVirtualFontColor },
  411. X{   "virtualIconic",        "VirtualIconic",    "False",
  412. X    &(GRV.VirtualIconic),    cvtBoolean,        NULL         },
  413. X{   "virtualSticky",        "VirtualSticky",    "",
  414. X    &(GRV.StickyList),        cvtStringList,        NULL,         },
  415. X{   "relativePosition",        "RelativePosition",    "True",
  416. X    &(GRV.UseRelativePosition),    cvtBoolean,        NULL         },
  417. X{   "grabVirtualKeys",        "GrabVirtualKeys",    "True",
  418. X    &(GRV.GrabVirtualKeys),    cvtBoolean,        NULL         },
  419. X{   "virtualGrid",        "VirtualGrid",        "Visible",
  420. X    &(GRV.VirtualGrid),        cvtGridEnum,        NULL         },
  421. X{   "virtualGridColor",        "VirtualGridColor",    "Black",
  422. X    &(GRV.VirtualGridColor),    cvtString,        updVirtualGridColor },
  423. X{   "raiseOnMove",        "RaiseOnMove",        "False",
  424. X    &(GRV.VirtualRaiseOnMove),    cvtBoolean,        NULL         },
  425. X{   "virtualRaiseVDM",        "VirtualRaiseVDM",    "False",
  426. X    &(GRV.VirtualRaiseVDM),    cvtBoolean,        NULL         },
  427. X{   "AutoShowRootMenu",        "AutoShowRootMenu",    "False",
  428. X    &(GRV.AutoShowRootMenu),    cvtBoolean,        NULL         },
  429. X{   "AutoRootMenuX",        "AutoRootMenuX",    "0",
  430. X    &(GRV.AutoRootMenuX),    cvtInteger,        NULL         },
  431. X{   "AutoRootMenuY",        "AutoRootMenuY",    "0",
  432. X    &(GRV.AutoRootMenuY),    cvtInteger,        NULL         },
  433. X{   "inputFocusColor",        "InputFocusColor",    NULL,
  434. X    &(GRV.InputFocusColor),    cvtString,        updInputFocusColor },
  435. X{   "fullSizeZoomX",        "FullSizeZoomX",    "False",
  436. X    &(GRV.FullSizeZoomX),    cvtBoolean,        NULL         },
  437. X{   "noDecor",            "NoDecor",        "",
  438. X    &(GRV.NoDecors),        cvtStringList,        NULL         },
  439. X{   "resizeMoveGeometry",    "ResizeMoveGeometry",    "0+0",
  440. X    &(GRV.ResizePosition),    cvtString,        NULL         },
  441. X{   "useImages",        "UseImages",        "UseVDM",
  442. X    &(GRV.UseImageMenu),    cvtImageType,        NULL        },
  443. X{   "virtualMoveGroup",        "VirtualMoveGroup",    "True",
  444. X    &(GRV.VirtualMoveGroups),    cvtBoolean,        NULL        },
  445. X};
  446. X
  447. X#define NRESOURCEITEMS (sizeof(ResourceTable)/sizeof(ResourceItem))
  448. X
  449. X
  450. X/* ===== Utilities ======================================================== */
  451. X
  452. X
  453. X/*
  454. X * Copy a string, converting it to lower case.
  455. X */
  456. Xstatic void
  457. Xstrnlower(dest, src, n)
  458. X    char *dest;
  459. X    char *src;
  460. X    int  n;
  461. X{
  462. X    char *p;
  463. X
  464. X    strncpy(dest, src, n);
  465. X    dest[n-1] = '\0';        /* force null termination */
  466. X
  467. X    for (p = dest; *p; ++p)
  468. X    if (isupper(*p))
  469. X        *p = tolower(*p);
  470. X}
  471. X
  472. X
  473. X#define BSIZE 100
  474. X
  475. X/*
  476. X * Determine whether value matches pattern, irrespective of case.
  477. X * This routine is necessary because not all systems have strcasecmp().
  478. X */
  479. XBool
  480. XMatchString(value, pattern)
  481. X    char *value;
  482. X    char *pattern;
  483. X{
  484. X    char buf[BSIZE];
  485. X
  486. X    strnlower(buf, value, BSIZE);
  487. X    return (0 == strcmp(buf, pattern));
  488. X}
  489. X
  490. X
  491. X/*
  492. X * Match any of the following booleans: yes, no, 1, 0, on, off, t, nil, 
  493. X * true, false.  Pass back the boolean matched in ret, and return True.  
  494. X * Otherwise, return False.  Matches are case-insensitive.
  495. X */
  496. Xstatic Bool
  497. XmatchBool(value, ret)
  498. X    char *value;
  499. X    Bool *ret;
  500. X{
  501. X    char buf[BSIZE];
  502. X
  503. X    strnlower(buf, value, BSIZE);
  504. X
  505. X    if (0 == strcmp(buf, "yes") ||
  506. X    0 == strcmp(buf, "on") ||
  507. X    0 == strcmp(buf, "t") ||
  508. X    0 == strcmp(buf, "true") ||
  509. X    0 == strcmp(buf, "1"))
  510. X    {
  511. X    *ret = True;
  512. X    return True;
  513. X    }
  514. X
  515. X    if (0 == strcmp(buf, "no") ||
  516. X    0 == strcmp(buf, "off") ||
  517. X    0 == strcmp(buf, "nil") ||
  518. X    0 == strcmp(buf, "false") ||
  519. X    0 == strcmp(buf, "0"))
  520. X    {
  521. X    *ret = False;
  522. X    return True;
  523. X    }
  524. X
  525. X    return False;
  526. X}
  527. X
  528. X
  529. X/*
  530. X * BoolString() - return Bool based on string, returning the default value if 
  531. X * the string can't be converted.
  532. X */
  533. XBool
  534. XBoolString(s, dflt)
  535. X    char    *s;
  536. X    Bool    dflt;
  537. X{
  538. X    Bool    b;
  539. X
  540. X    if (matchBool(s,&b))
  541. X        return b;
  542. X    else
  543. X        return dflt;
  544. X}
  545. X
  546. X
  547. X/*
  548. X * Match any of the following input focus keywords: followmouse, follow, f, 
  549. X * select, s, click, clicktotype, c.  Pass back True for focusfollows or 
  550. X * False for clicktotype in ret (since FocusFollowsMouse is the global
  551. X * corresponding to this resource), and return True.  
  552. X * Otherwise, return False.
  553. X */
  554. Xstatic Bool
  555. XmatchFocusKeyword(value, ret)
  556. X    char *value;
  557. X    Bool *ret;
  558. X{
  559. X    char buf[BSIZE];
  560. X
  561. X    strnlower(buf, value, BSIZE);
  562. X
  563. X    if (0 == strcmp(buf, "followmouse") ||
  564. X    0 == strcmp(buf, "follow") ||
  565. X    0 == strcmp(buf, "f"))
  566. X    {
  567. X    *ret = True;
  568. X    return True;
  569. X    }
  570. X
  571. X    if (0 == strcmp(buf, "select") ||
  572. X    0 == strcmp(buf, "click") ||
  573. X    0 == strcmp(buf, "clicktotype") ||
  574. X    0 == strcmp(buf, "c") ||
  575. X    0 == strcmp(buf, "s"))
  576. X    {
  577. X    *ret = False;
  578. X    return True;
  579. X    }
  580. X
  581. X    return False;
  582. X}
  583. X
  584. X
  585. X/*
  586. X * Match any of the three possible beep keywords:  always, never, or notices.
  587. X * Pass back the BeepStatus value by reference, and return True, if
  588. X * a match was found; otherwise return False and do not disturb the
  589. X * passed value.
  590. X */
  591. Xstatic Bool
  592. XmatchBeepKeyword(value, ret)
  593. X    char *value;
  594. X    BeepStatus *ret;
  595. X{
  596. X    if (MatchString(value,"always"))
  597. X    {
  598. X        *ret = BeepAlways;
  599. X        return True;
  600. X    }
  601. X    if (MatchString(value,"never"))
  602. X    {
  603. X        *ret = BeepNever;
  604. X        return True;
  605. X    }
  606. X    if (MatchString(value,"notices"))
  607. X    {
  608. X        *ret = BeepNotices;
  609. X        return True;
  610. X    }
  611. X    return False;
  612. X}
  613. X
  614. X
  615. X/*
  616. X * Match an icon placement keyword.  Store matched value in ret and return 
  617. X * True, or return False if no match occurred.
  618. X */
  619. Xstatic Bool
  620. XmatchIconPlace( value, ret )
  621. Xchar        *value;
  622. XIconPreference    *ret;
  623. X{
  624. X    if (MatchString(value, "top"))
  625. X    {
  626. X        *ret = AlongTop;
  627. X        return True;
  628. X    }
  629. X    if (MatchString(value, "bottom"))
  630. X    {
  631. X        *ret = AlongBottom;
  632. X        return True;
  633. X    }
  634. X    if (MatchString(value, "right"))
  635. X    {
  636. X        *ret = AlongRight;
  637. X        return True;
  638. X    }
  639. X    if (MatchString(value, "left"))
  640. X    {
  641. X        *ret = AlongLeft;
  642. X        return True;
  643. X    }
  644. X    if (MatchString(value, "top-lr"))
  645. X    {
  646. X        *ret = AlongTop;
  647. X        return True;
  648. X    }
  649. X    if (MatchString(value, "top-rl"))
  650. X    {
  651. X        *ret = AlongTopRL;
  652. X        return True;
  653. X    }
  654. X    if (MatchString(value, "bottom-lr"))
  655. X    {
  656. X        *ret = AlongBottom;
  657. X        return True;
  658. X    }
  659. X    if (MatchString(value, "bottom-rl"))
  660. X    {
  661. X        *ret = AlongBottomRL;
  662. X        return True;
  663. X    }
  664. X    if (MatchString(value, "right-tb"))
  665. X    {
  666. X        *ret = AlongRight;
  667. X        return True;
  668. X    }
  669. X    if (MatchString(value, "right-bt"))
  670. X    {
  671. X        *ret = AlongRightBT;
  672. X        return True;
  673. X    }
  674. X    if (MatchString(value, "left-tb"))
  675. X    {
  676. X        *ret = AlongLeft;
  677. X        return True;
  678. X    }
  679. X    if (MatchString(value, "left-bt"))
  680. X    {
  681. X        *ret = AlongLeftBT;
  682. X        return True;
  683. X    }
  684. X
  685. X    return False;
  686. X}
  687. X
  688. X
  689. Xstatic Bool
  690. XmatchMouselessKeyword(str, ret)
  691. X    char *str;
  692. X    MouselessMode *ret;
  693. X{
  694. X    if (0 == strcmp(str, "SunView1")) {
  695. X    *ret = KbdSunView;
  696. X    return True;
  697. X    } else if (0 == strcmp(str, "Basic")) {
  698. X    *ret = KbdBasic;
  699. X    return True;
  700. X    } else if (0 == strcmp(str, "Full")) {
  701. X    *ret = KbdFull;
  702. X    return True;
  703. X    }
  704. X    return False;
  705. X}
  706. X
  707. X
  708. X/*
  709. X * Parse a key specification of the form
  710. X *
  711. X * [modifier ...] keysym
  712. X *
  713. X * For example, "Control Shift F7".  Returns True if a valid keyspec was
  714. X * parsed, otherwise False.  The modifier mask is returned in modmask, and the
  715. X * keycode is returned in keycode.
  716. X */
  717. Xstatic Bool
  718. XparseKeySpec(dpy, str, modmask, keycode)
  719. X    Display *dpy;
  720. X    char *str;
  721. X    unsigned int *modmask;
  722. X    KeyCode *keycode;
  723. X{
  724. X    char line[100];
  725. X    char *word;
  726. X    extern unsigned int FindModiferMask();
  727. X    int kc, m;
  728. X    int mask = 0;
  729. X    int code = 0;
  730. X    KeySym ks;
  731. X
  732. X    strcpy(line, str);
  733. X    word = strtok(line, " \t");
  734. X    if (word == NULL)
  735. X    return False;
  736. X
  737. X    while (word != NULL) {
  738. X    ks = XStringToKeysym(word);
  739. X    if (ks == NoSymbol) {
  740. X        if (strcmp(word, "Any") == 0) {
  741. X        mask = AnyModifier;
  742. X        word = strtok(NULL, " \t");
  743. X        continue;
  744. X        } else if (strcmp(word, "Shift") == 0)
  745. X        ks = XK_Shift_L;
  746. X        else if (strcmp(word, "Control") == 0)
  747. X        ks = XK_Control_L;
  748. X        else if (strcmp(word, "Meta") == 0)
  749. X        ks = XK_Meta_L;
  750. X        else if (strcmp(word, "Alt") == 0)
  751. X        ks = XK_Alt_L;
  752. X        else if (strcmp(word, "Super") == 0)
  753. X        ks = XK_Super_L;
  754. X        else if (strcmp(word, "Hyper") == 0)
  755. X        ks = XK_Hyper_L;
  756. X        else
  757. X        return False;
  758. X    }
  759. X        
  760. X    kc = XKeysymToKeycode(dpy, ks);
  761. X    if (kc == 0)
  762. X        return False;
  763. X
  764. X    m = FindModifierMask(kc);
  765. X    if (m == 0) {
  766. X        code = kc;
  767. X        break;
  768. X    }
  769. X    mask |= m;
  770. X    word = strtok(NULL, " \t");
  771. X    }
  772. X
  773. X    if (code == 0)
  774. X    return False;
  775. X
  776. X    *keycode = code;
  777. X    *modmask = mask;
  778. X    return True;
  779. X}
  780. X
  781. X
  782. X#ifdef OW_I18N_L3
  783. X
  784. Xstatic void
  785. XsetOLLCPosix()
  786. X{
  787. X       register OLLCItem       *ollci, *ollci_end;
  788. X       register char           *current;
  789. X
  790. X
  791. X       ollci = &(GRV.LC.BasicLocale);
  792. X       ollci_end = &ollci[OLLC_LC_MAX];
  793. X       for (ollci++; ollci < ollci_end; ollci++)
  794. X       {
  795. X               if ((ollci->locale == NULL
  796. X                               || ollci->priority >= OLLC_SRC_POSIX)
  797. X                 && ollci->posix_category >= 0)
  798. X               {
  799. X                       ollci->locale = strdup(setlocale(
  800. X                                               ollci->posix_category, NULL));
  801. X                       OLLCUpdated = True;
  802. X               }
  803. X      }
  804. X}
  805. X
  806. X#endif /* OW_I18N_L3 */
  807. X
  808. X
  809. X/* ===== Converters ======================================================= */
  810. X
  811. X
  812. X/*
  813. X * static Bool cvtWhatever(dpy, item, string, addr)
  814. X *
  815. X * The job of the converter is to take a string and convert it into the value
  816. X * appropriate for storage into a global variable.  If the conversion is
  817. X * successful, the value is stored at addr and True is returned.  Otherwise,
  818. X * False is returned.  NOTE: the converted global variable shouldn't have any
  819. X * pointers into the resource database.  If it's necessary to keep a handle on
  820. X * this data, the converter should allocate memory and make a copy.  See also
  821. X * the note about memory allocation in the comment at the top of the updaters
  822. X * section, below.
  823. X */
  824. X
  825. X
  826. Xstatic Bool
  827. XcvtBoolean(dpy, item, string, addr)
  828. X    Display        *dpy;
  829. X    ResourceItem    *item;
  830. X    char        *string;
  831. X    void        *addr;
  832. X{
  833. X    return matchBool(string, (Bool *)addr);
  834. X}
  835. X
  836. X
  837. Xstatic Bool
  838. XcvtFont(dpy, item, string, addr)
  839. X    Display        *dpy;
  840. X    ResourceItem    *item;
  841. X    char        *string;
  842. X    void        *addr;
  843. X{
  844. X    XFontStruct        **dest = addr;
  845. X    XFontStruct        *info;
  846. X    
  847. X    info = XLoadQueryFont(dpy, string);
  848. X
  849. X    if (info == NULL)
  850. X    return False;
  851. X
  852. X    *dest = info;
  853. X    return True;
  854. X}
  855. X
  856. X
  857. X/*
  858. X * cvtCursorFont -- set up ALL cursors from cursor font specified.
  859. X *
  860. X * NOTE that CursorColor and Bg1Color must be set before the cursors!
  861. X *
  862. X * Notice that six cursors are set up (and stored in six separate GRV
  863. X * elements) from this single resource.  REMIND: this is kind of bogus.  
  864. X * Ideally, all six cursors would have fonts and character indexes specifiable 
  865. X * independently.  Further, addr isn't used; GRV is stored directly.
  866. X *
  867. X * REMIND: this appears to have a resource leak, in that cursorFont is loaded 
  868. X * but never unloaded.
  869. X */
  870. Xstatic Bool
  871. XcvtCursorFont(dpy, item, string, addr)
  872. X    Display        *dpy;
  873. X    ResourceItem    *item;
  874. X    char        *string;
  875. X    void        *addr;
  876. X{
  877. X    Font        cursorFont;
  878. X    int            ii;
  879. X    Cursor        *tmpVariable;
  880. X    unsigned int    tmpFontIndex;
  881. X    unsigned int    defaultIndex;
  882. X    XColor        foreColor, backColor;
  883. X    
  884. X    cursorFont = XLoadFont(dpy, string);
  885. X
  886. X    /*
  887. X     * REMIND: the following doesn't make any sense.  XLoadFont() simply 
  888. X     * allocates an ID, sends the LoadFont requst, and returns the ID.  There 
  889. X     * is no error indication in the return value from XLoadFont().  This 
  890. X     * needs to be fixed.  Perhaps using XLoadQueryFont() would be the right 
  891. X     * thing.
  892. X     */
  893. X
  894. X    if (cursorFont == NULL)
  895. X    return False;
  896. X
  897. X    /*
  898. X     * REMIND: in the future, we will probably want to set up some scheme for 
  899. X     * customizing cursor colors.  For now, use black and white.
  900. X     */
  901. X
  902. X    foreColor.red = foreColor.green = foreColor.blue = 0;    /* black */
  903. X    backColor.red = backColor.green = backColor.blue = 65535;    /* white */
  904. X
  905. X    for (ii = 0; ii < NUM_CURSORS; ++ii) {
  906. X
  907. X    switch (ii) {
  908. X
  909. X    case BASICPTR:
  910. X        tmpVariable = &GRV.BasicPointer;
  911. X        tmpFontIndex = OLC_basic;
  912. X        defaultIndex = XC_left_ptr;
  913. X        break;
  914. X
  915. X    case MOVEPTR:
  916. X        tmpVariable = &GRV.MovePointer;
  917. X        tmpFontIndex = OLC_basic;
  918. X        defaultIndex = XC_left_ptr;
  919. X        break;
  920. X
  921. X    case BUSYPTR:
  922. X        tmpVariable = &GRV.BusyPointer;
  923. X        tmpFontIndex = OLC_busy;
  924. X        defaultIndex = XC_watch;
  925. X        break;
  926. X
  927. X    case ICONPTR:
  928. X        tmpVariable = &GRV.IconPointer;
  929. X        tmpFontIndex = OLC_basic;
  930. X        defaultIndex = XC_left_ptr;
  931. X        break;
  932. X
  933. X    case RESIZEPTR:
  934. X        tmpVariable = &GRV.ResizePointer;
  935. X        tmpFontIndex = OLC_beye;
  936. X        defaultIndex = XC_tcross;
  937. X        break;
  938. X
  939. X    case MENUPTR:
  940. X        tmpVariable = &GRV.MenuPointer;
  941. X        tmpFontIndex = OLC_basic;
  942. X        defaultIndex = XC_sb_right_arrow;
  943. X        break;
  944. X
  945. X    case QUESTIONPTR:
  946. X        tmpVariable = &GRV.QuestionPointer;
  947. X        tmpFontIndex = OLC_basic;
  948. X        defaultIndex = XC_question_arrow;
  949. X        break;
  950. X
  951. X    case TARGETPTR:
  952. X        tmpVariable = &GRV.TargetPointer;
  953. X        tmpFontIndex = OLC_basic;
  954. X        defaultIndex = XC_circle;
  955. X        break;
  956. X
  957. X    case PANPTR:
  958. X        tmpVariable = &GRV.PanPointer;
  959. X        tmpFontIndex = OLC_panning;
  960. X        defaultIndex = XC_sb_v_double_arrow;
  961. X        break;
  962. X    }
  963. X
  964. X    if (cursorFont == 0 ||
  965. X        0 == (*tmpVariable = XCreateGlyphCursor(dpy, cursorFont,
  966. X            cursorFont, tmpFontIndex, tmpFontIndex+1, 
  967. X            &foreColor, &backColor)))
  968. X    {
  969. X        /* use default */
  970. X        *tmpVariable = XCreateFontCursor( dpy, defaultIndex );
  971. X#ifdef LATER
  972. X        XRecolorCursor(dpy, tmpVariable, &foreColor, &backColor);
  973. X#endif
  974. X    }
  975. X    }
  976. X
  977. X    return True;
  978. X}
  979. X
  980. X
  981. X/*
  982. X * Converting a string simply means making a copy of it.
  983. X */
  984. Xstatic Bool
  985. XcvtString(dpy, item, string, addr)
  986. X    Display        *dpy;
  987. X    ResourceItem    *item;
  988. X    char        *string;
  989. X    void        *addr;
  990. X{
  991. X    char **str = addr;
  992. X
  993. X    if (string == NULL)
  994. X    return False;
  995. X
  996. X    *str = MemNewString(string);
  997. X    return True;
  998. X}
  999. X
  1000. X
  1001. Xstatic Bool
  1002. XcvtFloat(dpy, item, string, addr)
  1003. X    Display        *dpy;
  1004. X    ResourceItem    *item;
  1005. X    char        *string;
  1006. X    void        *addr;
  1007. X{
  1008. X    return (1 == sscanf(string, "%f", (float *)addr));
  1009. X}
  1010. X
  1011. X
  1012. X/*
  1013. X * Convert an integer.  Note that %i converts from decimal, octal, and 
  1014. X * hexadecimal representations.
  1015. X */
  1016. Xstatic Bool
  1017. XcvtInteger(dpy, item, string, addr)
  1018. X    Display        *dpy;
  1019. X    ResourceItem    *item;
  1020. X    char        *string;
  1021. X    void        *addr;
  1022. X{
  1023. X    return (1 == sscanf(string, "%i", (int *)addr));
  1024. X}
  1025. X
  1026. X
  1027. X/*
  1028. X * Convert a string representing tenths of a second into milliseconds.
  1029. X */
  1030. Xstatic Bool
  1031. XcvtClickTimeout(dpy, item, string, addr)
  1032. X    Display        *dpy;
  1033. X    ResourceItem    *item;
  1034. X    char        *string;
  1035. X    void        *addr;
  1036. X{
  1037. X    int intval;
  1038. X    int *dest = addr;
  1039. X
  1040. X    if (1 != sscanf(string, "%d", &intval))
  1041. X    return False;
  1042. X
  1043. X    intval *= 100;            /* convert to milliseconds */
  1044. X
  1045. X    /*
  1046. X     * It's nearly impossible for typical mouse hardware to generate two
  1047. X     * clicks in less than 100ms.  We special-case this and make the minimum
  1048. X     * timeout value be 150ms.
  1049. X     */
  1050. X    if (intval < 150)
  1051. X    intval = 150;
  1052. X
  1053. X    *dest = intval;
  1054. X    return True;
  1055. X}
  1056. X
  1057. X
  1058. Xstatic Bool
  1059. XcvtFocusStyle(dpy, item, string, addr)
  1060. X    Display        *dpy;
  1061. X    ResourceItem    *item;
  1062. X    char        *string;
  1063. X    void        *addr;
  1064. X{
  1065. X    return matchFocusKeyword(string, (Bool *)addr);
  1066. X}
  1067. X
  1068. X
  1069. Xstatic Bool
  1070. XcvtBeepStatus(dpy, item, string, addr)
  1071. X    Display        *dpy;
  1072. X    ResourceItem    *item;
  1073. X    char        *string;
  1074. X    void        *addr;
  1075. X{
  1076. X    return matchBeepKeyword(string, (BeepStatus *)addr);
  1077. X}
  1078. X
  1079. X
  1080. Xstatic Bool
  1081. XcvtMouseless(dpy, item, string, addr)
  1082. X    Display        *dpy;
  1083. X    ResourceItem    *item;
  1084. X    char        *string;
  1085. X    void        *addr;
  1086. X{
  1087. X    return matchMouselessKeyword(string, (MouselessMode *)addr);
  1088. X}
  1089. X
  1090. X
  1091. Xstatic Bool
  1092. XcvtIconLocation(dpy, item, string, addr)
  1093. X    Display        *dpy;
  1094. X    ResourceItem    *item;
  1095. X    char        *string;
  1096. X    void        *addr;
  1097. X{
  1098. X    return matchIconPlace(string, (IconPreference *)addr);
  1099. X}
  1100. X
  1101. X
  1102. X/*
  1103. X * Convert a key specification.  REMIND: this needs to be reconciled with the 
  1104. X * key specification stuff in evbind.c.
  1105. X */
  1106. Xstatic Bool
  1107. XcvtKey(dpy, item, string, addr)
  1108. X    Display        *dpy;
  1109. X    ResourceItem    *item;
  1110. X    char        *string;
  1111. X    void        *addr;
  1112. X{
  1113. X    KeySpec        *keyspec = addr;
  1114. X    unsigned int    modmask;
  1115. X    KeyCode        keycode;
  1116. X
  1117. X    if (!parseKeySpec(dpy, string, &modmask, &keycode))
  1118. X    return False;
  1119. X
  1120. X    keyspec->modmask = modmask;
  1121. X    keyspec->keycode = keycode;
  1122. X    return True;
  1123. X}
  1124. X
  1125. X
  1126. X/*
  1127. X * buildStringList -- parse a string into words and build a linked list of 
  1128. X * them.
  1129. X */
  1130. Xstatic void
  1131. XbuildStringList(str, pplist)
  1132. Xchar *str;
  1133. XList **pplist;
  1134. X{
  1135. X    char *swork, *swork2;
  1136. X    List *l = NULL_LIST;
  1137. X
  1138. X    swork2 = swork = MemNewString(str);
  1139. X
  1140. X    while ((swork2 = strtok(swork2, " \t")) != NULL) {
  1141. X    l = ListCons(MemNewString(swork2),l);
  1142. X    swork2 = NULL;
  1143. X    }
  1144. X    MemFree(swork);
  1145. X    *pplist = l;
  1146. X}
  1147. X
  1148. X
  1149. Xstatic void *
  1150. XfreeStringList(str,junk)
  1151. Xchar *str;
  1152. Xvoid *junk;
  1153. X{
  1154. X    MemFree(str);
  1155. X    return NULL;
  1156. X}
  1157. X
  1158. X
  1159. Xstatic Bool
  1160. XcvtStringList(dpy, item, string, addr)
  1161. X    Display        *dpy;
  1162. X    ResourceItem    *item;
  1163. X    char        *string;
  1164. X    void        *addr;
  1165. X{
  1166. X    List **dest = addr;
  1167. X    List *newl = NULL_LIST;
  1168. X
  1169. X    buildStringList(string, &newl);
  1170. X    *dest = newl;
  1171. X    return True;
  1172. X}
  1173. X
  1174. X
  1175. X#ifdef OW_I18N_L3
  1176. X
  1177. X/*
  1178. X * REMIND: somewhat strange.  This function always returns True, so the
  1179. X * default value in the Resource Table is never used.  Further, this function 
  1180. X * handles both the conversion and update functions itself.
  1181. X */
  1182. Xstatic Bool
  1183. X_cvtOLLC(dpy, item, string, addr, priority)
  1184. X    Display        *dpy;
  1185. X    ResourceItem    *item;
  1186. X    char        *string;
  1187. X    void        *addr;
  1188. X{
  1189. X    OLLCItem        *ollcitem = addr;
  1190. X    char        *newlocale;
  1191. X
  1192. X    if (priority < ollcitem->priority)
  1193. X    return True;
  1194. X
  1195. X#ifdef notdef
  1196. X    fprintf(stderr,
  1197. X"_cvtOLLC locale#%d, newpri=%d, curpri=%d, newlocale %s, curlocale %s\n",
  1198. X        ollcitem->posix_category, priority, ollcitem->priority,
  1199. X        string, ollcitem->locale);
  1200. X#endif
  1201. X
  1202. X    /* don't need to do anything if the new locale is the same as the old */
  1203. X
  1204. X    if ((string == NULL && ollcitem->locale == NULL) ||
  1205. X        (string != NULL && ollcitem->locale != NULL &&
  1206. X     0 == strcmp(string, ollcitem->locale)))
  1207. X    {
  1208. X    return True;
  1209. X    }
  1210. X
  1211. X    /* they differ; update the locale */
  1212. X
  1213. X    if (string == NULL)
  1214. X    newlocale = NULL;
  1215. X    else
  1216. X    newlocale = MemNewString(string);
  1217. X
  1218. X    if (ollcitem->locale != NULL)
  1219. X    MemFree(ollcitem->locale);
  1220. X
  1221. X    ollcitem->locale = newlocale;
  1222. X    ollcitem->priority = priority;
  1223. X
  1224. X    OLLCUpdated = True;
  1225. X
  1226. X#ifdef notdef
  1227. X    fprintf(stderr, "_cvtOLLC: locale#%d -> %s\n",
  1228. X        ollcitem->posix_category, ollcitem->locale);
  1229. X#endif
  1230. X
  1231. X    return True;
  1232. X}
  1233. X
  1234. X
  1235. Xstatic Bool
  1236. XcvtOLLC(dpy, item, string, addr)
  1237. X    Display        *dpy;
  1238. X    ResourceItem    *item;
  1239. X    char        *string;
  1240. X    void        *addr;
  1241. X{
  1242. X    return _cvtOLLC(dpy, item, string, addr, OLLC_SRC_RESOURCE);
  1243. X}
  1244. X
  1245. X
  1246. Xstatic Bool
  1247. XcvtOLLCCL(dpy, item, string, addr)
  1248. X    Display        *dpy;
  1249. X    ResourceItem    *item;
  1250. X    char        *string;
  1251. X    void        *addr;
  1252. X{
  1253. X    return _cvtOLLC(dpy, item, string, addr, OLLC_SRC_COMMAND_LINE);
  1254. X}
  1255. X
  1256. X#endif /* OW_I18N_L3 */
  1257. X
  1258. X
  1259. X
  1260. X/* ===== Updaters ========================================================= */
  1261. X
  1262. X
  1263. X/*
  1264. X * static void updWhatever(dpy, item, cur, new);
  1265. X *
  1266. X * The job of the updater is to compare the current value and newly converted
  1267. X * values, and update the current value if they differ.  It is responsible
  1268. X * for all changes in global state, such as grabbing and ungrabbing keys.  
  1269. X * NOTE: if the converter has allocated memory, the updater must free it 
  1270. X * appropriately.  Since the updater is called with old and new values, 
  1271. X * exactly one of them should be freed by the updater, otherwise a memory leak 
  1272. X * will result.
  1273. X */
  1274. X
  1275. Xstatic void
  1276. XupdString(dpy, item, cur, new)
  1277. X    Display        *dpy;
  1278. X    ResourceItem    *item;
  1279. X    char        **cur, **new;
  1280. X{
  1281. X    MemFree(*cur);
  1282. X    *cur = *new;
  1283. X}
  1284. X
  1285. X
  1286. Xstatic void
  1287. XupdStringList(dpy, item, cur, new)
  1288. X    Display        *dpy;
  1289. X    ResourceItem    *item;
  1290. X    List        **cur, **new;
  1291. X{
  1292. X    ListApply(*cur, freeStringList, NULL);
  1293. X    ListDestroy(*cur);
  1294. X    *cur = *new;
  1295. X}
  1296. X
  1297. X
  1298. Xstatic void
  1299. XupdWorkspace(dpy, item, cur, new)
  1300. X    Display        *dpy;
  1301. X    ResourceItem    *item;
  1302. X    char        **cur, **new;
  1303. X{
  1304. X    MemFree(*cur);
  1305. X    *cur = *new;
  1306. X    SetWorkspaceColor(dpy);
  1307. X}
  1308. X
  1309. X
  1310. Xstatic void
  1311. XupdWindow(dpy, item, cur, new)
  1312. X    Display        *dpy;
  1313. X    ResourceItem    *item;
  1314. X    char        **cur, **new;
  1315. X{
  1316. X    MemFree(*cur);
  1317. X    *cur = *new;
  1318. X    SetWindowColor(dpy);
  1319. X}
  1320. X
  1321. X
  1322. Xstatic void
  1323. XupdForeground(dpy, item, cur, new)
  1324. X    Display        *dpy;
  1325. X    ResourceItem    *item;
  1326. X    char        **cur, **new;
  1327. X{
  1328. X    MemFree(*cur);
  1329. X    *cur = *new;
  1330. X    SetForegroundColor(dpy);
  1331. X}
  1332. X
  1333. Xstatic void
  1334. XupdBackground(dpy, item, cur, new)
  1335. X    Display        *dpy;
  1336. X    ResourceItem    *item;
  1337. X    char        **cur, **new;
  1338. X{
  1339. X    MemFree(*cur);
  1340. X    *cur = *new;
  1341. X    SetBackgroundColor(dpy);
  1342. X}
  1343. X
  1344. Xstatic void
  1345. XupdBorder(dpy, item, cur, new)
  1346. X    Display        *dpy;
  1347. X    ResourceItem    *item;
  1348. X    char        **cur, **new;
  1349. X{
  1350. X    MemFree(*cur);
  1351. X    *cur = *new;
  1352. X    SetBorderColor(dpy);
  1353. X}
  1354. X
  1355. X
  1356. Xstatic void
  1357. XupdSync(dpy, item, cur, new)
  1358. X    Display        *dpy;
  1359. X    ResourceItem    *item;
  1360. X    Bool        *cur, *new;
  1361. X{
  1362. X    if (*cur != *new) {
  1363. X    (void) XSynchronize(dpy, *new);
  1364. X    *cur = *new;
  1365. X    }
  1366. X}
  1367. X
  1368. X
  1369. Xstatic void
  1370. XupdTitleFont(dpy, item, cur, new)
  1371. X    Display        *dpy;
  1372. X    ResourceItem    *item;
  1373. X    XFontStruct        **cur, **new;
  1374. X{
  1375. X    XFree((char *) *cur);
  1376. X    *cur = *new;
  1377. X    SetTitleFont(dpy);
  1378. X}
  1379. X
  1380. X
  1381. Xstatic void
  1382. XupdTextFont(dpy, item, cur, new)
  1383. X    Display        *dpy;
  1384. X    ResourceItem    *item;
  1385. X    XFontStruct        **cur, **new;
  1386. X{
  1387. X    XFree((char *) *cur);
  1388. X    *cur = *new;
  1389. X    SetTextFont(dpy);
  1390. X}
  1391. X
  1392. X
  1393. Xstatic void
  1394. XupdButtonFont(dpy, item, cur, new)
  1395. X    Display        *dpy;
  1396. X    ResourceItem    *item;
  1397. X    XFontStruct        **cur, **new;
  1398. X{
  1399. X    XFree((char *) *cur);
  1400. X    *cur = *new;
  1401. X    SetButtonFont(dpy);
  1402. X}
  1403. X
  1404. X
  1405. Xstatic void
  1406. XupdIconFont(dpy, item, cur, new)
  1407. X    Display        *dpy;
  1408. X    ResourceItem    *item;
  1409. X    XFontStruct        **cur, **new;
  1410. X{
  1411. X    XFree((char *) *cur);
  1412. X    *cur = *new;
  1413. X    SetIconFont(dpy);
  1414. X}
  1415. X
  1416. X
  1417. Xstatic void
  1418. XupdGlyphFont(dpy, item, cur, new)
  1419. X    Display        *dpy;
  1420. X    ResourceItem    *item;
  1421. X    XFontStruct        **cur, **new;
  1422. X{
  1423. X    XFree((char *) *cur);
  1424. X    *cur = *new;
  1425. X    SetGlyphFont(dpy);
  1426. X}
  1427. X
  1428. X
  1429. Xstatic void
  1430. XupdIconLocation(dpy, item, cur, new)
  1431. X    Display        *dpy;
  1432. X    ResourceItem    *item;
  1433. X    IconPreference  *cur, *new;
  1434. X{
  1435. X    if (*cur != *new) {
  1436. X    *cur = *new;
  1437. X    SetIconLocation(dpy);
  1438. X    }
  1439. X}
  1440. X
  1441. X
  1442. Xstatic void
  1443. XupdMouseless(dpy, item, cur, new)
  1444. X    Display        *dpy;
  1445. X    ResourceItem    *item;
  1446. X    MouselessMode   *cur, *new;
  1447. X{
  1448. X    if (*cur != *new) {
  1449. X    *cur = *new;
  1450. X    RefreshKeyGrabs(dpy);
  1451. X    }
  1452. X}
  1453. X
  1454. X
  1455. X/*
  1456. X * unconfigureFocus
  1457. X *
  1458. X * Tell a client to remove any grabs it may have set up according to the focus 
  1459. X * mode.  If this client is the focus, tell it to draw in its unfocused state.
  1460. X */
  1461. Xstatic void *
  1462. XunconfigureFocus(cli)
  1463. X    Client *cli;
  1464. X{
  1465. X    if (cli->framewin == NULL)
  1466. X    return NULL;
  1467. X    FrameSetupGrabs(cli, cli->framewin->core.self, False);
  1468. X    if (cli->isFocus) {
  1469. X    cli->isFocus = False;
  1470. X    WinCallDraw((WinGeneric *)cli->framewin);
  1471. X    cli->isFocus = True;
  1472. X    }
  1473. X    return NULL;
  1474. X}
  1475. X
  1476. X
  1477. X/*
  1478. X * reconfigureFocus
  1479. X *
  1480. X * Tell a client to restore any grabs it may need for the new focus mode.  If 
  1481. X * this client is the focus, tell it to draw using the proper highlighting for 
  1482. X * the new focus mode.
  1483. X */
  1484. Xstatic void *
  1485. XreconfigureFocus(cli)
  1486. X    Client *cli;
  1487. X{
  1488. X    if (cli->framewin == NULL)
  1489. X    return NULL;
  1490. X    FrameSetupGrabs(cli, cli->framewin->core.self, True);
  1491. X    if (cli->isFocus) {
  1492. X    WinCallDraw((WinGeneric *)cli->framewin);
  1493. X    }
  1494. X    return NULL;
  1495. X}
  1496. X
  1497. X
  1498. X/*
  1499. X * UpdFocusStyle -- change the focus style on the fly
  1500. X *
  1501. X * If focus style needs updating, call unconfigureFocus on every client.  This
  1502. X * will clear grabs and highlighting and such while the old focus mode is
  1503. X * still in effect.  Update the global value, and then call reconfigureFocus
  1504. X * on every client to set up stuff for the new focus mode.
  1505. X *
  1506. X * REMIND: This function is global because it's called from FlipFocusFunc in
  1507. X * services.c.  This call passes NULL for item.  This needs to be cleaned up.
  1508. X */
  1509. Xvoid
  1510. XUpdFocusStyle(dpy, item, cur, new)
  1511. X    Display        *dpy;
  1512. X    ResourceItem    *item;
  1513. X    Bool        *cur, *new;
  1514. X{
  1515. X    if (*cur != *new) {
  1516. X    ListApply(ActiveClientList, unconfigureFocus, 0);
  1517. X    *cur = *new;
  1518. X    ListApply(ActiveClientList, reconfigureFocus, 0);
  1519. X    }
  1520. X}
  1521. X
  1522. X
  1523. X/* ===== Global Functions ================================================= */
  1524. X
  1525. X
  1526. X/*
  1527. X * InitGlobals -- probe OlwmDB for resources and store values into global 
  1528. X * variables.  Called once at startup time.
  1529. X */
  1530. Xvoid
  1531. XInitGlobals(dpy)
  1532. X    Display    *dpy;
  1533. X{
  1534. X    ResourceItem *item;
  1535. X    int i;
  1536. X    XrmRepresentation type;
  1537. X    XrmValue value;
  1538. X    XrmQuark classes[3];
  1539. X    XrmQuark instances[3];
  1540. X    char buf[1000];
  1541. X    Bool    found;
  1542. X
  1543. X    (void) memset((char *) &GRV, 0, sizeof(GRV));
  1544. X
  1545. X#ifdef OW_I18N_L3
  1546. X    GRVLCInit();
  1547. X#endif /* OW_I18N_L3 */
  1548. X
  1549. X    classes[2] = instances[2] = NULLQUARK;
  1550. X    instances[0] = TopInstanceQ;
  1551. X
  1552. X    for (i = 0; i < NRESOURCEITEMS; ++i) {
  1553. X        classes[0] = OpenWinQ;
  1554. X
  1555. X    item = &ResourceTable[i];
  1556. X    classes[1]   = item->classQ    = XrmStringToQuark(item->class);
  1557. X    instances[1] = item->instanceQ = XrmStringToQuark(item->instance);
  1558. X
  1559. X    /*
  1560. X     * Probe the database.  If the probe fails, or if the probe succeeds 
  1561. X     * but the resulting value cannot be converted, convert the default 
  1562. X     * value into the global variable.
  1563. X     *
  1564. X     * In olvwm, if we don't find the resource then look up the
  1565. X     * resource using the olwm class.  This is arguably wrong, but
  1566. X     * it allows previously specified olwm resources to work without
  1567. X     * changing their name.
  1568. X     */
  1569. X
  1570. X    if (!XrmQGetResource(OlwmDB, instances, classes, &type, &value)) {
  1571. X        classes[0] = OlwmQ;
  1572. X        found = XrmQGetResource(OlwmDB, instances, classes, &type, &value);
  1573. X    }
  1574. X    else found = True;
  1575. X    if (found)
  1576. X        found = (*item->converter)(dpy, item,
  1577. X                    (char *)value.addr, item->addr);
  1578. X    if (!found)
  1579. X        (void) (*item->converter)(dpy, item, item->defaultString,
  1580. X                      item->addr);
  1581. X    }
  1582. X
  1583. X    /*
  1584. X     * Special case for glyph font: if we couldn't find a valid glyph font,
  1585. X     * it's a fatal error.
  1586. X     */
  1587. X    if (GRV.GlyphFontInfo == NULL)
  1588. X    ErrorGeneral(gettext("can't open glyph font"));
  1589. X    /*NOTREACHED*/
  1590. X
  1591. X#ifdef OW_I18N_L3
  1592. X    setOLLCPosix();
  1593. X#endif /* OW_I18N_L3 */
  1594. X}
  1595. X
  1596. X
  1597. Xtypedef union _datum {
  1598. X    int            intval;
  1599. X    void        *pointer;
  1600. X    KeySpec        keyspec;
  1601. X#ifdef OW_I18N_L3
  1602. X    OLLCItem        ollcitem;
  1603. X#endif /* OW_I18N_L3 */
  1604. X} Datum;
  1605. X
  1606. X
  1607. Xstatic XrmBinding Bindings[] = { XrmBindTightly, XrmBindTightly };
  1608. X
  1609. X
  1610. X/*
  1611. X * UpdateGlobals -- handle updates to the server's resource database.  Called
  1612. X * every time the server's RESOURCE_MANAGER property changes.  stringdb is the
  1613. X * contents of this property.  Creates a new database and probes into it.  For
  1614. X * entries that have changed, convert the entry into a value and call the
  1615. X * update function.  If there is no update function, convert the entry
  1616. X * directly into the global variable.  Destroys the new database after 
  1617. X * processing it.
  1618. X */
  1619. Xvoid
  1620. XUpdateGlobals(dpy, stringdb)
  1621. X    Display        *dpy;
  1622. X    char        *stringdb;
  1623. X{
  1624. X    Datum        datum;
  1625. X    ResourceItem    *item;
  1626. X    int            i;
  1627. X    XrmDatabase        newDB;
  1628. X    XrmRepresentation    type;
  1629. X    XrmValue        newvalue, oldvalue;
  1630. X    XrmQuark        classes[3];
  1631. X    XrmQuark        instances[3];
  1632. X    void        *dest;
  1633. X
  1634. X    newDB = XrmGetStringDatabase(stringdb);
  1635. X
  1636. X    classes[0] = OpenWinQ;
  1637. X    instances[0] = TopInstanceQ;
  1638. X    classes[2] = instances[2] = NULLQUARK;
  1639. X
  1640. X    for (i = 0; i < NRESOURCEITEMS; ++i) {
  1641. X
  1642. X    item = &ResourceTable[i];
  1643. X
  1644. X    classes[1]   = item->classQ;
  1645. X    instances[1] = item->instanceQ;
  1646. X
  1647. X    if (XrmQGetResource(newDB, instances, classes, &type, &newvalue)) {
  1648. X        if (XrmQGetResource(OlwmDB, instances, classes, &type, &oldvalue) &&
  1649. X            0 == strcmp((char *)newvalue.addr, (char *)oldvalue.addr))
  1650. X        {
  1651. X            /* old and new values the same; ignore */
  1652. X            continue;
  1653. X        }
  1654. X
  1655. X        XrmQPutStringResource(&OlwmDB, Bindings, instances,
  1656. X                      (char *)newvalue.addr);
  1657. X
  1658. X        if (item->updater == NULL) {
  1659. X            (void) (*item->converter)(dpy, item, (char *)newvalue.addr,
  1660. X                          item->addr);
  1661. X        } else {
  1662. X            (void) memset((char *) &datum, 0, sizeof(datum));
  1663. X            if ((*item->converter)(dpy, item, (char *)newvalue.addr, &datum))
  1664. X            (*item->updater)(dpy, item, item->addr, &datum);
  1665. X        }
  1666. X    }
  1667. X    else {
  1668. X        /*
  1669. X         * use olwm resources; check above
  1670. X         */
  1671. X        classes[0] = OlwmQ;
  1672. X        if (XrmQGetResource(newDB, instances, classes, &type, &newvalue)) {
  1673. X            if (XrmQGetResource(OlwmDB, instances, classes,
  1674. X                &type, &oldvalue) &&
  1675. X                0 == strcmp((char *)newvalue.addr, (char *)oldvalue.addr))
  1676. X                {
  1677. X                    /* old and new values the same; ignore */
  1678. X                classes[0] = OpenWinQ;
  1679. X                    continue;
  1680. X                }
  1681. X
  1682. X            XrmQPutStringResource(&OlwmDB, Bindings, instances,
  1683. X                          (char *)newvalue.addr);
  1684. X
  1685. X            if (item->updater == NULL) {
  1686. X                (void) (*item->converter)(dpy, item, (char *)newvalue.addr,
  1687. X                              item->addr);
  1688. X            } else {
  1689. X                (void) memset((char *) &datum, 0, sizeof(datum));
  1690. X                if ((*item->converter)(dpy, item,
  1691. X                       (char *)newvalue.addr, &datum))
  1692. X                (*item->updater)(dpy, item, item->addr, &datum);
  1693. X        }
  1694. X        }
  1695. X        classes[0] = OpenWinQ;
  1696. X    }
  1697. X    }
  1698. X
  1699. X    UpdateBindings(dpy, newDB);
  1700. X
  1701. X#ifdef OW_I18N_L3
  1702. X    EffectOLLC(dpy);
  1703. X#endif /* OW_I18N_L3 */
  1704. X
  1705. X    XrmDestroyDatabase(newDB);
  1706. X}
  1707. X
  1708. X
  1709. X#ifdef OW_I18N_L3
  1710. X
  1711. X /*
  1712. X  * GRVLCInit: Here is the table for OPEN LOOK locale and POSIX/ANSI-C
  1713. X  * locale categories.
  1714. X  */
  1715. Xstatic void
  1716. XGRVLCInit()
  1717. X{
  1718. X       GRV.LC.BasicLocale.posix_category       = LC_CTYPE;
  1719. X       GRV.LC.DisplayLang.posix_category       = LC_MESSAGES;
  1720. X       GRV.LC.InputLang.posix_category         = -1;
  1721. X       GRV.LC.Numeric.posix_category           = LC_NUMERIC;
  1722. X       GRV.LC.DateFormat.posix_category        = LC_TIME;
  1723. X}
  1724. X
  1725. X/*
  1726. X * ReInitAllUserMenus -- Reinitalize the user menus for each screen
  1727. X */
  1728. Xstatic void
  1729. XReInitAllUserMenus(dpy, force) 
  1730. X    Display         *dpy;
  1731. X    Bool        force;
  1732. X{
  1733. XScreenInfo      *si;
  1734. Xextern List    *ScreenInfoList;
  1735. XList            *l = ScreenInfoList;
  1736. X               
  1737. X    for (si = ListEnum(&l); si; si = ListEnum(&l))
  1738. X    ReInitUserMenu(dpy, si, force);
  1739. X}
  1740. X
  1741. Xvoid
  1742. XEffectOLLC(dpy)
  1743. XDisplay       *dpy;
  1744. X{
  1745. X       register OLLCItem       *ollci, *ollci_end, *ollci_basic;
  1746. X       register char           *current;
  1747. X       register int            require_all_update;
  1748. X       int                     messages_updated;
  1749. X
  1750. X
  1751. X       if (!OLLCUpdated)
  1752. X               return;
  1753. X
  1754. X       require_all_update = False;
  1755. X       messages_updated = False;
  1756. X       ollci_basic = &(GRV.LC.BasicLocale);
  1757. X       ollci_end = &ollci_basic[OLLC_LC_MAX];
  1758. X
  1759. X       /*
  1760. X        * This is silly restriction, but works well for Sundae1.0
  1761. X        * environment.
  1762. X        */
  1763. X       current = setlocale(LC_CTYPE, NULL);
  1764. X       if (strcmp(current, "C") == 0
  1765. X        && ollci_basic->locale != NULL
  1766. X        && strcmp(current, ollci_basic->locale) != 0)
  1767. X       {
  1768. X               /*
  1769. X                * I'm doing LC_ALL rather only LC_CTYPE, becuase
  1770. X                * there are some locale category which does not
  1771. X                * covered by current OLLC spec.
  1772. X                */
  1773. X#ifdef notdef
  1774. X fprintf(stderr, "Basic Locale -> %s\n", ollci_basic->locale);
  1775. X#endif
  1776. X               setlocale(LC_ALL, ollci_basic->locale);
  1777. X               require_all_update = True;
  1778. X       }
  1779. X
  1780. X
  1781. X       for (ollci = ollci_basic + 1; ollci < ollci_end; ollci++)
  1782. X       {
  1783. X               if (ollci->posix_category < 0)
  1784. X                       continue;
  1785. X               current = setlocale(ollci->posix_category, NULL);
  1786. X               if (strcmp(current, ollci->locale) != 0
  1787. X               || require_all_update == True)
  1788. X               {
  1789. X                       /*
  1790. X                        * Again, we need following silly restriction
  1791. X                        * in order to work well with EUC based
  1792. X                        * environment.
  1793. X                        */
  1794. X                      if (strcmp(current, "C") == 0
  1795. X                        || strcmp(ollci->locale, "C") == 0
  1796. X                        || strcmp(ollci->locale, ollci_basic->locale) == 0)
  1797. X                       {
  1798. X#ifdef notdef
  1799. X fprintf(stderr, "locale#%d -> %s\n", ollci->posix_category, ollci->locale);
  1800. X#endif
  1801. X                               setlocale(ollci->posix_category,
  1802. X                                       ollci->locale);
  1803. X                               if (ollci->posix_category == LC_MESSAGES)
  1804. X                                       messages_updated = True;
  1805. X                       }
  1806. X               }
  1807. X       }
  1808. X       OLLCUpdated = False;
  1809. X
  1810. X       if (messages_updated == True) {
  1811. X        WindowMenuDestroy(dpy);
  1812. X        WindowMenuCreate(dpy);
  1813. X        ReInitAllUserMenus(dpy,True);
  1814. X       }
  1815. X}
  1816. X
  1817. X#endif /* OW_I18N_L3 */
  1818. X
  1819. X/*
  1820. X * SetVirtualScreenAttribute - set the given attribute for each vdm
  1821. X */
  1822. Xstatic void
  1823. XsetVirtualScreenAttribute(dpy, f) 
  1824. X    Display         *dpy;
  1825. X    FuncPtr        f;
  1826. X{
  1827. XScreenInfo      *si;
  1828. Xextern List    *ScreenInfoList;
  1829. XList            *l = ScreenInfoList;
  1830. X               
  1831. X    for (si = ListEnum(&l); si; si = ListEnum(&l)) {
  1832. X    (*f)(dpy,si);
  1833. X    RedrawVDM(si->vdm);
  1834. X    }
  1835. X}
  1836. X
  1837. Xstatic void
  1838. XupdVirtualFgColor(dpy, item, cur, new)
  1839. X    Display        *dpy;
  1840. X    ResourceItem    *item;
  1841. X    char        **cur, **new;
  1842. X{
  1843. X    MemFree(*cur);
  1844. X    *cur = *new;
  1845. X    setVirtualScreenAttribute(dpy, setScreenVirtualForegroundColor);
  1846. X}
  1847. X
  1848. Xstatic void
  1849. XupdVirtualBgColor(dpy, item, cur, new)
  1850. X    Display        *dpy;
  1851. X    ResourceItem    *item;
  1852. X    char        **cur, **new;
  1853. X{
  1854. X    MemFree(*cur);
  1855. X    *cur = *new;
  1856. X    setVirtualScreenAttribute(dpy, setScreenVirtualBackgroundColor);
  1857. X}
  1858. X
  1859. Xstatic void
  1860. XupdVirtualFontColor(dpy, item, cur, new)
  1861. X    Display        *dpy;
  1862. X    ResourceItem    *item;
  1863. X    char        **cur, **new;
  1864. X{
  1865. X    MemFree(*cur);
  1866. X    *cur = *new;
  1867. X    setVirtualScreenAttribute(dpy, setScreenVirtualFontColor);
  1868. X}
  1869. X
  1870. Xstatic void
  1871. XupdVirtualGridColor(dpy, item, cur, new)
  1872. X    Display        *dpy;
  1873. X    ResourceItem    *item;
  1874. X    char        **cur, **new;
  1875. X{
  1876. X    MemFree(*cur);
  1877. X    *cur = *new;
  1878. X    setVirtualScreenAttribute(dpy, setScreenVirtualGridColor);
  1879. X}
  1880. X
  1881. Xstatic void
  1882. XupdInputFocusColor(dpy, item, cur, new)
  1883. X    Display        *dpy;
  1884. X    ResourceItem    *item;
  1885. X    char        **cur, **new;
  1886. X{
  1887. X    MemFree(*cur);
  1888. X    *cur = *new;
  1889. X    setVirtualScreenAttribute(dpy, setScreenInputFocusColor);
  1890. X}
  1891. X
  1892. Xstatic void
  1893. XupdVirtualFont(dpy, item, cur, new)
  1894. X    Display        *dpy;
  1895. X    ResourceItem    *item;
  1896. X    char        **cur, **new;
  1897. X{
  1898. X    MemFree(*cur);
  1899. X    *cur = *new;
  1900. X    setVirtualScreenAttribute(dpy, updateScreenVirtualFont);
  1901. X}
  1902. X
  1903. Xstatic void
  1904. XupdVirtualGeometry(dpy, item, cur, new)
  1905. X    Display        *dpy;
  1906. X    ResourceItem    *item;
  1907. X    char        **cur, **new;
  1908. X{
  1909. X    MemFree(*cur);
  1910. X    *cur = *new;
  1911. X    setVirtualScreenAttribute(dpy, updateScreenVirtualGeometry);
  1912. X}
  1913. X
  1914. Xstatic void
  1915. XupdVirtualMap(dpy, item, cur, new)
  1916. X    Display        *dpy;
  1917. X    ResourceItem    *item;
  1918. X    char        **cur, **new;
  1919. X{
  1920. X    MemFree(*cur);
  1921. X    *cur = *new;
  1922. X    setVirtualScreenAttribute(dpy, updateScreenVirtualMap);
  1923. X}
  1924. X
  1925. Xstatic void
  1926. XupdVirtualMapColor(dpy, item, cur, new)
  1927. X    Display        *dpy;
  1928. X    ResourceItem    *item;
  1929. X    char        **cur, **new;
  1930. X{
  1931. X    MemFree(*cur);
  1932. X    *cur = *new;
  1933. X    setVirtualScreenAttribute(dpy, setScreenVirtualPixmapColor);
  1934. X}
  1935. X
  1936. Xstatic void
  1937. XupdVirtualDesktop(dpy, item, cur, new)
  1938. X    Display        *dpy;
  1939. X    ResourceItem    *item;
  1940. X    char        **cur, **new;
  1941. X{
  1942. X    MemFree(*cur);
  1943. X    *cur = *new;
  1944. X    setVirtualScreenAttribute(dpy, updateScreenVirtualDesktop);
  1945. X}
  1946. X
  1947. Xstatic void
  1948. XupdVirtualIconGeometry(dpy, item, cur, new)
  1949. X    Display        *dpy;
  1950. X    ResourceItem    *item;
  1951. X    char        **cur, **new;
  1952. X{
  1953. X    MemFree(*cur);
  1954. X    *cur = *new;
  1955. X    setVirtualScreenAttribute(dpy, updateScreenVirtualIconGeometry);
  1956. X}
  1957. X
  1958. Xstatic void
  1959. XupdVirtualScale(dpy, item, cur, new)
  1960. X    Display        *dpy;
  1961. X    ResourceItem    *item;
  1962. X    char        **cur, **new;
  1963. X{
  1964. X    MemFree(*cur);
  1965. X    *cur = *new;
  1966. X    setVirtualScreenAttribute(dpy, updateScreenVirtualScale);
  1967. X}
  1968. X
  1969. Xstatic Bool
  1970. X/* ARGSUSED */
  1971. XcvtGridEnum(dpy, item, value, ret)
  1972. X    Display        *dpy;
  1973. X    ResourceItem    *item;
  1974. X    char        *value;
  1975. X    VirtualGridType *ret;
  1976. X{
  1977. X    if (MatchString(value,"none"))
  1978. X    {
  1979. X        *ret = GridNone;
  1980. X        return True;
  1981. X    }
  1982. X    if (MatchString(value,"invisible"))
  1983. X    {
  1984. X        *ret = GridInvisible;
  1985. X        return True;
  1986. X    }
  1987. X    if (MatchString(value,"visible"))
  1988. X    {
  1989. X        *ret = GridVisible;
  1990. X        return True;
  1991. X    }
  1992. X    return False;
  1993. X}
  1994. X
  1995. Xstatic Bool
  1996. X/* ARGSUSED */
  1997. XcvtImageType(dpy, item, value, ret)
  1998. X    Display        *dpy;
  1999. X    ResourceItem    *item;
  2000. X    char        *value;
  2001. X    ImageType         *ret;
  2002. X{
  2003. X    if (MatchString(value,"useall"))
  2004. X    {
  2005. X        *ret = UseAll;
  2006. X        return True;
  2007. X    }
  2008. X    if (MatchString(value,"usenone"))
  2009. X    {
  2010. X        *ret = UseNone;
  2011. X        return True;
  2012. X    }
  2013. X    if (MatchString(value,"usevdm"))
  2014. X    {
  2015. X        *ret = UseVDM;
  2016. X        return True;
  2017. X    }
  2018. X    return False;
  2019. X}
  2020. END_OF_FILE
  2021. if test 49362 -ne `wc -c <'resources.c'`; then
  2022.     echo shar: \"'resources.c'\" unpacked with wrong size!
  2023. fi
  2024. # end of 'resources.c'
  2025. fi
  2026. if test -f 'slots.h' -a "${1}" != "-c" ; then 
  2027.   echo shar: Will not clobber existing file \"'slots.h'\"
  2028. else
  2029. echo shar: Extracting \"'slots.h'\" \(1970 characters\)
  2030. sed "s/^X//" >'slots.h' <<'END_OF_FILE'
  2031. X/*
  2032. X *      (c) Copyright 1990 Sun Microsystems, Inc. Sun design patents
  2033. X *      pending in the U.S. and foreign countries. See LEGAL_NOTICE
  2034. X *      file for terms of the license.
  2035. X */
  2036. X
  2037. X#ident    "@(#)slots.h    26.7    91/09/14 SMI"
  2038. X
  2039. X#ifndef _OLWM_SLOT_H
  2040. X#define _OLWM_SLOT_H
  2041. X
  2042. Xtypedef enum {SOTopToBottom, SOBottomToTop, SOLeftToRight, SORightToLeft} SlotOrder;
  2043. X
  2044. Xtypedef struct _iconSlot {
  2045. X    int     ma, mi, maw, miw;
  2046. X    Bool     positioned;
  2047. X    int    off_x, off_y;
  2048. X} IconSlot;
  2049. X
  2050. Xtypedef struct _iconGrid {
  2051. X    SlotOrder    SOmajor,SOminor;
  2052. X    int        *occupancy;
  2053. X    int        minoccupancy;
  2054. X    List        *iconList;
  2055. X    int        maslots,mislots;
  2056. X    int        slotshoriz,slotsvert;
  2057. X    int        pixhoriz,pixvert;
  2058. X} IconGrid;
  2059. X
  2060. Xextern IconGrid *SlotInit();     /* Display *dpy, int screeno */
  2061. X    /* initialises the Slots package; should be called for
  2062. X     * each screen
  2063. X     */
  2064. X
  2065. Xextern struct _iconSlot *SlotAlloc();    /* WinIcon *, Bool, Bool */
  2066. X    /* given a sized and possibly positioned icon window, allocate 
  2067. X     * the appropriate slots for it.  If the window is positioned, 
  2068. X     * True should be passed for the second parameter, and the x,y
  2069. X     * position will be honoured.  If the window is not positioned, it
  2070. X     * will be positioned by this function to the appropriate slots(s).
  2071. X     * If the icon is being manually positioned and should be positioned
  2072. X     * according to the icon grid, True should be passed for the third
  2073. X     * parameter; False should be passed otherwise.
  2074. X     */
  2075. X
  2076. Xextern Bool SlotFree();        /* WinIcon * */
  2077. X     /* An icon is going away, so its references to slots should also go
  2078. X     * away. 
  2079. X     */
  2080. X
  2081. Xextern Bool SlotSetLocations();    /* Display *dpy */
  2082. X    /* sets the order in which slots are allocated for icons which are
  2083. X     * not explicitly positioned.  The new order is obtained from the
  2084. X     * global resource vector.
  2085. X     * For example, the AlongBottom order is expressed as
  2086. X     * major BottomToTop, minor LeftToRight.  Any icons which were 
  2087. X     * automatically positioned are repositioned to equivalent positions
  2088. X     * in the new order.
  2089. X     */
  2090. X
  2091. X#endif /* _OLWM_SLOT_H */
  2092. END_OF_FILE
  2093. if test 1970 -ne `wc -c <'slots.h'`; then
  2094.     echo shar: \"'slots.h'\" unpacked with wrong size!
  2095. fi
  2096. # end of 'slots.h'
  2097. fi
  2098. echo shar: End of archive 3 \(of 21\).
  2099. cp /dev/null ark3isdone
  2100. MISSING=""
  2101. 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
  2102.     if test ! -f ark${I}isdone ; then
  2103.     MISSING="${MISSING} ${I}"
  2104.     fi
  2105. done
  2106. if test "${MISSING}" = "" ; then
  2107.     echo You have unpacked all 21 archives.
  2108.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  2109. else
  2110.     echo You still need to unpack the following archives:
  2111.     echo "        " ${MISSING}
  2112. fi
  2113. ##  End of shell archive.
  2114. exit 0
  2115. --
  2116. Molecular Simulations, Inc.             mail: dcmartin@postgres.berkeley.edu
  2117. 796 N. Pastoria Avenue                  uucp: uwvax!ucbvax!dcmartin
  2118. Sunnyvale, California 94086             at&t: 408/522-9236
  2119.