Changeset d8503fd in mainline for uspace/srv/hid/display/display.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/display.c

    re04b72d6 rd8503fd  
    11/*
    2  * Copyright (c) 2022 Jiri Svoboda
     2 * Copyright (c) 2023 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    9898        list_initialize(&disp->clients);
    9999        list_initialize(&disp->wmclients);
     100        list_initialize(&disp->cfgclients);
    100101        disp->next_wnd_id = 1;
    101102        list_initialize(&disp->ddevs);
     
    120121        assert(list_empty(&disp->clients));
    121122        assert(list_empty(&disp->wmclients));
     123        assert(list_empty(&disp->cfgclients));
    122124        assert(list_empty(&disp->seats));
    123125        assert(list_empty(&disp->ddevs));
     
    241243        list_remove(&wmclient->lwmclients);
    242244        wmclient->display = NULL;
     245}
     246
     247/** Add CFG client to display.
     248 *
     249 * @param disp Display
     250 * @param cfgclient CFG client
     251 */
     252void ds_display_add_cfgclient(ds_display_t *disp, ds_cfgclient_t *cfgclient)
     253{
     254        assert(cfgclient->display == NULL);
     255        assert(!link_used(&cfgclient->lcfgclients));
     256
     257        cfgclient->display = disp;
     258        list_append(&cfgclient->lcfgclients, &disp->cfgclients);
     259}
     260
     261/** Remove CFG client from display.
     262 *
     263 * @param cfgclient CFG client
     264 */
     265void ds_display_remove_cfgclient(ds_cfgclient_t *cfgclient)
     266{
     267        list_remove(&cfgclient->lcfgclients);
     268        cfgclient->display = NULL;
    243269}
    244270
     
    525551
    526552        seat->display = disp;
     553        seat->id = disp->next_seat_id++;
    527554        list_append(&seat->lseats, &disp->seats);
    528555}
     
    566593
    567594        return list_get_instance(link, ds_seat_t, lseats);
     595}
     596
     597/** Find seat by ID.
     598 *
     599 * @param display Display
     600 * @param id Seat ID
     601 */
     602ds_seat_t *ds_display_find_seat(ds_display_t *display, ds_seat_id_t id)
     603{
     604        ds_seat_t *seat;
     605
     606        seat = ds_display_first_seat(display);
     607        while (seat != NULL) {
     608                if (seat->id == id)
     609                        return seat;
     610
     611                seat = ds_display_next_seat(seat);
     612        }
     613
     614        return NULL;
    568615}
    569616
Note: See TracChangeset for help on using the changeset viewer.