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

Replaced iterators with index.

This commit is contained in:
Camilla Berglund 2012-04-09 15:16:56 +02:00
parent 168aba78d4
commit 3252829fe0

View File

@ -141,26 +141,23 @@ size_t _glfwPlatformGetClipboardData(void* data, size_t size, int format)
{ {
size_t len, rembytes, dummy; size_t len, rembytes, dummy;
unsigned char* d; unsigned char* d;
int fmt; int i, fmt;
Atom type; Atom type;
// Try different clipboards and formats that relate to the GLFW
// format with preference for more appropriate formats first
Atom *xfmt = _glfwLibrary.X11.selection.atoms.string;
Atom *xfmtend = xfmt + _GLFW_STRING_ATOM_COUNT;
// Get the currently active window // Get the currently active window
Window window = _glfwLibrary.activeWindow->X11.handle; Window window = _glfwLibrary.activeWindow->X11.handle;
for ( ; xfmt != xfmtend; xfmt++) for (i = 0; i < _GLFW_STRING_ATOM_COUNT; i++)
{ {
// Specify the format we would like. // Specify the format we would like.
_glfwLibrary.X11.selection.request = *xfmt; _glfwLibrary.X11.selection.request =
_glfwLibrary.X11.selection.atoms.strings[i];
// Convert the selection into a format we would like. // Convert the selection into a format we would like.
XConvertSelection(_glfwLibrary.X11.display, XConvertSelection(_glfwLibrary.X11.display,
_glfwLibrary.X11.selection.atom, _glfwLibrary.X11.selection.atom,
*xfmt, None, window, CurrentTime); _glfwLibrary.X11.selection.request,
None, window, CurrentTime);
XFlush(_glfwLibrary.X11.display); XFlush(_glfwLibrary.X11.display);
// Process pending events until we get a SelectionNotify. // Process pending events until we get a SelectionNotify.
@ -190,7 +187,7 @@ size_t _glfwPlatformGetClipboardData(void* data, size_t size, int format)
// Check the length of data to receive (rembytes) // Check the length of data to receive (rembytes)
XGetWindowProperty(_glfwLibrary.X11.display, XGetWindowProperty(_glfwLibrary.X11.display,
window, window,
*xfmt, _glfwLibrary.X11.selection.request,
0, 0, 0, 0,
0, 0,
AnyPropertyType, AnyPropertyType,
@ -204,7 +201,7 @@ size_t _glfwPlatformGetClipboardData(void* data, size_t size, int format)
{ {
int result = XGetWindowProperty(_glfwLibrary.X11.display, int result = XGetWindowProperty(_glfwLibrary.X11.display,
window, window,
*xfmt, _glfwLibrary.X11.selection.request,
0, rembytes, 0, rembytes,
0, 0,
AnyPropertyType, AnyPropertyType,