Wayland: When swapping buffers in response to a configure event ensure the window is the current context otherwise the swap fails

The swap failing will mean the buffer is not attached which might cause
issues with some compsitors.
This commit is contained in:
Kovid Goyal 2022-09-10 10:22:09 +05:30
parent 6741ac2087
commit 1e7a11b278
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

4
glfw/wl_window.c vendored
View File

@ -498,7 +498,11 @@ static void xdgSurfaceHandleConfigure(void* data,
window->wl.surface_configured_once = true;
// this will attach the buffer to the surface, the client is responsible for clearing the buffer to an appropriate blank
window->swaps_disallowed = false;
GLFWwindow *current = glfwGetCurrentContext();
bool context_is_current = ((_GLFWwindow*)current)->id == window->id;
if (!context_is_current) glfwMakeContextCurrent(data);
window->context.swapBuffers(window);
if (!context_is_current) glfwMakeContextCurrent(current);
if (!width && !height && !new_states && !window->wl.decorations.serverSide && getenv("XAUTHORITY") && strstr(getenv("XAUTHORITY"), "mutter")) {
// https://github.com/kovidgoyal/kitty/issues/4802