[comp.windows.x] Help wanted for window placement with Xt and Motif

markm@hcr.uucp (Mark Mendell) (05/24/90)

    I am working on an application that allows the user to save the current
locations and sizes of several windows, so that they can be restored to those
locations the next time the program is run, or reset to those locations during
the current execution.

    The program uses X11R3, Xt, and Motif. The problem occurs when running
under TWM.  When my application attempts to set the position of the widget
(using XtConfigureWidget or XtSetValues), TWM places the window at a different
position from where it is told.  In my case, it is 17 pixels to the left, and
21 pixels down.  I believe that this is about the size of the TWM header on
the window.

Here is the code I use to determine the absolute position on the root menu of
the start of the window.  

	XTranslateCoordinates(disp, window, rootWin, 0, 0, &x, &y, &dummy);

This seems to be off by the border width (2 pixels each right & down) from
where the window was asked to be placed when being created.  I assume that this
is caused by the TWM border.


To try to return the window to this location, I have tried:
	XtSetArg(al[ac], XtNx, x); ac++;
	XtSetArg(al[ac], XtNy, y); ac++;
	XtSetValues(widgetID, al, ac);

as well as:
	XtConfigureWidget(ww->widgetID, x, y, height, width, 0);

Both have the same behaviour under TWM.  Under MWM, this works fine.  There
seems to be a difference with the way reparenting is done under the two WMs.
I THINK that the numbers 17 and 21 come from the height of the window header
(19 pixels with a 6x13 font), and a border width of 2.  Initial placement of
windows is done correctly.


Is there any way to place windows where I want, under TWM?  If not, is there
any way to figure out the offsets, and move the window?  I suppose that I could
check out where the window ended up, and then move it from there, but that
seems pretty tacky.
-- 
Mark Mendell, SCO Canada, Inc.	(Formerly HCR Corporation)
	    130 Bloor St. W., Suite 1001, Toronto
	    Phone: (416)-922-1937, Fax:	(416)-922-8397
	    Usenet:	...!hcr!markm