Fix hide on lose focus due to our own menus and Preferences (Juliano Fischer Naves + Steve Boddy)

This commit is contained in:
Stephen Boddy 2017-06-24 04:02:38 +02:00
commit 3e9f7742d5
3 changed files with 19 additions and 3 deletions

View File

@ -33,6 +33,8 @@ class PrefsEditor:
plugins = None
keybindings = None
window = None
calling_window = None
term = None
builder = None
layouteditor = None
previous_layout_selection = None
@ -171,6 +173,8 @@ class PrefsEditor:
self.config = config.Config()
self.config.base.reload()
self.term = term
self.calling_window = self.term.get_toplevel()
self.calling_window.preventHide = True
self.builder = Gtk.Builder()
self.builder.set_translation_domain(APP_NAME)
self.keybindings = Keybindings()
@ -212,6 +216,7 @@ class PrefsEditor:
terminator = Terminator()
terminator.reconfigure()
self.window.destroy()
self.calling_window.preventHide = False
del(self)
def set_values(self):

View File

@ -842,6 +842,8 @@ class Terminal(Gtk.VBox):
elif event.type == Gdk.EventType.BUTTON_PRESS:
# Single Click gives popup
dbg('on_group_button_press: group menu popup')
window = self.get_toplevel()
window.preventHide = True
self.create_popup_group_menu(widget, event)
return True
else:
@ -982,6 +984,8 @@ class Terminal(Gtk.VBox):
def popup_menu(self, widget, event=None):
"""Display the context menu"""
window = self.get_toplevel()
window.preventHide = True
menu = TerminalPopupMenu(self)
menu.show(widget, event)

View File

@ -42,6 +42,7 @@ class Window(Container, Gtk.Window):
ignore_startup_show = None
set_pos_by_ratio = None
last_active_term = None
preventHide = None
zoom_data = None
@ -75,6 +76,8 @@ class Window(Container, Gtk.Window):
self.title = WindowTitle(self)
self.title.update()
self.preventHide = False
options = self.config.options_get()
if options:
if options.forcedtitle:
@ -226,6 +229,10 @@ class Window(Container, Gtk.Window):
terminal.on_window_focus_out()
self.losefocus_time = time.time()
if self.preventHide:
self.preventHide = False
else:
if self.config['hide_on_lose_focus'] and self.get_property('visible'):
self.position = self.get_position()
self.hidefunc()