[comp.windows.x] OlInitialize causes resource problem

paul@tredysvr.Tredydev.Unisys.COM (Paul Siu) (10/26/90)

I am encountering a problem between Open Look's initialization routine
OlInitialize().  When I use OlInitialize(), the resource database does not work
correctly.  The following program puts up a shell on the screen.  This is
just about the smallest Widget program one can make.

---------------------- A simple program to put up a window --------------------

#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
#include <X11/Xatom.h>
#include <X11/Shell.h>
#include <Xol/OpenLook.h>

void main(int argc, char *argv[])
   {
   Widget toplevel;	/* Top level Shell */

   /* Initialize the toolkit, and establish display connection */
   toplevel = OlInitialize(argv[0], "Shell", NULL, 0, &argc, argv);

   /* Display and manage the toplevel widget */
   XtRealizeWidget(toplevel);

   /* Enter event loop */
   XtMainLoop();
   }	

--------------------------------------------------------------------------------

I then set up a resource file with the pathname: /lib/X11/app-defaults/Shell

Shell.height: 200
Shell.Weight: 300

When I compile and run the program, the program would return an error telling
me that I did not specify the window height and width.  If I replace the
OlInitialize() with XtInitialize(), it works fine (but then you can't use the
rest of the Open Look toolkit).  It will also work if one change the "Shell" in
the resource file to "shell" with a lowercase letter.  Why does Open Look
refuse to recognize a class resource pattern?  Why is there a difference
OlInitialize() and XtInitialize().  Could anyone who have worked with Open
Look please help shred some light into this strange matter.

Paul Siu
paul@tredysvr.Tredydev.Unisys.COM

grp@Unify.com (Greg Pasquariello) (10/26/90)

In article <994@tredysvr.Tredydev.Unisys.COM>,
paul@tredysvr.Tredydev.Unisys.COM (Paul Siu) writes:

> I am encountering a problem between Open Look's initialization
routine
> OlInitialize().  When I use OlInitialize(), the resource database does
not work
> correctly.  The following program puts up a shell on the screen.  This
is
> just about the smallest Widget program one can make.
> 
> I then set up a resource file with the pathname:
/lib/X11/app-defaults/Shell
> 
> Shell.height: 200
> Shell.Weight: 300
> 
> When I compile and run the program, the program would return an error
telling
> me that I did not specify the window height and width.  If I replace
the
> OlInitialize() with XtInitialize(), it works fine (but then you can't
use the
> rest of the Open Look toolkit).  It will also work if one change the
"Shell" in
> the resource file to "shell" with a lowercase letter.  Why does Open
Look
> refuse to recognize a class resource pattern?  Why is there a
difference
> OlInitialize() and XtInitialize().  Could anyone who have worked with
Open
> Look please help shred some light into this strange matter.
> 

Open Look opens the file specified by the Class name ("Shell"), and
matches
class resources from that point on.  It doesn't expect the class name to
be
further specified in the resource description.  So if you put

*height:	200
*width:		300

in your class resource file, it will work as well.  This indeed seems
like a
bug, and it works differently for instance name resources.  They work
as you would expect.  I say that this "seems" like a bug, because I
cannot
find anyplace that says exactly how it should work!  

> Paul Siu
> paul@tredysvr.Tredydev.Unisys.COM

--

-Greg Pasquariello	grp@unify.com