[maemo-commits] [maemo-commits] r18965 - in projects/haf/trunk/libmatchbox2: . matchbox/core

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Thu Jul 23 15:08:36 EEST 2009
Author: gw
Date: 2009-07-23 15:08:29 +0300 (Thu, 23 Jul 2009)
New Revision: 18965

Modified:
   projects/haf/trunk/libmatchbox2/ChangeLog
   projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-atoms.c
   projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client.c
   projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-types.h
Log:

	* matchbox/core/mb-wm-types.h
        * matchbox/core/mb-wm-atoms.c
	* matchbox/core/mb-wm-client.c: For RGBA sapwood - look for 
	MAEMO_IGNORE_ALPHA window property, and only ignore alpha if so.
	Reverts previous change in order to handle alpha in a more compatible
	way.


Modified: projects/haf/trunk/libmatchbox2/ChangeLog
===================================================================
--- projects/haf/trunk/libmatchbox2/ChangeLog	2009-07-23 11:46:29 UTC (rev 18964)
+++ projects/haf/trunk/libmatchbox2/ChangeLog	2009-07-23 12:08:29 UTC (rev 18965)
@@ -1,3 +1,12 @@
+2009-07-23  Gordon Williams <gordon.williams at collabora.co.uk>
+
+	* matchbox/core/mb-wm-types.h
+        * matchbox/core/mb-wm-atoms.c
+	* matchbox/core/mb-wm-client.c: For RGBA sapwood - look for 
+	MAEMO_IGNORE_ALPHA window property, and only ignore alpha if so.
+	Reverts previous change in order to handle alpha in a more compatible
+	way.
+
 2009-07-22  Gordon Williams <gordon.williams at collabora.co.uk>
 
 	Changes to help with RGBA sapwood - disable alpha (transparency) 

Modified: projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-atoms.c
===================================================================
--- projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-atoms.c	2009-07-23 11:46:29 UTC (rev 18964)
+++ projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-atoms.c	2009-07-23 12:08:29 UTC (rev 18965)
@@ -109,10 +109,12 @@
     "_HILDON_WM_WINDOW_TYPE_LEGACY_MENU",
 
     "_MAEMO_SUPPRESS_ROOT_RECONFIGURATION",
+
+    "_MAEMO_IGNORE_ALPHA",
   };
 
   /* FIXME: Error Traps */
-  
+
   MBWM_ASSERT (MBWM_ATOM_COUNT == sizeof (atom_names) / sizeof (char*));
 
   XInternAtoms (wm->xdpy,

Modified: projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client.c
===================================================================
--- projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client.c	2009-07-23 11:46:29 UTC (rev 18964)
+++ projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client.c	2009-07-23 12:08:29 UTC (rev 18965)
@@ -106,7 +106,42 @@
   return False;
 }
 
+#if ENABLE_COMPOSITE
+static Bool
+mb_wm_client_ignore_alpha(MBWindowManagerClient *client)
+{
+  MBWindowManager *wm;
+  Atom actual_type_return;
+  int actual_format_return;
+  unsigned long nitems_return;
+  unsigned long bytes_after_return;
+  unsigned char* prop_return = NULL;
+  int result = 0;
 
+  wm = client->wmref;
+
+  mb_wm_util_trap_x_errors ();
+  XGetWindowProperty (wm->xdpy, client->window->xwindow,
+                      wm->atoms[WBWM_ATOM_MAEMO_IGNORE_ALPHA],
+                      0, G_MAXLONG,
+                      False,
+                      AnyPropertyType,
+                      &actual_type_return,
+                      &actual_format_return,
+                      &nitems_return,
+                      &bytes_after_return,
+                      &prop_return);
+  if (prop_return)
+    {
+      result = prop_return[0];
+      XFree (prop_return);
+    }
+  mb_wm_util_untrap_x_errors();
+
+  return result;
+}
+#endif
+
 static int
 mb_wm_client_init (MBWMObject *obj, va_list vap)
 {
@@ -176,9 +211,7 @@
     if (format && format->type == PictTypeDirect &&
 	format->direct.alphaMask)
       {
-        MBWMClientType ctype = MB_WM_CLIENT_CLIENT_TYPE (client);
-        if (ctype != MBWMClientTypeApp &&
-            ctype != MBWMClientTypeDialog)
+        if (!mb_wm_client_ignore_alpha(client))
           client->is_argb32 = True;
       }
   }

Modified: projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-types.h
===================================================================
--- projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-types.h	2009-07-23 11:46:29 UTC (rev 18964)
+++ projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-types.h	2009-07-23 12:08:29 UTC (rev 18965)
@@ -314,6 +314,13 @@
    */
   MBWM_ATOM_MAEMO_SUPPRESS_ROOT_RECONFIGURATION,
 
+  /* This flag is set on a window (currently by GTK) if the window
+   * itself contains an alpha channel, but we are supposed to ignore it.
+   * This is useful for RGBA sapwood, and gives us a performance boost by
+   * allowing our visibility detection (and SGX's) to know that the window
+   * is totally opaque. */
+  WBWM_ATOM_MAEMO_IGNORE_ALPHA,
+
   MBWM_ATOM_COUNT
 
 } MBWMAtom;

More information about the maemo-commits mailing list