Mercurial > py-sdl2
changeset 150:de2b9920d092
- Added new sdl2.cpuinfo.SDL_HasAVX() function from SDL2 HG
- Added new sdl2.video.SDL_GL_ResetAttributes() function from SDL2 HG
- Added new sdl2.hints.SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT hint from SDL2 HG
- Added missing wayland and new mir window manager information to sdl2.syswm
module from SDL2 HG
| author | Marcus von Appen <marcus@sysfault.org> |
|---|---|
| date | Fri, 07 Feb 2014 07:44:06 +0100 |
| parents | 786452bd8a62 |
| children | 971c36e3dbd7 |
| files | sdl2/cpuinfo.py sdl2/hints.py sdl2/syswm.py sdl2/test/cpuinfo_test.py sdl2/test/video_test.py sdl2/video.py |
| diffstat | 6 files changed, 34 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/sdl2/cpuinfo.py Fri Jan 24 18:15:48 2014 +0100 +++ b/sdl2/cpuinfo.py Fri Feb 07 07:44:06 2014 +0100 @@ -5,7 +5,7 @@ __all__ = ["SDL_CACHELINE_SIZE", "SDL_GetCPUCount", "SDL_GetCPUCacheLineSize", "SDL_HasRDTSC", "SDL_HasAltiVec", "SDL_HasMMX", "SDL_Has3DNow", "SDL_HasSSE", "SDL_HasSSE2", "SDL_HasSSE3", "SDL_HasSSE41", - "SDL_HasSSE42", "SDL_GetSystemRAM" + "SDL_HasSSE42", "SDL_GetSystemRAM", "SDL_HasAVX" ] SDL_CACHELINE_SIZE = 128 @@ -21,3 +21,5 @@ SDL_HasSSE41 = _bind("SDL_HasSSE41", None, SDL_bool) SDL_HasSSE42 = _bind("SDL_HasSSE42", None, SDL_bool) SDL_GetSystemRAM = _bind("SDL_GetSystemRAM", None, c_int, nullfunc) +SDL_HasAVX = _bind("SDL_HasAVX", None, SDL_bool) +
--- a/sdl2/hints.py Fri Jan 24 18:15:48 2014 +0100 +++ b/sdl2/hints.py Fri Feb 07 07:44:06 2014 +0100 @@ -16,6 +16,7 @@ "SDL_HINT_RENDER_DIRECT3D_THREADSAFE", "SDL_HINT_VIDEO_FULLSCREEN_SPACES", "SDL_HINT_MOUSE_RELATIVE_MODE_WARP", + "SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT", "SDL_HintPriority", "SDL_SetHintWithPriority", "SDL_SetHint", "SDL_GetHint", "SDL_ClearHints" ] @@ -43,6 +44,7 @@ SDL_HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK = b"SDL_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK" SDL_HINT_RENDER_DIRECT3D_THREADSAFE = b"SDL_RENDER_DIRECT3D_THREADSAFE" SDL_HINT_MOUSE_RELATIVE_MODE_WARP = b"SDL_MOUSE_RELATIVE_MODE_WARP" +SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT = b"SDL_VIDEO_WINDOW_SHARE_PIXEL_FORMAT" SDL_HINT_DEFAULT = 0 SDL_HINT_NORMAL = 1
--- a/sdl2/syswm.py Fri Jan 24 18:15:48 2014 +0100 +++ b/sdl2/syswm.py Fri Feb 07 07:44:06 2014 +0100 @@ -7,8 +7,8 @@ __all__ = ["SDL_SYSWM_TYPE", "SDL_SYSWM_UNKNOWN", "SDL_SYSWM_WINDOWS", "SDL_SYSWM_X11", "SDL_SYSWM_DIRECTFB", "SDL_SYSWM_COCOA", - "SDL_SYSWM_UIKIT", "SDL_SysWMmsg", "SDL_SysWMinfo", - "SDL_GetWindowWMInfo" + "SDL_SYSWM_UIKIT", "SDL_SYSWM_WAYLAND", "SDL_SYSWM_MIR", + "SDL_SysWMmsg", "SDL_SysWMinfo", "SDL_GetWindowWMInfo" ] SDL_SYSWM_TYPE = c_int @@ -18,6 +18,8 @@ SDL_SYSWM_DIRECTFB = 3 SDL_SYSWM_COCOA = 4 SDL_SYSWM_UIKIT = 5 +SDL_SYSWM_WAYLAND = 6 +SDL_SYSWM_MIR = 7 # FIXME: Hack around the ctypes "_type_ 'v' not supported" bug - remove # once this has been fixed properly in Python 2.7+ @@ -99,6 +101,19 @@ _fields_ = [("window", c_void_p)] +class _wl(Structure): + """Window information for Wayland.""" + _fields_ = [("display", c_void_p), + ("surface", c_void_p), + ("shell_surface", c_void_p)] + + +class _mir(Structure): + """Window information for Mir.""" + _fields_ = [("connection", c_void_p), + ("surface", c_void_p)] + + class _info(Union): """The platform-specific information of a window.""" _fields_ = [("win", _wininfo), @@ -106,6 +121,8 @@ ("dfb", _dfbinfo), ("cocoa", _cocoainfo), ("uikit", _uikitinfo), + ("wl", _wl), + ("mir", _mir), ("dummy", c_int) ]
--- a/sdl2/test/cpuinfo_test.py Fri Jan 24 18:15:48 2014 +0100 +++ b/sdl2/test/cpuinfo_test.py Fri Feb 07 07:44:06 2014 +0100 @@ -59,6 +59,10 @@ ret = cpuinfo.SDL_HasSSE42() self.assertIn(ret, (0, 1)) + def test_SDL_HasAVX(self): + ret = cpuinfo.SDL_HasAVX() + self.assertIn(ret, (0, 1)) + if __name__ == '__main__': sys.exit(unittest.main())
--- a/sdl2/test/video_test.py Fri Jan 24 18:15:48 2014 +0100 +++ b/sdl2/test/video_test.py Fri Feb 07 07:44:06 2014 +0100 @@ -807,6 +807,10 @@ video.SDL_DestroyWindow(window) video.SDL_GL_UnloadLibrary() + @unittest.skip("not implemented") + def test_SDL_GL_ResetAttributes(self): + pass + if __name__ == '__main__': sys.exit(unittest.main())
--- a/sdl2/video.py Fri Jan 24 18:15:48 2014 +0100 +++ b/sdl2/video.py Fri Feb 07 07:44:06 2014 +0100 @@ -68,7 +68,7 @@ "SDL_GL_ExtensionSupported", "SDL_GL_SetAttribute", "SDL_GL_GetAttribute", "SDL_GL_CreateContext", "SDL_GL_MakeCurrent", "SDL_GL_SetSwapInterval", "SDL_GL_GetSwapInterval", - "SDL_GL_SwapWindow", "SDL_GL_DeleteContext" + "SDL_GL_SwapWindow", "SDL_GL_DeleteContext", "SDL_GL_ResetAttributes" ] class SDL_DisplayMode(Structure): @@ -253,4 +253,5 @@ SDL_GL_SwapWindow = _bind("SDL_GL_SwapWindow", [POINTER(SDL_Window)]) SDL_GL_DeleteContext = _bind("SDL_GL_DeleteContext", [SDL_GLContext]) SDL_GL_GetDrawableSize = _bind("SDL_GL_GetDrawableSize", [POINTER(SDL_Window), POINTER(c_int), POINTER(c_int)], optfunc=nullfunc) +SDL_GL_ResetAttributes = _bind("SDL_GL_ResetAttributes")
