patches/metacity-03-branding-hack.diff
author rohinis
Tue, 29 Nov 2011 17:32:55 +0000
branchs11express-2010-11
changeset 22234 c23e64da3e06
parent 15708 b1bebd509db6
permissions -rw-r--r--
2011-11-29 Rohini S <[email protected]> * patches/Python26-22-audio.diff: Fixes CVE-2010-1634 * specs/SUNWPython26.spec: Fixes CR 7085446

diff -Nrup metacity-2.18.2/src/ui/frames.c ../metacity-2.18.2/src/ui/frames.c
--- metacity-2.18.2/src/ui/frames.c	2007-04-09 03:32:46.000000000 +0200
+++ ../metacity-2.18.2/src/ui/frames.c	2007-04-12 15:34:25.878227000 +0200
@@ -752,6 +752,8 @@ meta_frames_apply_shapes (MetaFrames *fr
   XRectangle xrect;
   Region corners_xregion;
   Region window_xregion;
+  /* hack for nimbus theme */
+  gboolean nimbus_theme = (strcmp ("nimbus", meta_prefs_get_theme ()) == 0) ? TRUE : FALSE; 
   
   frame = meta_frames_lookup_window (frames, xwindow);
   g_return_if_fail (frame != NULL);
@@ -788,74 +790,120 @@ meta_frames_apply_shapes (MetaFrames *fr
   
   if (fgeom.top_left_corner_rounded_radius != 0)
     {
-      const int corner = fgeom.top_left_corner_rounded_radius;
-      const float radius = sqrt(corner) + corner;
-      int i;
-
-      for (i=0; i<corner; i++)
-        {
-          const int width = floor(0.5 + radius - sqrt(radius*radius - (radius-(i+0.5))*(radius-(i+0.5))));
-          xrect.x = 0;
-          xrect.y = i;
-          xrect.width = width;
-          xrect.height = 1;
-          
-          XUnionRectWithRegion (&xrect, corners_xregion, corners_xregion);
-        }
+      if (nimbus_theme)
+	{
+	  xrect.x = 0;
+	  xrect.y = 0;
+	  xrect.width = 1;
+	  xrect.height = 1;
+	  XUnionRectWithRegion (&xrect, corners_xregion, corners_xregion);
+	}
+      else
+	{
+	  const int corner = fgeom.top_left_corner_rounded_radius;
+	  const float radius = sqrt(corner) + corner;
+	  int i;
+
+	  for (i=0; i<corner; i++)
+	    {
+	      const int width = floor(0.5 + radius - sqrt(radius*radius - (radius-(i+0.5))*(radius-(i+0.5))));
+	      xrect.x = 0;
+	      xrect.y = i;
+	      xrect.width = width;
+	      xrect.height = 1;
+
+	      XUnionRectWithRegion (&xrect, corners_xregion, corners_xregion);
+	    }
+	}
     }
 
   if (fgeom.top_right_corner_rounded_radius != 0)
     {
-      const int corner = fgeom.top_right_corner_rounded_radius;
-      const float radius = sqrt(corner) + corner;
-      int i;
+      if (nimbus_theme)
+	{
+	  xrect.x = new_window_width - 1;
+	  xrect.y = 0;
+	  xrect.width = 1;
+	  xrect.height = 1;
+	  XUnionRectWithRegion (&xrect, corners_xregion, corners_xregion);
+	}
+      else
+	{
 
-      for (i=0; i<corner; i++)
-        {
-          const int width = floor(0.5 + radius - sqrt(radius*radius - (radius-(i+0.5))*(radius-(i+0.5))));
-          xrect.x = new_window_width - width;
-          xrect.y = i;
-          xrect.width = width;
-          xrect.height = 1;
-          
-          XUnionRectWithRegion (&xrect, corners_xregion, corners_xregion);
-        }
+	  const int corner = fgeom.top_right_corner_rounded_radius;
+	  const float radius = sqrt(corner) + corner;
+	  int i;
+
+	  for (i=0; i<corner; i++)
+	    {
+	      const int width = floor(0.5 + radius - sqrt(radius*radius - (radius-(i+0.5))*(radius-(i+0.5))));
+	      xrect.x = new_window_width - width;
+	      xrect.y = i;
+	      xrect.width = width;
+	      xrect.height = 1;
+
+	      XUnionRectWithRegion (&xrect, corners_xregion, corners_xregion);
+	    }
+	}
     }
 
   if (fgeom.bottom_left_corner_rounded_radius != 0)
     {
-      const int corner = fgeom.bottom_left_corner_rounded_radius;
-      const float radius = sqrt(corner) + corner;
-      int i;
+      if (nimbus_theme)
+	{
+	  xrect.x = 0;
+	  xrect.y = new_window_height - 1;
+	  xrect.width = 1;
+	  xrect.height = 1;
+	  XUnionRectWithRegion (&xrect, corners_xregion, corners_xregion);
+	}
+      else
+	{
 
-      for (i=0; i<corner; i++)
-        {
-          const int width = floor(0.5 + radius - sqrt(radius*radius - (radius-(i+0.5))*(radius-(i+0.5))));
-          xrect.x = 0;
-          xrect.y = new_window_height - i - 1;
-          xrect.width = width;
-          xrect.height = 1;
-          
-          XUnionRectWithRegion (&xrect, corners_xregion, corners_xregion);
-        }
+	  const int corner = fgeom.bottom_left_corner_rounded_radius;
+	  const float radius = sqrt(corner) + corner;
+	  int i;
+
+	  for (i=0; i<corner; i++)
+	    {
+	      const int width = floor(0.5 + radius - sqrt(radius*radius - (radius-(i+0.5))*(radius-(i+0.5))));
+	      xrect.x = 0;
+	      xrect.y = new_window_height - i - 1;
+	      xrect.width = width;
+	      xrect.height = 1;
+
+	      XUnionRectWithRegion (&xrect, corners_xregion, corners_xregion);
+	    }
+	}
     }
 
   if (fgeom.bottom_right_corner_rounded_radius != 0)
     {
-      const int corner = fgeom.bottom_right_corner_rounded_radius;
-      const float radius = sqrt(corner) + corner;
-      int i;
-
-      for (i=0; i<corner; i++)
-        {
-          const int width = floor(0.5 + radius - sqrt(radius*radius - (radius-(i+0.5))*(radius-(i+0.5))));
-          xrect.x = new_window_width - width;
-          xrect.y = new_window_height - i - 1;
-          xrect.width = width;
-          xrect.height = 1;
-          
-          XUnionRectWithRegion (&xrect, corners_xregion, corners_xregion);
-        }
+      if (nimbus_theme)
+	{
+	  xrect.x = new_window_width - 1;
+	  xrect.y = new_window_height - 1;
+	  xrect.width = 1;
+	  xrect.height = 1;
+	  XUnionRectWithRegion (&xrect, corners_xregion, corners_xregion);
+	}
+      else
+	{
+	  const int corner = fgeom.bottom_right_corner_rounded_radius;
+	  const float radius = sqrt(corner) + corner;
+	  int i;
+
+	  for (i=0; i<corner; i++)
+	    {
+	      const int width = floor(0.5 + radius - sqrt(radius*radius - (radius-(i+0.5))*(radius-(i+0.5))));
+	      xrect.x = new_window_width - width;
+	      xrect.y = new_window_height - i - 1;
+	      xrect.width = width;
+	      xrect.height = 1;
+
+	      XUnionRectWithRegion (&xrect, corners_xregion, corners_xregion);
+	    }
+	}
     }
   
   window_xregion = XCreateRegion ();
diff -Nrup metacity-2.18.2/src/ui/theme-parser.c ../metacity-2.18.2/src/ui/theme-parser.c
--- metacity-2.18.2/src/ui/theme-parser.c	2007-04-08 20:46:17.000000000 +0200
+++ ../metacity-2.18.2/src/ui/theme-parser.c	2007-04-12 15:23:40.286578000 +0200
@@ -913,6 +913,23 @@ parse_toplevel_element (GMarkupParseCont
         return;
       
       title_scale_val = 1.0;
+
+	{ /* Hack for Nimbus theme - pretend we have rounded corners this way the theme will 
+	     look Ok in non-patches version of metacity */
+	  gboolean nimbus_theme = (strcmp ("nimbus", info->theme_name) == 0) ? TRUE : FALSE;
+	  if (nimbus_theme)
+	    {
+	      rounded_top_left_val = TRUE;
+	      rounded_top_right_val = TRUE;
+	      rounded_bottom_left_val = TRUE;
+	      rounded_bottom_right_val = TRUE;
+	      rounded_top_left = TRUE;
+	      rounded_top_right = TRUE;
+	      rounded_bottom_left = TRUE;
+	      rounded_bottom_right = TRUE;
+	    }
+	}
+      
       if (title_scale && !parse_title_scale (title_scale, &title_scale_val, context, error))
         return;