Skip to content

Commit

Permalink
Use a separate pad for input
Browse files Browse the repository at this point in the history
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
davidben committed May 11, 2010
1 parent bcff94d commit 0881cdd
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 13 deletions.
10 changes: 6 additions & 4 deletions global.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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) {
Expand Down
7 changes: 2 additions & 5 deletions owl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions owl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 0 additions & 4 deletions popwin.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 0881cdd

Please sign in to comment.