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

  1. Path: uunet!sun-barr!ames!pasteur!nntp
  2. From: scott.oaks@East.Sun.COM (Scott Oaks)
  3. Newsgroups: comp.sources.x
  4. Subject: v15i166: OpenLook Virtual Window Mgr (3.0), Part20/21
  5. Message-ID: <1992Feb4.140114.8411@pasteur.Berkeley.EDU>
  6. Date: 4 Feb 92 14:01:14 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: 2103
  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 166
  16. Archive-name: olvwm-3.0/part20
  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 20 (of 21)."
  25. # Contents:  Makefile.sunpro WinInfo.c defaults.c environ.h globals.h
  26. #   i18n.c iconimage.h iconmask.h mem.c olgx_impl.h properties.h
  27. #   screen.h slave.c virtual.h winbusy.c
  28. # Wrapped by dcmartin@fascet on Tue Jan 14 05:54:49 1992
  29. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  30. if test -f 'Makefile.sunpro' -a "${1}" != "-c" ; then 
  31.   echo shar: Will not clobber existing file \"'Makefile.sunpro'\"
  32. else
  33. echo shar: Extracting \"'Makefile.sunpro'\" \(3103 characters\)
  34. sed "s/^X//" >'Makefile.sunpro' <<'END_OF_FILE'
  35. X.KEEP_STATE:
  36. X
  37. X# Set this to the directory to place the olvwm executable
  38. XINSTALLDIR = ${OPENWINHOME}/bin
  39. X
  40. X# If you want to use the OPENWINDOWS help facility, then set HELPDIR
  41. X# to the directory where those files are kept.  If you cannot write
  42. X# to that directory but still want to install the helpfile, set HELPDIR
  43. X# to some other directory and add that directory to your HELPPATH.
  44. X# If you don't want to install the help file at all, set HELPDIR to /dev/null.
  45. XHELPDIR = ${OPENWINHOME}/lib/info
  46. X
  47. X# Where to install the man pages:  man1 dir is where olvwm.man will go;
  48. X# and man5 dir is where olvwmrc.man will go; youmay want to set these
  49. X# to a local directory somewhere.
  50. X# If you don't want to install the man pages, set MAN?DIR to /dev/null.
  51. X
  52. XMAN1DIR = ${OPENWINHOME}/man/man1
  53. XMAN5DIR = ${OPENWINHOME}/man/man5
  54. X
  55. X# If you don't have olwm installed anywhere and want to install the olwm
  56. X# man page (which discusses most of the olvwm functionality too) uncomment
  57. X# out the following lines
  58. X#OLWMMAN = olwm.man
  59. X
  60. X# Set this to the debugging options you'd like
  61. XDEBUG = -O
  62. X
  63. X#
  64. X# You shouldn't need to change anything below this line
  65. X
  66. XINC = -I${OPENWINHOME}/include
  67. XCFLAGS = ${INC} ${DEBUG} -DOW_I18N_L3 -DSUNDAE -DSHAPE
  68. X
  69. XHEADERS = cmdstream.h defaults.h environ.h events.h gettext.h \
  70. X      globals.h group.h helpcmd.h i18n.h iconimage.h iconmask.h  \
  71. X      kbdfuncs.h list.h mem.h menu.h notice.h olcursor.h         \
  72. X      olgx_impl.h ollocale.h olwm.h patchlevel.h properties.h    \
  73. X      resources.h screen.h slots.h st.h virtual.h win.h
  74. X
  75. XSRCS = Debug.c Error.c Notice.c Select.c WinInfo.c atom.c client.c \
  76. X    cmdstream.c defaults.c environ.c evbind.c events.c gettext.c \
  77. X    group.c helpsend.c i18n.c kbdfuncs.c list.c mem.c menu.c \
  78. X     moveresize.c olwm.c properties.c resources.c screen.c services.c \
  79. X    slave.c slots.c st.c states.c usermenu.c usleep.c virtual.c \
  80. X    win.c winbusy.c winbutton.c wincolor.c winframe.c wingframe.c \
  81. X    winicon.c winipane.c winmenu.c winnofoc.c winpane.c winpinmenu.c \
  82. X    winpush.c winresize.c winroot.c olvwmrc.c images.c \
  83. X    ol_button.c
  84. X
  85. XLDFLAGS = -L${OPENWINHOME}/lib
  86. XLIBS = ${LDFLAGS} -lolgx -lX11 -lXext -ll -lm
  87. X
  88. XOBJS = ${SRCS:.c=.o} version.o
  89. X
  90. Xolvwm : ${OBJS}
  91. X    cc -o olvwm ${OBJS} ${LIBS}
  92. X
  93. Xversion.c : ${SRCS} ${HEADERS}
  94. X    @echo -n "#ident \"@(#)olvwm version compiled " > version.c
  95. X    @/bin/sh -c 'echo `date` \"' >> version.c
  96. X
  97. Xparse.c : parse.l
  98. X    lex -t parse.l > parse.c   
  99. X         
  100. Xolvwmrc.c : olvwmrc.y 
  101. X    yacc olvwmrc.y 
  102. X    mv y.tab.c olvwmrc.c
  103. X
  104. Xolvwmrc.o : parse.c olvwmrc.c 
  105. X
  106. Xclean :
  107. X    /bin/rm -f olvwm .make.state .nse_depinfo version.c parse.c olvwmrc.c *.o core errs ,* .emacs_* tags TAGS make.log MakeOut "#"*
  108. X
  109. Xinstall:
  110. X    @echo "Installing olvwm in $(INSTALLDIR)"
  111. X    @/bin/cp olvwm $(INSTALLDIR)
  112. X    @echo "Installing help file in $(HELPDIR)"
  113. X    @/bin/cp olvwm.info $(HELPDIR)
  114. X    @echo "Installing olvwm man page in $(MAN1DIR)"
  115. X    @/bin/cp olvwm.man olvwm.1
  116. X    @/bin/cp olvwm.1 $(MAN1DIR)
  117. X    @/bin/rm -f olvwm.1
  118. X    @echo "Installing olvwmrc man page in $(MAN5DIR)"
  119. X    @/bin/cp olvwmrc.man olvwmrc.5
  120. X    @/bin/cp olvwmrc.5 $(MAN5DIR)
  121. X    @/bin/rm -f olvwmrc.5
  122. X    -@/bin/cp ${OLWMMAN} ${MAN1DIR}/olwm.1 >/dev/null 2>&1
  123. END_OF_FILE
  124. if test 3103 -ne `wc -c <'Makefile.sunpro'`; then
  125.     echo shar: \"'Makefile.sunpro'\" unpacked with wrong size!
  126. fi
  127. # end of 'Makefile.sunpro'
  128. fi
  129. if test -f 'WinInfo.c' -a "${1}" != "-c" ; then 
  130.   echo shar: Will not clobber existing file \"'WinInfo.c'\"
  131. else
  132. echo shar: Extracting \"'WinInfo.c'\" \(3093 characters\)
  133. sed "s/^X//" >'WinInfo.c' <<'END_OF_FILE'
  134. X/*
  135. X *      (c) Copyright 1989 Sun Microsystems, Inc. Sun design patents
  136. X *      pending in the U.S. and foreign countries. See LEGAL_NOTICE
  137. X *      file for terms of the license.
  138. X */
  139. X
  140. X#ident    "@(#)WinInfo.c    1.1 olvwm version 1/3/92"
  141. X
  142. X/*
  143. X * Based on
  144. X#ident    "@(#)WinInfo.c    26.5    91/09/14 SMI"
  145. X *
  146. X */
  147. X
  148. X#include <errno.h>
  149. X#include <stdio.h>
  150. X#include <memory.h>
  151. X#include <X11/Xos.h>
  152. X#include <X11/Xlib.h>
  153. X#include <X11/Xutil.h>
  154. X#include <X11/Xatom.h>
  155. X
  156. X#include "i18n.h"
  157. X#include "olwm.h"
  158. X#include "win.h"
  159. X#include "st.h"
  160. X#include "mem.h"
  161. X
  162. Xst_table    *wiHashTable;
  163. Xst_table    *vHashTable;
  164. X
  165. Xstatic int
  166. XwiCompare( w1, w2 )
  167. Xregister char    *w1, *w2;
  168. X{
  169. X    return ((Window)w1) - ((Window)w2);
  170. X}
  171. X
  172. Xstatic int
  173. XwiHash( w1, modulus )
  174. X    register char    *w1;
  175. X    register int    modulus;
  176. X{
  177. X    return ((Window)w1) % modulus;
  178. X}
  179. X
  180. X/*
  181. X * initialize the hash tables
  182. X * returns: True    - success
  183. X *        False    - failure
  184. X */
  185. X/*ARGSUSED*/    /* dpy arg will be used when multiple Displays supported */
  186. XWIInit( dpy )
  187. XDisplay    *dpy;
  188. X{
  189. X    wiHashTable = st_init_table(wiCompare, wiHash);
  190. X    vHashTable = st_init_table(wiCompare, wiHash);
  191. X}
  192. X
  193. X/*
  194. X * Save window information with the associated window, for later dispatch
  195. X */
  196. Xvoid
  197. XWIInstallInfo(info)
  198. XWinGeneric *info;
  199. X{
  200. X    if (WIGetInfo(info->core.self) != NULL)
  201. X    {
  202. X        ErrorGeneral(
  203. X            gettext("Tried to duplicate-register a window -- bailing"));
  204. X    }
  205. X    st_insert(wiHashTable, (int)info->core.self, (char *)info);
  206. X}
  207. X
  208. Xvoid
  209. XVInstallInfo(info)
  210. XWinGeneric *info;
  211. X{
  212. X    if (VGetInfo(info->core.virtual) != NULL)
  213. X        ErrorGeneral(gettext("Tried to duplicate register a virtual window"));
  214. X    st_insert(vHashTable, (int) info->core.virtual, (char *) info);
  215. X}
  216. X
  217. X/*
  218. X * delete storage for window information
  219. X * returns: True    - window entry deleted
  220. X *          False    - window entry not found
  221. X */
  222. XBool
  223. XWIUninstallInfo(win)
  224. XWindow    win;
  225. X{
  226. X    WinGeneric *oldInfo;
  227. X    Window    tmpWin = win;
  228. X    Window  *tmpWinPtr = &tmpWin;
  229. X    int    ret;
  230. X
  231. X    ret = (st_delete(wiHashTable, (char *)tmpWinPtr, (char *)&oldInfo));
  232. X    /*
  233. X     * We could have a corresponding VUninstallInfo, but it's easier
  234. X     * to do it here -- just make sure there is a virtual window
  235. X     */
  236. X    if (oldInfo) {
  237. X        if (tmpWin = oldInfo->core.virtual)
  238. X            st_delete(vHashTable, (char *)tmpWinPtr, (char *)&oldInfo);
  239. X    }
  240. X    return ret;
  241. X}
  242. X
  243. X/*
  244. X * delete storage for window information
  245. X * returns: True    - window entry deleted
  246. X *          False    - window entry not found
  247. X */
  248. XBool
  249. XVIUninstallInfo(win)
  250. XWindow    win;
  251. X{
  252. X    WinGeneric *oldInfo;
  253. X    Window    tmpWin = win;
  254. X    Window  *tmpWinPtr = &tmpWin;
  255. X
  256. X    return st_delete(vHashTable, (char *)tmpWinPtr, (char *)&oldInfo);
  257. X}
  258. X
  259. X/*
  260. X * retrieve information associated with a window
  261. X * returns: Pointer to WinGeneric struct if window is found
  262. X *        NULL if not found
  263. X */
  264. XWinGeneric *
  265. XWIGetInfo(win)
  266. XWindow    win;
  267. X{
  268. X    WinGeneric *winInfo = NULL;
  269. X
  270. X    st_lookup(wiHashTable, win, &winInfo);
  271. X    return winInfo;
  272. X}
  273. X
  274. XWinGeneric *
  275. XVGetInfo(win)
  276. XWindow    win;
  277. X{
  278. X    WinGeneric    *winInfo = NULL;
  279. X
  280. X    st_lookup(vHashTable, win, &winInfo);
  281. X    return winInfo;
  282. X}
  283. X
  284. X/*
  285. X * apply a function to all windows
  286. X */
  287. Xvoid
  288. XWIApply(f,c)
  289. Xenum st_retval (*f)();
  290. Xvoid *c;
  291. X{
  292. X    st_foreach(wiHashTable, f, c);
  293. X}
  294. END_OF_FILE
  295. if test 3093 -ne `wc -c <'WinInfo.c'`; then
  296.     echo shar: \"'WinInfo.c'\" unpacked with wrong size!
  297. fi
  298. # end of 'WinInfo.c'
  299. fi
  300. if test -f 'defaults.c' -a "${1}" != "-c" ; then 
  301.   echo shar: Will not clobber existing file \"'defaults.c'\"
  302. else
  303. echo shar: Extracting \"'defaults.c'\" \(3863 characters\)
  304. sed "s/^X//" >'defaults.c' <<'END_OF_FILE'
  305. X/*
  306. X *      (c) Copyright 1989, 1990 Sun Microsystems, Inc. Sun design patents
  307. X *      pending in the U.S. and foreign countries. See LEGAL_NOTICE
  308. X *      file for terms of the license.
  309. X */
  310. X
  311. X#ident    "@(#)defaults.c    26.11    91/09/14 SMI"
  312. X
  313. X#ifdef SYSV
  314. X#include <sys/types.h>
  315. X#include <unistd.h>
  316. X#endif
  317. X
  318. X#include <ctype.h>
  319. X#include <errno.h>
  320. X#include <stdio.h>
  321. X#ifdef SYSV
  322. X#include <string.h>
  323. X#else
  324. X#include <strings.h>
  325. X#endif
  326. X#include <sys/file.h>
  327. X#include <X11/Xos.h>
  328. X#include <X11/Xlib.h>
  329. X#include <X11/Xutil.h>
  330. X#include <X11/Xatom.h>
  331. X#include <X11/Xresource.h>
  332. X
  333. Xchar    *getenv();
  334. X
  335. X#include "i18n.h"
  336. X#include "ollocale.h"
  337. X#include "olwm.h"
  338. X#include "defaults.h"
  339. X#include "globals.h"
  340. X#include "resources.h"
  341. X
  342. Xextern    char    *ProgramName;
  343. X
  344. X/* private data */
  345. Xstatic void parseResourceDefaults();
  346. Xstatic void parseApplicationDefaults();
  347. X
  348. X/* 
  349. X * GetDefaults - Set up global OlwmDB with built-in default values.
  350. X *        Then, initialize all the appropriate olwm variables
  351. X *        using the information in the OlwmDB
  352. X */
  353. Xvoid
  354. XGetDefaults(dpy, commandlineDB)
  355. XDisplay        *dpy;
  356. XXrmDatabase    commandlineDB;
  357. X{
  358. X    /* put resource settings from default files into global OlwmDB */
  359. X    parseApplicationDefaults();
  360. X    parseResourceDefaults( dpy );
  361. X
  362. X    /* merge command line options last into global OlwmDB
  363. X     * notice that commandlineDB is destroyed by this call!
  364. X     */
  365. X    if ( commandlineDB != NULL )
  366. X        (void) XrmMergeDatabases( commandlineDB, &OlwmDB );
  367. X
  368. X    InitGlobals(dpy);
  369. X}
  370. X
  371. X
  372. X/* 
  373. X * parseApplicationDefaults - get resource settings from application 
  374. X *    default file
  375. X */
  376. Xstatic void
  377. XparseApplicationDefaults()
  378. X{
  379. X    XrmDatabase    applicationDB = NULL;
  380. X    char        filename[1024];
  381. X        char            *openWinPath;
  382. X    Bool        notFound = False;
  383. X
  384. X        /* look for application default file */
  385. X    if ( (openWinPath = getenv( "OPENWINHOME" )) != NULL )
  386. X    {
  387. X        (void) strcpy( filename, openWinPath );
  388. X        (void) strcat( filename, "/lib/app-defaults/" );
  389. X        (void) strcat( filename, ProgramName );
  390. X        if ( access( filename, R_OK ) != 0 )
  391. X            notFound = True;
  392. X    }
  393. X        else
  394. X        notFound = True;
  395. X
  396. X    if ( notFound )
  397. X    {
  398. X            (void) strcpy( filename, "/usr/lib/X11/app-defaults/" );
  399. X        (void) strcat( filename, ProgramName );
  400. X    }
  401. X
  402. X        applicationDB = XrmGetFileDatabase( filename );
  403. X    if ( applicationDB != NULL )
  404. X            (void) XrmMergeDatabases( applicationDB, &OlwmDB );
  405. X}
  406. X
  407. X/* 
  408. X * parseResourceDefaults - get resource settings from default user locations.
  409. X *    Look first for server property - if it's there, use it alone.
  410. X *    If it's not there, look for XENVIRONMENT file and use it.
  411. X *    If still no luck, use $HOME/.Xdefaults.
  412. X */
  413. Xstatic void
  414. XparseResourceDefaults( dpy )
  415. XDisplay    *dpy;
  416. X{
  417. X    XrmDatabase    serverDB = NULL, homeDB = NULL;
  418. X    char        filename[1024];
  419. X    unsigned long    nitems, remain;
  420. X    char        *resourceString;
  421. X    char        *environmentFile;
  422. X
  423. X    /* look for RESOURCE_MANAGER property on root window of screen 0 */
  424. X        resourceString = GetWindowProperty(dpy, RootWindow(dpy, 0),
  425. X                XA_RESOURCE_MANAGER, 0L, 100000000L,
  426. X                /* REMIND what should the length really be ? */
  427. X                XA_STRING, 0, &nitems, &remain);
  428. X        if ((resourceString != NULL) && (nitems != 0))
  429. X    {
  430. X        serverDB = XrmGetStringDatabase( resourceString );
  431. X        (void) XrmMergeDatabases( serverDB, &OlwmDB );
  432. X        XFree( resourceString );
  433. X        return;
  434. X    }
  435. X
  436. X    /* if unsuccessful, look for user defaults: 
  437. X     * first try XENVIRONMENT, next in $HOME/.Xdefaults 
  438. X     */
  439. X    if ( ( (environmentFile = getenv( "XENVIRONMENT" )) == NULL )
  440. X         || ( access( environmentFile, R_OK ) != 0 ) )
  441. X    {
  442. X        if ( (environmentFile = getenv( "HOME" )) != NULL )
  443. X        {
  444. X            (void) strcpy( filename, environmentFile );
  445. X            (void) strcat( filename, "/" );
  446. X            (void) strcat( filename, ".Xdefaults" );
  447. X            environmentFile = filename;
  448. X        }
  449. X    }
  450. X    if ( environmentFile != NULL )
  451. X    {
  452. X        homeDB = XrmGetFileDatabase( environmentFile );
  453. X        (void) XrmMergeDatabases( homeDB, &OlwmDB );
  454. X    }
  455. X    return;
  456. X}
  457. END_OF_FILE
  458. if test 3863 -ne `wc -c <'defaults.c'`; then
  459.     echo shar: \"'defaults.c'\" unpacked with wrong size!
  460. fi
  461. # end of 'defaults.c'
  462. fi
  463. if test -f 'environ.h' -a "${1}" != "-c" ; then 
  464.   echo shar: Will not clobber existing file \"'environ.h'\"
  465. else
  466. echo shar: Extracting \"'environ.h'\" \(279 characters\)
  467. sed "s/^X//" >'environ.h' <<'END_OF_FILE'
  468. X/*
  469. X *      (c) Copyright 1990 Sun Microsystems, Inc. Sun design patents
  470. X *      pending in the U.S. and foreign countries. See LEGAL_NOTICE
  471. X *      file for terms of the license.
  472. X */
  473. X
  474. X#ident    "@(#)environ.h    1.5    91/09/14 SMI"
  475. X
  476. Xextern    char    **MakeEnviron(/* ScreenInfo *scrInfo */);
  477. END_OF_FILE
  478. if test 279 -ne `wc -c <'environ.h'`; then
  479.     echo shar: \"'environ.h'\" unpacked with wrong size!
  480. fi
  481. # end of 'environ.h'
  482. fi
  483. if test -f 'globals.h' -a "${1}" != "-c" ; then 
  484.   echo shar: Will not clobber existing file \"'globals.h'\"
  485. else
  486. echo shar: Extracting \"'globals.h'\" \(4138 characters\)
  487. sed "s/^X//" >'globals.h' <<'END_OF_FILE'
  488. X/*
  489. X *      (c) Copyright 1990 Sun Microsystems, Inc. Sun design patents
  490. X *      pending in the U.S. and foreign countries. See LEGAL_NOTICE
  491. X *      file for terms of the license.
  492. X */
  493. X
  494. X#ident    "@(#)globals.h    1.1 olvwm version 1/3/92"
  495. X
  496. X/*
  497. X * Based on
  498. X#ident    "@(#)globals.h    26.26    91/10/04 SMI"
  499. X *
  500. X */
  501. X
  502. X#include "list.h"
  503. X
  504. Xtypedef struct {
  505. X    unsigned int    modmask;
  506. X    KeyCode        keycode;
  507. X} KeySpec;
  508. X
  509. Xtypedef enum { BeepAlways, BeepNever, BeepNotices } BeepStatus;
  510. X
  511. Xtypedef enum { KbdSunView, KbdBasic, KbdFull } MouselessMode;
  512. X
  513. Xtypedef enum { GridNone, GridInvisible, GridVisible } VirtualGridType;
  514. X
  515. Xtypedef enum { UseNone, UseVDM, UseAll } ImageType;
  516. X
  517. Xtypedef struct _globalResourceVariables {
  518. X    char        *WorkspaceColor;
  519. X    char        *WindowColor;
  520. X    char        *ForegroundColor;
  521. X    char        *BackgroundColor;
  522. X    char        *BorderColor;
  523. X    Bool        ReverseVideo;
  524. X    Bool        PaintWorkspace;
  525. X    Bool        F3dUsed;
  526. X    Bool        F3dFrames;
  527. X    Bool        F3dResize;
  528. X    XFontStruct        *TitleFontInfo;
  529. X    XFontStruct    *TextFontInfo;
  530. X    XFontStruct        *ButtonFontInfo;
  531. X    XFontStruct    *IconFontInfo;
  532. X    XFontStruct    *GlyphFontInfo;
  533. X    Cursor        BasicPointer;
  534. X    Cursor        MovePointer;
  535. X    Cursor        BusyPointer;
  536. X    Cursor        IconPointer;
  537. X    Cursor        ResizePointer;
  538. X    Cursor        MenuPointer;
  539. X    Cursor        QuestionPointer;
  540. X    Cursor        TargetPointer;
  541. X    Cursor        PanPointer;
  542. X    Bool        FocusFollowsMouse;
  543. X    Bool        ReparentFlag;
  544. X    char        *DefaultWinName;
  545. X    int        SaveWorkspaceTimeout;
  546. X    int        FlashTime;
  547. X    Bool        FShowMenuButtons;        /* XXX */
  548. X    Bool        FShowPinnedMenuButtons;        /* XXX */
  549. X    IconPreference    IconPlacement;
  550. X    Bool        FSnapToGrid;
  551. X    Bool        FocusLenience;
  552. X    Bool        DragWindow;
  553. X    Bool        AutoRaise;
  554. X    int        AutoRaiseDelay;
  555. X    Bool        PopupJumpCursor;
  556. X    Bool        ColorLocked;
  557. X    Bool        PPositionCompat;
  558. X    Bool        RefreshRecursively;
  559. X    BeepStatus    Beep;
  560. X    int        EdgeThreshold;
  561. X    int        DragRightDistance;
  562. X    int        MoveThreshold;
  563. X    int        ClickMoveThreshold;
  564. X    int        DoubleClickTime;
  565. X    int        RubberBandThickness;
  566. X    KeySpec        FrontKey;
  567. X    KeySpec        HelpKey;
  568. X    KeySpec        OpenKey;
  569. X    KeySpec        ConfirmKey;
  570. X    KeySpec        CancelKey;
  571. X    KeySpec        ColorLockKey;
  572. X    KeySpec        ColorUnlockKey;
  573. X    List        *Minimals;
  574. X    int        MouseChordTimeout;
  575. X    Bool        SingleScreen;
  576. X    Bool        AutoReReadMenuFile;
  577. X    Bool        KeepTransientsAbove;
  578. X    Bool        TransientsSaveUnder;
  579. X    Bool        TransientsTitled;
  580. X    Bool        SelectWindows;
  581. X    Bool        ShowMoveGeometry;
  582. X    Bool        ShowResizeGeometry;
  583. X    Bool        InvertFocusHighlighting;
  584. X    Bool        RunSlaveProcess;
  585. X    Bool        SelectToggleStacking;
  586. X    int        FlashCount;
  587. X    char        *DefaultIconImage;
  588. X    char        *DefaultIconMask;
  589. X    Bool        ServerGrabs;
  590. X    int        IconFlashCount;
  591. X    Bool        SelectDisplaysMenu;
  592. X    int        SelectionFuzz;
  593. X    Bool        AutoInputFocus;
  594. X    Bool        AutoColorFocus;
  595. X    Bool        ColorTracksInputFocus;
  596. X    int        IconFlashOnTime;
  597. X    int        IconFlashOffTime;
  598. X    MouselessMode    Mouseless;
  599. X    Bool        RaiseOnActivate;
  600. X    Bool        RestackWhenWithdraw;
  601. X#ifdef OW_I18N_L3
  602. X    OLLC        LC;
  603. X#endif /* OW_I18N_L3 */
  604. X/* Following are three entries are strictly for debugging purposes and 
  605. X * are not mentioned in the usage message or doc.
  606. X * Orphaned events are events that are associated with a window or frame 
  607. X * has no entry in the frame hash table, or events that are not handled by the
  608. X * various event handlers.
  609. X * 'PrintAll' is useful for when verification of an events existance is needed.
  610. X */
  611. X    Bool        PrintOrphans;
  612. X    Bool        PrintAll;
  613. X    Bool        Synchronize;
  614. X/*
  615. X * Following are entries for the Virtual Desktop.
  616. X */
  617. X    char        *VirtualDesktop;
  618. X    int        VDMScale;
  619. X    Bool        AllowMoveIntoDesktop;
  620. X    Bool        ArrowInRoot;
  621. X    char        *VirtualGeometry;
  622. X    char        *VirtualFontName;
  623. X    char        *VirtualBackgroundMap;
  624. X    char        *VirtualBackgroundColor;
  625. X    char        *VirtualPixmapColor;
  626. X    char        *VirtualIconGeometry;
  627. X    char        *VirtualForegroundColor;
  628. X    char        *VirtualFontColor;
  629. X    Bool        VirtualIconic;
  630. X    List        *StickyList;
  631. X    Bool        UseRelativePosition;
  632. X    Bool        GrabVirtualKeys;
  633. X    VirtualGridType    VirtualGrid;
  634. X    char        *VirtualGridColor;
  635. X    Bool        VirtualRaiseOnMove;
  636. X    Bool        VirtualRaiseVDM;
  637. X/*
  638. X * Following are entries added with olvwm but which aren't strictly
  639. X * dependent on the virtual nature of olvwm
  640. X */
  641. X    Bool        AutoShowRootMenu;
  642. X    int        AutoRootMenuX;
  643. X    int        AutoRootMenuY;
  644. X    char        *InputFocusColor;
  645. X    Bool        FullSizeZoomX;
  646. X    List        *NoDecors;
  647. X    char        *ResizePosition;
  648. X    ImageType    UseImageMenu;
  649. X    Bool        VirtualMoveGroups;
  650. X} GlobalResourceVariables;
  651. X
  652. Xextern GlobalResourceVariables    GRV;
  653. END_OF_FILE
  654. if test 4138 -ne `wc -c <'globals.h'`; then
  655.     echo shar: \"'globals.h'\" unpacked with wrong size!
  656. fi
  657. # end of 'globals.h'
  658. fi
  659. if test -f 'i18n.c' -a "${1}" != "-c" ; then 
  660.   echo shar: Will not clobber existing file \"'i18n.c'\"
  661. else
  662. echo shar: Extracting \"'i18n.c'\" \(3905 characters\)
  663. sed "s/^X//" >'i18n.c' <<'END_OF_FILE'
  664. X/*
  665. X *      (c) Copyright 1989, 1990 Sun Microsystems, Inc. Sun design patents
  666. X *      pending in the U.S. and foreign countries. See LEGAL_NOTICE
  667. X *      file for terms of the license.
  668. X */
  669. X
  670. X#ifdef OW_I18N
  671. X
  672. Xstatic    char    sccsid[] ="@(#) i18n.c 1.3 91/09/14 SMI";
  673. X
  674. X#include "i18n.h"
  675. X#include "mem.h"
  676. X
  677. X#include <stdio.h>
  678. X#include <X11/Xlib.h>
  679. X#include <X11/Xlibos.h>
  680. X#include <X11/Xatom.h>
  681. X
  682. X/*
  683. X * When converting the wide char to CTEXT, we need to estimate the
  684. X * space, but there are no right way to do this without actually
  685. X * converting.  "wslen(wchar) * sizeof(wchar_t)" will give us the how
  686. X * many bytes consume by the characters, but this does not include the
  687. X * any control sequences.  I decided use fudge bytes for this control
  688. X * sequnces for now.  This is absolutely bad idea to having a this
  689. X * value, but otherwise we need to convert it twice.  One control
  690. X * sequnce require the 3 bytes, so, following allow to switch the code
  691. X * set 6 times.
  692. X */
  693. X#define WCSTOCTS_FUDGE_BYTES    (3 * 6)
  694. X
  695. Xwchar_t *
  696. Xmbstowcsdup(mbs)
  697. Xregister char    *mbs;
  698. X{
  699. X    register int        n;
  700. X    register wchar_t    *wcs;
  701. X
  702. X    if (mbs == NULL)
  703. X        return NULL;
  704. X
  705. X    n = strlen(mbs) + 1;
  706. X    wcs = (wchar_t *) MemAlloc(n * sizeof(wchar_t));
  707. X    mbstowcs(wcs, mbs, n);
  708. X#if DEBUG > 4
  709. Xfprintf(stderr, "mbstowcsdup: mbs [%s] -> wcs [%ws]\n", mbs, wcs);
  710. X#endif
  711. X
  712. X    return wcs;
  713. X}
  714. X
  715. X
  716. Xwchar_t *
  717. Xctstowcsdup(cts)
  718. Xregister char    *cts;
  719. X{
  720. X    register int        n;
  721. X    register wchar_t    *wcs;
  722. X
  723. X    if (cts == NULL)
  724. X        return NULL;
  725. X
  726. X    n = strlen(cts) + 1;
  727. X    wcs = (wchar_t *) MemAlloc(n * sizeof(wchar_t));
  728. X    ctstowcs(wcs, cts, n);
  729. X
  730. X#ifdef DEBUG > 4
  731. Xfprintf(stderr, "ctstowcsdup: cts [%d:", n);
  732. Xascii_dump(cts);
  733. Xfprintf(stderr, "] -> wcs [%d:%ws]\n",
  734. X    (n * sizeof(wchar_t)), wcs);
  735. X#endif
  736. X
  737. X    return wcs;
  738. X}
  739. X
  740. X
  741. Xchar *
  742. Xctstombsdup(cts)
  743. Xregister char    *cts;
  744. X{
  745. X    register int        n;
  746. X    register wchar_t    *wcs;
  747. X    register char        *mbs;
  748. X
  749. X    wcs = ctstowcsdup(cts);
  750. X    if (wcs == NULL)
  751. X        return NULL;
  752. X
  753. X    n = wslen(wcs) * sizeof(wchar_t) + 1;
  754. X    mbs = (char *) MemAlloc(n);
  755. X    wcstombs(mbs, wcs, n);
  756. X
  757. X    MemFree (wcs);
  758. X    return mbs;
  759. X}
  760. X
  761. X
  762. Xchar *
  763. Xwcstoctsdup(wcs)
  764. Xregister wchar_t    *wcs;
  765. X{
  766. X    register int        n;
  767. X    register char        *cts;
  768. X
  769. X    if (wcs == NULL)
  770. X        return NULL;
  771. X
  772. X    n = wslen(wcs) * sizeof(wchar_t) + WCSTOCTS_FUDGE_BYTES + 1;
  773. X    cts = (char *) MemAlloc(n);
  774. X    /*
  775. X     * FIX_ME: We should check the result from wcstotcs, and if
  776. X     * cts does not have a enough space, we should re-allocate the
  777. X     * space and try again.
  778. X     */
  779. X    wcstocts(cts, wcs, n);
  780. X
  781. X#ifdef DEBUG > 4
  782. Xfprintf(stderr, "wcstoctsdup: wcs [%d:%ws] -> cts [%d:",
  783. X    wslen(wcs), wcs, n+1);
  784. Xascii_dump(cts);
  785. Xfprintf(stderr, "]\n");
  786. X#endif
  787. X
  788. X    return cts;
  789. X}
  790. X
  791. XXwcFetchName(dpy, w, name)
  792. XDisplay    *dpy;
  793. XWindow    w;
  794. Xwchar_t    **name;
  795. X{
  796. X    return XwcGetTextWindowProperty(XA_WM_NAME, dpy, w, name);
  797. X}
  798. X
  799. X
  800. XXwcGetIconName(dpy, w, name)
  801. XDisplay    *dpy;
  802. XWindow    w;
  803. Xwchar_t    **name;
  804. X{
  805. X    return XwcGetTextWindowProperty(XA_WM_ICON_NAME, dpy, w, name);
  806. X}
  807. X
  808. X
  809. XXwcGetTextWindowProperty(props, dpy, w, name)
  810. XAtom    props;
  811. XDisplay    *dpy;
  812. XWindow    w;
  813. Xwchar_t    **name;
  814. X{
  815. X    register int    len;
  816. X    int        ret;
  817. X    Atom        actual_type;
  818. X    int        actual_format;
  819. X    unsigned long    nitems;
  820. X    unsigned long    leftover;
  821. X    unsigned char    *data = NULL;
  822. X    extern Atom    AtomCompoundText;
  823. X
  824. X    ret = 0;
  825. X    if (XGetWindowProperty(dpy, w, props, 0L, (long)BUFSIZ, False,
  826. X                   AnyPropertyType, &actual_type, &actual_format,
  827. X                   &nitems, &leftover, &data) != Success)
  828. X    {
  829. X        *name = NULL;
  830. X    }
  831. X    else if ((actual_type == XA_STRING) &&  (actual_format == 8))
  832. X    {
  833. X        *name = mbstowcsdup((char *)data);
  834. X        ret = 1;
  835. X    }
  836. X    else if ((actual_type == AtomCompoundText) &&  (actual_format == 8))
  837. X    {
  838. X        *name = ctstowcsdup((char *)data);
  839. X        ret = 1;
  840. X    }
  841. X    else
  842. X        *name = NULL;
  843. X
  844. X    if (data)
  845. X        Xfree((char *)data);
  846. X    return ret;
  847. X}
  848. X
  849. X
  850. X#ifdef DEBUG > 4
  851. Xascii_dump(s)
  852. Xregister unsigned char    *s;
  853. X{
  854. X    while (*s)
  855. X    {
  856. X        if (*s < ' ')
  857. X            fprintf(stderr, "^%c", *s + '@');
  858. X        else if (*s > 0x80)
  859. X            fprintf(stderr, "(%2x)", *s);
  860. X        else
  861. X            fputc(*s, stderr);
  862. X        s++;
  863. X    }
  864. X}
  865. X#endif DEBUG
  866. X
  867. X#endif OW_I18N
  868. END_OF_FILE
  869. if test 3905 -ne `wc -c <'i18n.c'`; then
  870.     echo shar: \"'i18n.c'\" unpacked with wrong size!
  871. fi
  872. # end of 'i18n.c'
  873. fi
  874. if test -f 'iconimage.h' -a "${1}" != "-c" ; then 
  875.   echo shar: Will not clobber existing file \"'iconimage.h'\"
  876. else
  877. echo shar: Extracting \"'iconimage.h'\" \(2726 characters\)
  878. sed "s/^X//" >'iconimage.h' <<'END_OF_FILE'
  879. X/*
  880. X *      (c) Copyright 1991 Sun Microsystems, Inc. Sun design patents
  881. X *      pending in the U.S. and foreign countries. See LEGAL_NOTICE
  882. X *      file for terms of the license.
  883. X */
  884. X
  885. X#ident    "@(#)iconimage.h    26.9    91/09/14 SMI"
  886. X
  887. X#define iconimage_width 64
  888. X#define iconimage_height 48
  889. Xstatic unsigned char iconimage_bits[] = {
  890. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  891. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  892. X   0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0,
  893. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x01, 0x00, 0x00, 0x00,
  894. X   0x00, 0x00, 0x00, 0x48, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe4,
  895. X   0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf2, 0x09, 0x00, 0x00, 0x00,
  896. X   0x00, 0x00, 0x00, 0xb9, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x5c,
  897. X   0x27, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0xae, 0x4e, 0x00, 0x00, 0x00,
  898. X   0x00, 0x00, 0x20, 0x17, 0x9d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0xab,
  899. X   0x3a, 0x01, 0x00, 0x00, 0x00, 0x00, 0x08, 0x45, 0x94, 0x03, 0x00, 0x00,
  900. X   0x00, 0x00, 0x64, 0xaa, 0xca, 0x04, 0x00, 0x00, 0x00, 0x00, 0xf2, 0x14,
  901. X   0xe5, 0x09, 0x00, 0x00, 0x00, 0x00, 0xb9, 0xa9, 0xb2, 0x13, 0x00, 0x00,
  902. X   0x00, 0x80, 0x5c, 0x53, 0x59, 0x27, 0x00, 0x00, 0x00, 0x40, 0xae, 0xa6,
  903. X   0xac, 0x4e, 0x00, 0x00, 0x00, 0x20, 0x17, 0x4d, 0x56, 0x9d, 0x00, 0x00,
  904. X   0x00, 0x90, 0xab, 0x1a, 0xab, 0x3a, 0x01, 0x00, 0x00, 0xc8, 0x45, 0x94,
  905. X   0x55, 0x75, 0x06, 0x00, 0x00, 0x98, 0xaa, 0xca, 0xaa, 0x2a, 0x09, 0x00,
  906. X   0x00, 0x30, 0x15, 0xe5, 0x54, 0x95, 0x18, 0x00, 0x00, 0x60, 0xaa, 0xb2,
  907. X   0xa9, 0x4a, 0x0c, 0x00, 0x00, 0xc0, 0x54, 0x59, 0x53, 0x25, 0x06, 0x00,
  908. X   0x00, 0x80, 0xa9, 0xac, 0xa6, 0x12, 0x03, 0x00, 0x00, 0x00, 0x53, 0x56,
  909. X   0x4d, 0x89, 0x01, 0x00, 0x00, 0x00, 0x26, 0xab, 0x9a, 0xc4, 0x00, 0x00,
  910. X   0x00, 0x00, 0x8c, 0x55, 0x35, 0x62, 0x00, 0x00, 0x00, 0x00, 0xd8, 0xaa,
  911. X   0x2a, 0x31, 0x00, 0x00, 0x00, 0x00, 0x70, 0x55, 0x95, 0x18, 0x00, 0x00,
  912. X   0x00, 0x00, 0x60, 0xaa, 0x4a, 0x0c, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x54,
  913. X   0x25, 0x06, 0x00, 0x00, 0x00, 0x00, 0x80, 0xa9, 0x12, 0x03, 0x00, 0x00,
  914. X   0x00, 0x00, 0x00, 0x53, 0x89, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa6,
  915. X   0xc4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4c, 0x62, 0x00, 0x00, 0x00,
  916. X   0x00, 0x00, 0x00, 0x18, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0,
  917. X   0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x0c, 0x00, 0x00, 0x00,
  918. X   0x00, 0x00, 0x00, 0x40, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0,
  919. X   0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00,
  920. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  921. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
  922. END_OF_FILE
  923. if test 2726 -ne `wc -c <'iconimage.h'`; then
  924.     echo shar: \"'iconimage.h'\" unpacked with wrong size!
  925. fi
  926. # end of 'iconimage.h'
  927. fi
  928. if test -f 'iconmask.h' -a "${1}" != "-c" ; then 
  929.   echo shar: Will not clobber existing file \"'iconmask.h'\"
  930. else
  931. echo shar: Extracting \"'iconmask.h'\" \(2721 characters\)
  932. sed "s/^X//" >'iconmask.h' <<'END_OF_FILE'
  933. X/*
  934. X *      (c) Copyright 1991 Sun Microsystems, Inc. Sun design patents
  935. X *      pending in the U.S. and foreign countries. See LEGAL_NOTICE
  936. X *      file for terms of the license.
  937. X */
  938. X
  939. X#ident    "@(#)iconmask.h    1.4    91/09/14 SMI"
  940. X
  941. X#define iconmask_width 64
  942. X#define iconmask_height 48
  943. Xstatic unsigned char iconmask_bits[] = {
  944. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  945. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  946. X   0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0,
  947. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x01, 0x00, 0x00, 0x00,
  948. X   0x00, 0x00, 0x00, 0xf8, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc,
  949. X   0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x0f, 0x00, 0x00, 0x00,
  950. X   0x00, 0x00, 0x00, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff,
  951. X   0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00, 0x00,
  952. X   0x00, 0x00, 0xe0, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff,
  953. X   0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0x03, 0x00, 0x00,
  954. X   0x00, 0x00, 0xfc, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff,
  955. X   0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00,
  956. X   0x00, 0x80, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff,
  957. X   0xff, 0x7f, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00,
  958. X   0x00, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0xf8, 0xff, 0xff,
  959. X   0xff, 0xff, 0x07, 0x00, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00,
  960. X   0x00, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0xe0, 0xff, 0xff,
  961. X   0xff, 0xff, 0x0f, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00,
  962. X   0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0xff, 0xff,
  963. X   0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0x00, 0x00,
  964. X   0x00, 0x00, 0xfc, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff,
  965. X   0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0x1f, 0x00, 0x00,
  966. X   0x00, 0x00, 0xe0, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff,
  967. X   0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x03, 0x00, 0x00,
  968. X   0x00, 0x00, 0x00, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe,
  969. X   0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0x00,
  970. X   0x00, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0,
  971. X   0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x0f, 0x00, 0x00, 0x00,
  972. X   0x00, 0x00, 0x00, 0xc0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0,
  973. X   0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00,
  974. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  975. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
  976. END_OF_FILE
  977. if test 2721 -ne `wc -c <'iconmask.h'`; then
  978.     echo shar: \"'iconmask.h'\" unpacked with wrong size!
  979. fi
  980. # end of 'iconmask.h'
  981. fi
  982. if test -f 'mem.c' -a "${1}" != "-c" ; then 
  983.   echo shar: Will not clobber existing file \"'mem.c'\"
  984. else
  985. echo shar: Extracting \"'mem.c'\" \(3454 characters\)
  986. sed "s/^X//" >'mem.c' <<'END_OF_FILE'
  987. X/*
  988. X *      (c) Copyright 1989 Sun Microsystems, Inc. Sun design patents
  989. X *      pending in the U.S. and foreign countries. See LEGAL_NOTICE
  990. X *      file for terms of the license.
  991. X */
  992. X
  993. X#ident    "@(#)mem.c    26.9    91/09/14 SMI"
  994. X
  995. X/*
  996. X * Safe memory allocation/free routines - front-ends the C library functions
  997. X *
  998. X */
  999. X
  1000. X#include <malloc.h>
  1001. X#include <memory.h>
  1002. X#include <stdio.h>
  1003. X#include <sys/types.h>
  1004. X
  1005. X#include "i18n.h"
  1006. X
  1007. X#ifdef MEMDEBUG
  1008. X#include "st.h"
  1009. X
  1010. X#define MemAlloc d_MemAlloc
  1011. X#define MemFree  d_MemFree
  1012. X#define MemRealloc d_MemRealloc
  1013. X#define MemCalloc d_MemCalloc
  1014. X
  1015. Xint         MemAcct;
  1016. Xint         AcctTag;
  1017. X
  1018. Xstatic st_table *memHashTable;
  1019. X
  1020. Xtypedef struct {
  1021. X    unsigned int s;
  1022. X    int         a;
  1023. X    int         l;
  1024. X    char       *f;
  1025. X    char       *k;    
  1026. X}           Mem;
  1027. X
  1028. Xstatic int
  1029. XmemCompare(g1, g2)
  1030. X    char       *g1, *g2;
  1031. X{
  1032. X    return (g1 - g2);
  1033. X}
  1034. X
  1035. X
  1036. Xstatic int
  1037. XmemHash(g1, modulus)
  1038. X    int         g1;
  1039. X    int         modulus;
  1040. X{
  1041. X    return g1 % modulus;
  1042. X}
  1043. X
  1044. Xstatic void
  1045. XinsertAcctInfo(p, s, f, l, k)
  1046. X    void *p;
  1047. X    unsigned int s;
  1048. X    char *f;
  1049. X    int l;
  1050. X    char *k;
  1051. X{
  1052. X    if (MemAcct) {
  1053. X    Mem        *m;
  1054. X    MemAcct = 0;    /*prevent nasty recursion*/
  1055. X
  1056. X    if (memHashTable == NULL)
  1057. X        memHashTable = st_init_table(memCompare, memHash);
  1058. X
  1059. X    m = (Mem *) malloc(sizeof(Mem));
  1060. X    m->s = s;
  1061. X    m->f = f;
  1062. X    m->l = l;
  1063. X    m->a = AcctTag;
  1064. X    m->k = k;
  1065. X    st_insert(memHashTable, p, m);
  1066. X
  1067. X    MemAcct = 1;
  1068. X    }
  1069. X}
  1070. X
  1071. X
  1072. Xstatic enum st_retval
  1073. Xdodump(key, rec)
  1074. X    void       *key;
  1075. X    Mem        *rec;
  1076. X{
  1077. X    char extra[255];
  1078. X
  1079. X    if (rec->k == NULL)
  1080. X    strcpy(extra, "\n");
  1081. X    else {
  1082. X    if (strcmp(rec->k, "(string)") == 0)
  1083. X        sprintf(extra, ":\"%s\"\n", key);
  1084. X    else 
  1085. X        sprintf(extra, ":%s\n", rec->k);
  1086. X    }
  1087. X
  1088. X    fprintf(stderr, "extant: %d) 0x%.8x, (f:%s, l:%d) (%d bytes)%s",
  1089. X        rec->a, key, rec->f, rec->l, rec->s, extra);
  1090. X    return ST_DELETE;
  1091. X}
  1092. X
  1093. Xvoid
  1094. XDumpExtant()
  1095. X{
  1096. X    if (memHashTable)
  1097. X    st_foreach(memHashTable, dodump, NULL);
  1098. X    else
  1099. X    fprintf(stderr, "no accounting info availiable!\n");
  1100. X}
  1101. X
  1102. X#endif
  1103. X
  1104. Xvoid       *
  1105. XMemAlloc(sz
  1106. X#ifdef MEMDEBUG
  1107. X , f, l, k
  1108. X#endif
  1109. X)
  1110. X    unsigned int sz;
  1111. X#ifdef MEMDEBUG
  1112. X    char *f;
  1113. X    int l;
  1114. X    char *k;
  1115. X#endif
  1116. X{
  1117. X    void       *p;
  1118. X
  1119. X    if ((p = malloc(sz)) == NULL)
  1120. X    ErrorGeneral(gettext("Memory allocation failure."));
  1121. X
  1122. X    memset((char *) p, 0, (int) sz);
  1123. X
  1124. X#ifdef MEMDEBUG
  1125. X    insertAcctInfo(p, sz, f, l, k);
  1126. X#endif
  1127. X
  1128. X    return p;
  1129. X}
  1130. X
  1131. Xvoid       *
  1132. XMemCalloc(num, sz
  1133. X#ifdef MEMDEBUG
  1134. X   , f, l
  1135. X#endif
  1136. X)
  1137. X    unsigned int num;
  1138. X    unsigned int sz;
  1139. X#ifdef MEMDEBUG
  1140. X    char *f;
  1141. X    int l;
  1142. X#endif
  1143. X{
  1144. X    void       *p;
  1145. X
  1146. X    if ((p = calloc(num, sz)) == NULL)
  1147. X    ErrorGeneral(gettext("Memory array allocation failure."));
  1148. X
  1149. X    memset((char *) p, 0, (int) sz * (int) num);
  1150. X
  1151. X#ifdef MEMDEBUG
  1152. X    insertAcctInfo(p, sz * num, f, l, NULL);
  1153. X#endif
  1154. X
  1155. X    return p;
  1156. X}
  1157. X
  1158. Xvoid       *
  1159. XMemRealloc(p, sz)
  1160. X    void       *p;
  1161. X    unsigned int sz;
  1162. X{
  1163. X    void       *t;
  1164. X
  1165. X    if ((t = realloc(p, sz)) == NULL)
  1166. X    ErrorGeneral(gettext("Memory array allocation failure."));
  1167. X
  1168. X#ifdef MEMDEBUG
  1169. X    if (MemAcct && memHashTable) {
  1170. X    Mem        *oldM;
  1171. X    MemAcct = 0;
  1172. X    (void) st_delete(memHashTable, &p, (char *) &oldM);
  1173. X    oldM->s = sz;
  1174. X    st_insert(memHashTable, t, oldM);
  1175. X    MemAcct = 1;
  1176. X    }
  1177. X#endif
  1178. X
  1179. X    return t;
  1180. X}
  1181. X
  1182. X
  1183. Xvoid
  1184. XMemFree(p)
  1185. X    void       *p;
  1186. X{
  1187. X    if (p != NULL) {
  1188. X#ifdef MEMDEBUG
  1189. X    if (MemAcct && memHashTable) {
  1190. X        Mem        *oldM;
  1191. X        MemAcct = 0;
  1192. X        (void) st_delete(memHashTable, &p, (char *) &oldM);
  1193. X        free(oldM);
  1194. X        MemAcct = 1;
  1195. X    }
  1196. X#endif
  1197. X    free(p);
  1198. X    }
  1199. X}
  1200. END_OF_FILE
  1201. if test 3454 -ne `wc -c <'mem.c'`; then
  1202.     echo shar: \"'mem.c'\" unpacked with wrong size!
  1203. fi
  1204. # end of 'mem.c'
  1205. fi
  1206. if test -f 'olgx_impl.h' -a "${1}" != "-c" ; then 
  1207.   echo shar: Will not clobber existing file \"'olgx_impl.h'\"
  1208. else
  1209. echo shar: Extracting \"'olgx_impl.h'\" \(2771 characters\)
  1210. sed "s/^X//" >'olgx_impl.h' <<'END_OF_FILE'
  1211. X#ident "@(#)olgx_impl.h    1.14 91/04/09 SMI"
  1212. X
  1213. X/* 
  1214. X * Copyright 1990 Sun Microsystems
  1215. X */
  1216. X
  1217. X/*
  1218. X * OPEN LOOK object drawing package
  1219. X */
  1220. X
  1221. X#ifndef OL_PRIVATE_DEFINED
  1222. X#define OL_PRIVATE_DEFINED
  1223. X
  1224. X#ifdef OW_I18N
  1225. X/*
  1226. X * I18N_Portability: May need to change the following #include to
  1227. X * pickup the wchar_t and X11R5(-ish) Xlib functions definitions.
  1228. X */
  1229. X#include <widec.h>
  1230. X#include <mltext/XFontSet.h>
  1231. X#endif
  1232. X#include <olgx/olgx.h>
  1233. X
  1234. X#define STRING_SIZE         128     /* max size of a glyph font string */
  1235. X
  1236. X#define VARHEIGHT_BUTTON_CORNER_DIMEN  7
  1237. X
  1238. X
  1239. X#define False                   0
  1240. X#define True                    1
  1241. X
  1242. X
  1243. X/*
  1244. X * OPEN LOOK constant definitions
  1245. X */
  1246. X
  1247. X
  1248. X/*
  1249. X * Macro definitions
  1250. X */
  1251. X#define VARIABLE_LENGTH_MACRO(start_pos, offset)        \
  1252. X    for (i = 0; i < num_add; i++) {                \
  1253. X        string[start_pos+i] = offset + add_ins[i];    \
  1254. X    }
  1255. X
  1256. Xtypedef struct _per_disp_res_rec {
  1257. X  Display * dpy;
  1258. X  int screen;
  1259. X  GC_rec * gc_list_ptr;
  1260. X  Pixmap   busy_stipple;
  1261. X  Pixmap   grey_stipple;
  1262. X  struct _per_disp_res_rec * next;
  1263. X} per_disp_res_rec, *per_disp_res_ptr;
  1264. X
  1265. X/*
  1266. X * Definitions used by the color calculation code 
  1267. X */
  1268. X#define    XRGB    0xffff
  1269. X#define    MAXRGB    0xff
  1270. X#define    MAXH    360
  1271. X#define    MAXSV    1000
  1272. X
  1273. X#define VMUL        12    /* brighten by 20% (12 = 1.2*10) */
  1274. X#define SDIV        2    /* unsaturate by 50% (divide by 2) */
  1275. X#define VMIN        400    /* minimum highlight brightness of 40% */
  1276. X
  1277. Xtypedef struct {
  1278. X    int         r,
  1279. X                g,
  1280. X                b;
  1281. X}           RGB;
  1282. X
  1283. Xtypedef struct {
  1284. X    int         h,
  1285. X                s,
  1286. X                v;
  1287. X}           HSV;
  1288. X
  1289. X/*
  1290. X * Private function declarations
  1291. X */
  1292. X
  1293. Xint               calc_add_ins();
  1294. Xchar             * olgx_malloc();
  1295. Xvoid               olgx_update_horizontal_slider();
  1296. Xvoid               olgx_update_vertical_slider();
  1297. Xvoid               olgx_update_vertical_gauge();
  1298. Xvoid               olgx_update_horiz_gauge();
  1299. Xvoid               olgx_free();
  1300. Xvoid               olgx_destroy_gcrec();
  1301. Xvoid               olgx_total_gcs();
  1302. Xvoid               olgx_initialise_gcrec();
  1303. Xvoid               olgx_draw_elevator();
  1304. Xvoid               olgx_error();
  1305. Xvoid               olgx_draw_pixmap_label();
  1306. Xvoid               olgx_draw_varheight_button();
  1307. XPixmap             olgx_get_busy_stipple();
  1308. XPixmap             olgx_get_grey_stipple();
  1309. Xint                gc_matches();
  1310. Xint                olgx_cmp_fonts();
  1311. XGC_rec           * olgx_get_gcrec();
  1312. XGC_rec           * olgx_gcrec_available();
  1313. XGC_rec           * olgx_set_color_smart();
  1314. XGraphics_info    * olgx_create_ginfo();
  1315. Xper_disp_res_ptr   olgx_get_perdisplay_list();
  1316. X
  1317. X/* ol_color.c */
  1318. Xvoid               hsv_to_rgb();
  1319. Xvoid               rgb_to_hsv();
  1320. Xvoid               rgb_to_xcolor();
  1321. Xvoid               hsv_to_xcolor();
  1322. Xvoid               xcolor_to_hsv();
  1323. Xvoid               olgx_hsv_to_3D();
  1324. X
  1325. X#endif    !OL_PRIVATE_DEFINED
  1326. X
  1327. X
  1328. X
  1329. X
  1330. X
  1331. END_OF_FILE
  1332. if test 2771 -ne `wc -c <'olgx_impl.h'`; then
  1333.     echo shar: \"'olgx_impl.h'\" unpacked with wrong size!
  1334. fi
  1335. # end of 'olgx_impl.h'
  1336. fi
  1337. if test -f 'properties.h' -a "${1}" != "-c" ; then 
  1338.   echo shar: Will not clobber existing file \"'properties.h'\"
  1339. else
  1340. echo shar: Extracting \"'properties.h'\" \(1900 characters\)
  1341. sed "s/^X//" >'properties.h' <<'END_OF_FILE'
  1342. X/*
  1343. X *      (c) Copyright 1989 Sun Microsystems, Inc. Sun design patents
  1344. X *      pending in the U.S. and foreign countries. See LEGAL_NOTICE
  1345. X *      file for terms of the license.
  1346. X */
  1347. X
  1348. X#ident    "@(#)properties.h    26.5    91/09/14 SMI"
  1349. X
  1350. X#ifndef _OLWM_PROPERTIES_H
  1351. X#define _OLWM_PROPERTIES_H
  1352. X
  1353. X/*
  1354. X * Open Look Window Attribute structure
  1355. X */
  1356. Xtypedef struct {
  1357. X    unsigned long    flags;
  1358. X    Atom        win_type;
  1359. X    Atom        menu_type;
  1360. X    unsigned long    pin_initial_state;
  1361. X    unsigned long    cancel;
  1362. X} OLWinAttr;
  1363. X#define OLWINATTRLENGTH (sizeof(OLWinAttr)/sizeof(unsigned long))
  1364. X
  1365. X/* 
  1366. X * Values for flags in OLWinAttr
  1367. X */
  1368. X#define WA_WINTYPE    (1<<0)
  1369. X#define WA_MENUTYPE    (1<<1)
  1370. X#define WA_PINSTATE    (1<<2)
  1371. X#define WA_CANCEL    (1<<3)
  1372. X
  1373. X/*
  1374. X * Values for flags of available top-level window-management properties
  1375. X */
  1376. X#define WMClassAvail        (1<<0)
  1377. X#define WMNameAvail        (1<<1)
  1378. X#define WMIconNameAvail        (1<<2)
  1379. X#define WMNormalHintsAvail    (1<<3)
  1380. X#define WMHintsAvail        (1<<4)
  1381. X#define WMTransientForAvail    (1<<5)
  1382. X#define WMProtocolsAvail    (1<<6)
  1383. X#define WMColormapWindowsAvail    (1<<7)
  1384. X#define WMStateAvail        (1<<8)
  1385. X#define OLWinAttrAvail        (1<<9)
  1386. X#define OLDecorAddAvail        (1<<10)
  1387. X#define OLDecorDelAvail        (1<<11)
  1388. X#define OLWindowStateAvail    (1<<12)
  1389. X#define OLLeftFooterAvail    (1<<13)
  1390. X#define OLRightFooterAvail    (1<<14)
  1391. X
  1392. X#define ENTIRE_CONTENTS        (10000000L)
  1393. X
  1394. Xextern    void    *GetWindowProperty();
  1395. X
  1396. Xextern    int    PropListAvailable();
  1397. Xextern    void    PropSetAvailable();
  1398. Xextern    void    PropClearAvailable();
  1399. X
  1400. Xextern    Bool    PropGetWMName();
  1401. Xextern    Bool    PropGetWMIconName();
  1402. Xextern    Bool    PropGetWMClass();
  1403. Xextern    Bool    PropGetWMNormalHints();
  1404. Xextern    Bool    PropGetWMHints();
  1405. Xextern    Bool    PropGetWMProtocols();
  1406. Xextern    Bool    PropGetWMTransientFor();
  1407. Xextern    Bool    PropGetWMState();
  1408. Xextern    void    PropSetWMState();
  1409. Xextern    Bool    PropGetOLWindowState();
  1410. Xextern    Bool    PropGetOLWinAttr();
  1411. Xextern    Bool    PropGetOLDecorAdd();
  1412. Xextern    Bool    PropGetOLDecorDel();
  1413. X
  1414. X
  1415. X#endif /* _OLWM_PROPERTIES_H */
  1416. END_OF_FILE
  1417. if test 1900 -ne `wc -c <'properties.h'`; then
  1418.     echo shar: \"'properties.h'\" unpacked with wrong size!
  1419. fi
  1420. # end of 'properties.h'
  1421. fi
  1422. if test -f 'screen.h' -a "${1}" != "-c" ; then 
  1423.   echo shar: Will not clobber existing file \"'screen.h'\"
  1424. else
  1425. echo shar: Extracting \"'screen.h'\" \(4189 characters\)
  1426. sed "s/^X//" >'screen.h' <<'END_OF_FILE'
  1427. X/*
  1428. X *      (c) Copyright 1989, 1990 Sun Microsystems, Inc. Sun design patents
  1429. X *      pending in the U.S. and foreign countries. See LEGAL_NOTICE
  1430. X *      file for terms of the license.
  1431. X */
  1432. X
  1433. X#ident    "@(#)screen.h    1.1 olvwm version 1/3/92"
  1434. X
  1435. X/*
  1436. X * Based on
  1437. X#ident    "@(#)screen.h    26.17    91/09/14 SMI"
  1438. X *
  1439. X */
  1440. X
  1441. X#ifndef _OLWM_SCREEN_H
  1442. X#define _OLWM_SCREEN_H
  1443. X
  1444. X#include <olgx/olgx.h>
  1445. X
  1446. X/*
  1447. X *    Index's into GC array of ScreenInfo struct
  1448. X */
  1449. Xtypedef enum {    ROOT_GC,
  1450. X        FOREGROUND_GC,
  1451. X        BORDER_GC,
  1452. X        WINDOW_GC,
  1453. X        WORKSPACE_GC,
  1454. X        BUSY_GC,
  1455. X        ICON_NORMAL_GC,
  1456. X        ICON_MASK_GC,
  1457. X        ICON_BORDER_GC,
  1458. X        INPUTFOCUS_GC,
  1459. X        VDM_GC,
  1460. X        VDM_INPUT_GC,
  1461. X        NUM_GCS 
  1462. X} ScreenGCIndex;
  1463. X
  1464. X/*
  1465. X *    Index's into Graphics_info array of ScreenInfo struct
  1466. X */
  1467. Xtypedef enum { NORMAL_GINFO, 
  1468. X           BUTTON_GINFO, 
  1469. X           TEXT_GINFO,
  1470. X           REVPIN_GINFO,
  1471. X           INPUTFOCUS_GINFO,
  1472. X           NUM_GINFOS 
  1473. X} ScreenGinfoIndex;
  1474. X
  1475. X/*
  1476. X *    Index's into Pixmap array of ScreenInfo struct
  1477. X */
  1478. Xtypedef enum {
  1479. X    BUSY_STIPPLE,
  1480. X    ICON_BITMAP,
  1481. X    ICON_MASK,
  1482. X    PROTO_DRAWABLE,
  1483. X    GRAY50_BITMAP,
  1484. X    NUM_PIXMAPS
  1485. X} ScreenPixmapIndex;
  1486. X
  1487. X/*
  1488. X *     ColorMapFocus    - client/window which has colormap focus
  1489. X */
  1490. Xtypedef struct _colormapfocus {
  1491. X    struct _client        *client;
  1492. X    struct _wingeneric    *window;
  1493. X    Bool            locked;
  1494. X} ColorMapFocus;
  1495. X
  1496. X/*
  1497. X *    BackgroundType    - type of workspace background
  1498. X */
  1499. Xtypedef enum { BG_None, BG_Color, BG_Pixmap } BackgroundType;
  1500. X
  1501. X/*
  1502. X *    ColorInfo    - window/workspace/etc colors
  1503. X */
  1504. Xtypedef struct _colorinfo {
  1505. X    unsigned long        flags;
  1506. X    Bool            reverseVideo;
  1507. X    unsigned long        black, white;
  1508. X    unsigned long        fgColor, bgColor;
  1509. X    unsigned long        bg0Color,bg1Color,bg2Color,bg3Color;
  1510. X    unsigned long        borderColor;
  1511. X    BackgroundType        workspaceType;
  1512. X    unsigned long        workspaceColor;
  1513. X    unsigned long        workspaceRootPixel;
  1514. X    unsigned long        virtualFgColor, virtualBgColor;
  1515. X    unsigned long        virtualGridColor, virtualFontColor;
  1516. X    unsigned long        virtualPixmapColor;
  1517. X    unsigned long        virtualInputColor;
  1518. X    unsigned long        inputBg0Color,inputBg1Color,
  1519. X                inputBg2Color,inputBg3Color;
  1520. X    unsigned long        vIconColor;
  1521. X} ColorInfo;
  1522. X
  1523. X#define CIWorkspaceColorAlloced        (1L<<0)
  1524. X#define CIWindowColorAlloced        (1L<<1)
  1525. X#define CIForegroundColorAlloced    (1L<<2)
  1526. X#define CIBackgroundColorAlloced    (1L<<3)
  1527. X#define CIBorderColorAlloced        (1L<<4)
  1528. X#define CIVirtualForegroundColorAlloced    (1L<<5)
  1529. X#define CIVirtualBackgroundColorAlloced    (1L<<6)
  1530. X#define CIVirtualFontColorAlloced    (1L<<7)
  1531. X#define CIVirtualGridColorAlloced    (1L<<8)
  1532. X#define CIInputFocusColorAlloced    (1L<<9)
  1533. X#define CIVirtualPixmapColorAlloced    (1L<<10)
  1534. X
  1535. X/*
  1536. X *    ScreenInfo    - Per screen info
  1537. X */
  1538. Xtypedef struct _screeninfo {
  1539. X    int            screen;
  1540. X    Window            rootid;
  1541. X    struct _winroot        *rootwin;
  1542. X    int            depth;
  1543. X    Visual            *visual;
  1544. X    Colormap        colormap;
  1545. X    Bool            iscolor;
  1546. X    Bool            use3D;
  1547. X    ColorInfo        colorInfo;
  1548. X    GC            gc[NUM_GCS];
  1549. X    Graphics_info        *gi[NUM_GINFOS];
  1550. X    Pixmap            pixmap[NUM_PIXMAPS];
  1551. X    struct _menuCache    *menuCache;
  1552. X    ColorMapFocus        cmapfocus;
  1553. X    int            framepos;
  1554. X    struct _iconGrid    *iconGrid;
  1555. X    char            **environment;
  1556. X    int            instanceQ;    /* quark for this screen's
  1557. X                           instance name */
  1558. X    int            dfltIconWidth, dfltIconHeight;
  1559. X    struct _virtualdesktop    *vdm;
  1560. X    struct _menu        *menuTable[NUM_MENUS];
  1561. X    struct {
  1562. X        struct _button    **frameFullButtons;
  1563. X        struct _button    **frameDismissButtons;
  1564. X        struct _button    **frameLimitedButtons;
  1565. X    }             menuButtons;
  1566. X} ScreenInfo;
  1567. X
  1568. X/*
  1569. X *    Global functions from screen.c
  1570. X */
  1571. Xextern    void        InitScreens(/* Display *dpy */);
  1572. Xextern    void        DestroyScreens(/* Display *dpy */);
  1573. Xextern    ScreenInfo    *GetFirstScrInfo();
  1574. Xextern    ScreenInfo    *GetScrInfoOfScreen(/* int screen */);
  1575. Xextern    ScreenInfo    *GetScrInfoOfRoot(/* Window root */);
  1576. Xextern    void        SetWorkspaceColor(/* Display *dpy */);
  1577. Xextern    void        SetWindowColor(/* Display *dpy */);
  1578. Xextern    void        SetForegroundColor(/* Display *dpy */);
  1579. Xextern    void        SetBackgroundColor(/* Display *dpy */);
  1580. Xextern    void        SetBorderColor(/* Display *dpy */);
  1581. Xextern    void        SetTitleFont(/* Display *dpy */);
  1582. Xextern    void        SetTextFont(/* Display *dpy */);
  1583. Xextern    void        SetButtonFont(/* Display *dpy */);
  1584. Xextern    void        SetIconFont(/* Display *dpy */);
  1585. Xextern    void        SetGlyphFont(/* Display *dpy */);
  1586. Xextern    void        SetIconLocation(/*Display *dpy */);
  1587. Xextern    void        UpdateScreenResources();
  1588. X
  1589. X#endif    /* _OLWM_SCREEN_H */
  1590. END_OF_FILE
  1591. if test 4189 -ne `wc -c <'screen.h'`; then
  1592.     echo shar: \"'screen.h'\" unpacked with wrong size!
  1593. fi
  1594. # end of 'screen.h'
  1595. fi
  1596. if test -f 'slave.c' -a "${1}" != "-c" ; then 
  1597.   echo shar: Will not clobber existing file \"'slave.c'\"
  1598. else
  1599. echo shar: Extracting \"'slave.c'\" \(3354 characters\)
  1600. sed "s/^X//" >'slave.c' <<'END_OF_FILE'
  1601. X/*
  1602. X *      (c) Copyright 1989 Sun Microsystems, Inc. Sun design patents
  1603. X *      pending in the U.S. and foreign countries. See LEGAL_NOTICE
  1604. X *      file for terms of the license.
  1605. X */
  1606. X/* ----------------------------------------------------------------------
  1607. X *    slave.c
  1608. X * ---------------------------------------------------------------------*/
  1609. X
  1610. X#ident    "@(#)slave.c    26.8    91/09/14 SMI"
  1611. X
  1612. X#include <sys/types.h>
  1613. X#include <sys/time.h>
  1614. X#include <sys/resource.h>
  1615. X#include <X11/Xlib.h>
  1616. X#include <signal.h>
  1617. X#include <stdio.h>
  1618. X#include "cmdstream.h"
  1619. X
  1620. X/* ----------------------------------------------------------------------
  1621. X *    Local Data
  1622. X * ---------------------------------------------------------------------*/
  1623. Xtypedef struct {
  1624. X    char    *program;
  1625. X    pid_t    pid;
  1626. X} SlaveInfo;
  1627. X
  1628. Xstatic SlaveInfo slaveInfo = {
  1629. X    "olwmslave", 0
  1630. X};
  1631. X
  1632. X/* ----------------------------------------------------------------------
  1633. X *    Local Forward Declarations
  1634. X * ---------------------------------------------------------------------*/
  1635. Xvoid    SlaveFailure();
  1636. X
  1637. X/* ----------------------------------------------------------------------
  1638. X *    SlaveStart
  1639. X * ---------------------------------------------------------------------*/
  1640. Xpid_t
  1641. XSlaveStart(argv)
  1642. X    char        **argv;
  1643. X{
  1644. X    int        input[2],output[2];
  1645. X    struct rlimit    rlimit;
  1646. X    int        fd,maxfd;
  1647. X
  1648. X    if (pipe(input) == -1) {
  1649. X        ErrorWarning("Couldn't create input pipe for olwmslave");
  1650. X        perror("pipe");
  1651. X        SlaveFailure();
  1652. X        return -1;
  1653. X    }
  1654. X    if (pipe(output) == -1) {
  1655. X        ErrorWarning("Couldn't create output pipe for olwmslave");
  1656. X        perror("pipe");
  1657. X        SlaveFailure();
  1658. X        (void)close(input[0]);
  1659. X        (void)close(input[1]);
  1660. X        return -1;
  1661. X    }
  1662. X
  1663. X    slaveInfo.pid = fork();
  1664. X
  1665. X    switch (slaveInfo.pid) {
  1666. X    case -1:            /* error */
  1667. X        (void)close(input[0]);
  1668. X        (void)close(input[1]);
  1669. X        (void)close(output[0]);
  1670. X        (void)close(output[1]);
  1671. X        SlaveFailure();
  1672. X        break;
  1673. X    case 0:                /* Slave */
  1674. X        dup2(input[0],0);
  1675. X        dup2(output[1],1);
  1676. X        if (getrlimit(RLIMIT_NOFILE,&rlimit) == -1)
  1677. X            maxfd = 0;
  1678. X        else
  1679. X            maxfd = rlimit.rlim_cur;    
  1680. X        for (fd=3; fd<maxfd ; fd++) {
  1681. X            (void)close(fd);
  1682. X        }
  1683. X        argv[0] = slaveInfo.program;
  1684. X        if (execvp(slaveInfo.program,argv) == -1) {
  1685. X            SlaveFailure();
  1686. X            exit(-1);
  1687. X        }
  1688. X        break;
  1689. X    default:            /* parent */
  1690. X        SetCmdStream(fdopen(output[0],"r"),     /* reader */
  1691. X                 fdopen(input[1],"w"));    /* writer */
  1692. X        break;
  1693. X    }
  1694. X    return slaveInfo.pid;
  1695. X}
  1696. X
  1697. X/* ----------------------------------------------------------------------
  1698. X *    SlaveStop    - call to stop Slave process
  1699. X * ---------------------------------------------------------------------*/
  1700. Xvoid
  1701. XSlaveStop()
  1702. X{
  1703. X    if (slaveInfo.pid == 0)
  1704. X        return;
  1705. X    if (kill(slaveInfo.pid,SIGTERM) == -1) {
  1706. X        /* -- dont really want this error message
  1707. X        ErrorWarning("Couldn't kill olwmslave");
  1708. X        perror("kill");
  1709. X        */
  1710. X    }
  1711. X}
  1712. X
  1713. X/* ----------------------------------------------------------------------
  1714. X *    SlaveStopped    - called when Slave process has died
  1715. X * ---------------------------------------------------------------------*/
  1716. Xvoid
  1717. XSlaveStopped()
  1718. X{
  1719. X    SetCmdStream((FILE *)0,(FILE *)0);
  1720. X}
  1721. X
  1722. X/* ----------------------------------------------------------------------
  1723. X *    SlaveFailure    - called if Slave process wont/cant start
  1724. X * ---------------------------------------------------------------------*/
  1725. Xstatic void
  1726. XSlaveFailure()
  1727. X{
  1728. X    char    errbuf[256];
  1729. X
  1730. X    sprintf(errbuf,
  1731. X        "Couldn't start %s; Help for olwm will not work.",
  1732. X        slaveInfo.program);
  1733. X    ErrorWarning(errbuf);
  1734. X}
  1735. END_OF_FILE
  1736. if test 3354 -ne `wc -c <'slave.c'`; then
  1737.     echo shar: \"'slave.c'\" unpacked with wrong size!
  1738. fi
  1739. # end of 'slave.c'
  1740. fi
  1741. if test -f 'virtual.h' -a "${1}" != "-c" ; then 
  1742.   echo shar: Will not clobber existing file \"'virtual.h'\"
  1743. else
  1744. echo shar: Extracting \"'virtual.h'\" \(4412 characters\)
  1745. sed "s/^X//" >'virtual.h' <<'END_OF_FILE'
  1746. X/*
  1747. X *      (c) Copyright 1991 Scott Oaks
  1748. X *      See LEGAL_NOTICE file for terms of the license.
  1749. X */
  1750. X
  1751. X#ident    "@(#)virtual.h    1.1 olvwm version 1/3/92"
  1752. X
  1753. X#ifndef _OLWM_VIRTUAL_H
  1754. X#define _OLWM_VIRTUAL_H
  1755. X
  1756. X/*
  1757. X * The virtual desktop exists as a logical abstraction only; there is no
  1758. X * actual X window called the virtual desktop to which the frames are
  1759. X * reparented (unlike other virtual managers).  Frames are still reparented
  1760. X * to the root.
  1761. X *
  1762. X * Moving the virtual desktop then means that we have to move each window;
  1763. X * windows which no longer appear on the screen have coordinates outside
  1764. X * of [(0,0);(1152,900)] (or whatever the size of your screen is).  This
  1765. X * means that windows on the screen still map to (0,0);(1152,900).
  1766. X *
  1767. X * Moving each window doesn't really entail much overhead, since even if
  1768. X * we had a virtual root and shifted it, we'd still have to send synthetic
  1769. X * configure events to each window.
  1770. X *
  1771. X *
  1772. X * The Virtual Desktop is the logical abstraction and is several screens
  1773. X * large.  The VDM is the X window which displays this abstraction and
  1774. X * is a small X window on the display.  The VDM will have a frame and look
  1775. X * like any other base window, but it may never be unstuck.
  1776. X
  1777. X                    <- absoluteWidth ->
  1778. X     |-----------------------------------------------------|
  1779. X   ^ |                                                     |
  1780. X   | |                                                     |
  1781. X   a |                                                     |
  1782. X   b |            ->offsetX, offsetY (negative from up/left|
  1783. X   s |            |                                        |
  1784. X   o |            *******************                      |
  1785. X   l |            *                 *                      |
  1786. X   u |            *                 *                      |
  1787. X   t |            *                 *                      |
  1788. X   e |            *                 *                      |
  1789. X   H |            *                 *                      |
  1790. X   e |            *******************                      |
  1791. X   i |                                                     |
  1792. X   g |                                                     |
  1793. X   h |                                                     |
  1794. X   t |-----------------------------------------------------|
  1795. X
  1796. X */
  1797. X
  1798. Xtypedef struct _virtualresources {
  1799. X    char        *size;
  1800. X    char        *geometry;
  1801. X    char        *iconGeometry;
  1802. X    int            scale;
  1803. X    VirtualGridType    grid;
  1804. X    char        *background;
  1805. X} VirtualResources;
  1806. X
  1807. Xtypedef struct _virtualdesktop {
  1808. X    struct _client    *client;    /* Handle to client structure; this
  1809. X                     * leads to a recursive pointer trail */
  1810. X
  1811. X    int        offsetX;        /* Position of the upper/left corner  */
  1812. X    int        offsetY;        /* of the current screen on the VDM
  1813. X                     * These will always be <= 0, since it
  1814. X                     * should be added to a windows coord
  1815. X                     * to determine where on the virtual
  1816. X                     * desktop the window is              */
  1817. X
  1818. X    int        absoluteWidth;        /* Width of virtual desktop in pixels */
  1819. X    int        absoluteHeight;        /* Height of virtual desk in pixels   */
  1820. X
  1821. X    int        columns;        /* Number of logical screens across   */
  1822. X    int        rows;            /* Number of logical screens down     */
  1823. X    int        height;            /* height of the VDM in pixels        */
  1824. X    int        width;            /* width of the VDM in pixels         */
  1825. X    int        screenWidth;        /* Width of logical screen within VDM */
  1826. X    int        screenHeight;        /* Height of logical screen within VDM*/
  1827. X    int        screenX;        /* X position of current screen in VDM*/
  1828. X    int        screenY;        /* Y position of current screen in VDM*/
  1829. X    int        max_ascent;        /* max ascent of font in VDM          */
  1830. X    int        saveX;            /* for save/restore, last position    */
  1831. X    int        saveY;            /* for save/restore, last position    */
  1832. X    VirtualResources    *resources;    /* Screen-specific virtual resources  */
  1833. X} VirtualDesktop;
  1834. X
  1835. X/*
  1836. X * Structure to bundle the information needed to perform a drag/move within
  1837. X * the VDM
  1838. X */
  1839. Xtypedef struct _vdmstuff {
  1840. X    VirtualDesktop    *vdm;        /* Virtual Desktop involved in move   */
  1841. X    int            initX, initY;    /* Initial location of screenX        */
  1842. X    int            pointerX,    /* Initial press of button in move    */
  1843. X            pointerY;
  1844. X    int            numMoves;    /* number of times we got a motion ev */
  1845. X    GC            gc;        /* gc to draw with (use root gc       */
  1846. X} VDMstuff;
  1847. X
  1848. X/*
  1849. X * Structure to bundle amount a view into the desktop has moved
  1850. X */
  1851. Xtypedef struct deltas {
  1852. X    double    delta_x, delta_y;
  1853. X};
  1854. X
  1855. X#endif    /* _OLWM_VIRTUAL_H */
  1856. END_OF_FILE
  1857. if test 4412 -ne `wc -c <'virtual.h'`; then
  1858.     echo shar: \"'virtual.h'\" unpacked with wrong size!
  1859. fi
  1860. # end of 'virtual.h'
  1861. fi
  1862. if test -f 'winbusy.c' -a "${1}" != "-c" ; then 
  1863.   echo shar: Will not clobber existing file \"'winbusy.c'\"
  1864. else
  1865. echo shar: Extracting \"'winbusy.c'\" \(5649 characters\)
  1866. sed "s/^X//" >'winbusy.c' <<'END_OF_FILE'
  1867. X/*
  1868. X *      (c) Copyright 1989, 1990 Sun Microsystems, Inc. Sun design patents
  1869. X *      pending in the U.S. and foreign countries. See LEGAL_NOTICE
  1870. X *      file for terms of the license.
  1871. X */
  1872. X
  1873. X#ident    "@(#)winbusy.c    1.1 olvwm version 1/3/92"
  1874. X
  1875. X/*
  1876. X * Based on
  1877. X#ident    "@(#)winbusy.c    26.8    91/09/14 SMI"
  1878. X *
  1879. X */
  1880. X
  1881. X#include <errno.h>
  1882. X#include <stdio.h>
  1883. X#include <X11/Xos.h>
  1884. X#include <X11/Xlib.h>
  1885. X#include <X11/Xutil.h>
  1886. X#include <X11/Xatom.h>
  1887. X#include <olgx/olgx.h>
  1888. X
  1889. X#include "i18n.h"
  1890. X#include "ollocale.h"
  1891. X#include "mem.h"
  1892. X#include "olwm.h"
  1893. X#include "win.h"
  1894. X#include "globals.h"
  1895. X
  1896. X/***************************************************************************
  1897. X* global data
  1898. X***************************************************************************/
  1899. X
  1900. X/***************************************************************************
  1901. X* private data
  1902. X***************************************************************************/
  1903. X
  1904. Xstatic ClassBusy classBusy;
  1905. Xstatic Bool busyDisabled = True;
  1906. X
  1907. X/***************************************************************************
  1908. X* private functions
  1909. X***************************************************************************/
  1910. X
  1911. X/*
  1912. X * DestroyBusy -- destroy the busy window resources and free any allocated
  1913. X *    data.
  1914. X */
  1915. Xstatic int
  1916. XdestroyBusy(dpy, winInfo)
  1917. XDisplay    *dpy;
  1918. XWinBusy *winInfo;
  1919. X{
  1920. X    /* free our data and throw away window */
  1921. X    XUndefineCursor(dpy, winInfo->core.self);
  1922. X    WinRemoveChild(winInfo->core.parent,winInfo);
  1923. X    DestroyWindow(winInfo);
  1924. X    MemFree(winInfo);
  1925. X}
  1926. X
  1927. X
  1928. X/*
  1929. X * widthfuncBusy - recomputes the height of the busy window
  1930. X */
  1931. Xint
  1932. XwidthfuncBusy(win, pxcre)
  1933. XWinBusy *win;
  1934. XXConfigureRequestEvent *pxcre;
  1935. X{
  1936. X    WinGenericFrame *frame = (WinGenericFrame *)win->core.parent;
  1937. X    return frame->fcore.panewin->core.width;
  1938. X}
  1939. X
  1940. X/*
  1941. X * heightfuncBusy - recomputes the height of the busy window
  1942. X */
  1943. Xint
  1944. XheightfuncBusy(win, pxcre)
  1945. XWinBusy *win;
  1946. XXConfigureRequestEvent *pxcre;
  1947. X{
  1948. X    WinGenericFrame *frame = (WinGenericFrame *)win->core.parent;
  1949. X    return frame->fcore.panewin->core.height;
  1950. X}
  1951. X
  1952. X
  1953. X/*
  1954. X *
  1955. X * REMIND
  1956. X * 
  1957. X * Busy windows are effectively "turned off" by the static Bool busyDisabled.
  1958. X * The reason for this is that having a busy window on the screen over the
  1959. X * application's window will prevent that application from receiving drag-n-
  1960. X * drop messages properly.  When busyDisabled is set, the following newconfig,
  1961. X * newpos, and setconfig functions prevent the busy window from changing from
  1962. X * its initial state.  The initial state is set in MakeBusy, which makes the 
  1963. X * busy window very small and above the upper left corner of the frame window.
  1964. X */
  1965. X
  1966. Xstatic int
  1967. XnewConfigBusy(winInfo, pxcre)
  1968. X    WinBusy *winInfo;
  1969. X    XConfigureRequestEvent *pxcre;
  1970. X{
  1971. X    if (busyDisabled)
  1972. X    return 0;
  1973. X    else
  1974. X    return WinNewConfigFunc(winInfo, pxcre);
  1975. X}
  1976. X
  1977. X
  1978. Xstatic int
  1979. XnewPosBusy(winInfo, x, y)
  1980. X    WinBusy *winInfo;
  1981. X    int x, y;
  1982. X{
  1983. X    if (busyDisabled)
  1984. X    return 0;
  1985. X    else
  1986. X    return WinNewPosFunc(winInfo, x, y);
  1987. X}
  1988. X
  1989. X
  1990. Xstatic int
  1991. XsetConfigBusy(dpy, winInfo)
  1992. X    Display *dpy;
  1993. X    WinBusy *winInfo;
  1994. X{
  1995. X    if (busyDisabled)
  1996. X    return 0;
  1997. X    else
  1998. X    return WinSetConfigFunc(dpy, winInfo);
  1999. X}
  2000. X
  2001. X
  2002. X
  2003. X/***************************************************************************
  2004. X* global functions
  2005. X***************************************************************************/
  2006. X
  2007. X/*
  2008. X * MakeBusy  -- create the busy window.  The Busy window is exactly the
  2009. X *    same size as its parent and gets all keyboard and pointer events
  2010. X *    for the frame.  The parent is assumed to be a frame.
  2011. X */
  2012. XWinBusy *
  2013. XMakeBusy(dpy, par)
  2014. XDisplay    *dpy;
  2015. XWinGenericFrame *par;
  2016. X{
  2017. X    WinBusy *w;
  2018. X    Window win;
  2019. X        unsigned long valuemask;
  2020. X        XSetWindowAttributes attributes;
  2021. X
  2022. X    /* create the associated structure */
  2023. X    w = MemNew(WinBusy);
  2024. X    w->core.kind = WIN_BUSY;
  2025. X    w->class = &classBusy;
  2026. X    WinAddChild(par,w);
  2027. X    w->core.children = NULL;
  2028. X    w->core.client = par->core.client;
  2029. X    if (busyDisabled) {
  2030. X        w->core.x = -10;
  2031. X        w->core.y = -10;
  2032. X        w->core.width = 1;
  2033. X        w->core.height = 1;
  2034. X    } else {
  2035. X        w->core.x = par->fcore.panewin->core.x;    
  2036. X        w->core.y = par->fcore.panewin->core.y;
  2037. X        w->core.width = par->fcore.panewin->core.width;
  2038. X        w->core.height = par->fcore.panewin->core.height;
  2039. X    }
  2040. X    w->core.dirtyconfig = CWX | CWY | CWWidth | CWHeight;
  2041. X    w->core.exposures = NULL;
  2042. X    w->isFocus = False;
  2043. X
  2044. X    /* inheirit help from the parent frame */
  2045. X    w->core.helpstring = par->core.helpstring;
  2046. X
  2047. X    /* create the window */
  2048. X        attributes.event_mask = ButtonReleaseMask | ButtonPressMask | 
  2049. X        KeyPressMask;
  2050. X    attributes.cursor = GRV.BusyPointer;
  2051. X        valuemask = CWEventMask | CWCursor;
  2052. X        win = XCreateWindow(dpy, par->core.self,
  2053. X                        w->core.x, w->core.y,
  2054. X            w->core.width, w->core.height,
  2055. X                        0,
  2056. X            CopyFromParent,
  2057. X            InputOnly,
  2058. X                        CopyFromParent,
  2059. X                        valuemask,
  2060. X                        &attributes);
  2061. X
  2062. X    /* fill out remaining fields */
  2063. X    w->core.self = win;
  2064. X    WIInstallInfo(w);
  2065. X        MapRaised(w);
  2066. X
  2067. X    return w;
  2068. X}
  2069. X
  2070. Xvoid
  2071. XBusyInit(dpy)
  2072. XDisplay *dpy;
  2073. X{
  2074. X    classBusy.core.kind = WIN_BUSY;
  2075. X    classBusy.core.xevents[ButtonPress] = NoFocusEventBeep;
  2076. X    classBusy.core.xevents[ButtonRelease] = NoFocusEventBeep;
  2077. X    classBusy.core.xevents[KeyPress] = NoFocusEventBeep;
  2078. X    classBusy.core.xevents[KeyRelease] = NoFocusEventBeep;
  2079. X    classBusy.core.focusfunc = NULL;
  2080. X    classBusy.core.drawfunc = NULL;
  2081. X    classBusy.core.destroyfunc = destroyBusy;
  2082. X    classBusy.core.selectfunc = NULL;
  2083. X    classBusy.core.newconfigfunc = newConfigBusy;
  2084. X    classBusy.core.newposfunc = newPosBusy;
  2085. X    classBusy.core.setconfigfunc = setConfigBusy;
  2086. X    classBusy.core.createcallback = NULL;
  2087. X    classBusy.core.heightfunc = heightfuncBusy;
  2088. X    classBusy.core.widthfunc = widthfuncBusy;
  2089. X}
  2090. END_OF_FILE
  2091. if test 5649 -ne `wc -c <'winbusy.c'`; then
  2092.     echo shar: \"'winbusy.c'\" unpacked with wrong size!
  2093. fi
  2094. # end of 'winbusy.c'
  2095. fi
  2096. echo shar: End of archive 20 \(of 21\).
  2097. cp /dev/null ark20isdone
  2098. MISSING=""
  2099. 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
  2100.     if test ! -f ark${I}isdone ; then
  2101.     MISSING="${MISSING} ${I}"
  2102.     fi
  2103. done
  2104. if test "${MISSING}" = "" ; then
  2105.     echo You have unpacked all 21 archives.
  2106.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  2107. else
  2108.     echo You still need to unpack the following archives:
  2109.     echo "        " ${MISSING}
  2110. fi
  2111. ##  End of shell archive.
  2112. exit 0
  2113. --
  2114. Molecular Simulations, Inc.             mail: dcmartin@postgres.berkeley.edu
  2115. 796 N. Pastoria Avenue                  uucp: uwvax!ucbvax!dcmartin
  2116. Sunnyvale, California 94086             at&t: 408/522-9236
  2117.