fix up transparent background functioning

This commit is contained in:
Chris Jones 2010-01-21 20:36:18 +00:00
parent 7b0bb5818d
commit 356f9e90bf
1 changed files with 11 additions and 5 deletions

View File

@ -119,6 +119,8 @@ class Terminal(gtk.VBox):
if not hasattr(self.vte, "set_opacity") or \ if not hasattr(self.vte, "set_opacity") or \
not hasattr(self.vte, "is_composited"): not hasattr(self.vte, "is_composited"):
self.composite_support = False self.composite_support = False
else:
self.composite_support = True
self.vte.show() self.vte.show()
self.default_encoding = self.vte.get_encoding() self.default_encoding = self.vte.get_encoding()
@ -281,8 +283,7 @@ for %s (%s)' % (name, urlplugin.__class__.__name__))
lambda widget: self.vte.copy_clipboard()) lambda widget: self.vte.copy_clipboard())
if self.composite_support: if self.composite_support:
self.vte.connect('composited-changed', self.vte.connect('composited-changed', self.reconfigure)
self.on_composited_changed)
self.vte.connect('window-title-changed', lambda x: self.vte.connect('window-title-changed', lambda x:
self.emit('title-change', self.get_window_title())) self.emit('title-change', self.get_window_title()))
@ -557,16 +558,21 @@ for %s (%s)' % (name, urlplugin.__class__.__name__))
opacity = 65536 opacity = 65536
if background_type in ('image', 'transparent'): if background_type in ('image', 'transparent'):
self.vte.set_background_tint_color(gtk.gdk.color_parse(self.config['background_color'])) self.vte.set_background_tint_color(gtk.gdk.color_parse(self.config['background_color']))
self.vte.set_background_saturation(1 - saturation = 1.0 - float(self.config['background_darkness'])
(self.config['background_darkness'])) dbg('setting background saturation: %f' % saturation)
self.vte.set_background_saturation(saturation)
opacity = int(self.config['background_darkness'] * 65536) opacity = int(self.config['background_darkness'] * 65536)
else: else:
self.vte.set_background_saturation(1) self.vte.set_background_saturation(1)
if self.composite_support: if self.composite_support:
dbg('setting opacity: %d' % opacity)
self.vte.set_opacity(opacity) self.vte.set_opacity(opacity)
if self.config['background_type'] == 'transparent': if self.config['background_type'] == 'transparent' and \
self.config['enable_real_transparency'] == False:
self.vte.set_background_transparent(True) self.vte.set_background_transparent(True)
elif self.config['background_type'] != 'transparent':
self.vte.set_background_transparent(False)
self.vte.set_cursor_blinks(self.config['cursor_blink']) self.vte.set_cursor_blinks(self.config['cursor_blink'])