First, thank you for the advice on how to get back into Gnome.  I now once again have gnomes running around on my desktop <grin>.  If anybody tells me that Linux is easier to use than Windows, I will ... well, I guess I will politely disagree unless he can give me counterexamples.

I went to the code in "freeglut" that creates the window ("freeglut_window.c", line 425 or so) and that calculates the window position in "glutGet" ("freeglut_state.c", line 240 or so).  After a couple of consultations from the "man" pages, I have the following.

(1) Creating the window calls "XCreateWindow" and passes it arguments "x" and "y", which according to the man pages are the coordinates of the outside of the window.  It also passes it "w" and "h", which are the width and height of the inside (drawable) part of the window, and an argument of zero for "border_width".  The "border_width" is supposed to be the width of the window's border in pixels, but this seems not to be the case.

(2) In "glutGet", there is first of all a call to "XGetWindowAttributes", which returns a structure.  The first two elements in the structure are "x" and "y", which are the coordinates of the upper left hand corner of the drawable area relative to the corner of the outside of the window.  The second two elements are "width" and "height", which are the size of the drawable area; there are no surprises there.  The third element is the "border_width" which was set to zero when the window was created.

The function then calls "XTranslateCoordinates", passing it the "border_width" attribute twice as the input x- and y-coordinates, and receiving as output those coordinates relative to the upper left-hand corner of the screen.  These are the values that it returns to the calling application as the window x- and y-coordinates.


I would like to do one of two things, and I submit them to the group for a choice.  In the present situation, one convention (the outside of the window) is used to create the window and another convention (the drawable area) is used when getting the window position.  I consider this intolerable even though GLUT does it this way.  Here are the ways we can fix it:

(a) When creating the window, we can call "XGetWindowAttributes" to get the x- and y-coordinates of the drawable area relative to the corner of the window.  We can then call "XMoveWindow" to move the window so that the drawable area is at the position specified by the application.  This is how Windows does it and is my preferred solution.

(b) When getting the position of the window, we can subtract off the x- and y-coordinates of the drawable area from what is presently calculated and return to the application the position of the outside of the window.  This is not my preferred solution.

Do people have a preference of one over the other?

John F. Fay
john.fay@eglin.af.mil

"It is a poverty to decide that an unborn child must die in order that you may live as you like."  - Mother Teresa