Changeset 9f1362d4 in mainline for uspace/lib/c/generic/io/console.c


Ignore:
Timestamp:
2010-04-19T19:58:18Z (14 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
369a5f8
Parents:
caad59a
Message:

console output improvements

  • define new generic styles (STYLE_INVERTED for inverted print and STYLE_SELECTION for selections), use them primarily instead of specifying colors or RGBs
  • use console_set_style(fphone(stdout), STYLE_NORMAL) as the correct mean for reseting console settings (instead of specifying conrete hardcoded colors)
  • rename console_goto() to console_set_pos() (consistency with console_get_pos())
  • use semantically correct unsigned types for console sizes and cursor positions (instead of signed types)
  • use unsigned types for sizes and positions in libclui
  • top: nicer screen redrawing (do not use console_clear() which causes flickering, but repaint the screen properly — not entirely finished yet)
  • initialize mouse pointer coordinates (so the mouse cursor does not behave erratic after boot, unfortunatelly this does not solve ticket #223)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/io/console.c

    rcaad59a r9f1362d4  
    4545}
    4646
    47 int console_get_size(int phone, int *cols, int *rows)
     47int console_get_size(int phone, ipcarg_t *cols, ipcarg_t *rows)
    4848{
    49         ipcarg_t cols_v;
    50         ipcarg_t rows_v;
    51         int rc;
    52 
    53         rc = async_req_0_2(phone, CONSOLE_GET_SIZE, &cols_v, &rows_v);
    54 
    55         *cols = (int) cols_v;
    56         *rows = (int) rows_v;
    57         return rc;
     49        return async_req_0_2(phone, CONSOLE_GET_SIZE, cols, rows);
    5850}
    5951
    60 void console_set_style(int phone, int style)
     52void console_set_style(int phone, uint8_t style)
    6153{
    6254        async_msg_1(phone, CONSOLE_SET_STYLE, style);
    6355}
    6456
    65 void console_set_color(int phone, int fg_color, int bg_color, int flags)
     57void console_set_color(int phone, uint8_t fg_color, uint8_t bg_color,
     58    uint8_t flags)
    6659{
    6760        async_msg_3(phone, CONSOLE_SET_COLOR, fg_color, bg_color, flags);
    6861}
    6962
    70 void console_set_rgb_color(int phone, int fg_color, int bg_color)
     63void console_set_rgb_color(int phone, uint32_t fg_color, uint32_t bg_color)
    7164{
    7265        async_msg_2(phone, CONSOLE_SET_RGB_COLOR, fg_color, bg_color);
     
    7568void console_cursor_visibility(int phone, bool show)
    7669{
    77         async_msg_1(phone, CONSOLE_CURSOR_VISIBILITY, show != false);
     70        async_msg_1(phone, CONSOLE_CURSOR_VISIBILITY, (show != false));
    7871}
    7972
    80 int console_get_color_cap(int phone, int *ccap)
     73int console_get_color_cap(int phone, ipcarg_t *ccap)
    8174{
    82         ipcarg_t ccap_tmp;
    83         int rc;
    84 
    85         rc = async_req_0_1(phone, CONSOLE_GET_COLOR_CAP, &ccap_tmp);
    86         *ccap = ccap_tmp;
    87 
    88         return rc;
     75        return async_req_0_1(phone, CONSOLE_GET_COLOR_CAP, ccap);
    8976}
    9077
     
    9481}
    9582
    96 int console_get_pos(int phone, int *col, int *row)
     83int console_get_pos(int phone, ipcarg_t *col, ipcarg_t *row)
    9784{
    98         ipcarg_t col_v;
    99         ipcarg_t row_v;
    100         int rc;
    101 
    102         rc = async_req_0_2(phone, CONSOLE_GET_POS, &col_v, &row_v);
    103 
    104         *col = (int) col_v;
    105         *row = (int) row_v;
    106         return rc;
     85        return async_req_0_2(phone, CONSOLE_GET_POS, col, row);
    10786}
    10887
    109 void console_goto(int phone, int col, int row)
     88void console_set_pos(int phone, ipcarg_t col, ipcarg_t row)
    11089{
    11190        async_msg_2(phone, CONSOLE_GOTO, col, row);
Note: See TracChangeset for help on using the changeset viewer.