1
0
Fork 0
mirror of https://github.com/gwm17/glfw.git synced 2024-11-23 02:38:52 -05:00

X11: Add IPC helper window

This commit is contained in:
Camilla Berglund 2015-10-24 22:46:56 +02:00 committed by Camilla Berglund
parent fafe1732b5
commit 3b3a1390ad
2 changed files with 24 additions and 2 deletions

View File

@ -630,6 +630,20 @@ static Cursor createHiddenCursor(void)
return _glfwCreateCursorX11(&image, 0, 0);
}
// Create a helper window for IPC
//
static Window createHelperWindow(void)
{
XSetWindowAttributes wa;
wa.event_mask = PropertyChangeMask;
return XCreateWindow(_glfw.x11.display, _glfw.x11.root,
0, 0, 1, 1, 0, 0,
InputOnly,
DefaultVisual(_glfw.x11.display, _glfw.x11.screen),
CWEventMask, &wa);
}
// X error handler
//
static int errorHandler(Display *display, XErrorEvent* event)
@ -741,12 +755,12 @@ int _glfwPlatformInit(void)
_glfw.x11.screen = DefaultScreen(_glfw.x11.display);
_glfw.x11.root = RootWindow(_glfw.x11.display, _glfw.x11.screen);
_glfw.x11.context = XUniqueContext();
_glfw.x11.helperWindowHandle = createHelperWindow();
_glfw.x11.hiddenCursorHandle = createHiddenCursor();
if (!initExtensions())
return GLFW_FALSE;
_glfw.x11.hiddenCursorHandle = createHiddenCursor();
if (XSupportsLocale())
{
XSetLocaleModifiers("");
@ -781,6 +795,12 @@ void _glfwPlatformTerminate(void)
_glfw.x11.x11xcb.handle = NULL;
}
if (_glfw.x11.helperWindowHandle)
{
XDestroyWindow(_glfw.x11.display, _glfw.x11.helperWindowHandle);
_glfw.x11.helperWindowHandle = None;
}
if (_glfw.x11.hiddenCursorHandle)
{
XFreeCursor(_glfw.x11.display, _glfw.x11.hiddenCursorHandle);

View File

@ -136,6 +136,8 @@ typedef struct _GLFWlibraryX11
int screen;
Window root;
// Helper window for IPC
Window helperWindowHandle;
// Invisible cursor for hidden cursor mode
Cursor hiddenCursorHandle;
// Context for mapping window XIDs to _GLFWwindow pointers