Changeset 1affcdf3 in mainline for uspace/lib/clui/tinput.c


Ignore:
Timestamp:
2011-06-10T19:33:41Z (13 years ago)
Author:
Maurizio Lombardi <m.lombardi85@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1878386
Parents:
13ecdac9 (diff), 79a141a (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.
Message:

Merge mainline changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/clui/tinput.c

    r13ecdac9 r1affcdf3  
    5454static void tinput_sel_all(tinput_t *);
    5555static 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 *);
     56static void tinput_key_ctrl(tinput_t *, kbd_event_t *);
     57static void tinput_key_shift(tinput_t *, kbd_event_t *);
     58static void tinput_key_ctrl_shift(tinput_t *, kbd_event_t *);
     59static void tinput_key_unmod(tinput_t *, kbd_event_t *);
    6060static void tinput_pre_seek(tinput_t *, bool);
    6161static void tinput_post_seek(tinput_t *, bool);
     
    8888        tinput_sel_get_bounds(ti, &sa, &sb);
    8989       
    90         console_set_pos(fphone(stdout), (ti->col0 + start) % ti->con_cols,
     90        console_set_pos(ti->console, (ti->col0 + start) % ti->con_cols,
    9191            ti->row0 + (ti->col0 + start) / ti->con_cols);
    92         console_set_style(fphone(stdout), STYLE_NORMAL);
     92        console_set_style(ti->console, STYLE_NORMAL);
    9393       
    9494        size_t p = start;
     
    101101       
    102102        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               
    105106                memcpy(dbuf, ti->buffer + p,
    106107                    (sb - p) * sizeof(wchar_t));
     
    110111        }
    111112       
    112         fflush(stdout);
    113         console_set_style(fphone(stdout), STYLE_NORMAL);
     113        console_flush(ti->console);
     114        console_set_style(ti->console, STYLE_NORMAL);
    114115       
    115116        if (p < ti->nc) {
     
    123124                putchar(' ');
    124125       
    125         fflush(stdout);
     126        console_flush(ti->console);
    126127}
    127128
     
    133134static void tinput_position_caret(tinput_t *ti)
    134135{
    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,
    136137            ti->row0 + (ti->col0 + ti->pos) / ti->con_cols);
    137138}
     
    516517static void tinput_init(tinput_t *ti)
    517518{
     519        ti->console = console_init(stdin, stdout);
    518520        ti->hnum = 0;
    519521        ti->hpos = 0;
     
    533535int tinput_read(tinput_t *ti, char **dstr)
    534536{
    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)
    537539                return EIO;
    538540       
    539         if (console_get_pos(fphone(stdin), &ti->col0, &ti->row0) != EOK)
     541        if (console_get_pos(ti->console, &ti->col0, &ti->row0) != EOK)
    540542                return EIO;
    541543       
     
    548550       
    549551        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))
    554556                        return EIO;
    555557               
     
    596598}
    597599
    598 static void tinput_key_ctrl(tinput_t *ti, console_event_t *ev)
     600static void tinput_key_ctrl(tinput_t *ti, kbd_event_t *ev)
    599601{
    600602        switch (ev->key) {
     
    635637}
    636638
    637 static void tinput_key_ctrl_shift(tinput_t *ti, console_event_t *ev)
     639static void tinput_key_ctrl_shift(tinput_t *ti, kbd_event_t *ev)
    638640{
    639641        switch (ev->key) {
     
    655657}
    656658
    657 static void tinput_key_shift(tinput_t *ti, console_event_t *ev)
     659static void tinput_key_shift(tinput_t *ti, kbd_event_t *ev)
    658660{
    659661        switch (ev->key) {
     
    681683}
    682684
    683 static void tinput_key_unmod(tinput_t *ti, console_event_t *ev)
     685static void tinput_key_unmod(tinput_t *ti, kbd_event_t *ev)
    684686{
    685687        switch (ev->key) {
Note: See TracChangeset for help on using the changeset viewer.