Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!sun-barr!decwrl!lll-winken!gauss.llnl.gov!casey From: casey@gauss.llnl.gov (Casey Leedom) Newsgroups: comp.windows.x Subject: Re: Does anyone have a fix for R4/PL1 XGetDefault? Message-ID: <49928@lll-winken.LLNL.GOV> Date: 24 Feb 90 23:52:00 GMT References: <49344@lll-winken.LLNL.GOV> <9002212102.AA00298@expire.lcs.mit.edu> Sender: usenet@lll-winken.LLNL.GOV Reply-To: casey@gauss.llnl.gov (Casey Leedom) Organization: Lawrence Livermore National Laboratory Lines: 132 [[Sorry for the late follow up on this. We've had some problems here that have kept me occupied the last few days.]] | From: rws@EXPO.LCS.MIT.EDU (Bob Scheifler) | | And in the end I will have done exactly that: simply rewritten | XGetDefault using a different set of routines. | | Perhaps not. And even if you did, you'd at least have had to answer at | least one basic question (what to do for class names), and in the process | hopefully understood why XGetDefault as it stands is a crock. As a lot of backwards compatible routines are unfortunately. But the simplifying assumptions that XGetDefault makes turn out to be generally useful in a lot of simple situations. The fact that XGetDefault uses the class "Program" for the first QUARK and "Name" for the remaining QUARKs works for these programs quite nicely. | Again, I don't understand the reluctance to keep something usefully | simple like XGetDefault around. | | It is around. It is simple. You're trying to make it more complicated, | by arguing that a former abuse of it should still work. :-) I'm not arguing that it should be more complicated. The fact that it doesn't behave as one would expect it to makes it more complicated. Remember, we're talking user programming models here, not the particular implementation of XGetDefault. And as for ``former abuse'', I've checked XGetDefault out in all the versions of X that I have access to: 10.4, 11.2, 11.3 and 11.4. We already know that XGetDefault worked for multi-level resources in 11.3 and doesn't in 11.4. It turns out XGetDefault works quite nicely for multi-level resources under both 10.4 and 11.2. As a compatibility routine its current behavior isn't. Additionally the 10.4 documentation, while never explicitly stating that XGetDefault handles multi-level resources, mentions several examples of multi-level resources (see X.1) with specific mention to XGetDefault. Casey P.S. Here is a small program to test XGetDeault. I'd appreciate hearing of results for any other versions of the X Window System. ----- #! /bin/sh # This is a shell archive, meaning: # 1. Remove everything above the #! /bin/sh line. # 2. Save the resulting text in a file. # 3. Execute the file with /bin/sh (not csh) to create: # XGD # This archive created: Sat Feb 24 15:55:38 1990 export PATH; PATH=/bin:/usr/bin:$PATH if test ! -d 'XGD' then mkdir 'XGD' fi cd 'XGD' if test -f 'Imakefile' then echo shar: "will not over-write existing file 'Imakefile'" else sed 's/^X//' << \SHAR_EOF > 'Imakefile' XLOCAL_LIBRARIES = $(XLIB) X DEPLIBS = $(DEPXLIB) X DEFINES = -DX11 X X SRCS = foo.c X OBJS = foo.o X XComplexProgramTarget(foo) SHAR_EOF fi if test -f 'foo.c' then echo shar: "will not over-write existing file 'foo.c'" else sed 's/^X//' << \SHAR_EOF > 'foo.c' X#include X#ifdef X11 X#include X#endif X X#ifndef X11 Xextern char *XGetDefault(); X#endif X Xmain(argc, argv) X int argc; X char *argv[]; X{ X char *myname; X char *program, *resource, *value; X#ifdef X11 X Display *dpy; X#endif X X myname = argv[0]; X if (argc != 3) { X fprintf(stderr, "usage: %s program resource\n", myname); X exit(1); X } X program = argv[1]; X resource = argv[2]; X X#ifdef X11 X dpy = XOpenDisplay(""); X if (dpy == NULL) { X fprintf(stderr, "%s: unable to open display\n", myname); X exit(1); X } X#endif X X#ifdef X11 X value = XGetDefault(dpy, program, resource); X#else X value = XGetDefault(program, resource); X#endif X if (value != NULL) X puts(value); X X#ifdef X11 X XCloseDisplay(dpy); X#endif X exit(0); X} SHAR_EOF fi cd .. exit 0 # End of shell archive