From 1afd7010c61bed57d131bc07989edf71c826e1c6 Mon Sep 17 00:00:00 2001 From: Tobias Boege Date: Wed, 29 Jul 2015 19:32:45 +0000 Subject: [PATCH] [GB.NCURSES] * NEW: Screen.Beep() is a new method which makes an audible beep * NEW: Screen.Flash() produces a visual flash on the screen * BUG: Fix Window.ReadLine(): getnstr() doesn't return the input length git-svn-id: svn://localhost/gambas/trunk@7190 867c0c6c-44f3-4631-809d-bfa615b0a4ec --- gb.ncurses/src/c_screen.c | 14 ++++++++++++++ gb.ncurses/src/c_window.c | 8 ++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/gb.ncurses/src/c_screen.c b/gb.ncurses/src/c_screen.c index a2ce72bb2..eac2df773 100644 --- a/gb.ncurses/src/c_screen.c +++ b/gb.ncurses/src/c_screen.c @@ -158,6 +158,18 @@ BEGIN_METHOD_VOID(Screen_free) END_METHOD #endif +BEGIN_METHOD_VOID(Screen_Beep) + + beep(); + +END_METHOD + +BEGIN_METHOD_VOID(Screen_Flash) + + flash(); + +END_METHOD + BEGIN_METHOD_VOID(Screen_Refresh) SCREEN_refresh(); @@ -242,6 +254,8 @@ GB_DESC CScreenDesc[] = { GB_EVENT("Resize", NULL, NULL, &EVENT_Resize), GB_STATIC_METHOD("_init", NULL, Screen_init, NULL), + GB_STATIC_METHOD("Beep", NULL, Screen_Beep, NULL), + GB_STATIC_METHOD("Flash", NULL, Screen_Flash, NULL), GB_STATIC_METHOD("Refresh", NULL, Screen_Refresh, NULL), GB_STATIC_METHOD("Resize", NULL, Screen_Resize, "(Lines)i(Cols)i"), diff --git a/gb.ncurses/src/c_window.c b/gb.ncurses/src/c_window.c index cc5d7a963..5950b0266 100644 --- a/gb.ncurses/src/c_window.c +++ b/gb.ncurses/src/c_window.c @@ -501,14 +501,14 @@ END_METHOD BEGIN_METHOD_VOID(Window_ReadLine) char line[256]; /* XXX: Must be enough! */ - int len; + int ret; - len = getnstr(line, sizeof(line) - 1); - if (len == ERR) { + bzero(line, sizeof(line)); + ret = wgetnstr(THIS->main, line, sizeof(line) - 1); + if (ret == ERR) { GB.ReturnNull(); return; } - line[len] = 0; GB.ReturnNewZeroString(line); END_METHOD