mirror of
https://github.com/glfw/glfw.git
synced 2025-07-29 11:00:04 +00:00
Merge 37b07a6d31
into 763ec6cbcb
This commit is contained in:
commit
83919aaab8
@ -552,21 +552,37 @@ static Cursor createNULLCursor(void)
|
|||||||
GC gc;
|
GC gc;
|
||||||
XColor col;
|
XColor col;
|
||||||
Cursor cursor;
|
Cursor cursor;
|
||||||
|
int rectstatus;
|
||||||
// TODO: Add error checks
|
|
||||||
|
|
||||||
cursormask = XCreatePixmap(_glfw.x11.display, _glfw.x11.root, 1, 1, 1);
|
cursormask = XCreatePixmap(_glfw.x11.display, _glfw.x11.root, 1, 1, 1);
|
||||||
|
if (cursormask == BadValue)
|
||||||
|
return 0;
|
||||||
|
|
||||||
xgc.function = GXclear;
|
xgc.function = GXclear;
|
||||||
gc = XCreateGC(_glfw.x11.display, cursormask, GCFunction, &xgc);
|
gc = XCreateGC(_glfw.x11.display, cursormask, GCFunction, &xgc);
|
||||||
XFillRectangle(_glfw.x11.display, cursormask, gc, 0, 0, 1, 1);
|
if (gc == BadAlloc || gc == BadDrawable ||
|
||||||
|
gc == BadFont || gc == BadMatch ||
|
||||||
|
gc == BadPixmap || gc == BadValue)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
rectstatus = XFillRectangle(_glfw.x11.display, cursormask, gc, 0, 0, 1, 1);
|
||||||
|
if (rectstatus == BadDrawable || rectstatus == BadGC || rectstatus == BadMatch)
|
||||||
|
return 0;
|
||||||
|
|
||||||
col.pixel = 0;
|
col.pixel = 0;
|
||||||
col.red = 0;
|
col.red = 0;
|
||||||
col.flags = 4;
|
col.flags = 4;
|
||||||
cursor = XCreatePixmapCursor(_glfw.x11.display,
|
cursor = XCreatePixmapCursor(_glfw.x11.display,
|
||||||
cursormask, cursormask,
|
cursormask, cursormask,
|
||||||
&col, &col, 0, 0);
|
&col, &col, 0, 0);
|
||||||
XFreePixmap(_glfw.x11.display, cursormask);
|
if (cursor == BadAlloc || cursor == BadPixmap)
|
||||||
XFreeGC(_glfw.x11.display, gc);
|
return 0;
|
||||||
|
|
||||||
|
if (XFreePixmap(_glfw.x11.display, cursormask) == BadPixmap)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (XFreeGC(_glfw.x11.display, gc) == BadGC)
|
||||||
|
return 0;
|
||||||
|
|
||||||
return cursor;
|
return cursor;
|
||||||
}
|
}
|
||||||
@ -606,6 +622,8 @@ int _glfwPlatformInit(void)
|
|||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
|
|
||||||
_glfw.x11.cursor = createNULLCursor();
|
_glfw.x11.cursor = createNULLCursor();
|
||||||
|
if (_glfw.x11.cursor == 0)
|
||||||
|
return GL_FALSE;
|
||||||
|
|
||||||
if (!_glfwInitContextAPI())
|
if (!_glfwInitContextAPI())
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
|
Loading…
Reference in New Issue
Block a user