Commit a4cc6b27 authored by Guillaume Seguin's avatar Guillaume Seguin

Add some ultra ugly workaround to get unmazimized state right

parent 716f4f91
......@@ -290,6 +290,17 @@ class PronterWindow(MainWindow, pronsole.pronsole):
def on_resize(self, event):
maximized = self.IsMaximized()
self.set("last_window_maximized", maximized)
# FIXME: Hack ! it seems IsMaximized() is not always up to date when
# getting this event during unmaximization, so let's compare the window
# size to the available screensize. Yes, it's horrible.
if maximized:
evtsz = event.GetSize()
display = wx.Display(wx.Display.GetFromWindow(self))
area = display.GetClientArea()
# Ugly ! add some extra -20 padding to ensure we are not missing
# something
if evtsz[0] < area[2] - 20 or evtsz[1] < area[3] - 20:
self.set("last_window_maximized", False)
if not maximized and not self.IsIconized():
size = self.GetClientSize()
self.set("last_window_width", size[0])
......@@ -297,7 +308,8 @@ class PronterWindow(MainWindow, pronsole.pronsole):
event.Skip()
def on_maximize(self, event):
self.on_resize(event)
self.set("last_window_maximized", self.IsMaximized())
event.Skip()
def on_exit(self, event):
self.Close()
......
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