Ticket #110: 0002-Add-support-for-real-ARGB-transparency-when-availa.patch

File 0002-Add-support-for-real-ARGB-transparency-when-availa.patch, 2.7 KB (added by SnapShot, 3 years ago)
  • src/guake.py

    From c55755f90b5e57dca19c8a4f5820ba2bd311b8d5 Mon Sep 17 00:00:00 2001
    From: Aleksandar Krsteski <alekrsteski@gmail.com>
    Date: Thu, 19 Feb 2009 03:52:51 +0100
    Subject: [PATCH 2/2] Add support for real (ARGB) transparency when available.
    
    Guake by default will use real transparency with alpha channel if
    available. In preferences window it uses Opacity slider to control the
    terminal transparency which is only visible when background image is not
    set.
    
    Signed-off-by: Aleksandar Krsteski <alekrsteski@gmail.com>
    ---
     src/guake.py |   23 +++++++++++++++++++++--
     1 files changed, 21 insertions(+), 2 deletions(-)
    
    diff --git a/src/guake.py b/src/guake.py
    index 523bd7b..1f6df18 100644
    a b  
    248248                i.set_background_image_file(image) 
    249249                i.set_background_transparent(False) 
    250250            else: 
    251                 i.set_background_transparent(True) 
     251                """We need to clear the image if it's not set but there is 
     252                a bug in vte python bidnings which doesn't allow None to be 
     253                passed to set_background_image (C GTK function expects NULL). 
     254                The user will need to restart Guake after clearing the image. 
     255                i.set_background_image(None) 
     256                """ 
     257                if self.guake.has_argb: 
     258                    i.set_background_transparent(False) 
     259                else: 
     260                    i.set_background_transparent(True) 
    252261 
    253262    def bgopacity_changed(self, client, connection_id, entry, data): 
    254263        """If the gconf var style/background/opacity be changed, this 
     
    258267        opacity = entry.value.get_int() 
    259268        for i in self.guake.term_list: 
    260269            i.set_background_saturation(opacity / 100.0) 
    261             i.set_opacity(opacity) 
     270            if self.guake.has_argb: 
     271                i.set_opacity(int(opacity / 100.0 * 65535)) 
    262272 
    263273    def backspace_changed(self, client, connection_id, entry, data): 
    264274        """If the gconf var compat_backspace be changed, this method 
     
    478488        self.mainframe = self.get_widget('mainframe') 
    479489        self.resizer = self.get_widget('resizer') 
    480490 
     491        # check and set ARGB for real transparency 
     492        screen = self.window.get_screen() 
     493        colormap = screen.get_rgba_colormap() 
     494        if colormap != None and screen.is_composited(): 
     495            self.window.set_colormap(colormap) 
     496            self.has_argb = True 
     497        else: 
     498            self.has_argb = False 
     499 
    481500        # List of vte.Terminal widgets, it will be useful when needed 
    482501        # to get a widget by the current page in self.notebook 
    483502        self.term_list = []