Cleanup of clipboard manager work.

This commit is contained in:
Camilla Berglund 2013-04-30 02:16:24 +02:00
parent affb62514a
commit d6030808eb

View File

@ -39,14 +39,9 @@
// //
static Bool isSelectionMessage(Display* display, XEvent* event, XPointer pointer) static Bool isSelectionMessage(Display* display, XEvent* event, XPointer pointer)
{ {
if (event->type == SelectionRequest || return event->type == SelectionRequest ||
event->type == SelectionNotify || event->type == SelectionNotify ||
event->type == SelectionClear) event->type == SelectionClear;
{
return True;
}
return False;
} }
// Set the specified property to the selection converted to the requested target // Set the specified property to the selection converted to the requested target
@ -282,6 +277,7 @@ const char* _glfwPlatformGetClipboardString(_GLFWwindow* window)
const Atom formats[] = { _glfw.x11.UTF8_STRING, const Atom formats[] = { _glfw.x11.UTF8_STRING,
_glfw.x11.COMPOUND_STRING, _glfw.x11.COMPOUND_STRING,
XA_STRING }; XA_STRING };
const int formatCount = sizeof(formats) / sizeof(formats[0]);
if (_glfwFindWindowByHandle(XGetSelectionOwner(_glfw.x11.display, if (_glfwFindWindowByHandle(XGetSelectionOwner(_glfw.x11.display,
_glfw.x11.CLIPBOARD))) _glfw.x11.CLIPBOARD)))
@ -294,7 +290,7 @@ const char* _glfwPlatformGetClipboardString(_GLFWwindow* window)
free(_glfw.x11.selection.string); free(_glfw.x11.selection.string);
_glfw.x11.selection.string = NULL; _glfw.x11.selection.string = NULL;
for (i = 0; i < sizeof(formats) / sizeof(formats[0]); i++) for (i = 0; i < formatCount; i++)
{ {
char* data; char* data;
XEvent event; XEvent event;