]> git.ipfire.org Git - thirdparty/newt.git/commitdiff
- cleaned up const qualifiers in interfaces
authorhavill <havill>
Sat, 4 Jan 2003 19:15:25 +0000 (19:15 +0000)
committerhavill <havill>
Sat, 4 Jan 2003 19:15:25 +0000 (19:15 +0000)
- added Ctrl-L screen refresh
- fixed segfault in test.c when listbox items are selected
- accessibility: made newt useable with monochrome terms (#60931)
- leave the symbols in the libs (#60400)
- fixed grammar in tutorial (#63496)
- removed obsolete URL reference in tutorial.sgml
- error checking (curcomp exists) for formEvent, newtFormGetCurrent,
  removed fifty button limit (#59027)
- allowed the test progs showchars and showkey to be build via the makefile

Makefile.in
form.c
newt.c
newt.spec
showchars.c
showkey.c
test.c
tutorial.sgml

index b2eee730074f718e3b3bf5f94c761c92ae1b6fa7..3c65d9d647cd1d99330519656d0c1d9eab16761b 100644 (file)
@@ -17,7 +17,7 @@ PYTHONVERS = $(shell ls -d /usr/include/python* | sed "s|/usr/include/||g")
 WHIPTCLSO=
 #WHIPTCLSO=whiptcl.so
 
-PROGS = test whiptail $(WHIPTCLSO) testgrid testtree
+PROGS = test whiptail $(WHIPTCLSO) testgrid testtree showchars showkey
 TESTOBJS = test.o
 NDIALOGOBJS = whiptail.o dialogboxes.o
 WHIPTCLOBJS = whiptcl.o dialogboxes.o
@@ -60,6 +60,12 @@ testgrid:    testgrid.o $(LIBNEWT)
 testtree:      testtree.o $(LIBNEWT)
        gcc -g -o testtree testtree.o $(LIBNEWT) $(LIBS)
 
+showchars:     showchars.o $(LIBNEWT)
+       gcc -g -o showchars showchars.o $(LIBNEWT) $(LIBS)
+
+showkey:       showkey.o $(LIBNEWT)
+       gcc -g -o showkey showkey.o $(LIBNEWT) $(LIBS)
+
 _snackmodule.so:   snackmodule.c $(LIBNEWTSH)
        for ver in $(PYTHONVERS) ; do \
            if [ ! -f "$$ver/_snackmodule.so" -o $(LIBNEWTSH) -nt "$$ver/_snackmodule.so" ]; then \
diff --git a/form.c b/form.c
index 3dd87c3fca5a968aaf32d6fb55b54979e22d04a5..534ca29c17e4e7a18b7b65f8dab5319e6b73e709 100644 (file)
--- a/form.c
+++ b/form.c
@@ -1013,7 +1013,7 @@ void newtFormRun(newtComponent co, struct newtExitStruct * es) {
                key = newtGetKey();
 
                if (key == NEWT_KEY_RESIZE) {
-                   /* newtResizeScreen(1); */
+                   newtResizeScreen(1);
                    continue;
                }
 
diff --git a/newt.c b/newt.c
index 97a7f5213acf199ee18896e9c36448474bce0f76..3b6dae0940eaef987e8783616023ef01b641b93e 100644 (file)
--- a/newt.c
+++ b/newt.c
@@ -37,7 +37,7 @@ static char * helplineStack[20];
 static char ** currentHelpline = NULL;
 
 static int cursorRow, cursorCol;
-static int needResize;
+static int needResize = 0;
 static int cursorOn = 1;
 static int trashScreen = 0;
 
@@ -124,11 +124,10 @@ static const struct keymap keymap[] = {
 };
 static char keyPrefix = '\033';
 
-static const char *const version = // ident friendly
-    "$Version: Newt windowing library version " VERSION "$"
-    "$License: (C) 1996-2003 Red Hat, Inc. "
-             "Licensed under the terms of the Lesser GNU Public License. "
-             "Originally written by Erik Troan $";
+static const char ident[] = // ident friendly
+    "$Version: Newt windowing library v" VERSION " $"
+    "$Copyright: (C) 1996-2003 Red Hat, Inc. Written by Erik Troan $"
+    "$License: Lesser GNU Public License. $";
 
 static newtSuspendCallback suspendCallback = NULL;
 static void * suspendCallbackData = NULL;
@@ -170,9 +169,20 @@ int wstrlen(const char *str, int len) {
        return nchars;
 }
 
+static int getkey() {
+    int c;
+
+    while ((c = SLang_getkey()) == '\xC') { /* if Ctrl-L redraw whole screen */
+        SLsmg_touch_lines (0, SLtt_Screen_Rows - 1);
+        SLsmg_refresh();
+    }
+    return c;
+
+}
+
 void newtFlushInput(void) {
     while (SLang_input_pending(0)) {
-       SLang_getkey();
+       getkey();
     }
 }
 
@@ -201,34 +211,27 @@ void newtCls(void) {
     newtRefresh();
 }
 
-#if defined(THIS_DOESNT_WORK)
 void newtResizeScreen(int redraw) {
-    newtPushHelpLine("");
-
     SLtt_get_screen_size();
-    SLang_init_tty(0, 0, 0);
-
-    SLsmg_touch_lines (0, SLtt_Screen_Rows - 1);
-
-    /* I don't know why I need this */
-    SLsmg_refresh();
-
-    newtPopHelpLine();
-
-    if (redraw)
-       SLsmg_refresh();
+    SLsmg_reinit_smg();
+    if (redraw) {
+        SLsmg_touch_lines (0, SLtt_Screen_Rows - 1);
+        newtRefresh();
+    }
 }
-#endif
 
 int newtInit(void) {
-    char * MonoValue, * MonoEnv = "NEWT_MONO", * lang;
-
-    lang = getenv ("LANG");
-    if (lang && !strcasecmp (lang, "ja_JP.eucJP"))
+    char * MonoValue, * MonoEnv = "NEWT_MONO";
+    const char *lang;
+
+    if ((lang = getenv("LC_ALL")) == NULL)
+        if ((lang = getenv("LC_CTYPE")) == NULL)
+            if ((lang = getenv("LANG")) == NULL)
+                lang = "";
+    if (strstr (lang, ".euc") != NULL)
        trashScreen = 1;
 
-    /* use the version variable just to be sure it gets included */
-    strlen(version);
+    (void) strlen(ident);
 
     SLtt_get_terminfo();
     SLtt_get_screen_size();
@@ -270,6 +273,26 @@ int newtFinished(void) {
 }
 
 void newtSetColors(struct newtColors colors) {
+    if (!SLtt_Use_Ansi_Colors) {
+        int i;
+
+        for (i = 2; i < 25; i++)
+            SLtt_set_mono(i, NULL, 0);
+
+        SLtt_set_mono(NEWT_COLORSET_SELLISTBOX, NULL, SLTT_BOLD_MASK);
+
+        SLtt_set_mono(NEWT_COLORSET_ACTBUTTON, NULL, SLTT_REV_MASK);
+        SLtt_set_mono(NEWT_COLORSET_ACTCHECKBOX, NULL, SLTT_REV_MASK);
+        SLtt_set_mono(NEWT_COLORSET_ACTLISTBOX, NULL, SLTT_REV_MASK);
+        SLtt_set_mono(NEWT_COLORSET_ACTTEXTBOX, NULL, SLTT_REV_MASK);
+
+        SLtt_set_mono(NEWT_COLORSET_ACTSELLISTBOX, NULL, SLTT_REV_MASK | SLTT_BOLD_MASK);
+        
+        SLtt_set_mono(NEWT_COLORSET_DISENTRY, NULL, 0); // FIXME
+        SLtt_set_mono(NEWT_COLORSET_FULLSCALE, NULL, SLTT_ULINE_MASK | SLTT_REV_MASK);
+        SLtt_set_mono(NEWT_COLORSET_EMPTYSCALE, NULL, SLTT_ULINE_MASK);
+        return;
+    }
     SLtt_set_color(NEWT_COLORSET_ROOT, "", colors.rootFg, colors.rootBg);
     SLtt_set_color(NEWT_COLORSET_BORDER, "", colors.borderFg, colors.borderBg);
     SLtt_set_color(NEWT_COLORSET_WINDOW, "", colors.windowFg, colors.windowBg);
@@ -319,10 +342,12 @@ int newtGetKey(void) {
     const struct keymap * curr;
 
     do {
-       key = SLang_getkey();
+       key = getkey();
        if (key == 0xFFFF) {
-           if (needResize)
+           if (needResize) {
+                needResize = 0;
                return NEWT_KEY_RESIZE;
+            }
 
            /* ignore other signals */
            continue;
@@ -355,7 +380,7 @@ int newtGetKey(void) {
 
     *chptr++ = key;
     while (SLang_input_pending(5)) {
-       key = SLang_getkey();
+       key = getkey();
        if (key == keyPrefix) {
            /* he hit unknown keys too many times -- start over */
            memset(buf, 0, sizeof(buf));
@@ -397,13 +422,13 @@ int newtGetKey(void) {
 void newtWaitForKey(void) {
     newtRefresh();
 
-    SLang_getkey();
+    getkey();
     newtClearKeyBuffer();
 }
 
 void newtClearKeyBuffer(void) {
     while (SLang_input_pending(1)) {
-       SLang_getkey();
+       getkey();
     }
 }
 
index 2c7f6d826adadb81ef4659b2209479f450412cad..c713e7801c6ba1e6622c4666e307678aa63aeeae 100644 (file)
--- a/newt.spec
+++ b/newt.spec
@@ -4,7 +4,7 @@ Summary: A development library for text mode user interfaces.
 Name: newt
 %define version 0.52.0
 Version: %{version}
-Release: 1
+Release: 3
 License: LGPL
 Group: System Environment/Libraries
 Source: newt-%{version}.tar.gz
@@ -81,12 +81,15 @@ rm -rf $RPM_BUILD_ROOT
 %{_libdir}/libnewt.so
 
 %changelog
-* Fri Jan  3 2003 Adrian Havill <havill@redhat.com> 0.52.0-1
+* Sun Jan  5 2003 Adrian Havill <havill@redhat.com> 0.52.0-3
 - cleaned up const qualifiers in interfaces
+- added Ctrl-L screen refresh
+- fixed segfault in test.c when listbox items are selected
+- accessibility: made newt useable with monochrome terms (#60931)
 - leave the symbols in the libs (#60400)
 - fixed grammar in tutorial (#63496)
-- removed fifty button limit (#59027)
-- error checking (curcomp exists) for formEvent, newtFormGetCurrent (#59027)
+- error checking (curcomp exists) for formEvent, newtFormGetCurrent,
+  removed fifty button limit (#59027)
 
 * Tue Dec 17 2002 Matt Wilson <msw@redhat.com> 0.51.2-1
 - fixed wstrlen() it was calculating wcwidth(first wide char in
index 71d0adbd1e0284efb2adafbc20401419af5aea06..eb999eda851ef007b27242fbbb2098b2859b8c94 100644 (file)
@@ -17,8 +17,6 @@ void printall(int offset) {
 }
 
 int main(void) {
-    char n = 0;
-
     SLtt_get_terminfo();
 
     SLtt_Use_Ansi_Colors = 1;
index 5f465b5c25b78ac455dfaaa1858cd48987d6e311..14baf6c3c2ad548f61825594e07ea11b9c4bc278 100644 (file)
--- a/showkey.c
+++ b/showkey.c
@@ -2,7 +2,6 @@
 #include <slang.h>
 
 int main(void) {
-    char n = 0;
     int i;
     char * buf;
 
@@ -38,4 +37,5 @@ int main(void) {
     printf("\n\r");
 
     SLang_reset_tty();
+    return 0;
 }
diff --git a/test.c b/test.c
index 33be2c8e8a5bb7049c3a1530f1d7b70dfbd536ab..c1b9aa8d16045a5f8ff63b131fe54c991cdcb1e0 100644 (file)
--- a/test.c
+++ b/test.c
@@ -154,10 +154,10 @@ int main(void) {
     printf("got string 2: %s\n", enr2);
     printf("got string 3: %s\n", enr3);
 
+    printf("\nSelected listbox items (%d):\n", numsel);
     if(selectedList) {
-       printf("\nSelected listbox items:\n");
        for(i = 0; i < numsel; i++)
-           puts(selectedList[i]);
+           printf("#%d\n", (int) selectedList[i]);
     }
 
     return 0;
index 91e58b723510ad809aca27f829db14676ff7b07b..e15a338039c1a126e45e2eb7da5828007eb3d278 100644 (file)
@@ -8,7 +8,7 @@
 <firstname>Erik Troan, &lt;ewt@redhat.com&gt;</firstname>
 </author>
 
-<pubdate>v0.30, 13 May 1998</pubdate>
+<pubdate>v0.31, 2003-Jan-06</pubdate>
 
 <abstract>
 
@@ -35,7 +35,7 @@ makes it significantly easier to craft robust <literal remap="tt">newt</literal>
 tutorial documents <literal remap="tt">newt</literal> 0.30 --- older versions of <literal remap="tt">newt</literal> had
 annoying inconsistencies in it (which writing this tutorial pointed out),
 which were removed while this tutorial was written. The latest version of
-<literal remap="tt">newt</literal> is always available from <ulink url="ftp://ftp.redhat.com/pub/redhat/code/newt">ftp.redhat.com</ulink>.</para>
+<literal remap="tt">newt</literal> is always available from Red Hat.</para>
 
 <sect2><title>Background</title>