Ignore:
File:
1 edited

Legend:

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

    r195b7b3 r46a47c0  
    11/*
    2  * Copyright (c) 2019 Jiri Svoboda
     2 * Copyright (c) 2023 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    115115        seat = ds_display_first_seat(wnd->display);
    116116        while (seat != NULL) {
    117                 ds_seat_evac_focus(seat, wnd);
     117                ds_seat_evac_wnd_refs(seat, wnd);
    118118                seat = ds_display_next_seat(seat);
    119119        }
     120
     121        /* Make sure no event in the queue is referencing the window */
     122        ds_client_purge_window_events(wnd->client, wnd);
    120123
    121124        list_remove(&wnd->lcwindows);
     
    178181 * @param ewindow Place to store pointer to window receiving the event
    179182 * @param event Place to store event
    180  * @return Graphic context
     183 * @return EOK on success, ENOENT if event queue is empty
    181184 */
    182185errno_t ds_client_get_event(ds_client_t *client, ds_window_t **ewindow,
     
    199202}
    200203
     204/** Purge events from client event queue referring to a window.
     205 *
     206 * @param client Client
     207 * @param window Window
     208 */
     209void ds_client_purge_window_events(ds_client_t *client,
     210    ds_window_t *window)
     211{
     212        link_t *cur;
     213        link_t *next;
     214        ds_window_ev_t *wevent;
     215
     216        cur = list_first(&client->events);
     217        while (cur != NULL) {
     218                next = list_next(cur, &client->events);
     219                wevent = list_get_instance(cur, ds_window_ev_t, levents);
     220
     221                if (wevent->window == window)
     222                        list_remove(cur);
     223
     224                cur = next;
     225        }
     226}
     227
    201228/** Post close event to the client's message queue.
    202229 *
     
    230257 * @param client Client
    231258 * @param ewindow Window that the message is targetted to
    232  *
    233  * @return EOK on success or an error code
    234  */
    235 errno_t ds_client_post_focus_event(ds_client_t *client, ds_window_t *ewindow)
     259 * @param event Focus event data
     260 *
     261 * @return EOK on success or an error code
     262 */
     263errno_t ds_client_post_focus_event(ds_client_t *client, ds_window_t *ewindow,
     264    display_wnd_focus_ev_t *event)
    236265{
    237266        ds_window_ev_t *wevent;
     
    243272        wevent->window = ewindow;
    244273        wevent->event.etype = wev_focus;
     274        wevent->event.ev.focus = *event;
    245275        list_append(&wevent->levents, &client->events);
    246276
     
    346376 * @param client Client
    347377 * @param ewindow Window that the message is targetted to
    348  *
    349  * @return EOK on success or an error code
    350  */
    351 errno_t ds_client_post_unfocus_event(ds_client_t *client, ds_window_t *ewindow)
     378 * @param event Unfocus event data
     379 *
     380 * @return EOK on success or an error code
     381 */
     382errno_t ds_client_post_unfocus_event(ds_client_t *client, ds_window_t *ewindow,
     383    display_wnd_unfocus_ev_t *event)
    352384{
    353385        ds_window_ev_t *wevent;
     
    359391        wevent->window = ewindow;
    360392        wevent->event.etype = wev_unfocus;
     393        wevent->event.ev.unfocus = *event;
    361394        list_append(&wevent->levents, &client->events);
    362395
Note: See TracChangeset for help on using the changeset viewer.