-
Notifications
You must be signed in to change notification settings - Fork 491
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SDL_GetWindowWMInfo is not exposed #649
Comments
Here is the native code that defines SDL_SysWMinfo: struct SDL_SysWMinfo
{
SDL_version version;
SDL_SYSWM_TYPE subsystem;
union
{
#if defined(SDL_VIDEO_DRIVER_WINDOWS)
struct
{
HWND window; /**< The window handle */
HDC hdc; /**< The window device context */
} win;
#endif
#if defined(SDL_VIDEO_DRIVER_WINRT)
struct
{
IInspectable * window; /**< The WinRT CoreWindow */
} winrt;
#endif
#if defined(SDL_VIDEO_DRIVER_X11)
struct
{
Display *display; /**< The X11 display */
Window window; /**< The X11 window */
} x11;
#endif
#if defined(SDL_VIDEO_DRIVER_DIRECTFB)
struct
{
IDirectFB *dfb; /**< The directfb main interface */
IDirectFBWindow *window; /**< The directfb window handle */
IDirectFBSurface *surface; /**< The directfb client surface */
} dfb;
#endif
#if defined(SDL_VIDEO_DRIVER_COCOA)
struct
{
#if defined(__OBJC__) && defined(__has_feature) && __has_feature(objc_arc)
NSWindow __unsafe_unretained *window; /* The Cocoa window */
#else
NSWindow *window; /* The Cocoa window */
#endif
} cocoa;
#endif
#if defined(SDL_VIDEO_DRIVER_UIKIT)
struct
{
#if defined(__OBJC__) && defined(__has_feature) && __has_feature(objc_arc)
UIWindow __unsafe_unretained *window; /* The UIKit window */
#else
UIWindow *window; /* The UIKit window */
#endif
GLuint framebuffer; /* The GL view's Framebuffer Object. It must be bound when rendering to the screen using GL. */
GLuint colorbuffer; /* The GL view's color Renderbuffer Object. It must be bound when SDL_GL_SwapWindow is called. */
GLuint resolveFramebuffer; /* The Framebuffer Object which holds the resolve color Renderbuffer, when MSAA is used. */
} uikit;
#endif
#if defined(SDL_VIDEO_DRIVER_WAYLAND)
struct
{
struct wl_display *display; /**< Wayland display */
struct wl_surface *surface; /**< Wayland surface */
struct wl_shell_surface *shell_surface; /**< Wayland shell_surface (window manager handle) */
} wl;
#endif
#if defined(SDL_VIDEO_DRIVER_MIR)
struct
{
struct MirConnection *connection; /**< Mir display server connection */
struct MirSurface *surface; /**< Mir surface */
} mir;
#endif
#if defined(SDL_VIDEO_DRIVER_ANDROID)
struct
{
ANativeWindow *window;
EGLSurface surface;
} android;
#endif
#if defined(SDL_VIDEO_DRIVER_VIVANTE)
struct
{
EGLNativeDisplayType display;
EGLNativeWindowType window;
} vivante;
#endif
/* Can't have an empty union */
int dummy;
} info;
}; SDL_version and subsystem aside, there is actually a huge union where all its variants are conditional on things that we can hardly predict, unless at compile time. That effectively means that this binding should be part of the compilation process, and thus this method cannot be implemented without integrating bindgen to this crate, unfortunately. This is a pretty special case since this is one of the few functions which are very platform-specific, and thus lots of |
It sounds like version 2.0.6 will guarantee that this union will be exactly 64 bytes http://hg.libsdl.org/SDL/rev/69452f9839d5 which should make this a bit easier |
I built something minimalistic to test the topic:
The strange thing is, that it will always panic with: |
@hodasemi That can be fixed by declaring the SdlSysWminfo struct as |
@asgeir Yes, thanks. I also changed the type of subsystem to u32 and made SDL_SYSWM_* to const u32 values. It seems to be working now. |
I added this to the master branch in sdl2_sys, please tell me if that works for you as well. By the way, your |
See, https://wiki.libsdl.org/SDL_GetWindowWMInfo. At least I could not find it.
The text was updated successfully, but these errors were encountered: