Changeset e422ff6 in mainline for uspace/srv/hid/display/client.c


Ignore:
Timestamp:
2019-11-06T21:10:53Z (5 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
bfddc62
Parents:
959b7ec
Message:

ds_client_get_event() should not block if no events are pending

This is a relic of older design that didn't use pending event notification
via callback session.

File:
1 edited

Legend:

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

    r959b7ec re422ff6  
    3434 */
    3535
     36#include <adt/list.h>
    3637#include <errno.h>
    3738#include <stdlib.h>
     
    5859
    5960        list_initialize(&client->windows);
    60         prodcons_initialize(&client->events);
     61        list_initialize(&client->events);
    6162        client->cb = cb;
    6263        client->cb_arg = cb_arg;
     
    162163/** Get next event from client event queue.
    163164 *
    164  * This function blocks until an event is available.
    165  *
    166  * @param wnd Window
     165 * @param client Client
     166 * @param ewindow Place to store pointer to window receiving the event
     167 * @param event Place to store event
    167168 * @return Graphic context
    168169 */
     
    173174        ds_window_ev_t *wevent;
    174175
    175         link = prodcons_consume(&client->events);
     176        link = list_first(&client->events);
     177        if (link == NULL)
     178                return ENOENT;
    176179        wevent = list_get_instance(link, ds_window_ev_t, levents);
    177180
     
    182185}
    183186
     187/** Post keyboard event to the client's message queue.
     188 *
     189 * @param client Client
     190 * @param ewindow Window that the message is targetted to
     191 * @param event Event
     192 *
     193 * @return EOK on success or an error code
     194 */
    184195errno_t ds_client_post_kbd_event(ds_client_t *client, ds_window_t *ewindow,
    185196    kbd_event_t *event)
     
    193204        wevent->window = ewindow;
    194205        wevent->event.kbd_event = *event;
    195         prodcons_produce(&client->events, &wevent->levents);
     206        list_append(&wevent->levents, &client->events);
    196207
    197208        /* Notify the client */
Note: See TracChangeset for help on using the changeset viewer.