From 76827c72d15ffc6bb89190c839a48d29d4ed9690 Mon Sep 17 00:00:00 2001 From: dan Date: Tue, 27 Apr 1999 02:46:55 +0000 Subject: [PATCH] Made the secure textfield give some feedback about what is happening. --- WINGs/Resources/Makefile.in | 9 +--- WINGs/wtextfield.c | 117 +++++++++++++++++++++++++++----------------- WPrefs.app/po/Makefile.in | 9 +--- WPrefs.app/xpm/Makefile.in | 9 +--- configure | 4 +- src/wconfig.h.in | 2 +- 6 files changed, 81 insertions(+), 69 deletions(-) diff --git a/WINGs/Resources/Makefile.in b/WINGs/Resources/Makefile.in index 6451bfc8..a8bf066a 100644 --- a/WINGs/Resources/Makefile.in +++ b/WINGs/Resources/Makefile.in @@ -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 \ diff --git a/WINGs/wtextfield.c b/WINGs/wtextfield.c index cf5c50ae..f08e7dad 100644 --- a/WINGs/wtextfield.c +++ b/WINGs/wtextfield.c @@ -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); - - WMDrawImageString(screen, view->window, screen->textFieldGC, - tPtr->font, tx, ty, - &(tPtr->text[tPtr->viewPosition]), - tPtr->textLen - tPtr->viewPosition); - - if (tPtr->selection.count) { - int count; - - 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); - - 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)); - - XSetBackground(screen->display, screen->textFieldGC, - screen->white->color.pixel); - } + if (!tPtr->flags.enabled) + WMSetColorInGC(screen->darkGray, screen->textFieldGC); - if (!tPtr->flags.enabled) - WMSetColorInGC(screen->black, screen->textFieldGC); - } + WMDrawImageString(screen, view->window, screen->textFieldGC, + tPtr->font, tx, ty, + &(text[tPtr->viewPosition]), + tPtr->textLen - tPtr->viewPosition); + + if (tPtr->selection.count) { + int count; + + count = tPtr->selection.count < 0 + ? tPtr->selection.position + tPtr->selection.count + : tPtr->selection.position; + + /* + 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); + + 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); + } + + 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); } diff --git a/WPrefs.app/po/Makefile.in b/WPrefs.app/po/Makefile.in index 9de9fbfc..32fd1ca1 100644 --- a/WPrefs.app/po/Makefile.in +++ b/WPrefs.app/po/Makefile.in @@ -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 \ diff --git a/WPrefs.app/xpm/Makefile.in b/WPrefs.app/xpm/Makefile.in index eb4019b5..ec6a7e26 100644 --- a/WPrefs.app/xpm/Makefile.in +++ b/WPrefs.app/xpm/Makefile.in @@ -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 \ diff --git a/configure b/configure index f8845009..d0476c91 100755 --- a/configure +++ b/configure @@ -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 diff --git a/src/wconfig.h.in b/src/wconfig.h.in index e460df73..9a3b94af 100644 --- a/src/wconfig.h.in +++ b/src/wconfig.h.in @@ -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 -- 2.11.4.GIT