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

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Wed Jun 3 18:02:00 EEST 2009
Author: kihamala
Date: 2009-06-03 18:01:49 +0300 (Wed, 03 Jun 2009)
New Revision: 18592

Modified:
   projects/haf/trunk/clutter0.8/clutter/clutter-private.h
   projects/haf/trunk/clutter0.8/clutter/clutter-stage.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:
new API + fixes for HD's non-composited mode


Modified: projects/haf/trunk/clutter0.8/clutter/clutter-private.h
===================================================================
--- projects/haf/trunk/clutter0.8/clutter/clutter-private.h	2009-06-03 14:55:52 UTC (rev 18591)
+++ projects/haf/trunk/clutter0.8/clutter/clutter-private.h	2009-06-03 15:01:49 UTC (rev 18592)
@@ -216,6 +216,8 @@
 void _clutter_actor_apply_modelview_transform_recursive (ClutterActor *self,
 						       ClutterActor *ancestor);
 
+int _clutter_stage_get_shaped_mode (ClutterActor *self);
+
 // Big hack to remove threading calls
 #define g_object_freeze_notify(X)
 #define g_object_thaw_notify(X)

Modified: projects/haf/trunk/clutter0.8/clutter/clutter-stage.c
===================================================================
--- projects/haf/trunk/clutter0.8/clutter/clutter-stage.c	2009-06-03 14:55:52 UTC (rev 18591)
+++ projects/haf/trunk/clutter0.8/clutter/clutter-stage.c	2009-06-03 15:01:49 UTC (rev 18592)
@@ -252,6 +252,13 @@
   priv->shaped_mode = mode;
 }
 
+int
+_clutter_stage_get_shaped_mode (ClutterActor *self)
+{
+  ClutterStagePrivate *priv = CLUTTER_STAGE (self)->priv;
+  return priv->shaped_mode;
+}
+
 static void
 clutter_stage_paint (ClutterActor *self)
 {

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-06-03 14:55:52 UTC (rev 18591)
+++ projects/haf/trunk/clutter0.8/clutter/x11/clutter-x11-texture-pixmap.c	2009-06-03 15:01:49 UTC (rev 18592)
@@ -45,6 +45,7 @@
 #include "clutter-x11.h"
 #include "clutter-backend-x11.h"
 #include "clutter-debug.h"
+#include "clutter-private.h"
 
 #include "cogl/cogl.h"
 
@@ -114,6 +115,7 @@
 
   /* FIXME: lots of gbooleans. coalesce into bitfields */
   gboolean	have_shm;
+  gboolean      window_redirected;
   gboolean      window_redirect_automatic;
   gboolean      window_mapped;
   gboolean      destroyed;
@@ -407,6 +409,7 @@
   self->priv->pixmap_height = 0;
   self->priv->pixmap_width = 0;
   self->priv->shminfo.shmid = -1;
+  self->priv->window_redirected = FALSE;
   self->priv->window_redirect_automatic = TRUE;
   self->priv->window_mapped = FALSE;
   self->priv->destroyed = FALSE;
@@ -1094,6 +1097,39 @@
   g_object_unref (texture);
 }
 
