Fix STR #2560: use bullet instead of asterisk to hide secret input.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8413 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Manolo Gouy 2011-02-11 16:37:06 +00:00
parent 1125cf5385
commit f028f2ec9d

View File

@ -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 @@ const char* Fl_Input_::expand(const char* p, char* buf) const {
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 @@ double Fl_Input_::expandpos(
) 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;