Author: manolo
Date: 2011-02-11 08:37:06 -0800 (Fri, 11 Feb 2011)
New Revision: 8413
Log:
Fix STR #2560: use bullet instead of asterisk to hide secret input.
Modified:
branches/branch-1.3/src/Fl_Input_.cxx
Modified: branches/branch-1.3/src/Fl_Input_.cxx
===================================================================
--- branches/branch-1.3/src/Fl_Input_.cxx 2011-02-11 12:24:16 UTC (rev
8412)
+++ branches/branch-1.3/src/Fl_Input_.cxx 2011-02-11 16:37:06 UTC (rev
8413)
@@ -37,6 +37,12 @@
#include <ctype.h>
#define MAXBUF 1024
+#if defined(USE_X11) && !USE_XFT
+const int secret_char = '*'; // asterisk to hide secret input
+#else
+const int secret_char = 0x2022; // bullet to hide secret input
+#endif
+static int l_secret;
extern void fl_draw(const char*, int, float, float);
@@ -67,7 +73,10 @@
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) {
+ l_secret = fl_utf8encode(secret_char, o);
+ o += l_secret;
+ }
p++;
}
@@ -124,10 +133,12 @@
) const {
int n = 0;
int chr = 0;
+ int l;
if (input_type()==FL_SECRET_INPUT) {
while (p<e) {
- if (fl_utf8len((char)p[0]) >= 1) n++;
- p++;
+ l = fl_utf8len((char)p[0]);
+ if (l >= 1) n += l_secret;
+ p += l;
}
} else while (p<e) {
int c = *p & 255;
_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit