Fixed Issue #425 (hide_window will try to show a destroyed window)
This commit is contained in:
parent
24f1503234
commit
c9540023f1
|
@ -40,6 +40,7 @@ class Window(Container, Gtk.Window):
|
||||||
title = None
|
title = None
|
||||||
isfullscreen = None
|
isfullscreen = None
|
||||||
ismaximised = None
|
ismaximised = None
|
||||||
|
isDestroyed = False
|
||||||
hidebound = None
|
hidebound = None
|
||||||
hidefunc = None
|
hidefunc = None
|
||||||
losefocus_time = 0
|
losefocus_time = 0
|
||||||
|
@ -302,30 +303,32 @@ class Window(Container, Gtk.Window):
|
||||||
terminal.close()
|
terminal.close()
|
||||||
self.cnxids.remove_all()
|
self.cnxids.remove_all()
|
||||||
self.terminator.deregister_window(self)
|
self.terminator.deregister_window(self)
|
||||||
|
self.isDestroyed = True
|
||||||
self.destroy()
|
self.destroy()
|
||||||
del(self)
|
del(self)
|
||||||
|
|
||||||
def on_hide_window(self, data=None):
|
def on_hide_window(self, data=None):
|
||||||
"""Handle a request to hide/show the window"""
|
"""Handle a request to hide/show the window"""
|
||||||
|
|
||||||
if not self.get_property('visible'):
|
if not self.isDestroyed:
|
||||||
#Don't show if window has just been hidden because of
|
if not self.get_property('visible'):
|
||||||
#lost focus
|
#Don't show if window has just been hidden because of
|
||||||
if (time.time() - self.losefocus_time < 0.1) and \
|
#lost focus
|
||||||
self.config['hide_on_lose_focus']:
|
if (time.time() - self.losefocus_time < 0.1) and \
|
||||||
return
|
self.config['hide_on_lose_focus']:
|
||||||
if self.position:
|
return
|
||||||
self.move(self.position[0], self.position[1])
|
if self.position:
|
||||||
self.show()
|
self.move(self.position[0], self.position[1])
|
||||||
self.grab_focus()
|
self.show()
|
||||||
try:
|
self.grab_focus()
|
||||||
t = GdkX11.x11_get_server_time(self.get_window())
|
try:
|
||||||
except (TypeError, AttributeError):
|
t = GdkX11.x11_get_server_time(self.get_window())
|
||||||
t = 0
|
except (TypeError, AttributeError):
|
||||||
self.get_window().focus(t)
|
t = 0
|
||||||
else:
|
self.get_window().focus(t)
|
||||||
self.position = self.get_position()
|
else:
|
||||||
self.hidefunc()
|
self.position = self.get_position()
|
||||||
|
self.hidefunc()
|
||||||
|
|
||||||
# pylint: disable-msg=W0613
|
# pylint: disable-msg=W0613
|
||||||
def on_window_state_changed(self, window, event):
|
def on_window_state_changed(self, window, event):
|
||||||
|
|
Loading…
Reference in New Issue