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


Ignore:
Timestamp:
2020-03-02T11:22:01Z (5 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a2e104e
Parents:
7bb45e3
git-author:
Jiri Svoboda <jiri@…> (2020-02-01 11:18:50)
git-committer:
Jiri Svoboda <jiri@…> (2020-03-02 11:22:01)
Message:

Closing windows

File:
1 edited

Legend:

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

    r7bb45e3 r338d0935  
    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  */
    212 errno_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;
     205/** Post close 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_close_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_close;
    222222        list_append(&wevent->levents, &client->events);
    223223
     
    230230}
    231231
     232/** Post focus event to the client's message queue.
     233 *
     234 * @param client Client
     235 * @param ewindow Window that the message is targetted to
     236 *
     237 * @return EOK on success or an error code
     238 */
     239errno_t ds_client_post_focus_event(ds_client_t *client, ds_window_t *ewindow)
     240{
     241        ds_window_ev_t *wevent;
     242
     243        wevent = calloc(1, sizeof(ds_window_ev_t));
     244        if (wevent == NULL)
     245                return ENOMEM;
     246
     247        wevent->window = ewindow;
     248        wevent->event.etype = wev_focus;
     249        list_append(&wevent->levents, &client->events);
     250
     251        /* Notify the client */
     252        // TODO Do not send more than once until client drains the queue
     253        if (client->cb != NULL && client->cb->ev_pending != NULL)
     254                client->cb->ev_pending(client->cb_arg);
     255
     256        return EOK;
     257}
     258
    232259/** Post keyboard event to the client's message queue.
    233260 *
Note: See TracChangeset for help on using the changeset viewer.