Skip to content
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

Added SDL_GetWindowWMInfo support, and additional window flags #24

Merged
merged 2 commits into from Jul 2, 2018

Conversation

ReallyComeOn
Copy link
Contributor

SDL_GetWindowWMInfo can be used like so:

    window = SDL::Window.new("Window", 640, 480)
    renderer = SDL::Renderer.new(window)

    win_info = LibSDL::SDL_WMInfo.new
    win_info.version.major = 2
    win_info.version.minor = 0
    win_info.version.patch = 1

    if LibSDL.get_window_wm_info window, pointerof(win_info)
      puts "SUCCESS!"
    else
      puts "FAILED?"
    end
    puts win_info

I also added 5 additional x11 specific window flags.


struct WM_x11
display : Void*
window : UInt64
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The actual type chain in C appears to be Window -> XID -> CARD32 -> unsigned 32-bit integer.

SDL_SYSWM_WINDOWS
SDL_SYSWM_X11
SDL_SYSWM_DIRECTFB
SDL_SYSWM_COCOA
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are some more constants: UIKIT, WAYLAND, MIR, ...

struct SDL_WMInfo
version : SDL_Version
subsystem : SDL_SYSType
info : WM_x11 # TODO: Add support for other WM's
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be an explicit C union, so we can eventually add support for more systems:

struct SDL_WMInfoX11
  display : Void*
  window : UInt32
end

union SDL_WMInfoUnion
  x11: SDL_WMInfoX11
end

struct SDL_WMInfo
  version : SDL_Version
  subsystem : SDL_SYSType
  info: SDL_WMInfoUnion
end

@ysbaddaden ysbaddaden merged commit 6218a06 into ysbaddaden:master Jul 2, 2018
@ysbaddaden
Copy link
Owner

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants