X11 copying code and support PRIMARY & CLIPBOARD clipboards.

This commit is contained in:
Ralph Eastwood
2011-09-22 12:03:45 +01:00
parent 57522db6e2
commit 9f41e5b67a
6 changed files with 179 additions and 40 deletions
+22 -4
View File
@@ -89,8 +89,17 @@
#define _GLFW_PLATFORM_LIBRARY_STATE _GLFWlibraryX11 X11
#define _GLFW_PLATFORM_CONTEXT_STATE _GLFWcontextGLX GLX
// Number of string atoms that will be checked
#define _GLFW_STRING_ATOMS_COUNT 4
// Clipboard atoms
#define _GLFW_CLIPBOARD_ATOM_PRIMARY 0
#define _GLFW_CLIPBOARD_ATOM_CLIPBOARD 1
#define _GLFW_CLIPBOARD_ATOM_SECONDARY 2
#define _GLFW_CLIPBOARD_ATOM_COUNT 3
// String atoms
#define _GLFW_STRING_ATOM_UTF8 0
#define _GLFW_STRING_ATOM_COMPOUND 1
#define _GLFW_STRING_ATOM_STRING 2
#define _GLFW_STRING_ATOM_COUNT 3
//========================================================================
// GLFW platform specific types
@@ -229,8 +238,15 @@ typedef struct _GLFWlibraryX11
// Selection data
struct {
Atom stringatoms[_GLFW_STRING_ATOMS_COUNT];
Atom request;
struct {
Atom clipboard[_GLFW_CLIPBOARD_ATOM_COUNT];
Atom string[_GLFW_STRING_ATOM_COUNT];
} atoms;
struct {
size_t stringlen;
char *string;
} clipboard;
Atom request;
int converted;
} selection;
@@ -273,5 +289,7 @@ void _glfwTerminateJoysticks(void);
// Unicode support
long _glfwKeySym2Unicode(KeySym keysym);
// Clipboard handling
Atom _glfwSelectionRequest(XSelectionRequestEvent *request);
#endif // _platform_h_