Permalink
Browse files

Use a separate pad for input

wgetch calls a wrefresh on regular windows. I imagine this is for
echo(), which we do not use. Instead, we make a pad and only ever
wgetch on it.

This also means that the various nodelay settings on other windows are
unnecessary.
  • Loading branch information...
1 parent bcff94d commit 0881cdda52baa4677179208b39a3392f06182cf5 @davidben davidben committed May 6, 2010
Showing with 9 additions and 13 deletions.
  1. +6 −4 global.c
  2. +2 −5 owl.c
  3. +1 −0 owl.h
  4. +0 −4 popwin.c
View
@@ -119,6 +119,12 @@ void owl_global_init(owl_global *g) {
owl_list_create(&(g->psa_list));
g->timerlist = NULL;
g->interrupted = FALSE;
+
+ /* set up a pad for input */
+ g->input_pad = newpad(1, 1);
+ nodelay(g->input_pad, 1);
+ keypad(g->input_pad, 1);
+ meta(g->input_pad, 1);
}
/* Called once perl has been initialized */
@@ -178,11 +184,7 @@ void _owl_global_setup_windows(owl_global *g) {
idlok(owl_global_get_curs_sepwin(g), FALSE);
idlok(owl_global_get_curs_msgwin(g), FALSE);
- nodelay(owl_global_get_curs_typwin(g), 1);
- keypad(owl_global_get_curs_typwin(g), TRUE);
wmove(owl_global_get_curs_typwin(g), 0, 0);
-
- meta(owl_global_get_curs_typwin(g), TRUE);
}
owl_context *owl_global_get_context(owl_global *g) {
View
7 owl.c
@@ -310,12 +310,9 @@ int owl_process_messages(owl_ps_action *d, void *p)
void owl_process_input(const owl_io_dispatch *d, void *data)
{
owl_input j;
- WINDOW *typwin;
-
- typwin = owl_global_get_curs_typwin(&g);
while (1) {
- j.ch = wgetch(typwin);
+ j.ch = wgetch(g.input_pad);
if (j.ch == ERR) return;
j.uch = '\0';
@@ -338,7 +335,7 @@ void owl_process_input(const owl_io_dispatch *d, void *data)
else bytes = 1;
for (i = 1; i < bytes; i++) {
- int tmp = wgetch(typwin);
+ int tmp = wgetch(g.input_pad);
/* If what we got was not a byte, or not a continuation byte */
if (tmp > 0xff || !(tmp & 0x80 && ~tmp & 0x40)) {
/* ill-formed UTF-8 code unit subsequence, put back the
View
1 owl.h
@@ -564,6 +564,7 @@ typedef struct _owl_global {
int curmsg_vert_offset;
owl_view current_view;
owl_messagelist msglist;
+ WINDOW *input_pad;
PANEL *recpan, *seppan, *msgpan, *typpan;
int needrefresh;
int rightshift;
View
@@ -27,10 +27,6 @@ int owl_popwin_up(owl_popwin *pw)
pw->borderpanel = new_panel(borderwin);
popwin = newwin(pw->lines-2, pw->cols-2, startline+1, startcol+1);
pw->poppanel = new_panel(popwin);
-
- meta(popwin,TRUE);
- nodelay(popwin, 1);
- keypad(popwin, TRUE);
werase(popwin);
werase(borderwin);

0 comments on commit 0881cdd

Please sign in to comment.