Changeset 4055fe63 in mainline for uspace/srv/hid/display/seat.c


Ignore:
Timestamp:
2021-06-04T20:02:36Z (3 years ago)
Author:
Jiri Svoboda <jiri@…>
Children:
4b72e81
Parents:
2e6394e
Message:

Deliver close event to popup window when appropriate

That is, when focus changes or when user clicks outside of the
popup window.

File:
1 edited

Legend:

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

    r2e6394e r4055fe63  
    104104                ds_window_bring_to_top(wnd);
    105105        }
     106
     107        /* When focus changes, popup window should be closed */
     108        ds_seat_set_popup(seat, NULL);
    106109}
    107110
     
    113116void ds_seat_set_popup(ds_seat_t *seat, ds_window_t *wnd)
    114117{
     118        if (wnd == seat->popup)
     119                return;
     120
     121        if (seat->popup != NULL) {
     122                /* Window is no longer the popup window, send close request */
     123                ds_client_post_close_event(seat->popup->client,
     124                    seat->popup);
     125        }
     126
    115127        seat->popup = wnd;
    116128}
     
    139151
    140152        if (seat->popup == wnd)
    141                 seat->popup = NULL;
     153                ds_seat_set_popup(seat, NULL);
    142154}
    143155
     
    427439
    428440        wnd = ds_display_window_by_pos(seat->display, &seat->pntpos);
    429         /*
    430          * Deliver event to popup window, unless the pointer is over
    431          * it (in which case it will be delivered to that window
    432          * below, anyway.
    433          */
     441
     442        /* Click outside popup window */
     443        if (event->type == POS_PRESS && wnd != seat->popup) {
     444                /* Close popup window */
     445                ds_seat_set_popup(seat, NULL);
     446        }
     447
     448        /* Deliver event to popup window. */
    434449        if (seat->popup != NULL) {
    435450                rc = ds_window_post_pos_event(seat->popup, event);
Note: See TracChangeset for help on using the changeset viewer.