angel@umigw.MIAMI.EDU (angel li) (09/13/89)
Here are some patches for the Open Look window manager running on VMS. It would be nice if someone came up with the code to create a DECterm window directly in the window manager rather than spawning a command to run decw$mail_createdecterm. Here are a list of problems I've found with olwm on VMS: o The -f option does not seem to work with DECterm. I can't seem to get focus unless I click in the window. o olwm does not title modeless dialog boxes therefore these boxes are not draggable. o xfish now works :-) I have used olwm on VMS very lightly, I would be interested in getting VMS patches mailed to me. I have not found a way to cleanly replace the DEC window manager on VMS with olwm. Here is how I start up olwm from my decw$login.com: $! $! This does not work $! $!def/job/exec decw$winmgrexe sys$system:twm.exe $!spawn/nowait/input=nl: mcr twm $! $! This certainly works... $! $ stop decw$wm_1 $! $ spawn/nowait/input=nl: mcr du:[angel.bin]olwm $ spawn/nowait/input=nl:/out=nl: mcr decw$clock The define of decw$winmgrexe did not seem to work hence I used a sledgehammer on the DEC window manager. I hope someone can post the correct way for doing this. My next posting is patch to the LucidaSansTypewriter-12 font that adds the graphic characters that VMS uses for MONITOR, the debugger and the editors. diff -cN [.olwm-orig]adframe.c [.olwm]adframe.c *** [.olwm-orig]adframe.c Sat Sep 9 16:08:35 1989 --- [.olwm]adframe.c Fri Sep 8 22:30:04 1989 *************** *** 675,680 **** --- 675,684 ---- return ((FrameInfo *)frame->priv.ptr)->wmHints; } + #ifdef VMS + #define GetName olwmGetName + #endif + /* * GetName -- return name from passed frame */ diff -cN [.olwm-orig]adtitlebar.c [.olwm]adtitlebar.c *** [.olwm-orig]adtitlebar.c Sat Sep 9 16:08:38 1989 --- [.olwm]adtitlebar.c Fri Sep 8 22:30:15 1989 *************** *** 142,147 **** --- 142,151 ---- } + #ifdef VMS + #define GetName olwmGetName + #endif + /* * SetTitleName -- fetch the name of the window from the pane and * calculate the values needed to center the string diff -cN [.olwm-orig]defaults.c [.olwm]defaults.c *** [.olwm-orig]defaults.c Sat Sep 9 16:08:49 1989 --- [.olwm]defaults.c Sat Sep 9 14:06:14 1989 *************** *** 36,41 **** --- 36,48 ---- #define TAG "OpenWindows" MenuStr AppMenuStrs[MAXAPPMENUITEMS] = { + #ifdef VMS + { "Terminal", "mcr decw$mail_createdecterm" }, + { "Clock", "mcr decw$clock"}, + { "Calculator", "mcr decw$calc"}, + { "Calendar", "mcr decw$calendar"}, + { "FileView", "mcr decw$filevue"}, + #else { "Terminal", "xterm" }, { "Terminal Iconic", "xterm -iconic" }, { "Clock", "xclock"}, *************** *** 42,47 **** --- 49,55 ---- { "Digital Clock", "xclock -digital"}, { "FileView", "filemgr -Wb 230 230 230 -Wg"}, { "Command Tool", "cmdtool"}, + #endif }; int NumAppMenuStrs; *************** *** 101,107 **** --- 109,119 ---- if (!(NumAppMenuStrs = ReadAppMenu())) { + #ifdef VMS + NumAppMenuStrs = 5; + #else NumAppMenuStrs = 6; + #endif } } diff -cN [.olwm-orig]initgraphics.c [.olwm]initgraphics.c *** [.olwm-orig]initgraphics.c Sat Sep 9 16:08:42 1989 --- [.olwm]initgraphics.c Fri Sep 8 22:41:20 1989 *************** *** 193,199 **** --- 193,205 ---- DefaultDepth(dpy, DefaultScreen(dpy))); } + #ifdef VMS + #define DEFAULT_FONT "fixed" + #else + #define DEFAULT_FONT "9x15" + #endif + InitGraphics(dpy) Display *dpy; { *************** *** 201,216 **** /* Load up them font doggies. */ if ((NormalFontInfo = XLoadQueryFont(dpy, TitleBarFontName))==NULL) ! NormalFontInfo = XLoadQueryFont(dpy, "9x15"); if ((IconFontInfo = XLoadQueryFont(dpy, IconFontName))==NULL) ! IconFontInfo = XLoadQueryFont(dpy, "9x15"); if ((MenuTitleFontInfo = XLoadQueryFont(dpy, MenuTitleFontName))==NULL) ! MenuTitleFontInfo = XLoadQueryFont(dpy, "9x15"); if ((MenuButtonFontInfo = XLoadQueryFont(dpy,MenuButtonFontName))==NULL) ! MenuButtonFontInfo = XLoadQueryFont(dpy, "9x15"); /* Create a GC for drawing in the root window. */ --- 207,222 ---- /* Load up them font doggies. */ if ((NormalFontInfo = XLoadQueryFont(dpy, TitleBarFontName))==NULL) ! NormalFontInfo = XLoadQueryFont(dpy, DEFAULT_FONT); if ((IconFontInfo = XLoadQueryFont(dpy, IconFontName))==NULL) ! IconFontInfo = XLoadQueryFont(dpy, DEFAULT_FONT); if ((MenuTitleFontInfo = XLoadQueryFont(dpy, MenuTitleFontName))==NULL) ! MenuTitleFontInfo = XLoadQueryFont(dpy, DEFAULT_FONT); if ((MenuButtonFontInfo = XLoadQueryFont(dpy,MenuButtonFontName))==NULL) ! MenuButtonFontInfo = XLoadQueryFont(dpy, DEFAULT_FONT); /* Create a GC for drawing in the root window. */ diff -cN [.olwm-orig]makefile.vms [.olwm]makefile.vms *** [.olwm-orig]makefile.vms Thu Jan 1 00:00:00 1970 --- [.olwm]makefile.vms Sat Sep 9 16:10:41 1989 *************** *** 0 **** --- 1,73 ---- + # + # (c) Copyright 1989 Sun Microsystems, Inc. Sun design patents + # pending in the U.S. and foreign countries. See LEGAL_NOTICE + # file for terms of the license. + # + # Written for Sun Microsystems by Crucible, Santa Cruz, CA. + # + # @(#)Makefile 2.1 89/08/31 + # + + CFLAGS = /DEBUG $(CPPFLAGS) + + .c.obj: + def/user x11 decw$$include:;\ + def/user sys sys$$library:;\ + def/user c$$include sys$$library:;\ + $(CC) $(CFLAGS) $*.c + + SRC = olwm.c AdFrame.c defaults.c CheckMap.c \ + RubberWin.c InitGraphics.c WinInfo.c st.c \ + AdPushPin.c AdResize.c AdShineMark.c AdTitleBar.c \ + RootWin.c Icon.c Debug.c menu.c \ + AdFooter.c Select.c MenuWin.c Error.c usleep.c + + OBJ = olwm.obj, AdFrame.obj, defaults.obj, CheckMap.obj, \ + RubberWin.obj, InitGraphics.obj, WinInfo.obj, st.obj, \ + AdPushPin.obj, AdResize.obj, AdShineMark.obj, AdTitleBar.obj, \ + RootWin.obj, Icon.obj, Debug.obj, menu.obj, \ + AdFooter.obj, Select.obj, MenuWin.obj, Error.obj, usleep.obj + + HEADERS = menu.h olwm.h st.h + + BITMAPS = bitmaps/icon.h bitmaps/llresize.h bitmaps/lrresize.h bitmaps/ok.h \ + bitmaps/pushpin.h bitmaps/pushpinin.h bitmaps/shinemark.h \ + bitmaps/ulresize.h bitmaps/urresize.h bitmaps/windowmark.h + + MISC = .olwmmenu Readme Makefile + + # To disable menu shadows (for servers that do not support SaveUnder) + # remove the -DSHADOW option from CPPFLAGS + OPT = -O + CPPFLAGS = /def=("OL101088", "SHADOW") + LDFLAGS = $(OPT) -L${XNEWSHOME}/lib + + # this is pretty much every lint flag possible + LINTFLAGS = -abchx $(CPPFLAGS) + + PROGRAM = olwm.exe + LIBS = -lX11 + DISTDIR = /home/dist/olwm + + # .c.l: + # lint $(LINTFLAGS) $*.c > $*.l + + all: $(PROGRAM) + + dist: all + cp $(SRC) $(DISTDIR) + cp $(HEADERS) $(DISTDIR) + cp $(BITMAPS) $(DISTDIR)/bitmaps + cp $(PROGRAM) $(DISTDIR) + cp $(MISC) $(DISTDIR) + + clean: + rm -f $(OBJ) *.l + + $(PROGRAM): $(OBJ) + link/exe=$@ $(OBJ), gnu_cc:[000000]xt/opt, sys$$share:vaxcrtl/opt + + $(OBJ): olwm.h menu.h + + lint: $(OBJ) + lint $(LINTFLAGS) $(SRC) diff -cN [.olwm-orig]olwm.c [.olwm]olwm.c *** [.olwm-orig]olwm.c Sat Sep 9 16:08:53 1989 --- [.olwm]olwm.c Fri Sep 8 22:51:10 1989 *************** *** 17,22 **** --- 17,26 ---- #include "menu.h" #include "olwm.h" + #ifdef VMS + #define Exit olwmExit + #endif + /* * Externals */ *************** *** 335,340 **** --- 339,345 ---- /* Initialize the database. */ WIInit( DefDpy ); + #ifndef VMS /* * Force child processes to disinherit the TCP file descriptor. * This helps shell commands forked and exec'ed from menus *************** *** 345,350 **** --- 350,356 ---- perror( "uwm: child cannot disinherit TCP fd" ); exit( -1 ); } + #endif /* Set up the error handling function. */ XSetErrorHandler(ErrorHandler); *************** *** 580,585 **** --- 586,608 ---- Menu *menu; int index; { + #ifdef VMS + typedef struct { + int l; + char *a; + } DESC; + + int flag; + int status; + DESC cmd, input, output; + + cmd.l = strlen(AppMenuStrs[index].execString); + cmd.a = AppMenuStrs[index].execString; + input.l = strlen("NL:"); + input.a = "NL:"; + flag = 1; /* No wait */ + status = lib$spawn(&cmd, &input, 0, &flag); + #else char *commArgv[4]; commArgv[0] = "/bin/sh"; *************** *** 602,607 **** --- 625,631 ---- _exit(1); } } + #endif } /* diff -cN [.olwm-orig]usleep.c [.olwm]usleep.c *** [.olwm-orig]usleep.c Sat Sep 9 16:08:56 1989 --- [.olwm]usleep.c Sat Sep 9 15:59:28 1989 *************** *** 15,23 **** --- 15,25 ---- * needs. */ + #ifndef VMS #include <sys/types.h> #include <signal.h> #include <sys/time.h> + #endif #ifdef sun void olwm_do_nothing(); *************** *** 29,34 **** --- 31,71 ---- olwm_usleep(usec) unsigned usec; { + #ifdef VMS + static int eventFlag = -1; + char systim[80]; + char dot = '.'; + int quadTime[2]; + int day, hour, minute; + float second = 0.0; + double t; + struct { + int l; + char *a; + } d; + + + /* + Convert milliseconds to hours:minutes:seconds.fracSeconds + */ + t = usec * .001; /* convert to seconds */ + if (!t) + t = 1.; + day = t/(60*60*24); + t -= day*(60*60*24); + hour = t/(60*60); + t -= hour*60*60; + minute = t/(60); + second = t-minute*60*60; + sprintf(systim, "%d %d:%d:%f", day, hour, minute, second); + d.l = strlen(systim); + d.a = systim; + sys$bintim(&d, quadTime); + if (eventFlag == -1) + lib$get_ef(&eventFlag); + sys$setimr(eventFlag, quadTime, 0, 0); + sys$waitfr(eventFlag); + #else struct itimerval new, old; struct sigvec new_vec, old_vec; *************** *** 49,54 **** --- 86,92 ---- /* restore previous values for SIGALRM handler and the real itimer */ sigvec(SIGALRM, &old_vec, 0); setitimer(ITIMER_REAL, &old, 0); + #endif return(0); } -- Angel Li University of Miami/RSMAS Internet: angel@flipper.miami.edu UUCP: ncar!umigw!angel