From bd95f361b6841f1f0faaa1bd586b96aa7b4c7e7f Mon Sep 17 00:00:00 2001 From: Roman Roibu Date: Mon, 14 Sep 2020 13:14:25 +0200 Subject: [PATCH] Skip on_resize callback if window is minimized (iconified) --- pupil_src/launchables/eye.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/pupil_src/launchables/eye.py b/pupil_src/launchables/eye.py index 64bb454b15..6df8f7f1b2 100644 --- a/pupil_src/launchables/eye.py +++ b/pupil_src/launchables/eye.py @@ -290,14 +290,15 @@ def on_resize(window, w, h): nonlocal window_size nonlocal content_scale - framebuffer_size = glfw.glfwGetFramebufferSize(window) - is_minimized = any(c <= 0 for c in framebuffer_size) - - if not is_minimized: - # Always clear buffers on resize to make sure that there are no overlapping - # artifacts from previous frames. - gl_utils.glClear(gl_utils.GL_COLOR_BUFFER_BIT) - gl_utils.glClearColor(0, 0, 0, 1) + is_minimized = bool(glfw.glfwGetWindowAttrib(window, glfw.GLFW_ICONIFIED)) + + if is_minimized: + return + + # Always clear buffers on resize to make sure that there are no overlapping + # artifacts from previous frames. + gl_utils.glClear(gl_utils.GL_COLOR_BUFFER_BIT) + gl_utils.glClearColor(0, 0, 0, 1) active_window = glfw.glfwGetCurrentContext() glfw.glfwMakeContextCurrent(window)