mirror of
https://github.com/gwm17/glfw.git
synced 2024-11-29 21:48:52 -05:00
X11: Add dynamic loading of libXcursor
This commit is contained in:
parent
3f852c321f
commit
99e72830ea
|
@ -266,12 +266,10 @@ if (_GLFW_X11)
|
||||||
|
|
||||||
# Check for Xcursor
|
# Check for Xcursor
|
||||||
if (NOT X11_Xcursor_FOUND)
|
if (NOT X11_Xcursor_FOUND)
|
||||||
message(FATAL_ERROR "The Xcursor libraries and headers were not found")
|
message(FATAL_ERROR "The Xcursor headers were not found")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
list(APPEND glfw_INCLUDE_DIR "${X11_Xcursor_INCLUDE_PATH}")
|
list(APPEND glfw_INCLUDE_DIR "${X11_Xcursor_INCLUDE_PATH}")
|
||||||
list(APPEND glfw_LIBRARIES "${X11_Xcursor_LIB}")
|
|
||||||
list(APPEND glfw_PKG_DEPS "xcursor")
|
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -593,6 +593,17 @@ static GLFWbool initExtensions(void)
|
||||||
RROutputChangeNotifyMask);
|
RROutputChangeNotifyMask);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_glfw.x11.xcursor.handle = dlopen("libXcursor.so.1", RTLD_LAZY | RTLD_GLOBAL);
|
||||||
|
if (_glfw.x11.xcursor.handle)
|
||||||
|
{
|
||||||
|
_glfw.x11.xcursor.ImageCreate = (PFN_XcursorImageCreate)
|
||||||
|
dlsym(_glfw.x11.xcursor.handle, "XcursorImageCreate");
|
||||||
|
_glfw.x11.xcursor.ImageDestroy = (PFN_XcursorImageDestroy)
|
||||||
|
dlsym(_glfw.x11.xcursor.handle, "XcursorImageDestroy");
|
||||||
|
_glfw.x11.xcursor.ImageLoadCursor = (PFN_XcursorImageLoadCursor)
|
||||||
|
dlsym(_glfw.x11.xcursor.handle, "XcursorImageLoadCursor");
|
||||||
|
}
|
||||||
|
|
||||||
_glfw.x11.xinerama.handle = dlopen("libXinerama.so.1", RTLD_LAZY | RTLD_GLOBAL);
|
_glfw.x11.xinerama.handle = dlopen("libXinerama.so.1", RTLD_LAZY | RTLD_GLOBAL);
|
||||||
if (_glfw.x11.xinerama.handle)
|
if (_glfw.x11.xinerama.handle)
|
||||||
{
|
{
|
||||||
|
@ -782,6 +793,9 @@ Cursor _glfwCreateCursorX11(const GLFWimage* image, int xhot, int yhot)
|
||||||
int i;
|
int i;
|
||||||
Cursor cursor;
|
Cursor cursor;
|
||||||
|
|
||||||
|
if (!_glfw.x11.xcursor.handle)
|
||||||
|
return None;
|
||||||
|
|
||||||
XcursorImage* native = XcursorImageCreate(image->width, image->height);
|
XcursorImage* native = XcursorImageCreate(image->width, image->height);
|
||||||
if (native == NULL)
|
if (native == NULL)
|
||||||
return None;
|
return None;
|
||||||
|
@ -894,6 +908,12 @@ void _glfwPlatformTerminate(void)
|
||||||
_glfw.x11.randr.handle = NULL;
|
_glfw.x11.randr.handle = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_glfw.x11.xcursor.handle)
|
||||||
|
{
|
||||||
|
dlclose(_glfw.x11.xcursor.handle);
|
||||||
|
_glfw.x11.xcursor.handle = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (_glfw.x11.xinerama.handle)
|
if (_glfw.x11.xinerama.handle)
|
||||||
{
|
{
|
||||||
dlclose(_glfw.x11.xinerama.handle);
|
dlclose(_glfw.x11.xinerama.handle);
|
||||||
|
|
|
@ -82,6 +82,13 @@ typedef int (* PFN_XRRUpdateConfiguration)(XEvent*);
|
||||||
#define XRRSetCrtcGamma _glfw.x11.randr.SetCrtcGamma
|
#define XRRSetCrtcGamma _glfw.x11.randr.SetCrtcGamma
|
||||||
#define XRRUpdateConfiguration _glfw.x11.randr.UpdateConfiguration
|
#define XRRUpdateConfiguration _glfw.x11.randr.UpdateConfiguration
|
||||||
|
|
||||||
|
typedef XcursorImage* (* PFN_XcursorImageCreate)(int,int);
|
||||||
|
typedef void (* PFN_XcursorImageDestroy)(XcursorImage*);
|
||||||
|
typedef Cursor (* PFN_XcursorImageLoadCursor)(Display*,const XcursorImage*);
|
||||||
|
#define XcursorImageCreate _glfw.x11.xcursor.ImageCreate
|
||||||
|
#define XcursorImageDestroy _glfw.x11.xcursor.ImageDestroy
|
||||||
|
#define XcursorImageLoadCursor _glfw.x11.xcursor.ImageLoadCursor
|
||||||
|
|
||||||
typedef Bool (* PFN_XineramaIsActive)(Display*);
|
typedef Bool (* PFN_XineramaIsActive)(Display*);
|
||||||
typedef Bool (* PFN_XineramaQueryExtension)(Display*,int*,int*);
|
typedef Bool (* PFN_XineramaQueryExtension)(Display*,int*,int*);
|
||||||
typedef XineramaScreenInfo* (* PFN_XineramaQueryScreens)(Display*,int*);
|
typedef XineramaScreenInfo* (* PFN_XineramaQueryScreens)(Display*,int*);
|
||||||
|
@ -319,6 +326,13 @@ typedef struct _GLFWlibraryX11
|
||||||
Atom format;
|
Atom format;
|
||||||
} xdnd;
|
} xdnd;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
void* handle;
|
||||||
|
PFN_XcursorImageCreate ImageCreate;
|
||||||
|
PFN_XcursorImageDestroy ImageDestroy;
|
||||||
|
PFN_XcursorImageLoadCursor ImageLoadCursor;
|
||||||
|
} xcursor;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
GLFWbool available;
|
GLFWbool available;
|
||||||
void* handle;
|
void* handle;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user