mirror of
https://github.com/ahwootech/BRUTAL.git
synced 2026-11-26 13:08:24 +01:00
192 lines
10 KiB
C#
192 lines
10 KiB
C#
// <auto-generated/>
|
|
// Generated by Brutal.Glfw.Generate; do not edit by hand.
|
|
#nullable enable
|
|
|
|
namespace Brutal.GlfwApi.X11
|
|
{
|
|
/// <summary>
|
|
/// Native handle accessors for the X11 (Linux/BSD) and GLX backends. Add <c>using Brutal.GlfwApi.X11;</c> to call
|
|
/// these extension methods on <see cref="GlfwWindow"/> / <see cref="GlfwMonitor"/>.
|
|
/// </summary>
|
|
public static class X11Extensions
|
|
{
|
|
/// <summary>
|
|
/// Returns the X11 <c>Display</c> used by GLFW.
|
|
/// </summary>
|
|
/// <returns>The <c>Display</c> pointer used by GLFW, or <c>0</c> if an error occurred.</returns>
|
|
/// <remarks>
|
|
/// This function is only available on the X11 native build. Calling it on any other platform will result in
|
|
/// an <see cref="EntryPointNotFoundException"/>.
|
|
/// </remarks>
|
|
/// <possibleErrors>
|
|
/// <see cref="GlfwErrorCode.NotInitialized"/>, <see cref="GlfwErrorCode.PlatformUnavailable"/>
|
|
/// </possibleErrors>
|
|
/// <threadSafety>
|
|
/// This function may be called from any thread. Access is not synchronized.
|
|
/// </threadSafety>
|
|
/// <seealso href="https://www.glfw.org/docs/latest/group__native.html">glfwGetX11Display</seealso>
|
|
public static nint GetX11Display() => Glfw.PInvoke.GetX11Display();
|
|
|
|
/// <summary>
|
|
/// Returns the contents of the current X11 primary selection as a string.
|
|
/// </summary>
|
|
/// <returns>The contents of the selection as a UTF-8 encoded string, or null if an error occurred.</returns>
|
|
/// <remarks>
|
|
/// This function is only available on the X11 native build. Calling it on any other platform will result in
|
|
/// an <see cref="EntryPointNotFoundException"/>.
|
|
/// <para>
|
|
/// If the selection is empty or its contents cannot be converted, null is returned and a
|
|
/// <see cref="GlfwErrorCode.FormatUnavailable"/> error is generated.
|
|
/// </para>
|
|
/// </remarks>
|
|
/// <possibleErrors>
|
|
/// <see cref="GlfwErrorCode.NotInitialized"/>, <see cref="GlfwErrorCode.PlatformUnavailable"/>,
|
|
/// <see cref="GlfwErrorCode.PlatformError"/>, <see cref="GlfwErrorCode.FormatUnavailable"/>
|
|
/// </possibleErrors>
|
|
/// <threadSafety>
|
|
/// This function must only be called from the main thread.
|
|
/// </threadSafety>
|
|
/// <seealso href="https://www.glfw.org/docs/latest/group__native.html">glfwGetX11SelectionString</seealso>
|
|
public static string? GetX11SelectionString() => Glfw.PInvoke.GetX11SelectionString();
|
|
|
|
extension(GlfwMonitor monitor)
|
|
{
|
|
/// <summary>
|
|
/// Returns the <c>RRCrtc</c> of the specified monitor.
|
|
/// </summary>
|
|
/// <returns>The <c>RRCrtc</c> of the specified monitor, or <c>None</c> (0) if an error occurred.</returns>
|
|
/// <remarks>
|
|
/// This function is only available on the X11 native build. Calling it on any other platform will result
|
|
/// in an <see cref="EntryPointNotFoundException"/>.
|
|
/// </remarks>
|
|
/// <possibleErrors>
|
|
/// <see cref="GlfwErrorCode.NotInitialized"/>, <see cref="GlfwErrorCode.PlatformUnavailable"/>
|
|
/// </possibleErrors>
|
|
/// <threadSafety>
|
|
/// This function may be called from any thread. Access is not synchronized.
|
|
/// </threadSafety>
|
|
/// <seealso href="https://www.glfw.org/docs/latest/group__native.html">glfwGetX11Adapter</seealso>
|
|
public ulong GetX11Adapter() => Glfw.PInvoke.GetX11Adapter(monitor);
|
|
|
|
/// <summary>
|
|
/// Returns the <c>RROutput</c> of the specified monitor.
|
|
/// </summary>
|
|
/// <returns>The <c>RROutput</c> of the specified monitor, or <c>None</c> (0) if an error
|
|
/// occurred.</returns>
|
|
/// <remarks>
|
|
/// This function is only available on the X11 native build. Calling it on any other platform will result
|
|
/// in an <see cref="EntryPointNotFoundException"/>.
|
|
/// </remarks>
|
|
/// <possibleErrors>
|
|
/// <see cref="GlfwErrorCode.NotInitialized"/>, <see cref="GlfwErrorCode.PlatformUnavailable"/>
|
|
/// </possibleErrors>
|
|
/// <threadSafety>
|
|
/// This function may be called from any thread. Access is not synchronized.
|
|
/// </threadSafety>
|
|
/// <seealso href="https://www.glfw.org/docs/latest/group__native.html">glfwGetX11Monitor</seealso>
|
|
public ulong GetX11Monitor() => Glfw.PInvoke.GetX11Monitor(monitor);
|
|
}
|
|
extension(GlfwWindow window)
|
|
{
|
|
/// <summary>
|
|
/// Returns the X11 <c>Window</c> XID of the specified window.
|
|
/// </summary>
|
|
/// <returns>The X11 <c>Window</c> of the specified window, or <c>None</c> (0) if an error
|
|
/// occurred.</returns>
|
|
/// <remarks>
|
|
/// This function is only available on the X11 native build. Calling it on any other platform will result
|
|
/// in an <see cref="EntryPointNotFoundException"/>.
|
|
/// </remarks>
|
|
/// <possibleErrors>
|
|
/// <see cref="GlfwErrorCode.NotInitialized"/>, <see cref="GlfwErrorCode.PlatformUnavailable"/>
|
|
/// </possibleErrors>
|
|
/// <threadSafety>
|
|
/// This function may be called from any thread. Access is not synchronized.
|
|
/// </threadSafety>
|
|
/// <seealso href="https://www.glfw.org/docs/latest/group__native.html">glfwGetX11Window</seealso>
|
|
public ulong GetX11Window() => Glfw.PInvoke.GetX11Window(window);
|
|
|
|
/// <summary>
|
|
/// Returns the <c>GLXContext</c> of the specified window.
|
|
/// </summary>
|
|
/// <returns>The <c>GLXContext</c> of the specified window, or <c>0</c> if an error occurred.</returns>
|
|
/// <remarks>
|
|
/// This function is only available on the X11 native build with GLX context support. Calling it on any
|
|
/// other platform will result in an <see cref="EntryPointNotFoundException"/>.
|
|
/// </remarks>
|
|
/// <possibleErrors>
|
|
/// <see cref="GlfwErrorCode.NotInitialized"/>, <see cref="GlfwErrorCode.NoWindowContext"/>,
|
|
/// <see cref="GlfwErrorCode.PlatformUnavailable"/>
|
|
/// </possibleErrors>
|
|
/// <threadSafety>
|
|
/// This function may be called from any thread. Access is not synchronized.
|
|
/// </threadSafety>
|
|
/// <seealso href="https://www.glfw.org/docs/latest/group__native.html">glfwGetGLXContext</seealso>
|
|
public nint GetGLXContext() => Glfw.PInvoke.GetGLXContext(window);
|
|
|
|
/// <summary>
|
|
/// Returns the <c>GLXWindow</c> of the specified window.
|
|
/// </summary>
|
|
/// <returns>The <c>GLXWindow</c> of the specified window, or <c>None</c> (0) if an error
|
|
/// occurred.</returns>
|
|
/// <remarks>
|
|
/// This function is only available on the X11 native build with GLX context support. Calling it on any
|
|
/// other platform will result in an <see cref="EntryPointNotFoundException"/>.
|
|
/// </remarks>
|
|
/// <possibleErrors>
|
|
/// <see cref="GlfwErrorCode.NotInitialized"/>, <see cref="GlfwErrorCode.NoWindowContext"/>,
|
|
/// <see cref="GlfwErrorCode.PlatformUnavailable"/>
|
|
/// </possibleErrors>
|
|
/// <threadSafety>
|
|
/// This function may be called from any thread. Access is not synchronized.
|
|
/// </threadSafety>
|
|
/// <seealso href="https://www.glfw.org/docs/latest/group__native.html">glfwGetGLXWindow</seealso>
|
|
public ulong GetGLXWindow() => Glfw.PInvoke.GetGLXWindow(window);
|
|
|
|
/// <summary>
|
|
/// Retrieves the <c>GLXFBConfig</c> of the specified window's <c>GLXWindow</c>.
|
|
/// </summary>
|
|
/// <param name="config">Receives the <c>GLXFBConfig</c> of the window's <c>GLXWindow</c>, if
|
|
/// available.</param>
|
|
/// <returns><c>true</c> if successful, or <c>false</c> if an error occurred.</returns>
|
|
/// <remarks>
|
|
/// This function is only available when GLFW was built with GLX context support. Calling it otherwise
|
|
/// will result in an <see cref="EntryPointNotFoundException"/>.
|
|
/// <para>
|
|
/// <c>GLXFBConfig</c> is an opaque handle. GLFW leaves it unwritten on error, as core GLX defines no
|
|
/// invalid value, so <c>config</c> is set to 0 before the call.
|
|
/// </para>
|
|
/// </remarks>
|
|
/// <possibleErrors>
|
|
/// <see cref="GlfwErrorCode.NotInitialized"/>, <see cref="GlfwErrorCode.NoWindowContext"/>
|
|
/// </possibleErrors>
|
|
/// <threadSafety>
|
|
/// This function may be called from any thread. Access is not synchronized.
|
|
/// </threadSafety>
|
|
/// <seealso href="https://www.glfw.org/docs/latest/group__native.html">glfwGetGLXFBConfig</seealso>
|
|
public bool GetGLXFBConfig(out nint config)
|
|
{
|
|
config = default;
|
|
return Glfw.PInvoke.GetGLXFBConfig(window, out config) == GLFW_TRUE;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Sets the current X11 primary selection to the specified string.
|
|
/// </summary>
|
|
/// <param name="string">A UTF-8 encoded string. Copied before this method returns.</param>
|
|
/// <remarks>
|
|
/// This function is only available on the X11 native build. Calling it on any other platform will result in
|
|
/// an <see cref="EntryPointNotFoundException"/>.
|
|
/// </remarks>
|
|
/// <possibleErrors>
|
|
/// <see cref="GlfwErrorCode.NotInitialized"/>, <see cref="GlfwErrorCode.PlatformUnavailable"/>,
|
|
/// <see cref="GlfwErrorCode.PlatformError"/>
|
|
/// </possibleErrors>
|
|
/// <threadSafety>
|
|
/// This function must only be called from the main thread.
|
|
/// </threadSafety>
|
|
/// <seealso href="https://www.glfw.org/docs/latest/group__native.html">glfwSetX11SelectionString</seealso>
|
|
public static void SetX11SelectionString(string @string) => Glfw.PInvoke.SetX11SelectionString(@string);
|
|
}
|
|
}
|