mirror of
https://github.com/glfw/glfw.git
synced 2024-11-13 14:03:52 +00:00
Moved to use X11 context manager.
This commit is contained in:
parent
32273c5d96
commit
26756b9ae1
@ -434,6 +434,7 @@ static GLboolean initDisplay(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();
|
||||||
|
|
||||||
// Find or create window manager atoms
|
// Find or create window manager atoms
|
||||||
_glfw.x11.WM_STATE = XInternAtom(_glfw.x11.display, "WM_STATE", False);
|
_glfw.x11.WM_STATE = XInternAtom(_glfw.x11.display, "WM_STATE", False);
|
||||||
|
@ -108,6 +108,7 @@ typedef struct _GLFWlibraryX11
|
|||||||
|
|
||||||
// Invisible cursor for hidden cursor mode
|
// Invisible cursor for hidden cursor mode
|
||||||
Cursor cursor;
|
Cursor cursor;
|
||||||
|
XContext context;
|
||||||
|
|
||||||
// Window manager atoms
|
// Window manager atoms
|
||||||
Atom WM_STATE;
|
Atom WM_STATE;
|
||||||
|
@ -154,6 +154,11 @@ static GLboolean createWindow(_GLFWwindow* window,
|
|||||||
(unsigned char*) &hints,
|
(unsigned char*) &hints,
|
||||||
sizeof(MotifWmHints) / sizeof(long));
|
sizeof(MotifWmHints) / sizeof(long));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
XSaveContext(_glfw.x11.display,
|
||||||
|
window->x11.handle,
|
||||||
|
_glfw.x11.context,
|
||||||
|
(XPointer) window);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window->monitor && !_glfw.x11.hasEWMH)
|
if (window->monitor && !_glfw.x11.hasEWMH)
|
||||||
@ -461,13 +466,15 @@ _GLFWwindow* _glfwFindWindowByHandle(Window handle)
|
|||||||
{
|
{
|
||||||
_GLFWwindow* window;
|
_GLFWwindow* window;
|
||||||
|
|
||||||
for (window = _glfw.windowListHead; window; window = window->next)
|
if (XFindContext(_glfw.x11.display,
|
||||||
|
handle,
|
||||||
|
_glfw.x11.context,
|
||||||
|
(XPointer*) &window) != 0)
|
||||||
{
|
{
|
||||||
if (window->x11.handle == handle)
|
return NULL;
|
||||||
return window;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return window;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Process the specified X event
|
// Process the specified X event
|
||||||
@ -897,6 +904,7 @@ void _glfwPlatformDestroyWindow(_GLFWwindow* window)
|
|||||||
|
|
||||||
if (window->x11.handle)
|
if (window->x11.handle)
|
||||||
{
|
{
|
||||||
|
XDeleteContext(_glfw.x11.display, window->x11.handle, _glfw.x11.context);
|
||||||
XUnmapWindow(_glfw.x11.display, window->x11.handle);
|
XUnmapWindow(_glfw.x11.display, window->x11.handle);
|
||||||
XDestroyWindow(_glfw.x11.display, window->x11.handle);
|
XDestroyWindow(_glfw.x11.display, window->x11.handle);
|
||||||
window->x11.handle = (Window) 0;
|
window->x11.handle = (Window) 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user