[solved] Window origin

base.win.getProperties().getXOrigin()

This seems to always return the original, default value (i.e. 50), instead of the actual value. How can I get the actual x origin? (The same applies for the Y origin.)

import direct.directbase.DirectStart
from direct.showbase.DirectObject import DirectObject

def move(* args):

    print base.win.getProperties().getXOrigin(), base.win.getProperties().getYOrigin()

x = DirectObject()
x.accept('window-event', move)

run()

This example prints out ‘50, 50’ every time I move the window.

I’m using Panda3D SVN on Gentoo linux.

Hmm, looks like we don’t have a pathway to get this data back from the OS. :frowning: I’ll add something to automatically update the WindowProperties when the window is moved by the user.

David

I’ve just added the relevant code to cvs, but now I find that it is inconsistent with the precise meaning of the origin: when I ask to create a window at origin (100, 100), it creates a window whose decoration (I guess this is what Xlib calls the “outer border”) is at (100, 100), but the actual renderable part of the window is a little bit below and right of that.

But when the ConfigureNotify event comes in, the x, y position reported of the window is (104, 124), the “inner window”. I’m surprised by the inconsistency here; the Xlib manual seems to say that ConfigureNotify is supposed to report the “outer border” position. Do other Linux users see this same inconsistency?

In any case, the general Panda convention is supposed to be for the win-origin position to represent the corner of the actual renderable window, not the window decoration–the “inner window”. The design is based on the assumption that you may need to place the renderable part of the window in a very specific part of the screen due to some obscure hardware requirements (like a screen grabber or something). So it looks like we’ve been doing it wrong in the X11 version all this time.

David

Thanks a lot, drwr!

I’ve found a workaround for the difference between the two origins, by measuring it just after the window has been set to a known position.