1
0
Fork 0
mirror of https://github.com/gwm17/glfw.git synced 2024-11-27 04:28:52 -05:00

Formatting.

This commit is contained in:
Camilla Berglund 2012-04-09 15:12:59 +02:00
parent 508207ae04
commit 168aba78d4

View File

@ -47,7 +47,9 @@
Atom _glfwSelectionRequest(XSelectionRequestEvent* request)
{
Atom* atoms = _glfwLibrary.X11.selection.atoms.string;
Atom* formats = _glfwLibrary.X11.selection.atoms.string;
char* target = _glfwLibrary.X11.selection.clipboard.string;
if (request->target == XA_STRING)
{
// TODO: ISO Latin-1 specific characters don't get converted
@ -58,11 +60,11 @@ Atom _glfwSelectionRequest(XSelectionRequestEvent* request)
request->target,
8,
PropModeReplace,
(unsigned char*) _glfwLibrary.X11.selection.clipboard.string,
(unsigned char*) target,
8);
}
else if (request->target == atoms[_GLFW_STRING_ATOM_COMPOUND] ||
request->target == atoms[_GLFW_STRING_ATOM_UTF8])
else if (request->target == formats[_GLFW_STRING_ATOM_COMPOUND] ||
request->target == formats[_GLFW_STRING_ATOM_UTF8])
{
XChangeProperty(_glfwLibrary.X11.display,
request->requestor,
@ -70,7 +72,7 @@ Atom _glfwSelectionRequest(XSelectionRequestEvent* request)
request->target,
8,
PropModeReplace,
(unsigned char*) _glfwLibrary.X11.selection.clipboard.string,
(unsigned char*) target,
_glfwLibrary.X11.selection.clipboard.stringlen);
}
else
@ -200,13 +202,24 @@ size_t _glfwPlatformGetClipboardData(void *data, size_t size, int format)
// The number of bytes remaining (which is all of them)
if (rembytes > 0)
{
int result = XGetWindowProperty(_glfwLibrary.X11.display, window,
*xfmt, 0, rembytes, 0,
AnyPropertyType, &type, &fmt,
&len, &dummy, &d);
int result = XGetWindowProperty(_glfwLibrary.X11.display,
window,
*xfmt,
0, rembytes,
0,
AnyPropertyType,
&type,
&fmt,
&len, &dummy,
&d);
if (result == Success)
{
size_t s = size - 1 > rembytes ? rembytes : size - 1;
size_t s;
if (rembytes < size - 1)
s = rembytes;
else
s = size - 1;
// Copy the data out.
memcpy(data, d, s);