google-code-export / pyglet

Automatically exported from code.google.com/p/pyglet
BSD 3-Clause "New" or "Revised" License
1 stars 1 forks source link

Buggy implementation of _user32.ClientToScreen(self._hwnd, byref(rect)) #559

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. simply call Win32Window.GetLocation
2.
3.

Paste in the traceback or error message:

    self.window.get_location()
  File "C:\Python27\lib\site-packages\pyglet\window\win32\__init__.py", line 321, in get_location
    _user32.ClientToScreen(self._hwnd, byref(rect))
ctypes.ArgumentError: argument 2: <type 'exceptions.TypeError'>: expected 
LP_POINT instance instead of pointer to RECT

Any additional info (platform/language/hardware) that may be relevant?
Here is the fix:
        rect = RECT()
        _user32.GetClientRect(self._hwnd, byref(rect))
        point = POINT()
        point.x = rect.left
        point.y = rect.top
        _user32.ClientToScreen(self._hwnd, byref(point))
        return point.x, point.y

Original issue reported on code.google.com by seelenre...@gmail.com on 16 Mar 2012 at 10:30

GoogleCodeExporter commented 9 years ago
This has been fixed together with issue 510 in rev. e46762382a3c

Original comment by andreas....@gmail.com on 10 Jun 2012 at 11:22