Skip to content

Commit

Permalink
Skip on_resize callback if window is minimized (iconified)
Browse files Browse the repository at this point in the history
  • Loading branch information
romanroibu committed Sep 14, 2020
1 parent 01e1917 commit bd95f36
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions pupil_src/launchables/eye.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit bd95f36

Please sign in to comment.