[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference bulova::decw_jan-89_to_nov-90

Title:DECWINDOWS 26-JAN-89 to 29-NOV-90
Notice:See 1639.0 for VMS V5.3 kit; 2043.0 for 5.4 IFT kit
Moderator:STAR::VATNE
Created:Mon Oct 30 1989
Last Modified:Mon Dec 31 1990
Last Successful Update:Fri Jun 06 1997
Number of topics:3726
Total number of notes:19516

2734.0. "any good way to find out where a window REALLY is ?" by HANNAH::OSMAN (see HANNAH::IGLOO$:[OSMAN]ERIC.VT240) Wed May 09 1990 09:53

I have need to know where my window is on the screen.

The window in question is *not* made with UIL, although it does have standard
window manager trimmings.

The problem I'm having is that when I do XGetWindowAttributes, and look at
the x and y members, they are garbage numbers, in particular they're real
small.

I assume this is because my window is actually a child of a window manager
background window, so the small x and y merely show where my window is
pasted on the background window.

So... it looks like what I really want to know is where that window manager's
background window is located.

I can think of the following solutions, although they seem bulky, and I
wholeheartedly invite simpler ideas:

o	I could ASSUME that the parent of my window is the background window,
	and use XQueryTree to figure out my parent, then do XGetWindowAtts
	on the parent.

o	I could avoid the assumption by doing a loop that keeps XQuerying
	parents of parents until I find the "RootWindowOfScreen" and assume
	the child of that is the one to do XGetWindowAttributes on.

I'm still a bit timid of XQueryTree as it seems like you have to free all
sorts of stuff, even though all I really want to know is who is the parent.

Any easy way out of this mess ?

Thanks.

/Eric
T.RTitleUserPersonal
Name
DateLines
2734.1XTranslateCoordinatesDECWIN::KLEINWed May 09 1990 10:5221
This was just discussed yesterday in one of the notes files, but I don't
remember which one.

Use XTranslateCoordinates, something like:



static void WhereAreWe(w, xP, yP)
    Widget w;
    int *xP, *yP;
{
    Window tmpchild;

    XTranslateCoordinates (XtDisplay (w), XtWindow (w),
	RootWindowOfScreen (XtScreen (w)),
	-w->core.border_width, -w->core.border_width, xP, yP, &tmpchild);
}



-steve-
2734.2how do I know how high window manager decorations are though ?HANNAH::OSMANsee HANNAH::IGLOO$:[OSMAN]ERIC.VT240Wed May 09 1990 14:3423
    
    First of all XTRanslateCoordinates seems not to be in the index of
    the purple book
    
    	XWINDOW SYSTEM
    
    by Robert Scheifler and James Gettys.
    
    Is it in the book somewhere and just not indexed ?
    
    However, I have now used XTranslateCoordinates, but for now I have an
    assumption that the window manager decoration at the top is 20 pixels
    high.
    
    How can I avoid making that assumption ?
    
    The only thing I could think of was to temporarily put my window at
    (0,0), do the XTranslateCoordinates, and use the resultant y value as
    the height of the window manager decoration !
    
    Is this a good way to do it ?
    
    /Eric
2734.3its in there !GSRC::WESTHelp stamp out and abolish redundancy !Wed May 09 1990 16:2428
RE:   <<< Note 2734.2 by HANNAH::OSMAN "see HANNAH::IGLOO$:[OSMAN]ERIC.VT240" >>>
         -< how do I know how high window manager decorations are though ? >-

    
>>    Is it in the book somewhere and just not indexed ?

  Yes, me thinks its a boo boo.  Section 3.10 Page 60.  It _is_ indexed under
TranslateCoordinates (page 683)...good misdirection.
    
>>    However, I have now used XTranslateCoordinates, but for now I have an
>>    assumption that the window manager decoration at the top is 20 pixels
>>    high.

  Good assumption...I think that's the correct value.
    
>>    How can I avoid making that assumption ?

  By having the group/person who wrote the code for the frame window tell
you exactly what dimensions they used. :^)
    
>>    The only thing I could think of was to temporarily put my window at
>>    (0,0), do the XTranslateCoordinates, and use the resultant y value as
>>    the height of the window manager decoration !

  plus one...right?
    
						-=> Jim <=-

2734.4KONING::KONINGNI1D @FN42eqWed May 16 1990 14:526
Assuming any particular decoration size sounds like a BAD idea, since you
can't know which window manager is being used -- and, therefore, what size
decoration.  Just because some of them use 20 pixels of stuff doesn't mean
others will do the same.

	paul
2734.5TLE::ROUTLEYKevin Routley - VAX/VMS &amp; XD DEBUGThu May 17 1990 13:425
re .4:
Absolutely.  So how does one go about finding the size of window decoration?
Our current assumption has been 25 ...  

Kevin
2734.6use the treeTOOLEY::B_WACKERThu May 17 1990 14:422
Using XQueryTree and friends you can find out everything.  I think 
there's an xtree example in dw_examples or programming.
2734.7Depends on the technology...FUEL::grahamThe revolution will be televisedSat May 19 1990 00:0811
RE .4

>Assuming any particular decoration size sounds like a BAD idea, since you
>can't know which window manager is being used -- and, therefore, what size
>decoration. 

Isn't this what the Motif convenience resource, XmisMotifMWMRunning
there for?

Kris..
2734.8CLTVAX::dickSchoeller - Failed XperimentMon May 21 1990 11:367
.7

Even if you know whether mwm is running, you don't know the exact size of the
frame.  This is because, the frame thickness is customizable.  You ought to
realize that Kris with the amount of hacking you do   8^{).

Dick
2734.9ok...and thanx for reminding me..butFUEL::grahamThe revolution will be televisedMon May 28 1990 21:508
re .8

Dick

there has to be a way to compute the frame size....just don't 
how myself :-)

Kris..