[kupfer: 39/67] ui: When compositing, be transparent (slightly) under the GtkEventBox too



commit 1cd4a89ffde9702b7fa6c73c4755e0303d77ee34
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date:   Wed Mar 16 22:49:03 2011 +0100

    ui: When compositing, be transparent (slightly) under the GtkEventBox too
    
    GtkEventBox draws its background by default so we need to draw over it
    to be able to use the alpha channel.

 kupfer/ui/browser.py |   20 +++++++++++++++-----
 1 files changed, 15 insertions(+), 5 deletions(-)
---
diff --git a/kupfer/ui/browser.py b/kupfer/ui/browser.py
index 45d24af..ebb9dff 100644
--- a/kupfer/ui/browser.py
+++ b/kupfer/ui/browser.py
@@ -307,18 +307,28 @@ class MatchView (gtk.Bin):
 		# set a clip region for the expose event
 		context.rectangle(event.area.x, event.area.y,
 		                  event.area.width, event.area.height)
-		context.clip()
+		scale = 1.0/2**16
+		# paint over GtkEventBox's default background
+		context.clip_preserve()
+		context.set_operator(cairo.OPERATOR_SOURCE)
+		normc = widget.style.bg[gtk.STATE_NORMAL]
+		if widget.get_toplevel().is_composited():
+			context.set_source_rgba(normc.red*scale,
+					normc.green*scale, normc.blue*scale, 0.8)
+		else:
+			context.set_source_rgba(normc.red*scale,
+					normc.green*scale, normc.blue*scale, 1.0)
+		context.fill()
+
 		make_rounded_rect(context, 0, 0, rect.width, rect.height, radius=15)
 		# Get the current selection color
 		newc = widget.style.bg[widget.get_state()]
-		scale = 1.0/2**16
 		context.set_operator(cairo.OPERATOR_OVER)
 		context.set_source_rgba(newc.red*scale,
-				newc.green*scale, newc.blue*scale, 0.7)
-		context.fill_preserve ()
+				newc.green*scale, newc.blue*scale, 0.9)
+		context.fill()
 		return False
 
-
 	def do_size_request (self, requisition):
 		requisition.width, requisition.height = self.__child.size_request ()
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]