mirror of
https://github.com/glfw/glfw.git
synced 2026-09-22 16:52:57 +00:00
Unified X11 cursor creation.
This commit is contained in:
+1
-23
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user