mirror of
https://github.com/glfw/glfw.git
synced 2024-11-15 02:34:36 +00:00
Hooks to allow serving non-text selections
This commit is contained in:
parent
b35641f4a3
commit
f1f869acf7
@ -442,6 +442,13 @@ GLFWAPI void glfwSetX11SelectionString(const char* string);
|
|||||||
* @ingroup native
|
* @ingroup native
|
||||||
*/
|
*/
|
||||||
GLFWAPI const char* glfwGetX11SelectionString(void);
|
GLFWAPI const char* glfwGetX11SelectionString(void);
|
||||||
|
|
||||||
|
#include <X11/Xlib.h>
|
||||||
|
extern void (*handleSelectionRequest)(XEvent*);
|
||||||
|
void (*getSelectionRequestHandler(void))(XEvent*);
|
||||||
|
void setSelectionRequestHandler(void (*handler)(XEvent*));
|
||||||
|
Display* getGLFWDisplay(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(GLFW_EXPOSE_NATIVE_GLX)
|
#if defined(GLFW_EXPOSE_NATIVE_GLX)
|
||||||
|
@ -1314,6 +1314,8 @@ GLFWbool _glfwConnectX11(int platformID, _GLFWplatform* platform)
|
|||||||
_glfw.x11.xlib.handle = module;
|
_glfw.x11.xlib.handle = module;
|
||||||
|
|
||||||
*platform = x11;
|
*platform = x11;
|
||||||
|
|
||||||
|
handleSelectionRequest = handleSelectionRequest_;
|
||||||
return GLFW_TRUE;
|
return GLFW_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -896,6 +896,8 @@ typedef struct _GLFWcursorX11
|
|||||||
Cursor handle;
|
Cursor handle;
|
||||||
} _GLFWcursorX11;
|
} _GLFWcursorX11;
|
||||||
|
|
||||||
|
extern void (*handleSelectionRequest)(XEvent*);
|
||||||
|
void handleSelectionRequest_(XEvent* event);
|
||||||
|
|
||||||
GLFWbool _glfwConnectX11(int platformID, _GLFWplatform* platform);
|
GLFWbool _glfwConnectX11(int platformID, _GLFWplatform* platform);
|
||||||
int _glfwInitX11(void);
|
int _glfwInitX11(void);
|
||||||
|
@ -921,7 +921,8 @@ static Atom writeTargetToProperty(const XSelectionRequestEvent* request)
|
|||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handleSelectionRequest(XEvent* event)
|
void (*handleSelectionRequest)(XEvent*);
|
||||||
|
void handleSelectionRequest_(XEvent* event)
|
||||||
{
|
{
|
||||||
const XSelectionRequestEvent* request = &event->xselectionrequest;
|
const XSelectionRequestEvent* request = &event->xselectionrequest;
|
||||||
|
|
||||||
@ -3356,6 +3357,15 @@ GLFWAPI const char* glfwGetX11SelectionString(void)
|
|||||||
|
|
||||||
return getSelectionString(_glfw.x11.PRIMARY);
|
return getSelectionString(_glfw.x11.PRIMARY);
|
||||||
}
|
}
|
||||||
|
void (*getSelectionRequestHandler(void))(XEvent*) {
|
||||||
|
return handleSelectionRequest;
|
||||||
|
}
|
||||||
|
void setSelectionRequestHandler(void (*handler)(XEvent*)) {
|
||||||
|
handleSelectionRequest = handler;
|
||||||
|
}
|
||||||
|
Display* getGLFWDisplay(void) {
|
||||||
|
return _glfw.x11.display;
|
||||||
|
}
|
||||||
|
|
||||||
#endif // _GLFW_X11
|
#endif // _GLFW_X11
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user