Skip to content

Commit 55740af

Browse files
committed
Fixed missing entry point definition for get/set of X11 selection string
1 parent 8229194 commit 55740af

File tree

2 files changed

+64
-0
lines changed

2 files changed

+64
-0
lines changed

GLFW.NET/Enums/MesaPixelFormat.cs

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
namespace GLFW
2+
{
3+
/// <summary>
4+
/// Describes pixel formats used by Mesa.
5+
/// <para>All fields are self-explanatory.</para>
6+
/// </summary>
7+
public enum MesaPixelFormat
8+
{
9+
#pragma warning disable 1591
10+
Rgba,
11+
Bgra,
12+
Argb,
13+
Rgb ,
14+
Bgr ,
15+
Rgb565
16+
#pragma warning restore 1591
17+
}
18+
}

GLFW.NET/Native.cs

+46
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
using System;
22
using System.Runtime.InteropServices;
33
using System.Security;
4+
using System.Text;
5+
using JetBrains.Annotations;
46

57
namespace GLFW
68
{
@@ -17,6 +19,24 @@ public static class Native
1719
{
1820
#region External
1921

22+
/// <summary>
23+
/// Retrieves a pointer to the Wayland display.
24+
/// <para>The pointer is to a native <c>wl_display</c> struct defined in wayland-client.c.</para>
25+
/// </summary>
26+
/// <returns>A pointer to the Wayland display struct.</returns>
27+
/// <seealso href="https://github.com/msteinert/wayland/blob/master/src/wayland-client.c"/>
28+
[DllImport(Glfw.LIBRARY, EntryPoint = "glfwGetWaylandDisplay", CallingConvention = CallingConvention.Cdecl)]
29+
public static extern IntPtr GetWaylandDisplay();
30+
31+
/// <summary>
32+
/// Retrieves a pointer to the Wayland output monitor.
33+
/// <para>The pointer is to a native <c>wl_output</c> struct defined in wayland-client.c.</para>
34+
/// </summary>
35+
/// <returns>A pointer to the Wayland output struct.</returns>
36+
/// <seealso href="https://github.com/msteinert/wayland/blob/master/src/wayland-client.c"/>
37+
[DllImport(Glfw.LIBRARY, EntryPoint = "glfwGetWaylandMonitor", CallingConvention = CallingConvention.Cdecl)]
38+
public static extern IntPtr GetWaylandMonitor(Monitor monitor);
39+
2040
/// <summary>
2141
/// Returns the pointer to the Wayland window for the specified window.
2242
/// </summary>
@@ -112,6 +132,32 @@ public static class Native
112132
[DllImport(Glfw.LIBRARY, EntryPoint = "glfwGetWin32Window", CallingConvention = CallingConvention.Cdecl)]
113133
public static extern IntPtr GetWin32Window(Window window);
114134

135+
/// <summary>
136+
/// Returns the contents of the selection as a string.
137+
/// </summary>
138+
/// <returns>The selected string, or <c>null</c> if error occurs or no string is selected.</returns>
139+
[CanBeNull]
140+
public static string GetX11SelectionString()
141+
{
142+
var ptr = GetX11SelectionStringInternal();
143+
return ptr == IntPtr.Zero ? null : Util.PtrToStringUTF8(ptr);
144+
}
145+
146+
/// <summary>
147+
/// Sets the clipboard string of an X11 window.
148+
/// </summary>
149+
/// <param name="str">The string to set.</param>
150+
public static void SetX11SelectionString([NotNull] string str)
151+
{
152+
SetX11SelectionString(Encoding.UTF8.GetBytes(str));
153+
}
154+
155+
[DllImport(Glfw.LIBRARY, EntryPoint = "glfwSetX11SelectionString", CallingConvention = CallingConvention.Cdecl)]
156+
private static extern void SetX11SelectionString([NotNull] byte[] str);
157+
158+
[DllImport(Glfw.LIBRARY, EntryPoint = "glfwGetX11SelectionString", CallingConvention = CallingConvention.Cdecl)]
159+
private static extern IntPtr GetX11SelectionStringInternal();
160+
115161
[DllImport(Glfw.LIBRARY, EntryPoint = "glfwGetWin32Adapter", CallingConvention = CallingConvention.Cdecl)]
116162
private static extern IntPtr GetWin32AdapterInternal(Monitor monitor);
117163

0 commit comments

Comments
 (0)