1
1
using System ;
2
2
using System . Runtime . InteropServices ;
3
3
using System . Security ;
4
+ using System . Text ;
5
+ using JetBrains . Annotations ;
4
6
5
7
namespace GLFW
6
8
{
@@ -17,6 +19,24 @@ public static class Native
17
19
{
18
20
#region External
19
21
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
+
20
40
/// <summary>
21
41
/// Returns the pointer to the Wayland window for the specified window.
22
42
/// </summary>
@@ -112,6 +132,32 @@ public static class Native
112
132
[ DllImport ( Glfw . LIBRARY , EntryPoint = "glfwGetWin32Window" , CallingConvention = CallingConvention . Cdecl ) ]
113
133
public static extern IntPtr GetWin32Window ( Window window ) ;
114
134
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
+
115
161
[ DllImport ( Glfw . LIBRARY , EntryPoint = "glfwGetWin32Adapter" , CallingConvention = CallingConvention . Cdecl ) ]
116
162
private static extern IntPtr GetWin32AdapterInternal ( Monitor monitor ) ;
117
163
0 commit comments