Changeset fd777a2 in mainline


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

Location:
uspace/srv/hid/display
Files:
8 edited

Legend:

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

    rcf32dbd rfd777a2  
    9393 * @param client client
    9494 * @param wnd Window
    95  * @return EOK on success, ENOMEM if there are no free window identifiers
    96  */
    97 errno_t ds_client_add_window(ds_client_t *client, ds_window_t *wnd)
     95 */
     96void ds_client_add_window(ds_client_t *client, ds_window_t *wnd)
    9897{
    9998        assert(wnd->client == NULL);
    100         assert(!link_used(&wnd->lwindows));
     99        assert(!link_used(&wnd->lcwindows));
    101100
    102101        wnd->client = client;
    103102        wnd->id = client->display->next_wnd_id++;
    104         list_append(&wnd->lwindows, &client->windows);
    105 
    106         return EOK;
     103        list_append(&wnd->lcwindows, &client->windows);
    107104}
    108105
     
    122119        }
    123120
    124         list_remove(&wnd->lwindows);
     121        list_remove(&wnd->lcwindows);
    125122        wnd->client = NULL;
    126123}
     
    162159                return NULL;
    163160
    164         return list_get_instance(link, ds_window_t, lwindows);
     161        return list_get_instance(link, ds_window_t, lcwindows);
    165162}
    166163
     
    172169ds_window_t *ds_client_next_window(ds_window_t *wnd)
    173170{
    174         link_t *link = list_next(&wnd->lwindows, &wnd->client->windows);
     171        link_t *link = list_next(&wnd->lcwindows, &wnd->client->windows);
    175172
    176173        if (link == NULL)
    177174                return NULL;
    178175
    179         return list_get_instance(link, ds_window_t, lwindows);
     176        return list_get_instance(link, ds_window_t, lcwindows);
    180177}
    181178
  • uspace/srv/hid/display/client.h

    rcf32dbd rfd777a2  
    4545    ds_client_t **);
    4646extern void ds_client_destroy(ds_client_t *);
    47 extern errno_t ds_client_add_window(ds_client_t *, ds_window_t *);
     47extern void ds_client_add_window(ds_client_t *, ds_window_t *);
    4848extern void ds_client_remove_window(ds_window_t *);
    4949extern ds_window_t *ds_client_find_window(ds_client_t *, ds_wnd_id_t);
  • 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 *
  • uspace/srv/hid/display/display.h

    rcf32dbd rfd777a2  
    5151extern ds_client_t *ds_display_next_client(ds_client_t *);
    5252extern ds_window_t *ds_display_find_window(ds_display_t *, ds_wnd_id_t);
     53extern void ds_display_add_window(ds_display_t *, ds_window_t *);
     54extern void ds_display_remove_window(ds_window_t *);
     55extern ds_window_t *ds_display_first_window(ds_display_t *);
     56extern ds_window_t *ds_display_next_window(ds_window_t *);
    5357extern errno_t ds_display_post_kbd_event(ds_display_t *, kbd_event_t *);
    5458extern void ds_display_add_seat(ds_display_t *, ds_seat_t *);
  • uspace/srv/hid/display/seat.c

    rcf32dbd rfd777a2  
    8282
    8383        if (seat->focus == wnd) {
    84                 /* Focus a different window. XXX Need list of all windows */
    85                 nwnd = ds_client_next_window(wnd);
     84                /* Focus a different window. XXX Delegate to WM */
     85                nwnd = ds_display_next_window(wnd);
    8686                if (nwnd == NULL)
    87                         nwnd = ds_client_first_window(wnd->client);
     87                        nwnd = ds_display_first_window(wnd->display);
    8888                if (nwnd == wnd)
    8989                        nwnd = NULL;
  • uspace/srv/hid/display/types/display/display.h

    rcf32dbd rfd777a2  
    6262        /** Seats (of ds_seat_t) */
    6363        list_t seats;
     64
     65        /** Windows (of ds_window_t) in stacking order */
     66        list_t windows;
    6467} ds_display_t;
    6568
  • uspace/srv/hid/display/types/display/window.h

    rcf32dbd rfd777a2  
    4949        struct ds_client *client;
    5050        /** Link to @c client->windows */
    51         link_t lwindows;
     51        link_t lcwindows;
     52        /** Containing display */
     53        struct ds_display *display;
     54        /** Link to @c display->windows */
     55        link_t ldwindows;
    5256        /** Display position */
    5357        gfx_coord2_t dpos;
  • uspace/srv/hid/display/window.c

    rcf32dbd rfd777a2  
    205205
    206206        ds_client_add_window(client, wnd);
     207        ds_display_add_window(client->display, wnd);
    207208
    208209        wnd->gc = gc;
     
    223224{
    224225        ds_client_remove_window(wnd);
     226        ds_display_remove_window(wnd);
    225227        (void) gfx_context_delete(wnd->gc);
    226228
Note: See TracChangeset for help on using the changeset viewer.