Skip to content

Commit

Permalink
#2372 on some platforms (ie: macos), we have to re-create the opengl …
Browse files Browse the repository at this point in the history
…context when the window is resized

git-svn-id: https://xpra.org/svn/Xpra/trunk@23441 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Aug 4, 2019
1 parent 2d4d6f1 commit 3f786cd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
13 changes: 11 additions & 2 deletions src/xpra/client/gl/gl_window_backing_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,9 @@
WEBP_YUV = envbool("XPRA_WEBP_YUV", True)
FORCE_CLONE = envbool("XPRA_OPENGL_FORCE_CLONE", False)
DRAW_REFRESH = envbool("XPRA_OPENGL_DRAW_REFRESH", False)
FBO_RESIZE = envbool("XPRA_OPENGL_FBO_RESIZE", not OSX)
FBO_RESIZE = envbool("XPRA_OPENGL_FBO_RESIZE", True)
FBO_RESIZE_DELAY = envint("XPRA_OPENGL_FBO_RESIZE_DELAY", 50)
CONTEXT_REINIT = envbool("XPRA_OPENGL_CONTEXT_REINIT", OSX)

CURSOR_IDLE_TIMEOUT = envint("XPRA_CURSOR_IDLE_TIMEOUT", 6)
TEXTURE_CURSOR = envbool("XPRA_OPENGL_TEXTURE_CURSOR", True)
Expand Down Expand Up @@ -249,7 +250,7 @@ def __init__(self, wid, window_alpha, pixel_depth=0):
self.last_present_fbo_error = None

WindowBackingBase.__init__(self, wid, window_alpha and self.HAS_ALPHA)
self.init_gl_config(window_alpha)
self.init_gl_config(self._alpha_enabled)
self.init_backing()
self.bit_depth = self.get_bit_depth(pixel_depth)
self.init_formats()
Expand Down Expand Up @@ -327,6 +328,10 @@ def init(self, ww, wh, bw, bh):
self.gl_setup = False
oldw, oldh = self.size
self.size = bw, bh
if CONTEXT_REINIT:
self.close_gl_config()
self.init_gl_config(self._alpha_enabled)
return
if FBO_RESIZE:
self.resize_fbo(oldw, oldh, bw, bh)

Expand Down Expand Up @@ -523,7 +528,11 @@ def init_fbo(self, texture_index, fbo, w, h, mag_filter):
glClear(GL_COLOR_BUFFER_BIT)


def close_gl_config(self):
pass

def close(self):
self.close_gl_config()
#This seems to cause problems, so we rely
#on destroying the context to clear textures and fbos...
#if self.offscreen_fbo is not None:
Expand Down
3 changes: 1 addition & 2 deletions src/xpra/client/gl/gtk_base/gl_drawing_area.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ def do_gl_show(self, _rect_count):
#glFlush was enough
pass

def close(self):
GLWindowBackingBase.close(self)
def close_gl_config(self):
c = self.context
if c:
self.context = None
Expand Down

0 comments on commit 3f786cd

Please sign in to comment.