1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-30 18:32:34 +01:00

Made the secure textfield give some feedback about what is happening.

This commit is contained in:
dan
1999-04-27 02:46:55 +00:00
parent a205d1f5c2
commit 76827c72d1
6 changed files with 74 additions and 62 deletions

View File

@@ -108,9 +108,9 @@ GZIP_ENV = --best
all: all-redirect
.SUFFIXES:
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnu WINGs/Resources/Makefile
cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps WINGs/Resources/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
@@ -142,11 +142,6 @@ distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = WINGs/Resources
distdir: $(DISTFILES)
here=`cd $(top_builddir) && pwd`; \
top_distdir=`cd $(top_distdir) && pwd`; \
distdir=`cd $(distdir) && pwd`; \
cd $(top_srcdir) \
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu WINGs/Resources/Makefile
@for file in $(DISTFILES); do \
d=$(srcdir); \
if test -d $$d/$$file; then \

View File

@@ -527,19 +527,36 @@ resizeTextField(WMTextField *tPtr, unsigned int width, unsigned int height)
}
static char*
makeHiddenString(int length)
{
char *data = wmalloc(length+1);
memset(data, '*', length);
data[length] = '\0';
return data;
}
static void
paintCursor(TextField *tPtr)
{
int cx;
WMScreen *screen = tPtr->view->screen;
int textWidth;
char *text;
cx = WMWidthOfString(tPtr->font, &(tPtr->text[tPtr->viewPosition]),
if (tPtr->flags.secure)
text = makeHiddenString(strlen(tPtr->text));
else
text = tPtr->text;
cx = WMWidthOfString(tPtr->font, &(text[tPtr->viewPosition]),
tPtr->cursorPosition-tPtr->viewPosition);
switch (tPtr->flags.alignment) {
case WARight:
textWidth = WMWidthOfString(tPtr->font, tPtr->text, tPtr->textLen);
textWidth = WMWidthOfString(tPtr->font, text, tPtr->textLen);
if (textWidth < tPtr->usableWidth)
cx += tPtr->offsetWidth + tPtr->usableWidth - textWidth + 1;
else
@@ -551,7 +568,7 @@ paintCursor(TextField *tPtr)
case WAJustified:
/* not supported */
case WACenter:
textWidth = WMWidthOfString(tPtr->font, tPtr->text, tPtr->textLen);
textWidth = WMWidthOfString(tPtr->font, text, tPtr->textLen);
if (textWidth < tPtr->usableWidth)
cx += tPtr->offsetWidth + (tPtr->usableWidth-textWidth)/2;
else
@@ -567,6 +584,9 @@ paintCursor(TextField *tPtr)
XDrawLine(screen->display, tPtr->view->window, screen->xorGC,
cx, tPtr->offsetWidth, cx,
tPtr->view->size.height - tPtr->offsetWidth - 1);
if (tPtr->flags.secure)
free(text);
}
@@ -617,6 +637,7 @@ paintTextField(TextField *tPtr)
int rx;
int bd;
int totalWidth;
char *text;
if (!view->flags.realized || !view->flags.mapped)
@@ -628,10 +649,16 @@ paintTextField(TextField *tPtr)
bd = 2;
}
if (tPtr->flags.secure) {
text = makeHiddenString(strlen(tPtr->text));
} else {
text = tPtr->text;
}
totalWidth = tPtr->view->size.width - 2*bd;
if (tPtr->textLen > 0) {
tw = WMWidthOfString(tPtr->font, &(tPtr->text[tPtr->viewPosition]),
tw = WMWidthOfString(tPtr->font, &(text[tPtr->viewPosition]),
tPtr->textLen - tPtr->viewPosition);
th = WMFontHeight(tPtr->font);
@@ -662,54 +689,51 @@ paintTextField(TextField *tPtr)
break;
}
if (!tPtr->flags.secure) {
if (!tPtr->flags.enabled)
WMSetColorInGC(screen->darkGray, screen->textFieldGC);
if (!tPtr->flags.enabled)
WMSetColorInGC(screen->darkGray, screen->textFieldGC);
WMDrawImageString(screen, view->window, screen->textFieldGC,
tPtr->font, tx, ty,
&(tPtr->text[tPtr->viewPosition]),
tPtr->textLen - tPtr->viewPosition);
WMDrawImageString(screen, view->window, screen->textFieldGC,
tPtr->font, tx, ty,
&(text[tPtr->viewPosition]),
tPtr->textLen - tPtr->viewPosition);
if (tPtr->selection.count) {
int count;
if (tPtr->selection.count) {
int count;
count = tPtr->selection.count < 0
? tPtr->selection.position + tPtr->selection.count
: tPtr->selection.position;
count = tPtr->selection.count < 0
? tPtr->selection.position + tPtr->selection.count
: tPtr->selection.position;
/*
rx = tx + WMWidthOfString(tPtr->font,
&(tPtr->text[tPtr->viewPosition]),
count)
- WMWidthOfString(tPtr->font,
tPtr->text,tPtr->viewPosition);
*/
rx = tPtr->offsetWidth + 1 + WMWidthOfString(tPtr->font,tPtr->text,count)
- WMWidthOfString(tPtr->font,tPtr->text,tPtr->viewPosition);
/*
rx = tx + WMWidthOfString(tPtr->font,
&(text[tPtr->viewPosition]),
count)
- WMWidthOfString(tPtr->font,
text,tPtr->viewPosition);
*/
rx = tPtr->offsetWidth + 1 + WMWidthOfString(tPtr->font,text,count)
- WMWidthOfString(tPtr->font,text,tPtr->viewPosition);
XSetBackground(screen->display, screen->textFieldGC,
screen->gray->color.pixel);
XSetBackground(screen->display, screen->textFieldGC,
screen->gray->color.pixel);
WMDrawImageString(screen, view->window, screen->textFieldGC,
tPtr->font, rx, ty, &(tPtr->text[count]),
abs(tPtr->selection.count));
WMDrawImageString(screen, view->window, screen->textFieldGC,
tPtr->font, rx, ty, &(text[count]),
abs(tPtr->selection.count));
XSetBackground(screen->display, screen->textFieldGC,
screen->white->color.pixel);
}
XSetBackground(screen->display, screen->textFieldGC,
screen->white->color.pixel);
}
if (!tPtr->flags.enabled)
WMSetColorInGC(screen->black, screen->textFieldGC);
}
if (!tPtr->flags.enabled)
WMSetColorInGC(screen->black, screen->textFieldGC);
} else {
XClearArea(screen->display, view->window, bd, bd, totalWidth,
view->size.height - 2*bd, False);
}
/* draw cursor */
if (tPtr->flags.focused && tPtr->flags.enabled && tPtr->flags.cursorOn
&& !tPtr->flags.secure) {
if (tPtr->flags.focused && tPtr->flags.enabled && tPtr->flags.cursorOn) {
paintCursor(tPtr);
}
@@ -717,6 +741,9 @@ paintTextField(TextField *tPtr)
if (tPtr->flags.bordered) {
drawRelief(view, tPtr->flags.beveled);
}
if (tPtr->flags.secure)
free(text);
}

View File

@@ -120,9 +120,9 @@ all: all-redirect
.SUFFIXES:
.SUFFIXES: .mo .po
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnu WPrefs.app/po/Makefile
cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps WPrefs.app/po/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
@@ -135,11 +135,6 @@ distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = WPrefs.app/po
distdir: $(DISTFILES)
here=`cd $(top_builddir) && pwd`; \
top_distdir=`cd $(top_distdir) && pwd`; \
distdir=`cd $(distdir) && pwd`; \
cd $(top_srcdir) \
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu WPrefs.app/po/Makefile
@for file in $(DISTFILES); do \
d=$(srcdir); \
if test -d $$d/$$file; then \

View File

@@ -109,9 +109,9 @@ GZIP_ENV = --best
all: all-redirect
.SUFFIXES:
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnu WPrefs.app/xpm/Makefile
cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps WPrefs.app/xpm/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
@@ -143,11 +143,6 @@ distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = WPrefs.app/xpm
distdir: $(DISTFILES)
here=`cd $(top_builddir) && pwd`; \
top_distdir=`cd $(top_distdir) && pwd`; \
distdir=`cd $(distdir) && pwd`; \
cd $(top_srcdir) \
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu WPrefs.app/xpm/Makefile
@for file in $(DISTFILES); do \
d=$(srcdir); \
if test -d $$d/$$file; then \

4
configure vendored
View File

@@ -751,7 +751,7 @@ fi
PACKAGE=WindowMaker
VERSION=0.53.1
VERSION=0.54.0
if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
{ echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; }
@@ -2987,7 +2987,7 @@ fi
supported_locales="cs de es fr gl it ja ko nl no pt ru se tr fi hr el pl ro da zh_TW.Big5 zh_CN sk"
supported_wprefs_locales="pt hr fr ko ja cs zh_TW.Big5 es zh_CN"
supported_wprefs_locales="pt hr fr ko ja cs zh_TW.Big5 es zh_CN fi"
for lang in $LINGUAS; do
ok=0

View File

@@ -3,7 +3,7 @@
*
* WindowMaker window manager
*
* Copyright (c) 1997-199 Alfredo K. Kojima
* Copyright (c) 1997-1999 Alfredo K. Kojima
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by