1
0
Fork 0
mirror of https://github.com/gwm17/glfw.git synced 2024-11-27 04:28:52 -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, XSetSelectionOwner(_glfwLibrary.X11.display, XA_PRIMARY,
_glfwLibrary.activeWindow->X11.handle, CurrentTime); _glfwLibrary.activeWindow->X11.handle, CurrentTime);
XSetSelectionOwner(_glfwLibrary.X11.display, XSetSelectionOwner(_glfwLibrary.X11.display,
_glfwLibrary.X11.selection.atoms.clipboard _glfwLibrary.X11.selection.atom,
[_GLFW_CLIPBOARD_ATOM_CLIPBOARD],
_glfwLibrary.activeWindow->X11.handle, CurrentTime); _glfwLibrary.activeWindow->X11.handle, CurrentTime);
XFlush(_glfwLibrary.X11.display); 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 // Try different clipboards and formats that relate to the GLFW
// format with preference for more appropriate formats first // 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 *xfmt = getInternalFormat(format);
Atom *xfmtend = xfmt + _GLFW_STRING_ATOM_COUNT; Atom *xfmtend = xfmt + _GLFW_STRING_ATOM_COUNT;
// Get the currently active window // Get the currently active window
Window window = _glfwLibrary.activeWindow->X11.handle; 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. // Convert the selection into a format we would like.
XConvertSelection(_glfwLibrary.X11.display, *xcbrd, XConvertSelection(_glfwLibrary.X11.display,
*xfmt, None, window, CurrentTime); _glfwLibrary.X11.selection.atom,
XFlush(_glfwLibrary.X11.display); *xfmt, None, window, CurrentTime);
XFlush(_glfwLibrary.X11.display);
// Process pending events until we get a SelectionNotify. // Process pending events until we get a SelectionNotify.
while (!_glfwLibrary.X11.selection.converted) while (!_glfwLibrary.X11.selection.converted)
_glfwPlatformWaitEvents(); _glfwPlatformWaitEvents();
// Successful?
if (_glfwLibrary.X11.selection.converted == 1)
break;
}
// Successful? // Successful?
if (_glfwLibrary.X11.selection.converted == 1) if (_glfwLibrary.X11.selection.converted == 1)
{
_glfwLibrary.X11.selection.converted = 0;
break; break;
}
} }
// Successful?
if (_glfwLibrary.X11.selection.converted == 1)
_glfwLibrary.X11.selection.converted = 0;
// Unsuccessful conversion, bail with no clipboard data // Unsuccessful conversion, bail with no clipboard data
if (_glfwLibrary.X11.selection.converted) if (_glfwLibrary.X11.selection.converted)
{ {

View File

@ -456,13 +456,9 @@ static GLboolean initDisplay(void)
// the keyboard mapping. // the keyboard mapping.
updateKeyCodeLUT(); updateKeyCodeLUT();
// Find or create clipboard atoms // Find or create clipboard atom
_glfwLibrary.X11.selection.atoms.clipboard[_GLFW_CLIPBOARD_ATOM_PRIMARY] = _glfwLibrary.X11.selection.atom =
XA_PRIMARY;
_glfwLibrary.X11.selection.atoms.clipboard[_GLFW_CLIPBOARD_ATOM_CLIPBOARD] =
XInternAtom(_glfwLibrary.X11.display, "CLIPBOARD", False); XInternAtom(_glfwLibrary.X11.display, "CLIPBOARD", False);
_glfwLibrary.X11.selection.atoms.clipboard[_GLFW_CLIPBOARD_ATOM_SECONDARY] =
XA_SECONDARY;
// Find or create selection atoms // Find or create selection atoms
_glfwLibrary.X11.selection.atoms.string[_GLFW_STRING_ATOM_UTF8] = _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_LIBRARY_STATE _GLFWlibraryX11 X11
#define _GLFW_PLATFORM_CONTEXT_STATE _GLFWcontextGLX GLX #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 // String atoms
#define _GLFW_STRING_ATOM_UTF8 0 #define _GLFW_STRING_ATOM_UTF8 0
#define _GLFW_STRING_ATOM_COMPOUND 1 #define _GLFW_STRING_ATOM_COMPOUND 1
@ -236,8 +230,8 @@ typedef struct _GLFWlibraryX11
// Selection data // Selection data
struct { struct {
Atom atom;
struct { struct {
Atom clipboard[_GLFW_CLIPBOARD_ATOM_COUNT];
Atom string[_GLFW_STRING_ATOM_COUNT]; Atom string[_GLFW_STRING_ATOM_COUNT];
} atoms; } atoms;
struct { struct {