mirror of
https://github.com/glfw/glfw.git
synced 2024-11-22 13:04:35 +00:00
X11: Add IPC helper window
This commit is contained in:
parent
fafe1732b5
commit
3b3a1390ad
@ -630,6 +630,20 @@ static Cursor createHiddenCursor(void)
|
|||||||
return _glfwCreateCursorX11(&image, 0, 0);
|
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
|
// X error handler
|
||||||
//
|
//
|
||||||
static int errorHandler(Display *display, XErrorEvent* event)
|
static int errorHandler(Display *display, XErrorEvent* event)
|
||||||
@ -741,12 +755,12 @@ int _glfwPlatformInit(void)
|
|||||||
_glfw.x11.screen = DefaultScreen(_glfw.x11.display);
|
_glfw.x11.screen = DefaultScreen(_glfw.x11.display);
|
||||||
_glfw.x11.root = RootWindow(_glfw.x11.display, _glfw.x11.screen);
|
_glfw.x11.root = RootWindow(_glfw.x11.display, _glfw.x11.screen);
|
||||||
_glfw.x11.context = XUniqueContext();
|
_glfw.x11.context = XUniqueContext();
|
||||||
|
_glfw.x11.helperWindowHandle = createHelperWindow();
|
||||||
|
_glfw.x11.hiddenCursorHandle = createHiddenCursor();
|
||||||
|
|
||||||
if (!initExtensions())
|
if (!initExtensions())
|
||||||
return GLFW_FALSE;
|
return GLFW_FALSE;
|
||||||
|
|
||||||
_glfw.x11.hiddenCursorHandle = createHiddenCursor();
|
|
||||||
|
|
||||||
if (XSupportsLocale())
|
if (XSupportsLocale())
|
||||||
{
|
{
|
||||||
XSetLocaleModifiers("");
|
XSetLocaleModifiers("");
|
||||||
@ -781,6 +795,12 @@ void _glfwPlatformTerminate(void)
|
|||||||
_glfw.x11.x11xcb.handle = NULL;
|
_glfw.x11.x11xcb.handle = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_glfw.x11.helperWindowHandle)
|
||||||
|
{
|
||||||
|
XDestroyWindow(_glfw.x11.display, _glfw.x11.helperWindowHandle);
|
||||||
|
_glfw.x11.helperWindowHandle = None;
|
||||||
|
}
|
||||||
|
|
||||||
if (_glfw.x11.hiddenCursorHandle)
|
if (_glfw.x11.hiddenCursorHandle)
|
||||||
{
|
{
|
||||||
XFreeCursor(_glfw.x11.display, _glfw.x11.hiddenCursorHandle);
|
XFreeCursor(_glfw.x11.display, _glfw.x11.hiddenCursorHandle);
|
||||||
|
@ -136,6 +136,8 @@ typedef struct _GLFWlibraryX11
|
|||||||
int screen;
|
int screen;
|
||||||
Window root;
|
Window root;
|
||||||
|
|
||||||
|
// Helper window for IPC
|
||||||
|
Window helperWindowHandle;
|
||||||
// Invisible cursor for hidden cursor mode
|
// Invisible cursor for hidden cursor mode
|
||||||
Cursor hiddenCursorHandle;
|
Cursor hiddenCursorHandle;
|
||||||
// Context for mapping window XIDs to _GLFWwindow pointers
|
// Context for mapping window XIDs to _GLFWwindow pointers
|
||||||
|
Loading…
Reference in New Issue
Block a user