Commits

Marcus von Appen committed de2b992

- 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

  • Participants
  • Parent commits 786452b

Comments (0)

Files changed (6)

 __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
 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)
+
            "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"
            ]
 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
 
 __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
 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+
     _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),
                 ("dfb", _dfbinfo),
                 ("cocoa", _cocoainfo),
                 ("uikit", _uikitinfo),
+                ("wl", _wl),
+                ("mir", _mir),
                 ("dummy", c_int)
                 ]
 

sdl2/test/cpuinfo_test.py

         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())

sdl2/test/video_test.py

         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())
            "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):
 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")