From d1989ec4a6e751ecfb7de271d002f57f768eb17a Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Sat, 3 Jul 2010 20:00:04 +0100 Subject: [PATCH] When a window loses focus, update all the terminals within to show the inactive titlebar colours. Closes LP #576276 --- terminatorlib/terminal.py | 4 ++++ terminatorlib/titlebar.py | 6 ++++++ terminatorlib/window.py | 4 ++-- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/terminatorlib/terminal.py b/terminatorlib/terminal.py index 611e9a0e..85313a81 100755 --- a/terminatorlib/terminal.py +++ b/terminatorlib/terminal.py @@ -982,6 +982,10 @@ for %s (%s)' % (name, urlplugin.__class__.__name__)) """Inform other parts of the application when focus is received""" self.emit('focus-in') + def on_window_focus_out(self): + """Update our UI when the window loses focus""" + self.titlebar.update('window-focus-out') + def scrollbar_jump(self, position): """Move the scrollbar to a particular row""" self.scrollbar.set_value(position) diff --git a/terminatorlib/titlebar.py b/terminatorlib/titlebar.py index 1921535b..5f26b50d 100755 --- a/terminatorlib/titlebar.py +++ b/terminatorlib/titlebar.py @@ -127,7 +127,13 @@ class Titlebar(gtk.EventBox): default_bg = True group_fg = self.config['title_inactive_fg_color'] group_bg = self.config['title_inactive_bg_color'] + elif other == 'window-focus-out': + title_fg = self.config['title_inactive_fg_color'] + title_bg = self.config['title_inactive_bg_color'] + icon = '_receive_off' + default_bg = True else: + # We're the active terminal title_fg = self.config['title_transmit_fg_color'] title_bg = self.config['title_transmit_bg_color'] if terminator.groupsend == terminator.groupsend_type['all']: diff --git a/terminatorlib/window.py b/terminatorlib/window.py index 42c51b2f..88712ce0 100755 --- a/terminatorlib/window.py +++ b/terminatorlib/window.py @@ -186,8 +186,8 @@ class Window(Container, gtk.Window): def on_focus_out(self, window, event): """Focus has left the window""" - # FIXME: Cause the terminal titlebars to update here - pass + for terminal in self.get_visible_terminals(): + terminal.on_window_focus_out() def on_focus_in(self, window, event): """Focus has entered the window"""