Newsgroups: comp.windows.x Path: utzoo!utgpu!cunews!bcars8!bnrgate!bcars85!jsparkes From: jsparkes@bcars85.bnr.ca (Jeff Sparkes) Subject: access to Xt resources Message-ID: Sender: news@bnrgate.bnr.ca (USENET News Administration) Organization: Bell-Northern Research, Ltd. Ottawa Ontario CANADA Distribution: comp Date: 25 Jul 90 19:53:14 GMT Is there any way get at the compiled and merged set of resources that Xt uses for widgets? I use my own calls to the resource manager to grab some special resources, but I only know how to get the server string, not all the resource with options and app-defaults mixed in. The relevant bits of code follow. The reason I am doing this is to get different translation tables based on (mostly) arbitrary keyboard names. Xt seems to 1. only deal with resource names that are compiled in 2. not deal with requests with emedded dots ... if ((s = XResourceManagerString(display)) != NULL) { char buf[100]; rdb = XrmGetStringDatabase(s); sprintf(buf, "keymap.%s", appres.keymap); kbdtrans = get_resource(rdb, argv[0], buf); sprintf(buf, "keymap.%s.user", appres.keymap); usertrans = get_resource(rdb, argv[0], buf); } else { XtWarning("No server resource database"); } ... /* * A way to work around bugs with Xt resources. It seems to be impossible * to get arbitrarily named resources. Someday this should be hacked to * add classes too. */ char * get_resource(rdb, prog, name) XrmDatabase rdb; char *prog, *name; { XrmValue value; char *type[20]; char buf[20], str[1024]; char *s; if ((s = rindex(prog, '/')) != 0) prog = s+1; sprintf(str, "%s.%s", prog, name); if (XrmGetResource(rdb, str, 0, type, &value) == True) { return XtNewString(value.addr); } else { return 0; } } -- Jeff Sparkes jsparkes@bnr.ca Another feature is that the seats float, so that the airline can recover them if the plane crashes into the ocean. -- Dave Barry