|
|
|
@ -370,14 +370,15 @@ int _glfwPlatformCreateCursor(_GLFWcursor* cursor, |
|
|
|
|
const GLFWimage* image, |
|
|
|
|
int xhot, int yhot) |
|
|
|
|
{ |
|
|
|
|
struct wl_shm_pool *pool; |
|
|
|
|
struct wl_shm_pool* pool; |
|
|
|
|
int stride = image->width * 4; |
|
|
|
|
int length = image->width * image->height * 4; |
|
|
|
|
void *data; |
|
|
|
|
void* data; |
|
|
|
|
int fd, i; |
|
|
|
|
|
|
|
|
|
fd = createAnonymousFile(length); |
|
|
|
|
if (fd < 0) { |
|
|
|
|
if (fd < 0) |
|
|
|
|
{ |
|
|
|
|
_glfwInputError(GLFW_PLATFORM_ERROR, |
|
|
|
|
"Wayland: Creating a buffer file for %d B failed: %m\n", |
|
|
|
|
length); |
|
|
|
@ -385,7 +386,8 @@ int _glfwPlatformCreateCursor(_GLFWcursor* cursor, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
data = mmap(NULL, length, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); |
|
|
|
|
if (data == MAP_FAILED) { |
|
|
|
|
if (data == MAP_FAILED) |
|
|
|
|
{ |
|
|
|
|
_glfwInputError(GLFW_PLATFORM_ERROR, |
|
|
|
|
"Wayland: Cursor mmap failed: %m\n"); |
|
|
|
|
close(fd); |
|
|
|
@ -405,7 +407,8 @@ int _glfwPlatformCreateCursor(_GLFWcursor* cursor, |
|
|
|
|
*target++ = source[3]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
cursor->wl.buffer = wl_shm_pool_create_buffer(pool, 0, |
|
|
|
|
cursor->wl.buffer = |
|
|
|
|
wl_shm_pool_create_buffer(pool, 0, |
|
|
|
|
image->width, |
|
|
|
|
image->height, |
|
|
|
|
stride, WL_SHM_FORMAT_ARGB8888); |
|
|
|
@ -426,9 +429,9 @@ void _glfwPlatformDestroyCursor(_GLFWcursor* cursor) |
|
|
|
|
|
|
|
|
|
void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor) |
|
|
|
|
{ |
|
|
|
|
struct wl_buffer *buffer; |
|
|
|
|
struct wl_cursor_image *image; |
|
|
|
|
struct wl_surface *surface = _glfw.wl.cursorSurface; |
|
|
|
|
struct wl_buffer* buffer; |
|
|
|
|
struct wl_cursor_image* image; |
|
|
|
|
struct wl_surface* surface = _glfw.wl.cursorSurface; |
|
|
|
|
|
|
|
|
|
if (!_glfw.wl.pointer) |
|
|
|
|
return; |
|
|
|
|