def _recreate(self, changes): # If flipping to/from fullscreen and using override_redirect (we # always are, _NET_WM_FULLSCREEN doesn't work), need to recreate the # window. # # A possible improvement could be to just hide the top window, # destroy the GLX window, and reshow it again when leaving fullscreen. # This would prevent the floating window from being moved by the # WM. if 'fullscreen' in changes or 'resizable' in changes: # clear out the GLX context self.switch_to() gl.glFlush() glx.glXMakeCurrent(self._x_display, 0, None) if self._glx_window: glx.glXDestroyWindow(self._x_display, self._glx_window) xlib.XDestroyWindow(self._x_display, self._window) self._glx_window = None self._window = None self._mapped = False # TODO: detect state loss only by examining context share. if 'context' in changes: self._lost_context = True self._lost_context_state = True self._create()
def destroy(self): super(XlibContext13, self).destroy() if self.glx_window: glx.glXDestroyWindow(self.config.display._display, self.glx_window) self.glx_window = None if self.glx_context: glx.glXDestroyContext(self.x_display, self.glx_context) self.glx_context = None
def detach(self): if not self.canvas: return self.set_current() gl.glFlush() # needs to be in try/except? super(XlibContext13, self).detach() glx.glXMakeContextCurrent(self.x_display, 0, 0, None) if self.glx_window: glx.glXDestroyWindow(self.x_display, self.glx_window) self.glx_window = None
def close(self): # clear out the GLX context. Can fail if current context already # destroyed (on exit, say). try: gl.glFlush() except gl.GLException: pass glx.glXMakeCurrent(self._x_display, 0, None) self._unmap() if self._glx_window: glx.glXDestroyWindow(self._x_display, self._glx_window) if self._window: xlib.XDestroyWindow(self._x_display, self._window) self._window = None self._glx_window = None
def close(self): # clear out the GLX context. Can fail if current context already # destroyed (on exit, say). try: gl.glFlush() except gl.GLException: pass glx.glXMakeCurrent(self._x_display, 0, None) self._unmap() if self._glx_window: glx.glXDestroyWindow(self._x_display, self._glx_window) if self._window: xlib.XDestroyWindow(self._x_display, self._window) self._window = None self._glx_window = None if _have_utf8: xlib.XDestroyIC(self._x_ic) xlib.XCloseIM(self._x_im)