#include <sys/time.h>
#include <sys/types.h>
#include <termios.h>
+#include <time.h>
#include <unistd.h>
#include <wchar.h>
static int cursorRow, cursorCol;
static int cursorOn = 1;
+static int noFlowCtrl = 0;
static int trashScreen = 0;
extern int needResize;
static void initKeymap();
static void freeKeymap();
-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;
static void parseColors(char *s, struct newtColors *palette)
{
char *name, *str, *fg, *bg;
- int i;
for (str = s; (s = strtok(str, ";:\n\r\t ")); str = NULL) {
name = s;
int newtResume(void) {
SLsmg_resume_smg ();
SLsmg_refresh();
- return SLang_init_tty(0, 0, 0);
+ return SLang_init_tty(0, noFlowCtrl, 0);
}
void newtCls(void) {
*/
int newtInit(void) {
char * MonoValue, * MonoEnv = "NEWT_MONO";
+ char * NoFlowCtrlValue, * NoFlowCtrlEnv = "NEWT_NOFLOWCTRL";
const char *lang;
int ret;
if (strstr (lang, ".euc") != NULL)
trashScreen = 1;
- (void) strlen(ident);
-
SLutf8_enable(-1);
SLtt_get_terminfo();
SLtt_get_screen_size();
if ( MonoValue != NULL )
SLtt_Use_Ansi_Colors = 0;
+ NoFlowCtrlValue = getenv(NoFlowCtrlEnv);
+ if ( NoFlowCtrlValue != NULL )
+ noFlowCtrl = 1;
+
if ((ret = SLsmg_init_smg()) < 0)
return ret;
- if ((ret = SLang_init_tty(0, 0, 0)) < 0)
+ if ((ret = SLang_init_tty(0, noFlowCtrl, 0)) < 0)
return ret;
initColors();
if (currentWindow == NULL)
return;
- row = col = 0;
-
row = currentWindow->top - 1;
col = currentWindow->left - 2;
if (row < 0)
* @param int - number of usecs to wait for.
*/
void newtDelay(unsigned int usecs) {
- usleep(usecs);
+ struct timespec t = { usecs / 1000000, (usecs % 1000000) * 1000 };
+
+ nanosleep(&t, NULL);
}
struct eventResult newtDefaultEventHandler(newtComponent c,
}
SLsmg_gotorc(SLtt_Screen_Rows - 1, 0);
SLsmg_write_string(buf);
+ SLsmg_gotorc(cursorRow, cursorCol);
}
void newtPushHelpLine(const char * text) {
SLsmg_touch_lines(0, SLtt_Screen_Rows);
}
+void newtComponentGetPosition(newtComponent co, int * left, int * top) {
+ if (left) *left = co->left;
+ if (top) *top = co->top;
+}
+
+void newtComponentGetSize(newtComponent co, int * width, int * height) {
+ if (width) *width = co->width;
+ if (height) *height = co->height;
+}