Changes in uspace/lib/ui/src/ui.c [3d10a2f:252d03c] in mainline


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/ui/src/ui.c

    r3d10a2f r252d03c  
    3939#include <errno.h>
    4040#include <fibril.h>
    41 #include <gfx/color.h>
    42 #include <gfx/render.h>
    4341#include <io/console.h>
    4442#include <stdbool.h>
     
    5553 *
    5654 * Output specification has the form <proto>@<service> where proto is
    57  * eiher 'disp' for display service, 'cons' for console, 'null'
    58  * for dummy output. Service is a location ID service name (e.g. hid/display).
     55 * eiher 'disp' for display service or 'cons' for console. Service
     56 * is a location ID service name (e.g. hid/display).
    5957 *
    6058 * @param ospec Output specification
     
    8280                } else if (str_lcmp(ospec, "cons@", str_length("cons@")) == 0) {
    8381                        *ws = ui_ws_console;
    84                 } else if (str_lcmp(ospec, "null@", str_length("null@")) == 0) {
    85                         *ws = ui_ws_null;
    8682                } else {
    8783                        *ws = ui_ws_unknown;
     
    10197 *
    10298 * @param ospec Output specification or @c UI_DISPLAY_DEFAULT to use
    103  *              the default display service, UI_CONSOLE_DEFAULT to use
    104  *              the default console service, UI_DISPLAY_NULL to use
    105  *              dummy output.
     99 *              the default output
    106100 * @param rui Place to store pointer to new UI
    107101 * @return EOK on success or an error code
     
    115109        ui_winsys_t ws;
    116110        const char *osvc;
    117         sysarg_t cols;
    118         sysarg_t rows;
    119111        ui_t *ui;
    120112
     
    135127                if (console == NULL)
    136128                        return EIO;
    137 
    138                 rc = console_get_size(console, &cols, &rows);
    139                 if (rc != EOK) {
    140                         console_done(console);
    141                         return rc;
    142                 }
    143 
    144                 console_cursor_visibility(console, false);
    145129
    146130                /* ws == ui_ws_console */
     
    159143
    160144                ui->cgc = cgc;
    161                 ui->rect.p0.x = 0;
    162                 ui->rect.p0.y = 0;
    163                 ui->rect.p1.x = cols;
    164                 ui->rect.p1.y = rows;
    165 
    166                 (void) ui_paint(ui);
    167         } else if (ws == ui_ws_null) {
    168                 rc = ui_create_disp(NULL, &ui);
    169                 if (rc != EOK)
    170                         return rc;
    171145        } else {
    172146                return EINVAL;
     
    229203                if (ui->cgc != NULL)
    230204                        console_gc_delete(ui->cgc);
    231                 if (ui->console != NULL) {
    232                         console_cursor_visibility(ui->console, true);
     205                if (ui->console != NULL)
    233206                        console_done(ui->console);
    234                 }
    235207                if (ui->display != NULL)
    236208                        display_close(ui->display);
     
    244216        ui_window_t *awnd;
    245217        ui_evclaim_t claim;
    246         pos_event_t pos;
    247218
    248219        awnd = ui_window_get_active(ui);
     
    255226                break;
    256227        case CEV_POS:
    257                 pos = event->ev.pos;
    258                 /* Translate event to window-relative coordinates */
    259                 pos.hpos -= awnd->dpos.x;
    260                 pos.vpos -= awnd->dpos.y;
    261 
    262                 claim = ui_wdecor_pos_event(awnd->wdecor, &pos);
     228                claim = ui_wdecor_pos_event(awnd->wdecor, &event->ev.pos);
    263229                /* Note: If event is claimed, awnd might not be valid anymore */
    264230                if (claim == ui_unclaimed)
    265                         ui_window_send_pos(awnd, &pos);
    266 
     231                        ui_window_send_pos(awnd, &event->ev.pos);
    267232                break;
    268233        }
     
    315280{
    316281        errno_t rc;
    317         gfx_context_t *gc;
    318282        ui_window_t *awnd;
    319         gfx_color_t *color = NULL;
    320 
    321         /* In case of null output */
    322         if (ui->cgc == NULL)
    323                 return EOK;
    324 
    325         gc = console_gc_get_ctx(ui->cgc);
    326 
    327         rc = gfx_color_new_ega(0x11, &color);
    328         if (rc != EOK)
    329                 return rc;
    330 
    331         rc = gfx_set_color(gc, color);
    332         if (rc != EOK) {
    333                 gfx_color_delete(color);
    334                 return rc;
    335         }
    336 
    337         rc = gfx_fill_rect(gc, &ui->rect);
    338         if (rc != EOK) {
    339                 gfx_color_delete(color);
    340                 return rc;
    341         }
    342 
    343         gfx_color_delete(color);
    344283
    345284        /* XXX Should repaint all windows */
Note: See TracChangeset for help on using the changeset viewer.