Path: utzoo!attcan!uunet!snorkelwacker!bloom-beacon!itstd.sri.COM!davy From: davy@itstd.sri.COM Newsgroups: comp.windows.x Subject: how do you get correct window position? Message-ID: <9006131913.AA02147@intrepid.itstd.sri.com> Date: 13 Jun 90 19:13:14 GMT Sender: root@athena.mit.edu (Wizard A. Root) Organization: The Internet Lines: 42 Given the following code fragment: Widget w, toplevel; toplevel = ... w = XtCreatePopupShell(name, wmShellWidgetClass, toplevel, args, nargs); /* create widgets inside the shell widget */ How do I get the *correct* (x,y) position of the window belonging to the shell widget so I can create another one in exactly the same place? Currently, I am doing: WindowAttributes win_attributes; XGetWindowAttributes(display, XtWindow(w), &win_attributes); XTranslateCoordinates(display, XtWindow(w), root_window, win_attributes.x, win_attributes.y, &savex, &savey, &junk); and then using savex and savey. However, when I recreate the shell widget in the next invocation of the program, using savex and savey in the geometry argument, the window is a couple of pixels down and to the right. So every time I save the position and recreate, the window moves a little bit. Not good. As near as I can figure, since twm is putting a border on the window of the shell widget, I need to be taking that into account. But I've been running through the manuals for an hour and a half and can't find any routine which will tell me how big the border twm is sticking on there is! Can anyone suggest how to do this? (Note: I'm not particularly attached to using XGetWindowAttributes, so if there's a better function, please let me know.) Thanks, Dave Curry davy@itstd.sri.com