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


Ignore:
Timestamp:
2020-02-19T13:28:34Z (5 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0a052b0
Parents:
e1f2079
git-author:
Jiri Svoboda <jiri@…> (2020-01-18 18:28:21)
git-committer:
Jiri Svoboda <jiri@…> (2020-02-19 13:28:34)
Message:

Deliver window focus and unfocus events

File:
1 edited

Legend:

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

    re1f2079 rb0a94854  
    203203}
    204204
     205/** Post focus event to the client's message queue.
     206 *
     207 * @param client Client
     208 * @param ewindow Window that the message is targetted to
     209 *
     210 * @return EOK on success or an error code
     211 */
     212errno_t ds_client_post_focus_event(ds_client_t *client, ds_window_t *ewindow)
     213{
     214        ds_window_ev_t *wevent;
     215
     216        wevent = calloc(1, sizeof(ds_window_ev_t));
     217        if (wevent == NULL)
     218                return ENOMEM;
     219
     220        wevent->window = ewindow;
     221        wevent->event.etype = wev_focus;
     222        list_append(&wevent->levents, &client->events);
     223
     224        /* Notify the client */
     225        // TODO Do not send more than once until client drains the queue
     226        if (client->cb != NULL && client->cb->ev_pending != NULL)
     227                client->cb->ev_pending(client->cb_arg);
     228
     229        return EOK;
     230}
     231
    205232/** Post keyboard event to the client's message queue.
    206233 *
     
    262289}
    263290
     291/** Post unfocus event to the client's message queue.
     292 *
     293 * @param client Client
     294 * @param ewindow Window that the message is targetted to
     295 *
     296 * @return EOK on success or an error code
     297 */
     298errno_t ds_client_post_unfocus_event(ds_client_t *client, ds_window_t *ewindow)
     299{
     300        ds_window_ev_t *wevent;
     301
     302        wevent = calloc(1, sizeof(ds_window_ev_t));
     303        if (wevent == NULL)
     304                return ENOMEM;
     305
     306        wevent->window = ewindow;
     307        wevent->event.etype = wev_unfocus;
     308        list_append(&wevent->levents, &client->events);
     309
     310        /* Notify the client */
     311        // TODO Do not send more than once until client drains the queue
     312        if (client->cb != NULL && client->cb->ev_pending != NULL)
     313                client->cb->ev_pending(client->cb_arg);
     314
     315        return EOK;
     316}
     317
    264318/** @}
    265319 */
Note: See TracChangeset for help on using the changeset viewer.