Applied coding conventions.
This commit is contained in:
parent
d022e54934
commit
7f470065fc
@ -76,3 +76,4 @@ GLFWAPI size_t glfwGetClipboardData(void *data, size_t size, int format)
|
||||
|
||||
return _glfwPlatformGetClipboardData(data, size, format);
|
||||
}
|
||||
|
||||
|
@ -36,18 +36,15 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
////// GLFW platform API //////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//========================================================================
|
||||
// Get the corresponding X11 format for a given GLFW format.
|
||||
//========================================================================
|
||||
|
||||
static Atom *getInternalFormat(int fmt)
|
||||
static Atom* getInternalFormat(int format)
|
||||
{
|
||||
// Get the necessary atoms
|
||||
switch (fmt)
|
||||
switch (format)
|
||||
{
|
||||
case GLFW_CLIPBOARD_FORMAT_STRING:
|
||||
return _glfwLibrary.X11.selection.atoms.string;
|
||||
@ -56,6 +53,11 @@ static Atom *getInternalFormat(int fmt)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
////// GLFW internal API //////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//========================================================================
|
||||
// X11 selection request event
|
||||
//========================================================================
|
||||
@ -93,9 +95,15 @@ Atom _glfwSelectionRequest(XSelectionRequestEvent *request)
|
||||
// TODO: Should we set an error? Probably not.
|
||||
return None;
|
||||
}
|
||||
|
||||
return request->target;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
////// GLFW platform API //////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//========================================================================
|
||||
// Set the clipboard contents
|
||||
//========================================================================
|
||||
@ -140,6 +148,7 @@ void _glfwPlatformSetClipboardData(void *data, size_t size, int format)
|
||||
XFlush(_glfwLibrary.X11.display);
|
||||
}
|
||||
|
||||
|
||||
//========================================================================
|
||||
// Return the current clipboard contents
|
||||
//========================================================================
|
||||
@ -224,15 +233,17 @@ size_t _glfwPlatformGetClipboardData(void *data, size_t size, int format)
|
||||
if (result == Success)
|
||||
{
|
||||
size_t s = size - 1 > rembytes ? rembytes : size - 1;
|
||||
|
||||
// Copy the data out.
|
||||
memcpy(data, d, s);
|
||||
|
||||
// Null-terminate strings.
|
||||
if (format == GLFW_CLIPBOARD_FORMAT_STRING)
|
||||
{
|
||||
((char *)data)[s] = '\0';
|
||||
}
|
||||
|
||||
// Free the data allocated using X11.
|
||||
XFree(d);
|
||||
|
||||
// Return the actual number of bytes.
|
||||
return rembytes;
|
||||
}
|
||||
@ -243,6 +254,7 @@ size_t _glfwPlatformGetClipboardData(void *data, size_t size, int format)
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user