1
0
Fork 0
mirror of https://github.com/gwm17/glfw.git synced 2024-11-26 20:28:49 -05:00

Removed support for primary and secondary selections.

This commit is contained in:
Camilla Berglund 2012-04-09 15:00:52 +02:00
parent cbe29b4963
commit d55616661d
3 changed files with 19 additions and 38 deletions

View File

@ -142,8 +142,7 @@ void _glfwPlatformSetClipboardData(void *data, size_t size, int format)
XSetSelectionOwner(_glfwLibrary.X11.display, XA_PRIMARY,
_glfwLibrary.activeWindow->X11.handle, CurrentTime);
XSetSelectionOwner(_glfwLibrary.X11.display,
_glfwLibrary.X11.selection.atoms.clipboard
[_GLFW_CLIPBOARD_ATOM_CLIPBOARD],
_glfwLibrary.X11.selection.atom,
_glfwLibrary.activeWindow->X11.handle, CurrentTime);
XFlush(_glfwLibrary.X11.display);
}
@ -162,44 +161,36 @@ size_t _glfwPlatformGetClipboardData(void *data, size_t size, int format)
// Try different clipboards and formats that relate to the GLFW
// format with preference for more appropriate formats first
Atom *xcbrd = _glfwLibrary.X11.selection.atoms.clipboard;
Atom *xcbrdend = _glfwLibrary.X11.selection.atoms.clipboard +
_GLFW_CLIPBOARD_ATOM_COUNT;
Atom *xfmt = getInternalFormat(format);
Atom *xfmtend = xfmt + _GLFW_STRING_ATOM_COUNT;
// Get the currently active window
Window window = _glfwLibrary.activeWindow->X11.handle;
for ( ; xcbrd != xcbrdend; xcbrd++)
for ( ; xfmt != xfmtend; xfmt++)
{
for ( ; xfmt != xfmtend; xfmt++)
{
// Specify the format we would like.
_glfwLibrary.X11.selection.request = *xfmt;
// Specify the format we would like.
_glfwLibrary.X11.selection.request = *xfmt;
// Convert the selection into a format we would like.
XConvertSelection(_glfwLibrary.X11.display, *xcbrd,
*xfmt, None, window, CurrentTime);
XFlush(_glfwLibrary.X11.display);
// Convert the selection into a format we would like.
XConvertSelection(_glfwLibrary.X11.display,
_glfwLibrary.X11.selection.atom,
*xfmt, None, window, CurrentTime);
XFlush(_glfwLibrary.X11.display);
// Process pending events until we get a SelectionNotify.
while (!_glfwLibrary.X11.selection.converted)
_glfwPlatformWaitEvents();
// Successful?
if (_glfwLibrary.X11.selection.converted == 1)
break;
}
// Process pending events until we get a SelectionNotify.
while (!_glfwLibrary.X11.selection.converted)
_glfwPlatformWaitEvents();
// Successful?
if (_glfwLibrary.X11.selection.converted == 1)
{
_glfwLibrary.X11.selection.converted = 0;
break;
}
}
// Successful?
if (_glfwLibrary.X11.selection.converted == 1)
_glfwLibrary.X11.selection.converted = 0;
// Unsuccessful conversion, bail with no clipboard data
if (_glfwLibrary.X11.selection.converted)
{

View File

@ -456,13 +456,9 @@ static GLboolean initDisplay(void)
// the keyboard mapping.
updateKeyCodeLUT();
// Find or create clipboard atoms
_glfwLibrary.X11.selection.atoms.clipboard[_GLFW_CLIPBOARD_ATOM_PRIMARY] =
XA_PRIMARY;
_glfwLibrary.X11.selection.atoms.clipboard[_GLFW_CLIPBOARD_ATOM_CLIPBOARD] =
// Find or create clipboard atom
_glfwLibrary.X11.selection.atom =
XInternAtom(_glfwLibrary.X11.display, "CLIPBOARD", False);
_glfwLibrary.X11.selection.atoms.clipboard[_GLFW_CLIPBOARD_ATOM_SECONDARY] =
XA_SECONDARY;
// Find or create selection atoms
_glfwLibrary.X11.selection.atoms.string[_GLFW_STRING_ATOM_UTF8] =

View File

@ -85,12 +85,6 @@
#define _GLFW_PLATFORM_LIBRARY_STATE _GLFWlibraryX11 X11
#define _GLFW_PLATFORM_CONTEXT_STATE _GLFWcontextGLX GLX
// 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
@ -236,8 +230,8 @@ typedef struct _GLFWlibraryX11
// Selection data
struct {
Atom atom;
struct {
Atom clipboard[_GLFW_CLIPBOARD_ATOM_COUNT];
Atom string[_GLFW_STRING_ATOM_COUNT];
} atoms;
struct {