Skip to content

Commit

Permalink
GlfwNativeWindow: Allow wayland window ptr to be read when GLFW is co…
Browse files Browse the repository at this point in the history
…mpiled with both X11 and Wayland (dotnet#2156)
  • Loading branch information
Beyley committed Apr 24, 2024
1 parent ff35bea commit 2f07bf5
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/Windowing/Silk.NET.GLFW/GlfwNativeWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,16 @@ public unsafe GlfwNativeWindow(Glfw api, WindowHandle* window) : this()
if (api.Context.TryGetProcAddress("glfwGetX11Display", out var getX11Display) &&
api.Context.TryGetProcAddress("glfwGetX11Window", out var getX11Window))
{
Kind |= NativeWindowFlags.X11;
X11 = ((nint) ((delegate* unmanaged[Cdecl]<void*>) getX11Display)(),
((delegate* unmanaged[Cdecl]<WindowHandle*, nuint>) getX11Window)(window));
return;
var x11Display = (nint) ((delegate* unmanaged[Cdecl]<void*>) getX11Display)();
var x11Window = ((delegate* unmanaged[Cdecl]<WindowHandle*, nuint>) getX11Window)(window);

if (x11Display != 0 && x11Window != 0)
{
Kind |= NativeWindowFlags.X11;

X11 = (x11Display, x11Window);
return;
}
}

if (api.Context.TryGetProcAddress("glfwGetWaylandDisplay", out var getWaylandDisplay) &&
Expand Down

0 comments on commit 2f07bf5

Please sign in to comment.