Changeset 1ebcb791 in mainline for uspace/lib/ui/src/ui.c


Ignore:
Timestamp:
2021-09-01T19:44:37Z (4 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f7c12b3
Parents:
45004f3
Message:

Fill text UI background with color

File:
1 edited

Legend:

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

    r45004f3 r1ebcb791  
    3939#include <errno.h>
    4040#include <fibril.h>
     41#include <gfx/color.h>
     42#include <gfx/render.h>
    4143#include <io/console.h>
    4244#include <stdbool.h>
     
    109111        ui_winsys_t ws;
    110112        const char *osvc;
     113        sysarg_t cols;
     114        sysarg_t rows;
    111115        ui_t *ui;
    112116
     
    128132                        return EIO;
    129133
     134                rc = console_get_size(console, &cols, &rows);
     135                if (rc != EOK) {
     136                        console_done(console);
     137                        return rc;
     138                }
     139
    130140                console_cursor_visibility(console, false);
    131141
     
    145155
    146156                ui->cgc = cgc;
     157                ui->rect.p0.x = 0;
     158                ui->rect.p0.y = 0;
     159                ui->rect.p1.x = cols;
     160                ui->rect.p1.y = rows;
     161
     162                (void) ui_paint(ui);
    147163        } else {
    148164                return EINVAL;
     
    284300{
    285301        errno_t rc;
     302        gfx_context_t *gc;
    286303        ui_window_t *awnd;
     304        gfx_color_t *color = NULL;
     305
     306        gc = console_gc_get_ctx(ui->cgc);
     307
     308        rc = gfx_color_new_ega(0x11, &color);
     309        if (rc != EOK)
     310                return rc;
     311
     312        rc = gfx_set_color(gc, color);
     313        if (rc != EOK) {
     314                gfx_color_delete(color);
     315                return rc;
     316        }
     317
     318        rc = gfx_fill_rect(gc, &ui->rect);
     319        if (rc != EOK) {
     320                gfx_color_delete(color);
     321                return rc;
     322        }
     323
     324        gfx_color_delete(color);
    287325
    288326        /* XXX Should repaint all windows */
Note: See TracChangeset for help on using the changeset viewer.