Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset bb14312 in mainline for uspace/lib/congfx/src/console.c


Ignore:
Timestamp:
2021-06-26T16:40:28Z (5 months ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master
Children:
1215db9
Parents:
69511176
Message:

Use hardware cursor in text mode

We extend GC with cursor control operations. This will also allow to
control the HW cursor when running display server in text mode in
the future (provided that we implement the missing bits in the rest
of the stack, i.e. in IPC GC and in the display server).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/congfx/src/console.c

    r69511176 rbb14312  
    5757static errno_t console_gc_bitmap_render(void *, gfx_rect_t *, gfx_coord2_t *);
    5858static errno_t console_gc_bitmap_get_alloc(void *, gfx_bitmap_alloc_t *);
     59static errno_t console_gc_cursor_get_pos(void *, gfx_coord2_t *);
     60static errno_t console_gc_cursor_set_pos(void *, gfx_coord2_t *);
     61static errno_t console_gc_cursor_set_visible(void *, bool);
    5962
    6063gfx_context_ops_t console_gc_ops = {
     
    6669        .bitmap_destroy = console_gc_bitmap_destroy,
    6770        .bitmap_render = console_gc_bitmap_render,
    68         .bitmap_get_alloc = console_gc_bitmap_get_alloc
     71        .bitmap_get_alloc = console_gc_bitmap_get_alloc,
     72        .cursor_get_pos = console_gc_cursor_get_pos,
     73        .cursor_set_pos = console_gc_cursor_set_pos,
     74        .cursor_set_visible = console_gc_cursor_set_visible
    6975};
    7076
     
    435441}
    436442
     443/** Get cursor position on console GC.
     444 *
     445 * @param arg Console GC
     446 * @param pos Place to store position
     447 *
     448 * @return EOK on success or an error code
     449 */
     450static errno_t console_gc_cursor_get_pos(void *arg, gfx_coord2_t *pos)
     451{
     452        console_gc_t *cgc = (console_gc_t *) arg;
     453        sysarg_t col;
     454        sysarg_t row;
     455        errno_t rc;
     456
     457        rc = console_get_pos(cgc->con, &col, &row);
     458        if (rc != EOK)
     459                return rc;
     460
     461        pos->x = col;
     462        pos->y = row;
     463        return EOK;
     464}
     465
     466/** Set cursor position on console GC.
     467 *
     468 * @param arg Console GC
     469 * @param pos New cursor position
     470 *
     471 * @return EOK on success or an error code
     472 */
     473static errno_t console_gc_cursor_set_pos(void *arg, gfx_coord2_t *pos)
     474{
     475        console_gc_t *cgc = (console_gc_t *) arg;
     476
     477        console_set_pos(cgc->con, pos->x, pos->y);
     478        return EOK;
     479}
     480
     481/** Set cursor visibility on console GC.
     482 *
     483 * @param arg Console GC
     484 * @param visible @c true iff cursor should be made visible
     485 *
     486 * @return EOK on success or an error code
     487 */
     488static errno_t console_gc_cursor_set_visible(void *arg, bool visible)
     489{
     490        console_gc_t *cgc = (console_gc_t *) arg;
     491
     492        console_cursor_visibility(cgc->con, visible);
     493        return EOK;
     494}
     495
    437496/** @}
    438497 */
Note: See TracChangeset for help on using the changeset viewer.