Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!lll-winken!gauss.llnl.gov!casey From: casey@gauss.llnl.gov (Casey Leedom) Newsgroups: comp.windows.x Subject: Re: I can't get XGetDefault to work Message-ID: <69064@lll-winken.LLNL.GOV> Date: 2 Oct 90 06:49:13 GMT References: <829@redford.UUCP> Sender: usenet@lll-winken.LLNL.GOV Organization: Lawrence Livermore National Laboratory Lines: 78 [[I tried replying to Bill directly but neither his path nor reply-to address worked.]] I was one of the people who flamed and still have yet to receive a rational answer why we can't back support the old XGetDefault behavior. We now have a backward compatibility routine which isn't backwards compatible. Oh well. Here's a patch to XGetDefault that will make it work the way it used to. Note, as Bob points out, you should change your code to use the Xrm stuff directly for compatibility reasons. Casey P.S. The following patch is relative to MIT patch level 14. ----- %%% mit/lib/X/XGetDflt.c: %%% %%% Fix XGetDefault so that XGetDefault(dpy, program, name) works when name %%% containing a compound string (``foo.bar'', etc.) *** mit/lib/X/XGetDflt.c-dist Tue Jan 30 18:35:20 1990 --- mit/lib/X/XGetDflt.c Sun Feb 11 22:32:00 1990 *************** *** 124,134 **** register char *name; /* name of option program wants */ #endif { /* to get, for example, "font" */ ! XrmName names[3]; ! XrmClass classes[3]; XrmRepresentation fromType; XrmValue result; char *progname; /* * strip path off of program name (XXX - this is OS specific) --- 124,136 ---- register char *name; /* name of option program wants */ #endif { /* to get, for example, "font" */ ! XrmName names[100]; /* 100: YECH -- and XrmStringToNameList */ ! XrmClass classes[100]; /* does not even let us pass in this limit */ XrmRepresentation fromType; XrmValue result; char *progname; + register XrmClass classp; + register int i; /* * strip path off of program name (XXX - this is OS specific) *************** *** 150,160 **** UnlockDisplay(dpy); names[0] = XrmStringToName(progname); - names[1] = XrmStringToName(name); - names[2] = NULLQUARK; classes[0] = XrmStringToClass("Program"); ! classes[1] = XrmStringToClass("Name"); ! classes[2] = NULLQUARK; (void)XrmQGetResource(dpy->db, names, classes, &fromType, &result); return (result.addr); } --- 152,163 ---- UnlockDisplay(dpy); names[0] = XrmStringToName(progname); classes[0] = XrmStringToClass("Program"); ! XrmStringToNameList(name, &names[1]); ! classp = XrmStringToClass("Name"); ! for (i = 1; names[i] != NULLQUARK; i++) ! classes[i] = classp; ! classes[i] = NULLQUARK; (void)XrmQGetResource(dpy->db, names, classes, &fromType, &result); return (result.addr); }