Path: utzoo!news-server.csri.toronto.edu!rpi!usc!cs.utexas.edu!uunet!mcsun!unido!laura!tommy!klute From: klute@tommy.informatik.uni-dortmund.de (Rainer Klute) Newsgroups: comp.windows.x Subject: Design problem in XtVaGetApplicationResources Message-ID: <3108@laura.UUCP> Date: 18 Mar 91 16:45:46 GMT Sender: news@laura.UUCP Reply-To: klute@tommy.informatik.uni-dortmund.de (Rainer Klute) Organization: University of Dortmund, Germany Lines: 44 As every X toolkit programmer knows Xt offers a nice way to retrieve application resources: XtVaGetApplicationResources. The "normal" way to use this function is something like this: XtToolkitInitialize (); applicationContext = XtCreateApplicationContext (); display = XtOpenDisplay (applicationContext, (char *) 0, "name", "Class", options, XtNumber (options), &argc, argv); shellWidget = XtVaAppCreateShell ("name", "Class", applicationShellWidgetClass, display, NULL); XtVaGetApplicationResources (shellWidget, &applicationOptions, resources, XtNumber (resources), NULL); However, this stuff will only work if you already have a connection to an X server, because you have to pass a widget (hence a display connection) as parameter to XtVaGetApplicationResources. Now, what can I do if I don't have one? Before opening any display connection and creating any widgets my application *first* wants to read its resources - using XtVaGetApplicationResources - and only then open a display connection *upon the values of the retrieved resources*. Well, this can of course be done with the Xlib resource manager functions - but Xt really should be able to do it. I don't see any reason why XtVaGetApplicationResources would need the widget parameter except for retrieving the application's name and class which could also be given as Strings. So my conclusion is that this must be a design problem which should be fixed in a future Xt version, perhaps like this: XtToolkitInitialize (); applicationContext = XtCreateApplicationContext (); /* proposed new Xt function: */ XtVaInitApplicationResources (applicationContext, "name", "Class", options, XtNumber (options), &argc, argv, NULL); XtVaGetApplicationResources (applicationContext, &applicationOptions, resources, XtNumber (resources), NULL); Comments anyone? -- Dipl.-Inform. Rainer Klute klute@irb.informatik.uni-dortmund.de Univ. Dortmund, IRB klute@unido.uucp, klute@unido.bitnet Postfach 500500 |)|/ Tel.: +49 231 755-4663 D-4600 Dortmund 50 |\|\ Fax : +49 231 755-2386