klg@dukeac.UUCP (Kim Greer) (09/01/89)
(This is for a friend who can't post to the net. Please reply to the net or e-mail to dave@orion.mc.duke.edu -klg) I have been using xgraph on a sun 3/60 under Sun OS (3.5). I have found that the graph window always shows up in unix:0.1, even if I explicitly state "-display unix:0.0". I looked back at the original archive, and found that this problem was noted by the moderator. Has anyone come up with a fix for this? I hate flipping back and forth between the two displays, and I would love to put unix:0.1 to rest. (Of course, I could do all of my work in unix:0.1 and ignore unix:0.0, but dammit, xgraph gives me an option for display, and I want it to work!) Thanks Dave dave@orion.mc.duke.edu
stolcke@icsi.Berkeley.EDU (Andreas Stolcke) (09/02/89)
> I have been using xgraph on a sun 3/60 under Sun OS (3.5). I > have found that the graph window always shows up in unix:0.1, > even if I explicitly state "-display unix:0.0". I looked > back at the original archive, and found that this problem was > noted by the moderator. > Looking into the code I found this somewhat counter-intuitive behavior to be a `feature'! xgraph goes off hunting for a color screen on the display it is running on even if given a bw screen in DISPLAY. A side effect of this seems to be that xgraph sets up a new colormap for the screen it uses. This turns out to be pretty ugly, compared with the default colormap. It's easy to get rid of all this, see patch below. I ran into two other problems: The default printer names compiled into the program are the right ones if you happen to work in Berkeley's CS Division, I made xgraph look for environment variables PLOTTER and PRINTER instead, following the convention used by other BSD programs. Finally, the font patterns used to obtain fonts from the server are very general. In particular, if you have xproof installed they will retrieve the wrong fonts and cause havoc in the dialog box. BTW, xgraph is otherwise a really neat piece of software so it's worth some hacking to get it running. ---- Andreas Stolcke International Computer Science Institute stolcke@icsi.Berkeley.EDU 1957 Center St., Suite 600, Berkeley, CA 94704 (415) 642-4274 ext. 126 ---- These are the patches to xgraph to get it running the way we wanted *** xgraph.c.dist Sun Apr 9 14:47:32 1989 --- xgraph.c Fri Sep 1 18:21:34 1989 *************** *** 737,743 **** --- 737,747 ---- /* Default color names */ static char *defColors[MAXATTR] = { "red", "SpringGreen", "blue", "yellow", + #ifdef BAD_COLORS "cyan", "plum", "orange", "coral" + #else + "cyan", "plum", "orange", "magenta" + #endif }; int InitSets() *************** *** 802,808 **** --- 806,816 ---- } } else { /* Its color */ + #ifdef BAD_COLORS bgPixel = GetColor("LightGray"); + #else + bgPixel = white_pixel; + #endif zeroPixel = white_pixel; zeroWidth = 1; normPixel = black_pixel; *************** *** 996,1002 **** --- 1004,1016 ---- { char newname[100]; int idx; + char *plotter, *getenv(); + /* check if environment tells us which plotter to use */ + plotter = getenv( "PLOTTER" ); + if ( plotter == NULL ) + plotter = getenv( "PRINTER" ); + if (rd_pix("Background")) { bgPixel = def_pixel; } *************** *** 1041,1046 **** --- 1055,1063 ---- /* Read device specific parameters */ for (idx = 0; idx < hard_count; idx++) { + if ( plotter != NULL ) + (void) strncpy( hard_devices[idx].dev_printer, plotter, MFNAME-1 ); + sprintf(newname, "%s.Dimension", hard_devices[idx].dev_name); if (rd_dbl(newname)) hard_devices[idx].dev_max_dim = def_dbl; sprintf(newname, "%s.OutputTitleFont", hard_devices[idx].dev_name); *** ux11/ux11n_font.c.dist Tue Feb 7 11:03:37 1989 --- ux11/ux11n_font.c Fri Sep 1 16:20:47 1989 *************** *** 115,120 **** data.micrometers = size; return ux11_find_font(disp, scrn_num, ! "*-medium-r-normal-*", ux11_size_eval, (VOID_P) &data, rtn_font, rtn_name); } --- 115,120 ---- data.micrometers = size; return ux11_find_font(disp, scrn_num, ! "*-medium-r-normal-*-iso8859-1", ux11_size_eval, (VOID_P) &data, rtn_font, rtn_name); } *** ux11/ux11s_vismap.c.dist Tue Feb 7 11:03:37 1989 --- ux11/ux11s_vismap.c Fri Sep 1 18:31:37 1989 *************** *** 30,41 **** --- 30,46 ---- * if the default is returned, and UX11_ALTERNATE if a non-defualt * visual/colormap is returned. */ + /* this behavior is counter-intuitive and we get rid of it! + A. Stolcke, 9/1/89 + */ { int def_depth; XVisualInfo info; + #ifdef LOOK_FOR_COLOR def_depth = DefaultDepth(disp, DefaultScreen(disp)); if (def_depth > UX11_MIN_DEPTH) { + #endif /* Plenty and sufficient default resources */ *rtn_vis = DefaultVisual(disp, DefaultScreen(disp)); *rtn_cmap = DefaultColormap(disp, DefaultScreen(disp)); *************** *** 42,47 **** --- 47,53 ---- *rtn_scrn = DefaultScreen(disp); *rtn_depth = DefaultDepth(disp, DefaultScreen(disp)); return UX11_DEFAULT; + #ifdef LOOK_FOR_COLOR } else { /* Try to find another suitable visual */ if (ux11_find_visual(disp, ux11_color_vis, &info)) { *************** *** 72,77 **** --- 78,84 ---- return 0; } } + #endif } *** Makefile.dist Sun Apr 9 13:51:44 1989 --- Makefile Fri Sep 1 18:35:17 1989 *************** *** 12,18 **** # line below. # ! CLEVEL = CFLAGS = $(CLEVEL) -Ixtb -Iux11 CC = cc --- 12,18 ---- # line below. # ! CLEVEL = -O CFLAGS = $(CLEVEL) -Ixtb -Iux11 CC = cc *************** *** 24,29 **** --- 24,31 ---- LIBS = xtb/$(XTB) ux11/$(UX11) -lX11 -lm TARGET = xgraph + XBIN = /usr/local/X11R3/bin + XMAN = /usr/local/X11R3/man #-------- *************** *** 46,48 **** --- 48,54 ---- rm -f $(OBJ) $(TARGET) xgtest.o xgtest #* *~ cd xtb; make clean cd ux11; make clean + + install: $(TARGET) + install -c $(TARGET) $(XBIN) + install -c $(TARGET).1 $(XMAN)/man1
davidh@dent.Berkeley.EDU (David S. Harrison) (09/03/89)
> I have been using xgraph on a sun 3/60 under Sun OS (3.5). I > have found that the graph window always shows up in unix:0.1, > even if I explicitly state "-display unix:0.0". I looked > back at the original archive, and found that this problem was > noted by the moderator. I think you have omitted an important piece of information. The visuals of your two screens must be different (i.e. one is color the other is monochrome). Xgraph tries to be intelligent about selecting an appropriate visual. Its algorithm favors color over black and white. Thus, I suspect unix:0.1 is your color screen. I don't have an easy solution to the problem. I am not sure, but I suspect I can't easily determine whether you have explicitly specified the screen in your display specification without explictly parsing the specification manually. Perhaps someone can suggest a strategy. In the interim, you can change the function ux11_std_vismap in ux11/ux11s_vismap.c to always use the default screen and visual by changing the value of UX11_MIN_DEPTH from four to zero. David Harrison UC Berkeley Electronics Research Lab (davidh@ic.Berkeley.EDU, ...!ucbvax!ucbcad!davidh)