Changeset 41811af in mainline for uspace/lib/clui/tinput.c
- Timestamp:
- 2011-06-10T10:14:26Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ab547063
- Parents:
- 9536e6e (diff), 390d80d (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/clui/tinput.c
r9536e6e r41811af 54 54 static void tinput_sel_all(tinput_t *); 55 55 static void tinput_sel_delete(tinput_t *); 56 static void tinput_key_ctrl(tinput_t *, console_event_t *);57 static void tinput_key_shift(tinput_t *, console_event_t *);58 static void tinput_key_ctrl_shift(tinput_t *, console_event_t *);59 static void tinput_key_unmod(tinput_t *, console_event_t *);56 static void tinput_key_ctrl(tinput_t *, kbd_event_t *); 57 static void tinput_key_shift(tinput_t *, kbd_event_t *); 58 static void tinput_key_ctrl_shift(tinput_t *, kbd_event_t *); 59 static void tinput_key_unmod(tinput_t *, kbd_event_t *); 60 60 static void tinput_pre_seek(tinput_t *, bool); 61 61 static void tinput_post_seek(tinput_t *, bool); … … 88 88 tinput_sel_get_bounds(ti, &sa, &sb); 89 89 90 console_set_pos( fphone(stdout), (ti->col0 + start) % ti->con_cols,90 console_set_pos(ti->console, (ti->col0 + start) % ti->con_cols, 91 91 ti->row0 + (ti->col0 + start) / ti->con_cols); 92 console_set_style( fphone(stdout), STYLE_NORMAL);92 console_set_style(ti->console, STYLE_NORMAL); 93 93 94 94 size_t p = start; … … 101 101 102 102 if (p < sb) { 103 fflush(stdout); 104 console_set_style(fphone(stdout), STYLE_SELECTED); 103 console_flush(ti->console); 104 console_set_style(ti->console, STYLE_SELECTED); 105 105 106 memcpy(dbuf, ti->buffer + p, 106 107 (sb - p) * sizeof(wchar_t)); … … 110 111 } 111 112 112 fflush(stdout);113 console_set_style( fphone(stdout), STYLE_NORMAL);113 console_flush(ti->console); 114 console_set_style(ti->console, STYLE_NORMAL); 114 115 115 116 if (p < ti->nc) { … … 123 124 putchar(' '); 124 125 125 fflush(stdout);126 console_flush(ti->console); 126 127 } 127 128 … … 133 134 static void tinput_position_caret(tinput_t *ti) 134 135 { 135 console_set_pos( fphone(stdout), (ti->col0 + ti->pos) % ti->con_cols,136 console_set_pos(ti->console, (ti->col0 + ti->pos) % ti->con_cols, 136 137 ti->row0 + (ti->col0 + ti->pos) / ti->con_cols); 137 138 } … … 516 517 static void tinput_init(tinput_t *ti) 517 518 { 519 ti->console = console_init(stdin, stdout); 518 520 ti->hnum = 0; 519 521 ti->hpos = 0; … … 533 535 int tinput_read(tinput_t *ti, char **dstr) 534 536 { 535 fflush(stdout);536 if (console_get_size( fphone(stdin), &ti->con_cols, &ti->con_rows) != EOK)537 console_flush(ti->console); 538 if (console_get_size(ti->console, &ti->con_cols, &ti->con_rows) != EOK) 537 539 return EIO; 538 540 539 if (console_get_pos( fphone(stdin), &ti->col0, &ti->row0) != EOK)541 if (console_get_pos(ti->console, &ti->col0, &ti->row0) != EOK) 540 542 return EIO; 541 543 … … 548 550 549 551 while (!ti->done) { 550 fflush(stdout);551 552 console_event_t ev;553 if (!console_get_ event(fphone(stdin), &ev))552 console_flush(ti->console); 553 554 kbd_event_t ev; 555 if (!console_get_kbd_event(ti->console, &ev)) 554 556 return EIO; 555 557 … … 596 598 } 597 599 598 static void tinput_key_ctrl(tinput_t *ti, console_event_t *ev)600 static void tinput_key_ctrl(tinput_t *ti, kbd_event_t *ev) 599 601 { 600 602 switch (ev->key) { … … 635 637 } 636 638 637 static void tinput_key_ctrl_shift(tinput_t *ti, console_event_t *ev)639 static void tinput_key_ctrl_shift(tinput_t *ti, kbd_event_t *ev) 638 640 { 639 641 switch (ev->key) { … … 655 657 } 656 658 657 static void tinput_key_shift(tinput_t *ti, console_event_t *ev)659 static void tinput_key_shift(tinput_t *ti, kbd_event_t *ev) 658 660 { 659 661 switch (ev->key) { … … 681 683 } 682 684 683 static void tinput_key_unmod(tinput_t *ti, console_event_t *ev)685 static void tinput_key_unmod(tinput_t *ti, kbd_event_t *ev) 684 686 { 685 687 switch (ev->key) {
Note:
See TracChangeset
for help on using the changeset viewer.