[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#443227: patch for xclock problem



tags 443227 +patch
thanks

I believe the following patch fixes this problem.  I noticed the same
problem some time ago in Fedora 8 (which I used to have to run at
work).  I run Lenny on my main box and didn't see this at home until
today when I got x11-apps.  The problem appears to be a missing set of
braces in Clock.c.  The scope of an "else" was too narrow.

This is a diff -uw just so you can see how small the patch really is.
The real patch is attached.

--- Clock.c.orig	2008-05-10 21:46:01.007754048 -0400
+++ Clock.c	2008-05-10 22:11:58.767784897 -0400
@@ -656,6 +656,7 @@
 		     2 * w->clock.padding;
        }
        else
+       {
 #endif
 #ifndef NO_I18N 
        if (!no_locale) {
@@ -698,6 +699,7 @@
 	       w->clock.font->descent + 2 * w->clock.padding;
        }
     }
+    }
     if (w->core.width == 0)
 	w->core.width = min_width;
     if (w->core.height == 0)

--Jay

-- 
Jay Berkenbilt <qjb@debian.org>

--- x11-apps-7.3+1/xclock/Clock.c.orig	2007-09-14 17:18:56.000000000 -0400
+++ x11-apps-7.3+1/xclock/Clock.c	2008-05-10 22:18:46.147733977 -0400
@@ -656,46 +656,48 @@
 		     2 * w->clock.padding;
        }
        else
+       {
 #endif
 #ifndef NO_I18N 
-       if (!no_locale) {
-	   XFontSetExtents *fse;
+	  if (!no_locale) {
+	      XFontSetExtents *fse;
 
-	   if(w->clock.fontSet == NULL) {
-	       char **missing, *default_str;
-	       int n_missing;
-	       w->clock.fontSet = XCreateFontSet( XtDisplay(w),
-		 XtDefaultFontSet,
-		 &missing,
-		 &n_missing,
-		 &default_str);
-	   }
-	   if (w->clock.fontSet != NULL)
-	   {
-	       /* don't free this... it's freed with the XFontSet. */
-	       fse = XExtentsOfFontSet(w->clock.fontSet);
-	       
-	       min_width = XmbTextEscapement(w->clock.fontSet,str,
-		 len)
-		 + 2 * w->clock.padding;
-	       min_height = fse->max_logical_extent.height +
-		 3 * w->clock.padding;
-	   } else {
-	       no_locale = True;
-	   }
-       }
+	      if(w->clock.fontSet == NULL) {
+		  char **missing, *default_str;
+		  int n_missing;
+		  w->clock.fontSet = XCreateFontSet( XtDisplay(w),
+		    XtDefaultFontSet,
+		    &missing,
+		    &n_missing,
+		    &default_str);
+	      }
+	      if (w->clock.fontSet != NULL)
+	      {
+		  /* don't free this... it's freed with the XFontSet. */
+		  fse = XExtentsOfFontSet(w->clock.fontSet);
+
+		  min_width = XmbTextEscapement(w->clock.fontSet,str,
+		    len)
+		    + 2 * w->clock.padding;
+		  min_height = fse->max_logical_extent.height +
+		    3 * w->clock.padding;
+	      } else {
+		  no_locale = True;
+	      }
+	  }
 
-       if (!no_locale)
-#endif /* NO_I18N */
-       {
-	   if (w->clock.font == NULL)
-	       w->clock.font = XQueryFont( XtDisplay(w),
-					   XGContextFromGC(
-					    DefaultGCOfScreen(XtScreen(w))) );
-	   min_width = XTextWidth(w->clock.font, str, len) +
-	       2 * w->clock.padding;
-	   min_height = w->clock.font->ascent +
-	       w->clock.font->descent + 2 * w->clock.padding;
+	  if (!no_locale)
+   #endif /* NO_I18N */
+	  {
+	      if (w->clock.font == NULL)
+		  w->clock.font = XQueryFont( XtDisplay(w),
+					      XGContextFromGC(
+					       DefaultGCOfScreen(XtScreen(w))) );
+	      min_width = XTextWidth(w->clock.font, str, len) +
+		  2 * w->clock.padding;
+	      min_height = w->clock.font->ascent +
+		  w->clock.font->descent + 2 * w->clock.padding;
+	  }
        }
     }
     if (w->core.width == 0)

Reply to: