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

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Wed Jun 3 23:14:30 EEST 2009
Author: tthurman
Date: 2009-06-03 23:14:15 +0300 (Wed, 03 Jun 2009)
New Revision: 18601

Modified:
   projects/haf/trunk/libmatchbox2/ChangeLog
   projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client-window.c
Log:
	Fixes: NB#114352 Unwanted line is displayed in contact starter view
	* matchbox/core/mb-wm-client-window.c: Truncate window titles
	longer than 512 bytes.  If the title is XML, fall back to treating
	it as non-XML, or it won't show.



Modified: projects/haf/trunk/libmatchbox2/ChangeLog
===================================================================
--- projects/haf/trunk/libmatchbox2/ChangeLog	2009-06-03 16:44:22 UTC (rev 18600)
+++ projects/haf/trunk/libmatchbox2/ChangeLog	2009-06-03 20:14:15 UTC (rev 18601)
@@ -1,3 +1,11 @@
+2009-06-03  Thomas Thurman  <thomas.thurman at collabora.co.uk>
+
+	Fixes: NB#114352 Unwanted line is displayed in contact starter view
+
+	* matchbox/core/mb-wm-client-window.c: Truncate window titles
+	longer than 512 bytes.  If the title is XML, fall back to treating
+	it as non-XML, or it won't show.
+
 2009-06-03  Kimmo Hämäläinen  <kimmo.hamalainen at nokia.com>
 
 	* matchbox/comp-mgr/mb-wm-comp-mgr-clutter.[ch]

Modified: projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client-window.c
===================================================================
--- projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client-window.c	2009-06-03 16:44:22 UTC (rev 18600)
+++ projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client-window.c	2009-06-03 20:14:15 UTC (rev 18601)
@@ -612,8 +612,32 @@
 	    goto badwindow_error;
 
 	  if (name)
-	    break;
+	    {
+	      const int maximum_name_length = 512;
+	      if (strlen(name) > maximum_name_length)
+		{
+		  /* Bug 114352: stupidly long names get truncated. */
+		  g_warning ("Window name was too long; truncating it.\n");
+		  name[maximum_name_length] = 0;
 
+		  /* We run the risk of making the XML invalid,
+		   * which will cause no title at all to be shown,
+		   * so just pretend it's ordinary UTF-8 text.
+		   */
+		  if (*cursor==COOKIE_WIN_NAME_UTF8_XML)
+		    *cursor = COOKIE_WIN_NAME_UTF8;
+
+		  /*
+		   * (We also run the risk of making the UTF-8 invalid
+		   * by cutting a character in the middle, but since
+		   * this only causes a warning to be displayed and
+		   * doesn't stop the rest of the string being shown,
+		   * we don't need to deal with it.)
+		   */
+		}
+	      break;
+	    }
+
 	  cursor++;
 	}
 


More information about the maemo-commits mailing list