From a06f2808fbfc9471990cd264da3b2f387c8b4526 Mon Sep 17 00:00:00 2001 From: Juliano Fischer Naves Date: Mon, 19 Jun 2017 21:12:11 -0400 Subject: [PATCH] Prevent terminator hiding due to right click. Refer to bug #843674 --- terminatorlib/terminal.py | 2 ++ terminatorlib/window.py | 15 ++++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/terminatorlib/terminal.py b/terminatorlib/terminal.py index 0b0a8b6b..9c91bf0f 100755 --- a/terminatorlib/terminal.py +++ b/terminatorlib/terminal.py @@ -175,6 +175,7 @@ class Terminal(Gtk.VBox): os.putenv('http_proxy', self.config['http_proxy']) self.reconfigure() self.vte.set_size(80, 24) + self.preventHide = False def get_vte(self): """This simply returns the vte widget we are using""" @@ -942,6 +943,7 @@ class Terminal(Gtk.VBox): # plus either the app is not interested in mouse events or Shift is pressed if event.get_state() & Gdk.ModifierType.CONTROL_MASK == 0: if event.get_state() & Gdk.ModifierType.SHIFT_MASK == 0: + self.preventHide = True if not Vte.Terminal.do_button_press_event(self.vte, event): right_click[0](*right_click[1]) else: diff --git a/terminatorlib/window.py b/terminatorlib/window.py index 0e8ed02e..ee9df57b 100755 --- a/terminatorlib/window.py +++ b/terminatorlib/window.py @@ -222,13 +222,22 @@ class Window(Container, Gtk.Window): def on_focus_out(self, window, event): """Focus has left the window""" + preventHide = False for terminal in self.get_visible_terminals(): + if terminal.preventHide: + preventHide = True + terminal.preventHide = False + terminal.on_window_focus_out() self.losefocus_time = time.time() - if self.config['hide_on_lose_focus'] and self.get_property('visible'): - self.position = self.get_position() - self.hidefunc() + + if not preventHide: + if self.config['hide_on_lose_focus'] and self.get_property('visible'): + self.position = self.get_position() + self.hidefunc() + else: + preventHide = False def on_focus_in(self, window, event): """Focus has entered the window"""