summaryrefslogtreecommitdiff
path: root/src/Fl_Input_.cxx
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2011-02-11 16:37:06 +0000
committerManolo Gouy <Manolo>2011-02-11 16:37:06 +0000
commitf028f2ec9ddbd45d2116e3d79e1ca2b526181ec9 (patch)
tree3a54b37e57cfb69cd106b1c8eaf16187ec13cf31 /src/Fl_Input_.cxx
parent1125cf5385496e616522a874dd212ac342f87fb9 (diff)
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
Diffstat (limited to 'src/Fl_Input_.cxx')
-rw-r--r--src/Fl_Input_.cxx17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/Fl_Input_.cxx b/src/Fl_Input_.cxx
index 2c4e5336c..27655e4e2 100644
--- a/src/Fl_Input_.cxx
+++ b/src/Fl_Input_.cxx
@@ -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;