Changeset fd777a2 in mainline for uspace/srv/hid/display/display.c


Ignore:
Timestamp:
2019-11-29T23:58:15Z (4 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
879d7245
Parents:
cf32dbd
Message:

Add list of all windows on a display, in stacking order

File:
1 edited

Legend:

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

    rcf32dbd rfd777a2  
    6161        disp->next_wnd_id = 1;
    6262        list_initialize(&disp->seats);
     63        list_initialize(&disp->windows);
    6364        *rdisp = disp;
    6465        return EOK;
     
    163164}
    164165
     166/** Add window to display.
     167 *
     168 * @param display Display
     169 * @param wnd Window
     170 */
     171void ds_display_add_window(ds_display_t *display, ds_window_t *wnd)
     172{
     173        assert(wnd->display == NULL);
     174        assert(!link_used(&wnd->ldwindows));
     175
     176        wnd->display = display;
     177        list_prepend(&wnd->ldwindows, &display->windows);
     178}
     179
     180/** Remove window from display.
     181 *
     182 * @param wnd Window
     183 */
     184void ds_display_remove_window(ds_window_t *wnd)
     185{
     186        list_remove(&wnd->ldwindows);
     187        wnd->display = NULL;
     188}
     189
     190/** Get first window in display.
     191 *
     192 * @param display Display
     193 * @return First window or @c NULL if there is none
     194 */
     195ds_window_t *ds_display_first_window(ds_display_t *display)
     196{
     197        link_t *link = list_first(&display->windows);
     198
     199        if (link == NULL)
     200                return NULL;
     201
     202        return list_get_instance(link, ds_window_t, ldwindows);
     203}
     204
     205/** Get next window in client.
     206 *
     207 * @param wnd Current window
     208 * @return Next window or @c NULL if there is none
     209 */
     210ds_window_t *ds_display_next_window(ds_window_t *wnd)
     211{
     212        link_t *link = list_next(&wnd->ldwindows, &wnd->display->windows);
     213
     214        if (link == NULL)
     215                return NULL;
     216
     217        return list_get_instance(link, ds_window_t, ldwindows);
     218}
     219
    165220/** Post keyboard event to a display.
    166221 *
Note: See TracChangeset for help on using the changeset viewer.