Changeset d8503fd in mainline for uspace/srv/hid/display/seat.c


Ignore:
Timestamp:
2023-01-09T21:14:04Z (16 months ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
46b02cb
Parents:
e04b72d6
Message:

Display configuration utility and server support

Currently we can only create, list and delete seats using the
'disp' utility (but no way to assign devices).

File:
1 edited

Legend:

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

    re04b72d6 rd8503fd  
    3939#include <gfx/render.h>
    4040#include <stdlib.h>
     41#include <str.h>
    4142#include "client.h"
    4243#include "cursor.h"
     
    5152 *
    5253 * @param display Parent display
     54 * @param name Seat name
    5355 * @param rseat Place to store pointer to new seat.
    5456 * @return EOK on success, ENOMEM if out of memory
    5557 */
    56 errno_t ds_seat_create(ds_display_t *display, ds_seat_t **rseat)
     58errno_t ds_seat_create(ds_display_t *display, const char *name,
     59    ds_seat_t **rseat)
    5760{
    5861        ds_seat_t *seat;
     62        ds_seat_t *s0;
     63
     64        s0 = ds_display_first_seat(display);
     65        while (s0 != NULL) {
     66                if (str_cmp(s0->name, name) == 0)
     67                        return EEXIST;
     68                s0 = ds_display_next_seat(s0);
     69        }
    5970
    6071        seat = calloc(1, sizeof(ds_seat_t));
     
    6273                return ENOMEM;
    6374
     75        seat->name = str_dup(name);
     76        if (seat->name == NULL) {
     77                free(seat);
     78                return ENOMEM;
     79        }
     80
    6481        ds_display_add_seat(display, seat);
    6582        seat->pntpos.x = 0;
     
    8097{
    8198        ds_display_remove_seat(seat);
     99        free(seat->name);
    82100        free(seat);
    83101}
Note: See TracChangeset for help on using the changeset viewer.