Window origin

I’m on linux, and I’m trying to get the window origin but I’m not getting anything but zeros.

Here’s what I’m doing:

 wp = WindowProperties(base.win.getProperties())
        
        
        if wp.hasOrigin():
            winX = wp.getXOrigin()
            winY = wp.getYOrigin()
        else:
            print 'no origin'
            return task.again

I found this ([url][solved] Window origin]) in the forums, but I’m unclear as to if this was actually fixed or not.

Hmm, are you waiting until the window is full realized? Try calling base.graphicsEngine.openWindows() before querying the window properties.

David

That didn’t seem to make a difference.

I haven’t tried it on windows yet, so it may work there.

Maybe I’m approaching my problem wrong. I have a panda window embedded in a wx frame (thanks to several great examples from the forums), and I’m having trouble managing the focus between the wx frame and the panda window. If the user alt-tabs, or opens up a dialog all of the keyboard events stop working until I set the the panda window to the foreground again.

My solution (and there may be other better solutions) is to track where the cursor is and set the panda window to the foreground if the cursor is within the bounds of the panda window.

So I plan on using the origin and the window size to figure that out.

The whole code is here (http://code.google.com/p/excavation/source/browse/src/tools/collide.py#307).

Yeah, never mind that’s a pretty stupid way to handle focus.

It’s much cleaner and simpler to just reset to foreground on mouse1 click, and it looks like panda isn’t capturing the mouse1 click when it’s in the wx controls, so it works out perfect.

        self.accept('mouse1', self.click)
    def click(self):
        '''mouse 1 click'''
        wp = WindowProperties(base.win.getProperties())
        if not wp.getForeground():
            wp.setForeground(True) 
            base.win.requestProperties(wp)

I’m still not able to grab the origin of the window though, but it’s no longer my biggest concern.