1
0
Fork 0
mirror of https://github.com/gwm17/glfw.git synced 2024-11-23 10:48:51 -05:00

Added support for MULTIPLE target.

This commit is contained in:
Camilla Berglund 2013-04-29 12:26:25 +02:00
parent 7012d97958
commit 822eb1c986
3 changed files with 53 additions and 0 deletions

View File

@ -67,6 +67,57 @@ Atom _glfwWriteSelection(XSelectionRequestEvent* request)
return request->property;
}
if (request->target == _glfw.x11.MULTIPLE)
{
// Multiple conversions were requested
Atom* targets;
unsigned long i, count;
count = _glfwGetWindowProperty(request->requestor,
request->property,
XA_ATOM,
(unsigned char**) &targets);
for (i = 0; i < count; i += 2)
{
int j;
for (j = 0; j < _GLFW_CLIPBOARD_FORMAT_COUNT; j++)
{
if (targets[i] == _glfw.x11.selection.formats[j])
break;
}
if (j < _GLFW_CLIPBOARD_FORMAT_COUNT)
{
XChangeProperty(_glfw.x11.display,
request->requestor,
targets[i + 1],
targets[i],
8,
PropModeReplace,
(unsigned char*) _glfw.x11.selection.string,
strlen(_glfw.x11.selection.string));
}
else
targets[i + 1] = None;
}
XChangeProperty(_glfw.x11.display,
request->requestor,
request->property,
request->target,
32,
PropModeReplace,
(unsigned char*) targets,
count);
XFree(targets);
return request->property;
}
for (i = 0; i < _GLFW_CLIPBOARD_FORMAT_COUNT; i++)
{
if (request->target == _glfw.x11.selection.formats[i])

View File

@ -544,6 +544,7 @@ static GLboolean initDisplay(void)
// Find or create standard clipboard atoms
_glfw.x11.TARGETS = XInternAtom(_glfw.x11.display, "TARGETS", False);
_glfw.x11.MULTIPLE = XInternAtom(_glfw.x11.display, "MULTIPLE", False);
_glfw.x11.CLIPBOARD = XInternAtom(_glfw.x11.display, "CLIPBOARD", False);
// Store clipboard format atoms in order of preference

View File

@ -119,6 +119,7 @@ typedef struct _GLFWlibraryX11
// Selection atoms
Atom TARGETS;
Atom MULTIPLE;
Atom CLIPBOARD;
Atom UTF8_STRING;
Atom COMPOUND_STRING;