[pyclutter] examples: Show how to use the ClutterX11 API
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pyclutter] examples: Show how to use the ClutterX11 API
- Date: Thu, 30 Apr 2015 12:19:17 +0000 (UTC)
commit 6a5e78e5325aebaff046af5748623005cd370ecd
Author: Emmanuele Bassi <ebassi gnome org>
Date: Thu Apr 30 13:17:20 2015 +0100
examples: Show how to use the ClutterX11 API
The rounded rectangle example tries to use a transparent stage.
The default backend on Linux is the GDK one, if enabled, and that
automatically uses an ARGB visual when a compositor is running; the
X11 backend, on the other hand, needs an explicit call to enable it.
examples/rounded-rectangle.py | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/examples/rounded-rectangle.py b/examples/rounded-rectangle.py
index 480ccb8..eb1c062 100644
--- a/examples/rounded-rectangle.py
+++ b/examples/rounded-rectangle.py
@@ -3,6 +3,15 @@ import cairo
from gi.repository import GObject
from gi.repository import Clutter
+# Use an ARGB visual on X11; we need to do this before initializing
+# Clutter, but only if the X11 API is available
+try:
+ from gi.repository import ClutterX11
+ ClutterX11.set_use_argb_visual(True)
+except ImportError:
+ # No ClutterX11 available
+ pass
+
# The code for the rounded rectangle drawing is taken from the
# Cairo documentation
def draw_content(canvas, cr, surface_width, surface_height):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]