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

View File

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

View File

@ -42,6 +42,7 @@ class Window(Container, Gtk.Window):
ignore_startup_show = None ignore_startup_show = None
set_pos_by_ratio = None set_pos_by_ratio = None
last_active_term = None last_active_term = None
preventHide = None
zoom_data = None zoom_data = None
@ -74,6 +75,8 @@ class Window(Container, Gtk.Window):
self.title = WindowTitle(self) self.title = WindowTitle(self)
self.title.update() self.title.update()
self.preventHide = False
options = self.config.options_get() options = self.config.options_get()
if options: if options:
@ -226,9 +229,13 @@ class Window(Container, Gtk.Window):
terminal.on_window_focus_out() terminal.on_window_focus_out()
self.losefocus_time = time.time() self.losefocus_time = time.time()
if self.config['hide_on_lose_focus'] and self.get_property('visible'):
self.position = self.get_position() if self.preventHide:
self.hidefunc() self.preventHide = False
else:
if self.config['hide_on_lose_focus'] and self.get_property('visible'):
self.position = self.get_position()
self.hidefunc()
def on_focus_in(self, window, event): def on_focus_in(self, window, event):
"""Focus has entered the window""" """Focus has entered the window"""