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): ...@@ -290,6 +290,17 @@ class PronterWindow(MainWindow, pronsole.pronsole):
def on_resize(self, event): def on_resize(self, event):
maximized = self.IsMaximized() maximized = self.IsMaximized()
self.set("last_window_maximized", maximized) 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(): if not maximized and not self.IsIconized():
size = self.GetClientSize() size = self.GetClientSize()
self.set("last_window_width", size[0]) self.set("last_window_width", size[0])
...@@ -297,7 +308,8 @@ class PronterWindow(MainWindow, pronsole.pronsole): ...@@ -297,7 +308,8 @@ class PronterWindow(MainWindow, pronsole.pronsole):
event.Skip() event.Skip()
def on_maximize(self, event): def on_maximize(self, event):
self.on_resize(event) self.set("last_window_maximized", self.IsMaximized())
event.Skip()
def on_exit(self, event): def on_exit(self, event):
self.Close() 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