X11: Add native access to primary selection

This adds the native access functions glfwSetX11SelectionString and
glfwGetX11SelectionString under GLFW_EXPOSE_NATIVE_X11.  They are
similar to glfwSetClipboardString and glfwGetClipboardString but operate
on the PRIMARY selection.

The primary selection is widely used in X11, and so seems important to
support.  Primary selection is mostly an X11-specific thing, hence it's
exposed as an X11 native interface.

Fixes #894.
Closes #1056.

Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
This commit is contained in:
Kristian Nielsen
2017-08-02 16:10:13 +02:00
committed by Camilla Löwy
parent 3ee7f8f695
commit 29a75ab09d
6 changed files with 180 additions and 72 deletions
+2
View File
@@ -611,6 +611,7 @@ static GLFWbool initExtensions(void)
// ICCCM standard clipboard atoms
_glfw.x11.TARGETS = XInternAtom(_glfw.x11.display, "TARGETS", False);
_glfw.x11.MULTIPLE = XInternAtom(_glfw.x11.display, "MULTIPLE", False);
_glfw.x11.PRIMARY = XInternAtom(_glfw.x11.display, "PRIMARY", False);
_glfw.x11.CLIPBOARD = XInternAtom(_glfw.x11.display, "CLIPBOARD", False);
// Clipboard manager atoms
@@ -853,6 +854,7 @@ void _glfwPlatformTerminate(void)
_glfw.x11.hiddenCursorHandle = (Cursor) 0;
}
free(_glfw.x11.primarySelectionString);
free(_glfw.x11.clipboardString);
if (_glfw.x11.im)