- while ((ch = wgetch(win)) != ERR) {
- /*
- * Some terminals (the Wyse-50 is the most common) generate
- * a \n from the down-arrow key. With this logic, it's the
- * user's choice whether to set kcud=\n for wgetch();
- * terminating *getstr() with \n should work either way.
- */
- if (ch == '\n'
- || ch == '\r'
- || ch == KEY_DOWN
- || ch == KEY_ENTER) {
- if (oldecho == TRUE
- && win->_cury == win->_maxy
- && win->_scroll)
- wechochar(win, '\n');
- break;
- }
- if (ch == erasec || ch == KEY_LEFT || ch == KEY_BACKSPACE) {
- if (str > oldstr) {
- str = WipeOut(win, y, x, oldstr, str, oldecho);
- }
- } else if (ch == killc) {
- while (str > oldstr) {
- str = WipeOut(win, y, x, oldstr, str, oldecho);
- }
- } else if (ch >= KEY_MIN
- || (maxlen >= 0 && str - oldstr >= maxlen)) {
- beep();
- } else {
- *str++ = ch;
- if (oldecho == TRUE) {
- int oldy = win->_cury;
- if (waddch(win, ch) == ERR) {
- /*
- * We can't really use the lower-right
- * corner for input, since it'll mess
- * up bookkeeping for erases.
- */
- win->_flags &= ~_WRAPPED;
- waddch(win, ' ');
- str = WipeOut(win, y, x, oldstr, str, oldecho);
- continue;
- } else if (win->_flags & _WRAPPED) {
- /*
- * If the last waddch forced a wrap &
- * scroll, adjust our reference point
- * for erasures.
- */
- if (win->_scroll
- && oldy == win->_maxy
- && win->_cury == win->_maxy) {
- if (--y <= 0) {
- y = 0;
- }
- }
- win->_flags &= ~_WRAPPED;
- }
- wrefresh(win);
+ while ((ch = wgetch_events(win, evl)) != ERR) {
+ /*
+ * Some terminals (the Wyse-50 is the most common) generate
+ * a \n from the down-arrow key. With this logic, it's the
+ * user's choice whether to set kcud=\n for wgetch();
+ * terminating *getstr() with \n should work either way.
+ */
+ if (ch == '\n'
+ || ch == '\r'
+ || ch == KEY_DOWN
+ || ch == KEY_ENTER) {
+ if (oldecho == TRUE
+ && win->_cury == win->_maxy
+ && win->_scroll)
+ wechochar(win, (chtype) '\n');
+ break;
+ }
+#ifdef KEY_EVENT
+ if (ch == KEY_EVENT)
+ break;
+#endif
+#ifdef KEY_RESIZE
+ if (ch == KEY_RESIZE)
+ break;
+#endif
+ if (ch == erasec || ch == KEY_LEFT || ch == KEY_BACKSPACE) {
+ if (str > oldstr) {
+ str = WipeOut(win, y, x, oldstr, str, oldecho);
+ }
+ } else if (ch == killc) {
+ while (str > oldstr) {
+ str = WipeOut(win, y, x, oldstr, str, oldecho);
+ }
+ } else if (ch >= KEY_MIN
+ || (maxlen >= 0 && str - oldstr >= maxlen)) {
+ NCURSES_SP_NAME(beep) (NCURSES_SP_ARG);
+ } else {
+ *str++ = (char) ch;
+ if (oldecho == TRUE) {
+ int oldy = win->_cury;
+ if (waddch(win, (chtype) ch) == ERR) {
+ /*
+ * We can't really use the lower-right
+ * corner for input, since it'll mess
+ * up bookkeeping for erases.
+ */
+ win->_flags &= ~_WRAPPED;
+ waddch(win, (chtype) ' ');
+ str = WipeOut(win, y, x, oldstr, str, oldecho);
+ continue;
+ } else if (win->_flags & _WRAPPED) {
+ /*
+ * If the last waddch forced a wrap &
+ * scroll, adjust our reference point
+ * for erasures.
+ */
+ if (win->_scroll
+ && oldy == win->_maxy
+ && win->_cury == win->_maxy) {
+ if (--y <= 0) {
+ y = 0;