Index: debian/changelog
===================================================================
--- debian/changelog	(revision 2)
+++ debian/changelog	(working copy)
@@ -1,3 +1,16 @@
+metacity (1:2.28.1-0ubuntu6) lucid; urgency=low
+
+  * Corrected support for buttons backgrounds with transparency
+    - Added 'no background' if there is only one button
+    - Backgrounds no more overlap if transparency used
+
+  * Corrected bug with left button clickable region when window is
+    maximized
+    - Corrected first left button was activable by clicking on it's left
+      (Out of the button) when window is maximized
+
+ -- Nicolas DESFONTAINE <noop@free.fr>  Sun, 14 Mar 2010 02:08:50 +0100
+
 metacity (1:2.28.1-0ubuntu5) lucid; urgency=low
 
   * debian/metacity-common.gconf-defaults:
Index: src/ui/theme.c
===================================================================
--- src/ui/theme.c	(revision 2)
+++ src/ui/theme.c	(working copy)
@@ -704,25 +704,34 @@
 
   for (i = 0; i < n_left; i++)
     {
-      if (i == 0) /* prefer left background if only one button */
-        left_bg_rects[i] = &fgeom->left_left_background;
+      if (i == 0)
+        {
+          if (n_left > 1)
+            left_bg_rects[i] = &fgeom->left_left_background;
+          else /* No background if only one single button */
+            left_bg_rects[i] = &fgeom->left_single_background;
+        }
       else if (i == (n_left - 1))
         left_bg_rects[i] = &fgeom->left_right_background;
       else
-        left_bg_rects[i] = &fgeom->left_middle_backgrounds[i - 1];
+        left_bg_rects[i] = &fgeom->left_middle_backgrounds[i];
     }
 
   for (i = 0; i < n_right; i++)
     {
-      /* prefer right background if only one button */
       if (i == (n_right - 1))
-        right_bg_rects[i] = &fgeom->right_right_background;
+        {
+          if (n_right > 1)
+            right_bg_rects[i] = &fgeom->right_right_background;
+          else /* No background if only one single button */
+            right_bg_rects[i] = &fgeom->right_single_background;
+        }
       else if (i == 0)
         right_bg_rects[i] = &fgeom->right_left_background;
       else
-        right_bg_rects[i] = &fgeom->right_middle_backgrounds[i - 1];
+        right_bg_rects[i] = &fgeom->right_middle_backgrounds[i];
     }
-  
+
   /* Be sure buttons fit */
   while (n_left > 0 || n_right > 0)
     {
@@ -876,24 +885,14 @@
 
       if (flags & META_FRAME_MAXIMIZED)
         {
-          if (i==0)
-            {
-              rect->clickable.x = 0;
-              rect->clickable.width = button_width + x;
-            }
-          else
-            {
-              rect->clickable.x = rect->visible.x;
-              rect->clickable.width = button_width;
-            }
+          rect->clickable.x = rect->visible.x;
+          rect->clickable.width = button_width;
+          rect->clickable.y = 0;
+          rect->clickable.height = button_height + button_y;
+        }
+      else
+        g_memmove (&(rect->clickable), &(rect->visible), sizeof(rect->clickable));
 
-            rect->clickable.y = 0;
-            rect->clickable.height = button_height + button_y;
-          }
-        else
-          g_memmove (&(rect->clickable), &(rect->visible), sizeof(rect->clickable));
-
-
       x = rect->visible.x + rect->visible.width + layout->button_border.right;
       if (left_buttons_has_spacer[i])
         x += (button_width * 0.75);
@@ -4525,7 +4524,7 @@
               /* MIDDLE_BACKGROUND type may get drawn more than once */
               if ((j == META_BUTTON_TYPE_RIGHT_MIDDLE_BACKGROUND ||
                    j == META_BUTTON_TYPE_LEFT_MIDDLE_BACKGROUND) &&
-                  middle_bg_offset < MAX_MIDDLE_BACKGROUNDS)
+                  (middle_bg_offset < (MAX_MIDDLE_BACKGROUNDS - 1)))
                 {
                   ++middle_bg_offset;
                 }
Index: src/ui/theme.h
===================================================================
--- src/ui/theme.h	(revision 2)
+++ src/ui/theme.h	(working copy)
@@ -200,9 +200,11 @@
   MetaButtonSpace unstick_rect;
 
 #define MAX_MIDDLE_BACKGROUNDS (MAX_BUTTONS_PER_CORNER - 2)
+  GdkRectangle left_single_background;
   GdkRectangle left_left_background;
   GdkRectangle left_middle_backgrounds[MAX_MIDDLE_BACKGROUNDS];
   GdkRectangle left_right_background;
+  GdkRectangle right_single_background;
   GdkRectangle right_left_background;
   GdkRectangle right_middle_backgrounds[MAX_MIDDLE_BACKGROUNDS];
   GdkRectangle right_right_background;
