Skip to content

Commit 7623bd5

Browse files
committed
Add SDL_GetWindowWMInfo in sdl2_sys
Because of the lack of untagged union support as of this commit's date, this is not implemented in sdl2 yet. Fixes #649
1 parent 0e2ac14 commit 7623bd5

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

sdl2-sys/src/video.rs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,32 @@ pub enum SDL_GLprofile {
142142
SDL_GL_CONTEXT_PROFILE_ES = 0x0004
143143
}
144144

145+
#[repr(u32)]
146+
pub enum SDL_SYSWM_TYPE {
147+
SDL_SYSWM_UNKNOWN,
148+
SDL_SYSWM_WINDOWS,
149+
SDL_SYSWM_X11,
150+
SDL_SYSWM_DIRECTFB,
151+
SDL_SYSWM_COCOA,
152+
SDL_SYSWM_UIKIT,
153+
SDL_SYSWM_WAYLAND,
154+
SDL_SYSWM_MIR,
155+
SDL_SYSWM_WINRT,
156+
SDL_SYSWM_ANDROID,
157+
SDL_SYSWM_VIVANTE
158+
}
159+
160+
#[repr(C)]
161+
pub struct SDL_SysWMinfo {
162+
pub version: ::version::SDL_version,
163+
pub subsystem: SDL_SYSWM_TYPE,
164+
// info should be an untagged union, but it has not it stable yet. Waiting for
165+
// https://github.com/rust-lang/rust/issues/32836 to be closed.
166+
//
167+
// According to http://hg.libsdl.org/SDL/rev/69452f9839d5, this can at most be 64bytes.
168+
pub info: [u8; 64],
169+
}
170+
145171
//SDL_video.h
146172
extern "C" {
147173
pub fn SDL_GetNumVideoDrivers() -> c_int;
@@ -195,6 +221,7 @@ extern "C" {
195221
pub fn SDL_GetWindowGrab(window: *mut SDL_Window) -> SDL_bool;
196222
pub fn SDL_SetWindowBrightness(window: *mut SDL_Window, brightness: c_float) -> c_int;
197223
pub fn SDL_GetWindowBrightness(window: *mut SDL_Window) -> c_float;
224+
pub fn SDL_GetWindowWMInfo(window: *mut SDL_Window, info: *mut SDL_SysWMinfo) -> SDL_bool;
198225
pub fn SDL_SetWindowGammaRamp(window: *mut SDL_Window, red: *const uint16_t, green: *const uint16_t, blue: *const uint16_t) -> c_int;
199226
pub fn SDL_GetWindowGammaRamp(window: *mut SDL_Window, red: *mut uint16_t, green: *mut uint16_t, blue: *mut uint16_t) -> c_int;
200227
pub fn SDL_DestroyWindow(window: *mut SDL_Window);

0 commit comments

Comments
 (0)