Sophie

Sophie

distrib > Mageia > 5 > i586 > media > core-updates-src > by-pkgid > d76eea1b7760e62750338e2975db5953 > files > 9

xscreensaver-5.29-6.1.mga5.src.rpm

diff -ruN xscreensaver-5.29.orig/driver/lock.c xscreensaver-5.29/driver/lock.c
--- xscreensaver-5.29.orig/driver/lock.c	2014-05-03 22:34:04.000000000 +0200
+++ xscreensaver-5.29/driver/lock.c	2015-01-22 16:57:00.288183355 +0100
@@ -523,6 +523,11 @@
       Dimension w2 = 0, w3 = 0, button_w = 0;
       Dimension h2 = 0, h3 = 0, button_h = 0;
       const char *passwd_string = SAMPLE_INPUT;
+      XFontSet fs;
+      char **missing_charset_list = NULL;
+      int missing_charset_count = 0;
+      char *def_string = NULL;
+      struct mlstr_line *line;
 
       /* Measure the user_label. */
       XTextExtents (pw->label_font,
@@ -561,6 +566,22 @@
 	  pw->prompt_label = mlstring_new (prompt, pw->label_font, 
                                            max_string_width_px);
 
+	  fs = XCreateFontSet (si->dpy,
+			       "*",
+			       &missing_charset_list,
+			       &missing_charset_count,
+			       &def_string);
+	  XFreeStringList (missing_charset_list);
+	  if (fs != NULL)
+	    {
+	      pw->prompt_label->overall_width = 0;
+	      for (line = pw->prompt_label->lines; line; line = line->next_line)
+		{
+		  line->line_width = XmbTextEscapement(fs, line->line, strlen(line->line));
+		  pw->prompt_label->overall_width = MAX(pw->prompt_label->overall_width, line->line_width);
+		}
+	      XFreeFontSet(si->dpy, fs);
+	    }
 	  if (pw->prompt_label->overall_width > w2)
             w2 = pw->prompt_label->overall_width;
 
@@ -892,14 +913,35 @@
     struct tm *tm = localtime (&now);
     memset (buf, 0, sizeof(buf));
     strftime (buf, sizeof(buf)-1, pw->date_label, tm);
+    XFontSet fs;
+    char **missing_charset_list = NULL;
+    int missing_charset_count = 0;
+    char *def_string = NULL;
 
     XSetFont (si->dpy, gc1, pw->date_font->fid);
     y1 += pw->shadow_width;
     y1 += (spacing + tb_height);
     y1 += spacing/2;
-    sw = string_width (pw->date_font, buf);
-    x2 = x1 + x2 - sw;
-    XDrawString (si->dpy, si->passwd_dialog, gc1, x2, y1, buf, strlen(buf));
+
+    fs = XCreateFontSet (si->dpy,
+			 "*",
+			 &missing_charset_list,
+			 &missing_charset_count,
+			 &def_string);
+    XFreeStringList (missing_charset_list);
+    if (fs == NULL)
+      {
+	sw = string_width (pw->date_font, buf);
+	x2 = x1 + x2 - sw;
+	XDrawString (si->dpy, si->passwd_dialog, gc1, x2, y1, buf, strlen(buf));
+      }
+    else
+      {
+	sw = XmbTextEscapement(fs, buf, strlen(buf));
+	x2 = x1 + x2 - sw;
+	XmbDrawString (si->dpy, si->passwd_dialog, fs, gc1, x2, y1, buf, strlen(buf));
+	XFreeFontSet(si->dpy, fs);
+      }
   }
 
   /* Set up the GCs for the "New Login" and "Unlock" buttons.
diff -ruN xscreensaver-5.29.orig/driver/mlstring.c xscreensaver-5.29/driver/mlstring.c
--- xscreensaver-5.29.orig/driver/mlstring.c	2010-10-09 02:39:09.000000000 +0200
+++ xscreensaver-5.29/driver/mlstring.c	2015-01-22 16:53:39.110775485 +0100
@@ -210,6 +210,10 @@
 void
 mlstring_draw(Display *dpy, Drawable dialog, GC gc, mlstring *string, int x, int y) {
   struct mlstr_line *line;
+  XFontSet fs;
+  char **missing_charset_list = NULL;
+  int missing_charset_count = 0;
+  char *def_string = NULL;
 
   if (!string)
     return;
@@ -218,11 +222,22 @@
 
   XSetFont(dpy, gc, string->font_id);
 
+  fs = XCreateFontSet (dpy,
+		       "*",
+		       &missing_charset_list,
+		       &missing_charset_count,
+		       &def_string);
+  XFreeStringList (missing_charset_list);
   for (line = string->lines; line; line = line->next_line)
     {
-      XDrawString(dpy, dialog, gc, x, y, line->line, strlen(line->line));
+      if (fs == NULL)
+	XDrawString(dpy, dialog, gc, x, y, line->line, strlen(line->line));
+      else
+	XmbDrawString (dpy, dialog, fs, gc, x, y, line->line, strlen(line->line));
       y += string->font_height * LINE_SPACING;
     }
+  if (fs != NULL)
+    XFreeFontSet(dpy, fs);
 }
 
 /* vim:ts=8:sw=2:noet