DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L2560
Version: 1.3-feature


Now that we all this unicode goodness, it is time to replace that old ugly
asterisk in Fl_Secret_Input with something a bit more modern. U+2022 is a
popular choice and that's what the attached patch changes it to.

I've used escape sequences instead of UTF-8 in the source to avoid
problems with editors and compilers that has problems with non-ASCII.


Link: http://www.fltk.org/str.php?L2560
Version: 1.3-feature
diff -up fltk-1.3.x-r8365/src/Fl_Input_.cxx.orig 
fltk-1.3.x-r8365/src/Fl_Input_.cxx
--- fltk-1.3.x-r8365/src/Fl_Input_.cxx.orig     2011-02-10 20:17:56.195480610 
+0100
+++ fltk-1.3.x-r8365/src/Fl_Input_.cxx  2011-02-10 22:00:43.064426227 +0100
@@ -38,6 +38,9 @@
 
 #define MAXBUF 1024
 
+#define SECRET_CHARACTER "\xe2\x80\xa2"  // U+2022 BULLET
+#define SECRET_CHARACTER_LEN (sizeof(SECRET_CHARACTER) - 1)
+
 extern void fl_draw(const char*, int, float, float);
 
 ////////////////////////////////////////////////////////////////
@@ -67,7 +70,10 @@ const char* Fl_Input_::expand(const char
 
   if (input_type()==FL_SECRET_INPUT) {
     while (o<e && p < value_+size_) {
-      if (fl_utf8len((char)p[0]) >= 1) *o++ = '*';
+      if (fl_utf8len((char)p[0]) >= 1) {
+        memcpy(o, SECRET_CHARACTER, SECRET_CHARACTER_LEN);
+        o += SECRET_CHARACTER_LEN;
+      }
       p++;
     }
 
@@ -126,7 +132,7 @@ double Fl_Input_::expandpos(
   int chr = 0;
   if (input_type()==FL_SECRET_INPUT) {
     while (p<e) {
-      if (fl_utf8len((char)p[0]) >= 1) n++;
+      if (fl_utf8len((char)p[0]) >= 1) n += SECRET_CHARACTER_LEN;
       p++;
     }
   } else while (p<e) {
_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to