Unified X11 cursor creation.

This commit is contained in:
Camilla Berglund
2014-06-22 13:13:53 +02:00
parent 215924f797
commit 9b6c14b7ae
3 changed files with 39 additions and 52 deletions
+1 -23
View File
@@ -1454,29 +1454,7 @@ int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
const GLFWimage* image,
int xhot, int yhot)
{
int i;
XcursorImage* native = XcursorImageCreate(image->width, image->height);
if (native == NULL)
return GL_FALSE;
native->xhot = xhot;
native->yhot = yhot;
unsigned char* source = (unsigned char*) image->pixels;
XcursorPixel* target = native->pixels;
for (i = 0; i < image->width * image->height; i++, target++, source += 4)
{
*target = (source[3] << 24) |
(source[0] << 16) |
(source[1] << 8) |
source[2];
}
cursor->x11.handle = XcursorImageLoadCursor(_glfw.x11.display, native);
XcursorImageDestroy(native);
cursor->x11.handle = _glfwCreateCursor(image, xhot, yhot);
if (cursor->x11.handle == None)
return GL_FALSE;