mirror of
https://github.com/glfw/glfw.git
synced 2024-11-22 18:15:10 +00:00
Added support for MULTIPLE target.
This commit is contained in:
parent
7012d97958
commit
822eb1c986
@ -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])
|
||||
|
@ -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
|
||||
|
@ -119,6 +119,7 @@ typedef struct _GLFWlibraryX11
|
||||
|
||||
// Selection atoms
|
||||
Atom TARGETS;
|
||||
Atom MULTIPLE;
|
||||
Atom CLIPBOARD;
|
||||
Atom UTF8_STRING;
|
||||
Atom COMPOUND_STRING;
|
||||
|
Loading…
Reference in New Issue
Block a user