[maemo-commits] [maemo-commits] r18950 - in projects/haf/trunk/clutter0.8: clutter/eglx clutter/x11 debian

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Wed Jul 22 16:27:10 EEST 2009
Author: gw
Date: 2009-07-22 16:27:06 +0300 (Wed, 22 Jul 2009)
New Revision: 18950

Modified:
   projects/haf/trunk/clutter0.8/clutter/eglx/clutter-eglx-texture-pixmap.c
   projects/haf/trunk/clutter0.8/clutter/x11/clutter-x11-texture-pixmap.c
   projects/haf/trunk/clutter0.8/clutter/x11/clutter-x11-texture-pixmap.h
   projects/haf/trunk/clutter0.8/debian/changelog
Log:
  * clutter/eglx/clutter-eglx-texture-pixmap.c
    clutter/x11/clutter-x11-texture-pixmap.c
    clutter/x11/clutter-x11-texture-pixmap.h: added a set_allow_alpha function
    for use with the new sapwood (to disable the alpha channel on RGBA pixmaps
    for windows that aren't really transparent but need RGBA anyway).


Modified: projects/haf/trunk/clutter0.8/clutter/eglx/clutter-eglx-texture-pixmap.c
===================================================================
--- projects/haf/trunk/clutter0.8/clutter/eglx/clutter-eglx-texture-pixmap.c	2009-07-22 12:50:47 UTC (rev 18949)
+++ projects/haf/trunk/clutter0.8/clutter/eglx/clutter-eglx-texture-pixmap.c	2009-07-22 13:27:06 UTC (rev 18950)
@@ -242,6 +242,7 @@
   Pixmap                          pixmap;
   Window                          window;
   guint                           pixmap_depth;
+  gboolean                        has_alpha;
   CoglPixelFormat                 format;
   EGLint			  value;
   ClutterBackendEGL		  *backend;
@@ -288,11 +289,16 @@
 
   /*g_debug("%s: Pixmap depth %d", __FUNCTION__, pixmap_depth);*/
 
+  has_alpha = pixmap_depth==32;
+  if (!clutter_x11_texture_pixmap_get_allow_alpha(
+        CLUTTER_X11_TEXTURE_PIXMAP(actor)))
+    has_alpha = FALSE;
+
   if (pixmap)
     {
       EGLConfig conf = clutter_eglx_get_eglconfig (
                                 backend->edpy, &priv->egl_surface,
-                                pixmap, pixmap_depth);
+                                pixmap, has_alpha);
       print_config_info (conf);
     }
   else
@@ -310,7 +316,7 @@
 	}
       conf = clutter_eglx_get_eglconfig (
                         backend->edpy, &priv->egl_surface,
-                        pixmap, pixmap_depth);
+                        pixmap, has_alpha);
       print_config_info (conf);
     }
 
@@ -455,12 +461,11 @@
 static EGLConfig
 clutter_eglx_get_eglconfig (EGLDisplay *display,
                             EGLSurface *surface, Pixmap pixmap,
-                            int depth)
+                            gboolean has_alpha)
 {
   EGLConfig configs[20];
   int i, nconfigs = 0;
   EGLBoolean ret;
-  gboolean has_alpha = depth==32;
 
   ret = eglChooseConfig (display, pixmap_config, configs,
                          G_N_ELEMENTS (configs), &nconfigs);

Modified: projects/haf/trunk/clutter0.8/clutter/x11/clutter-x11-texture-pixmap.c
===================================================================
--- projects/haf/trunk/clutter0.8/clutter/x11/clutter-x11-texture-pixmap.c	2009-07-22 12:50:47 UTC (rev 18949)
+++ projects/haf/trunk/clutter0.8/clutter/x11/clutter-x11-texture-pixmap.c	2009-07-22 13:27:06 UTC (rev 18950)
@@ -121,6 +121,7 @@
   gboolean      destroyed;
   gboolean      owns_pixmap;
   gboolean      override_redirect;
+  gboolean      allow_alpha;
   gint          window_x, window_y;
 
   GList         *shapes;
@@ -414,6 +415,7 @@
   self->priv->window_mapped = FALSE;
   self->priv->destroyed = FALSE;
   self->priv->override_redirect = FALSE;
+  self->priv->allow_alpha = TRUE;
   self->priv->window_x = 0;
   self->priv->window_y = 0;
   self->priv->shapes = 0;
@@ -850,6 +852,9 @@
   else
     goto free_image_and_return;
 
+  if (!priv->allow_alpha)
+    pixel_has_alpha = FALSE;
+
   /* For debugging purposes, un comment to simply generate dummy
    * pixmap data. (A Green background and Blue cross) */
 #if 0
@@ -1508,3 +1513,18 @@
   *ageo = geo;
   priv->shapes = g_list_append(priv->shapes, ageo);
 }
+
+/* Set whether we will allow this pixmap to have an alpha channel or not */
+void clutter_x11_texture_pixmap_set_allow_alpha(ClutterX11TexturePixmap *texture,
+                                                gboolean allow)
+{
+  g_return_if_fail (CLUTTER_X11_IS_TEXTURE_PIXMAP (texture));
+  texture->priv->allow_alpha = allow;
+}
+
+/* Get whether we will allow this pixmap to have an alpha channel or not */
+gboolean clutter_x11_texture_pixmap_get_allow_alpha(ClutterX11TexturePixmap *texture)
+{
+  g_return_if_fail (CLUTTER_X11_IS_TEXTURE_PIXMAP (texture));
+  return texture->priv->allow_alpha;
+}

Modified: projects/haf/trunk/clutter0.8/clutter/x11/clutter-x11-texture-pixmap.h
===================================================================
--- projects/haf/trunk/clutter0.8/clutter/x11/clutter-x11-texture-pixmap.h	2009-07-22 12:50:47 UTC (rev 18949)
+++ projects/haf/trunk/clutter0.8/clutter/x11/clutter-x11-texture-pixmap.h	2009-07-22 13:27:06 UTC (rev 18950)
@@ -95,6 +95,10 @@
 clutter_x11_texture_pixmap_set_redirection (ClutterX11TexturePixmap *texture,
                                             gboolean setting);
 
+void clutter_x11_texture_pixmap_set_allow_alpha(ClutterX11TexturePixmap *texture,
+                                                gboolean allow);
+gboolean clutter_x11_texture_pixmap_get_allow_alpha(ClutterX11TexturePixmap *texture);
+
 G_END_DECLS
 
 #endif

Modified: projects/haf/trunk/clutter0.8/debian/changelog
===================================================================
--- projects/haf/trunk/clutter0.8/debian/changelog	2009-07-22 12:50:47 UTC (rev 18949)
+++ projects/haf/trunk/clutter0.8/debian/changelog	2009-07-22 13:27:06 UTC (rev 18950)
@@ -1,6 +1,10 @@
 clutter (0.8.2-0maemo41~unreleased) unstable; urgency=low
 
-  * foo
+  * clutter/eglx/clutter-eglx-texture-pixmap.c
+    clutter/x11/clutter-x11-texture-pixmap.c
+    clutter/x11/clutter-x11-texture-pixmap.h: added a set_allow_alpha function
+    for use with the new sapwood (to disable the alpha channel on RGBA pixmaps
+    for windows that aren't really transparent but need RGBA anyway).
 
  -- Aapo Kojo <aapo.kojo at nokia.com>  Mon, 20 Jul 2009 12:48:30 +0300
 

More information about the maemo-commits mailing list