Commit d76b9551 authored by Guillaume Seguin's avatar Guillaume Seguin

Skip size/reshape events in glpanel when frozen/too small

parent ce9c26e4
...@@ -69,6 +69,9 @@ class wxGLPanel(wx.Panel): ...@@ -69,6 +69,9 @@ class wxGLPanel(wx.Panel):
def processSizeEvent(self, event): def processSizeEvent(self, event):
'''Process the resize event.''' '''Process the resize event.'''
if self.IsFrozen():
event.Skip()
return
if (wx.VERSION > (2, 9) and self.canvas.IsShownOnScreen()) or self.canvas.GetContext(): if (wx.VERSION > (2, 9) and self.canvas.IsShownOnScreen()) or self.canvas.GetContext():
# Make sure the frame is shown before calling SetCurrent. # Make sure the frame is shown before calling SetCurrent.
self.canvas.SetCurrent(self.context) self.canvas.SetCurrent(self.context)
...@@ -121,6 +124,8 @@ class wxGLPanel(wx.Panel): ...@@ -121,6 +124,8 @@ class wxGLPanel(wx.Panel):
size = self.GetClientSize() size = self.GetClientSize()
oldwidth, oldheight = self.width, self.height oldwidth, oldheight = self.width, self.height
width, height = size.width, size.height width, height = size.width, size.height
if width < 1 or height < 1:
return
self.width = max(float(width), 1.0) self.width = max(float(width), 1.0)
self.height = max(float(height), 1.0) self.height = max(float(height), 1.0)
self.OnInitGL(call_reshape = False) self.OnInitGL(call_reshape = False)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment