Commit: f34cceaceb364d354672d1bce6d97f943eccc53d Author: Christian Rauch Date: Mon Jul 12 23:28:41 2021 +0100 Branches: wayland https://developer.blender.org/rBf34cceaceb364d354672d1bce6d97f943eccc53d
GHOST/wayland: create temporary file manually for older kernel versions =================================================================== M intern/ghost/intern/GHOST_SystemWayland.cpp =================================================================== diff --git a/intern/ghost/intern/GHOST_SystemWayland.cpp b/intern/ghost/intern/GHOST_SystemWayland.cpp index 75a80de983d..4ed8241d5b1 100644 --- a/intern/ghost/intern/GHOST_SystemWayland.cpp +++ b/intern/ghost/intern/GHOST_SystemWayland.cpp @@ -49,6 +49,7 @@ #include <fcntl.h> #include <sys/mman.h> #include <unistd.h> +#include <linux/version.h> #include <cstring> @@ -1804,8 +1805,22 @@ GHOST_TSuccess GHOST_SystemWayland::setCustomCursorShape(uint8_t *bitmap, static const int32_t stride = sizex * 4; /* ARGB */ cursor->file_buffer->size = size_t(stride * sizey); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0) const int fd = memfd_create("blender-cursor-custom", MFD_CLOEXEC | MFD_ALLOW_SEALING); fcntl(fd, F_ADD_SEALS, F_SEAL_SHRINK); +#else + char *tmpname; + asprintf(&tmpname, "%s/%s", getenv("XDG_RUNTIME_DIR"), "blender-XXXXXX"); + const int fd = mkostemp(tmpname, O_CLOEXEC); + if (fd >= 0) { + unlink(tmpname); + } + free(tmpname); + if (fd < 0) { + return GHOST_kFailure; + } +#endif + posix_fallocate(fd, 0, int32_t(cursor->file_buffer->size)); cursor->file_buffer->data = mmap( _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs