1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-31 19:12:32 +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 all: all-redirect
.SUFFIXES: .SUFFIXES:
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) $(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) \ cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
@@ -142,11 +142,6 @@ distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = WINGs/Resources subdir = WINGs/Resources
distdir: $(DISTFILES) 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 \ @for file in $(DISTFILES); do \
d=$(srcdir); \ d=$(srcdir); \
if test -d $$d/$$file; then \ 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 static void
paintCursor(TextField *tPtr) paintCursor(TextField *tPtr)
{ {
int cx; int cx;
WMScreen *screen = tPtr->view->screen; WMScreen *screen = tPtr->view->screen;
int textWidth; 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); tPtr->cursorPosition-tPtr->viewPosition);
switch (tPtr->flags.alignment) { switch (tPtr->flags.alignment) {
case WARight: case WARight:
textWidth = WMWidthOfString(tPtr->font, tPtr->text, tPtr->textLen); textWidth = WMWidthOfString(tPtr->font, text, tPtr->textLen);
if (textWidth < tPtr->usableWidth) if (textWidth < tPtr->usableWidth)
cx += tPtr->offsetWidth + tPtr->usableWidth - textWidth + 1; cx += tPtr->offsetWidth + tPtr->usableWidth - textWidth + 1;
else else
@@ -551,7 +568,7 @@ paintCursor(TextField *tPtr)
case WAJustified: case WAJustified:
/* not supported */ /* not supported */
case WACenter: case WACenter:
textWidth = WMWidthOfString(tPtr->font, tPtr->text, tPtr->textLen); textWidth = WMWidthOfString(tPtr->font, text, tPtr->textLen);
if (textWidth < tPtr->usableWidth) if (textWidth < tPtr->usableWidth)
cx += tPtr->offsetWidth + (tPtr->usableWidth-textWidth)/2; cx += tPtr->offsetWidth + (tPtr->usableWidth-textWidth)/2;
else else
@@ -567,6 +584,9 @@ paintCursor(TextField *tPtr)
XDrawLine(screen->display, tPtr->view->window, screen->xorGC, XDrawLine(screen->display, tPtr->view->window, screen->xorGC,
cx, tPtr->offsetWidth, cx, cx, tPtr->offsetWidth, cx,
tPtr->view->size.height - tPtr->offsetWidth - 1); tPtr->view->size.height - tPtr->offsetWidth - 1);
if (tPtr->flags.secure)
free(text);
} }
@@ -617,6 +637,7 @@ paintTextField(TextField *tPtr)
int rx; int rx;
int bd; int bd;
int totalWidth; int totalWidth;
char *text;
if (!view->flags.realized || !view->flags.mapped) if (!view->flags.realized || !view->flags.mapped)
@@ -628,10 +649,16 @@ paintTextField(TextField *tPtr)
bd = 2; bd = 2;
} }
if (tPtr->flags.secure) {
text = makeHiddenString(strlen(tPtr->text));
} else {
text = tPtr->text;
}
totalWidth = tPtr->view->size.width - 2*bd; totalWidth = tPtr->view->size.width - 2*bd;
if (tPtr->textLen > 0) { if (tPtr->textLen > 0) {
tw = WMWidthOfString(tPtr->font, &(tPtr->text[tPtr->viewPosition]), tw = WMWidthOfString(tPtr->font, &(text[tPtr->viewPosition]),
tPtr->textLen - tPtr->viewPosition); tPtr->textLen - tPtr->viewPosition);
th = WMFontHeight(tPtr->font); th = WMFontHeight(tPtr->font);
@@ -662,54 +689,51 @@ paintTextField(TextField *tPtr)
break; break;
} }
if (!tPtr->flags.secure) { if (!tPtr->flags.enabled)
if (!tPtr->flags.enabled) WMSetColorInGC(screen->darkGray, screen->textFieldGC);
WMSetColorInGC(screen->darkGray, screen->textFieldGC);
WMDrawImageString(screen, view->window, screen->textFieldGC, WMDrawImageString(screen, view->window, screen->textFieldGC,
tPtr->font, tx, ty, tPtr->font, tx, ty,
&(tPtr->text[tPtr->viewPosition]), &(text[tPtr->viewPosition]),
tPtr->textLen - tPtr->viewPosition); tPtr->textLen - tPtr->viewPosition);
if (tPtr->selection.count) { if (tPtr->selection.count) {
int count; int count;
count = tPtr->selection.count < 0 count = tPtr->selection.count < 0
? tPtr->selection.position + tPtr->selection.count ? tPtr->selection.position + tPtr->selection.count
: tPtr->selection.position; : tPtr->selection.position;
/* /*
rx = tx + WMWidthOfString(tPtr->font, rx = tx + WMWidthOfString(tPtr->font,
&(tPtr->text[tPtr->viewPosition]), &(text[tPtr->viewPosition]),
count) count)
- WMWidthOfString(tPtr->font, - WMWidthOfString(tPtr->font,
tPtr->text,tPtr->viewPosition); text,tPtr->viewPosition);
*/ */
rx = tPtr->offsetWidth + 1 + WMWidthOfString(tPtr->font,tPtr->text,count) rx = tPtr->offsetWidth + 1 + WMWidthOfString(tPtr->font,text,count)
- WMWidthOfString(tPtr->font,tPtr->text,tPtr->viewPosition); - WMWidthOfString(tPtr->font,text,tPtr->viewPosition);
XSetBackground(screen->display, screen->textFieldGC, XSetBackground(screen->display, screen->textFieldGC,
screen->gray->color.pixel); screen->gray->color.pixel);
WMDrawImageString(screen, view->window, screen->textFieldGC, WMDrawImageString(screen, view->window, screen->textFieldGC,
tPtr->font, rx, ty, &(tPtr->text[count]), tPtr->font, rx, ty, &(text[count]),
abs(tPtr->selection.count)); abs(tPtr->selection.count));
XSetBackground(screen->display, screen->textFieldGC, XSetBackground(screen->display, screen->textFieldGC,
screen->white->color.pixel); screen->white->color.pixel);
} }
if (!tPtr->flags.enabled) if (!tPtr->flags.enabled)
WMSetColorInGC(screen->black, screen->textFieldGC); WMSetColorInGC(screen->black, screen->textFieldGC);
}
} else { } else {
XClearArea(screen->display, view->window, bd, bd, totalWidth, XClearArea(screen->display, view->window, bd, bd, totalWidth,
view->size.height - 2*bd, False); view->size.height - 2*bd, False);
} }
/* draw cursor */ /* draw cursor */
if (tPtr->flags.focused && tPtr->flags.enabled && tPtr->flags.cursorOn if (tPtr->flags.focused && tPtr->flags.enabled && tPtr->flags.cursorOn) {
&& !tPtr->flags.secure) {
paintCursor(tPtr); paintCursor(tPtr);
} }
@@ -717,6 +741,9 @@ paintTextField(TextField *tPtr)
if (tPtr->flags.bordered) { if (tPtr->flags.bordered) {
drawRelief(view, tPtr->flags.beveled); drawRelief(view, tPtr->flags.beveled);
} }
if (tPtr->flags.secure)
free(text);
} }

View File

@@ -120,9 +120,9 @@ all: all-redirect
.SUFFIXES: .SUFFIXES:
.SUFFIXES: .mo .po .SUFFIXES: .mo .po
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) $(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) \ cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
@@ -135,11 +135,6 @@ distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = WPrefs.app/po subdir = WPrefs.app/po
distdir: $(DISTFILES) 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 \ @for file in $(DISTFILES); do \
d=$(srcdir); \ d=$(srcdir); \
if test -d $$d/$$file; then \ if test -d $$d/$$file; then \

View File

@@ -109,9 +109,9 @@ GZIP_ENV = --best
all: all-redirect all: all-redirect
.SUFFIXES: .SUFFIXES:
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) $(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) \ cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
@@ -143,11 +143,6 @@ distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = WPrefs.app/xpm subdir = WPrefs.app/xpm
distdir: $(DISTFILES) 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 \ @for file in $(DISTFILES); do \
d=$(srcdir); \ d=$(srcdir); \
if test -d $$d/$$file; then \ if test -d $$d/$$file; then \

4
configure vendored
View File

@@ -751,7 +751,7 @@ fi
PACKAGE=WindowMaker PACKAGE=WindowMaker
VERSION=0.53.1 VERSION=0.54.0
if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then 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; } { 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_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 for lang in $LINGUAS; do
ok=0 ok=0

View File

@@ -3,7 +3,7 @@
* *
* WindowMaker window manager * 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 * 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 * it under the terms of the GNU General Public License as published by