Changeset 4d8002d in mainline for uspace/srv/hid/display/display.c


Ignore:
Timestamp:
2020-05-15T16:18:51Z (5 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
4912dd59
Parents:
6feccae
Message:

Bitmapped mouse cursor

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/hid/display/display.c

    r6feccae r4d8002d  
    4040#include <stdlib.h>
    4141#include "client.h"
     42#include "cursimg.h"
     43#include "cursor.h"
    4244#include "seat.h"
    4345#include "window.h"
     
    5355{
    5456        ds_display_t *disp;
     57        ds_cursor_t *cursor;
     58        int i;
    5559        errno_t rc;
    5660
     
    6367                free(disp);
    6468                return ENOMEM;
     69        }
     70
     71        list_initialize(&disp->cursors);
     72
     73        for (i = 0; i < dcurs_limit; i++) {
     74                rc = ds_cursor_create(disp, &ds_cursimg[i].rect,
     75                    ds_cursimg[i].image, &cursor);
     76                if (rc != EOK)
     77                        goto error;
     78
     79                disp->cursor[i] = cursor;
    6580        }
    6681
     
    7388        *rdisp = disp;
    7489        return EOK;
     90error:
     91        ds_display_destroy(disp);
     92        return rc;
    7593}
    7694
     
    83101        assert(list_empty(&disp->clients));
    84102        assert(list_empty(&disp->seats));
     103        /* XXX destroy cursors */
    85104        gfx_color_delete(disp->bg_color);
    86105        free(disp);
     
    462481}
    463482
     483/** Add cursor to display.
     484 *
     485 * @param display Display
     486 * @param cursor Cursor
     487 */
     488void ds_display_add_cursor(ds_display_t *display, ds_cursor_t *cursor)
     489{
     490        assert(cursor->display == NULL);
     491        assert(!link_used(&cursor->ldisplay));
     492
     493        cursor->display = display;
     494        list_prepend(&cursor->ldisplay, &display->cursors);
     495}
     496
     497/** Remove cursor from display.
     498 *
     499 * @param cursor Cursor
     500 */
     501void ds_display_remove_cursor(ds_cursor_t *cursor)
     502{
     503        list_remove(&cursor->ldisplay);
     504        cursor->display = NULL;
     505}
     506
    464507// XXX
    465508gfx_context_t *ds_display_get_gc(ds_display_t *display)
Note: See TracChangeset for help on using the changeset viewer.