+void
+clutter_x11_texture_pixmap_set_redirection (ClutterX11TexturePixmap *texture,
+                                            gboolean setting)
+{
+  ClutterX11TexturePixmapPrivate *priv;
+  Display *dpy = clutter_x11_get_default_display ();
+
+  priv = texture->priv;
+
+  if (setting && !priv->window_redirected && priv->window)
+    {
+      XCompositeRedirectWindow (dpy,
+                                priv->window,
+                                priv->window_redirect_automatic ?
+                                CompositeRedirectAutomatic :
+                                CompositeRedirectManual);
+      XSync (dpy, False);
+      priv->window_redirected = TRUE;
+    }
+  else if (!setting && priv->window_redirected && priv->window)
+    {
+      clutter_x11_trap_x_errors ();
+      XCompositeUnredirectWindow (dpy,
+                                  priv->window,
+                                  priv->window_redirect_automatic ?
+                                  CompositeRedirectAutomatic :
+                                  CompositeRedirectManual);
+      XSync (clutter_x11_get_default_display (), False);
+      clutter_x11_untrap_x_errors ();
+      priv->window_redirected = FALSE;
+    }
+}
+
 /**
  * clutter_x11_texture_pixmap_set_window:
  * @texture: the texture to bind
@@ -1130,13 +1166,18 @@
   if (priv->window)
     {
       clutter_x11_remove_filter (on_x_event_filter_too, (gpointer)texture);
-      clutter_x11_trap_x_errors ();
-      XCompositeUnredirectWindow(clutter_x11_get_default_display (),
-                                  priv->window,
-                                  priv->window_redirect_automatic ?
-                                  CompositeRedirectAutomatic : CompositeRedirectManual);
-      XSync (clutter_x11_get_default_display (), False);
-      clutter_x11_untrap_x_errors ();
+      if (priv->window_redirected)
+        {
+          clutter_x11_trap_x_errors ();
+          XCompositeUnredirectWindow(dpy,
+                                     priv->window,
+                                     priv->window_redirect_automatic ?
+                                     CompositeRedirectAutomatic :
+                                     CompositeRedirectManual);
+          XSync (clutter_x11_get_default_display (), False);
+          clutter_x11_untrap_x_errors ();
+          priv->window_redirected = FALSE;
+        }
     }
 
   priv->window = window;
@@ -1158,12 +1199,16 @@
         return;
       }
 
-    XCompositeRedirectWindow
-                       (dpy,
-                        window,
-                        automatic ?
-                        CompositeRedirectAutomatic : CompositeRedirectManual);
-    XSync (dpy, False);
+    if (!_clutter_stage_get_shaped_mode (clutter_stage_get_default ()))
+      {
+        XCompositeRedirectWindow (dpy,
+                                  window,
+                                  automatic ?
+                                  CompositeRedirectAutomatic :
+                                  CompositeRedirectManual);
+        XSync (dpy, False);
+        priv->window_redirected = TRUE;
+      }
   }
 
   clutter_x11_untrap_x_errors ();

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-06-03 14:55:52 UTC (rev 18591)
+++ projects/haf/trunk/clutter0.8/clutter/x11/clutter-x11-texture-pixmap.h	2009-06-03 15:01:49 UTC (rev 18592)
@@ -91,6 +91,9 @@
 void clutter_x11_texture_pixmap_clear_shapes(ClutterX11TexturePixmap *texture);
 void clutter_x11_texture_pixmap_add_shape(ClutterX11TexturePixmap *texture,
                                           ClutterGeometry geo);
+void
+clutter_x11_texture_pixmap_set_redirection (ClutterX11TexturePixmap *texture,
+                                            gboolean setting);
 
 G_END_DECLS
 

Modified: projects/haf/trunk/clutter0.8/debian/changelog
===================================================================
--- projects/haf/trunk/clutter0.8/debian/changelog	2009-06-03 14:55:52 UTC (rev 18591)
+++ projects/haf/trunk/clutter0.8/debian/changelog	2009-06-03 15:01:49 UTC (rev 18592)
@@ -1,6 +1,15 @@
 clutter (0.8.2-0maemo35~unreleased) unstable; urgency=low
 
-  * foo
+  Kimmo:
+  * clutter/x11/clutter-x11-texture-pixmap.[ch]
+    (clutter_x11_texture_pixmap_set_redirection): New function to toggle
+    XComposite redirection on/off within Clutter. This is used from
+    libmatchbox2 to sync redirection states between the two libraries.
+    (ClutterX11TexturePixmapPrivate): Add window_redirected member.
+    (clutter_x11_texture_pixmap_set_window): Redirect only if the stage is
+    not in shaped mode. Unredirect only if the window was redirected before.
+  * clutter/clutter-stage.c (_clutter_stage_get_shaped_mode): New function to
+    read the shaped mode setting of a stage.
 
  -- Kimmo Hämäläinen <kimmo.hamalainen at nokia.com>  Tue,  2 Jun 2009 16:50:14 +0300
 


More information about the maemo-commits mailing list