Skip to content

Commit

Permalink
X11: Ensure repainting still works after destorying a GL context
Browse files Browse the repository at this point in the history
On Linux, repaints are only issued if the number of received SHM
completion events matches the number of events initiated with
`xShmPutImage`.

Previously, destroying a GL context was calling `XSync (display, True)`
which cleared the event queue. Sometimes, this would cause an 'SHM
Completion Event' to be removed from the queue. This meant that the
number of received events would never match the number of initiated
events, and repainting would stop indefinitely.

By calling `XSync (display, False)` instead, we ensure that pending
events are kept in the queue, so any pending SHM completion event will
be found as usual during the next repaint timer callback.
  • Loading branch information
reuk committed Feb 18, 2021
1 parent c6280f7 commit a31a4dc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion modules/juce_opengl/native/juce_OpenGL_linux_X11.h
Expand Up @@ -135,7 +135,7 @@ class OpenGLContext::NativeContext
XWindowSystemUtilities::ScopedXLock xLock;
X11Symbols::getInstance()->xUnmapWindow (display, embeddedWindow);
X11Symbols::getInstance()->xDestroyWindow (display, embeddedWindow);
X11Symbols::getInstance()->xSync (display, True);
X11Symbols::getInstance()->xSync (display, False);
}
}

Expand Down

0 comments on commit a31a4dc

Please sign in to comment.