From: Miroslav Lichvar Date: Thu, 20 Mar 2008 18:47:32 +0000 (+0100) Subject: improve SIGWINCH handling in form X-Git-Tag: r0-52-9~5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0593cb3366c540859ef48c9381f55ddd6202b8b1;p=thirdparty%2Fnewt.git improve SIGWINCH handling in form --- diff --git a/form.c b/form.c index ae1c6a0..765e8e3 100644 --- a/form.c +++ b/form.c @@ -422,6 +422,8 @@ struct componentOps formOps = { newtDefaultMappedHandler, } ; +int needResize = 0; + static inline int componentFits(newtComponent co, int compNum) { struct form * form = co->data; struct element * el = form->elements + compNum; @@ -992,6 +994,11 @@ void newtFormRun(newtComponent co, struct newtExitStruct * es) { timeout.tv_sec = timeout.tv_usec = 0; } + if (needResize) { + needResize = 0; + newtResizeScreen(1); + } + i = select(max + 1, &readSet, &writeSet, &exceptSet, form->timer ? &timeout : NULL); if (i < 0) continue; /* ?? What should we do here? */ @@ -1031,11 +1038,6 @@ void newtFormRun(newtComponent co, struct newtExitStruct * es) { key = newtGetKey(); - if (key == NEWT_KEY_RESIZE) { - newtResizeScreen(1); - continue; - } - for (i = 0; i < form->numHotKeys; i++) { if (form->hotKeys[i] == key) { es->reason = NEWT_EXIT_HOTKEY; diff --git a/newt.c b/newt.c index 37050a0..51b5a2d 100644 --- a/newt.c +++ b/newt.c @@ -37,9 +37,9 @@ static char * helplineStack[20]; static char ** currentHelpline = NULL; static int cursorRow, cursorCol; -static int needResize = 0; static int cursorOn = 1; static int trashScreen = 0; +extern int needResize; static const char * defaultHelpLine = " / between elements | selects | next screen" @@ -264,8 +264,9 @@ void newtCls(void) { * @param redraw - boolean - should we redraw the screen? */ void newtResizeScreen(int redraw) { + /* we can't redraw from scratch, just redisplay SLang screen */ SLtt_get_screen_size(); - SLsmg_reinit_smg(); + /* SLsmg_reinit_smg(); */ if (redraw) { SLsmg_touch_lines (0, SLtt_Screen_Rows - 1); newtRefresh(); @@ -309,10 +310,6 @@ int newtInit(void) { newtCursorOff(); initKeymap(); - /*memset(&sa, 0, sizeof(sa)); - sa.sa_handler = handleSigwinch; - sigaction(SIGWINCH, &sa, NULL);*/ - SLsignal_intr(SIGWINCH, handleSigwinch); SLang_getkey_intr_hook = getkeyInterruptHook;