Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uunet!cs.utexas.edu!usc!elroy.jpl.nasa.gov!decwrl!asente From: asente@decwrl.dec.com (Paul Asente) Newsgroups: comp.windows.x Subject: Re: Geometry, resources, etc. Keywords: X11R4, twm, Xaw (R3) Message-ID: <3051@bacchus.dec.com> Date: 18 Mar 90 07:56:23 GMT References: <2253@husc6.harvard.edu> Distribution: usa Organization: DEC Western Software Lab Lines: 46 In article <2253@husc6.harvard.edu> kochhar@endor.harvard.edu (Sandeep Kochhar) writes: >I have a client that creates two toplevel windows using the following >sequence: > > toplevel = XtInitialize("main", "Demo", NULL, ZERO, &argc, argv); > ... > Atoplevel = XtCreateApplicationShell("atop", topLevelShellWidgetClass, ...); > ... > Btoplevel = XtCreateApplicationShell("atop", topLevelShellWidgetClass, ...); >Here are my two questions: > >1. I am having trouble specifying resources for the Atop and Btop widgets > separately. e.g. -xrm '*font: courb12' makes all the fonts in Atop's > subwindows and Btop's subwindows courb12. However, if I want, say > courb12 in A and 9x15 in B, I tried > -xrm '*atop*font:courb12' -xrm '*btop*font:9x15' > but nothing happened. What's the way to include atop and btop > in the resource hierarchy? Unless you are doing something like writing a window manager, shells created through XtAppCreateShell (the newer version of XtCreateApplicationshell) should be application shells. What you probably should be doing is using XtCreatePopupShell and make the shells children of your initial shell (from XtInitialize). XtAppCreateShell creates an entirely new widget hierarchy, and only application shells work really well as the root of a widget hierarchy. >2. In the topLevelShellWidgetClass widget (e.g. Atoplevel above), if > I set the XtNgeometry resource to "+100+100", the windows show up > at (100,100) as I expected. However, I couldn't get the windows > to show up at (100,100) using XtNx and XtNy alone. Here's my > question: why does XtNgeometry work, but XtNx and XtNy don't? Probably it's your window manager. If you specify a geometry with XtNgeometry, the toolkit sets the USize and/or UPosition flags, indicating that the user specified the geometry. If you use XtNx, XtNy, XtNwidth, and/or XtNheight, the toolkit sets the PSize and/or PPosition flags, indicating that the program specified the geometry. Window managers often threat these two cases differently, respecting user-set geometries but asking the user for the geometry or putting the window in some default place if the program specified the geometry. In general the right thing to do is for programs to use XtNx and XtNy, and to leave XtNgeometry for the user's command line or .Xdefaults file. -paul asente asente@decwrl.dec.com decwrl!asente