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


Ignore:
Timestamp:
2021-06-03T14:02:59Z (3 years ago)
Author:
Jiri Svoboda <jiri@…>
Children:
2e6394e
Parents:
6baab83
git-author:
Jiri Svoboda <jiri@…> (2021-06-02 17:00:03)
git-committer:
Jiri Svoboda <jiri@…> (2021-06-03 14:02:59)
Message:

Popup windows event delivery is special

Popup windows don't get focus, yet they still receive events.

File:
1 edited

Legend:

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

    r6baab83 rb4b4dafe  
    11/*
    2  * Copyright (c) 2019 Jiri Svoboda
     2 * Copyright (c) 2021 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    106106}
    107107
    108 /** Evacuate focus from window.
     108/** Set seat popup window.
     109 *
     110 * @param seat Seat
     111 * @param wnd Popup window
     112 */
     113void ds_seat_set_popup(ds_seat_t *seat, ds_window_t *wnd)
     114{
     115        seat->popup = wnd;
     116}
     117
     118/** Evacuate seat references to window.
    109119 *
    110120 * If seat's focus is @a wnd, it will be set to a different window.
     121 * If seat's popup window is @a wnd, it will be set to NULL.
    111122 *
    112123 * @param seat Seat
    113124 * @param wnd Window to evacuate focus from
    114125 */
    115 void ds_seat_evac_focus(ds_seat_t *seat, ds_window_t *wnd)
     126void ds_seat_evac_wnd_refs(ds_seat_t *seat, ds_window_t *wnd)
    116127{
    117128        ds_window_t *nwnd;
     
    126137                ds_seat_set_focus(seat, nwnd);
    127138        }
     139
     140        if (seat->popup == wnd)
     141                seat->popup = NULL;
    128142}
    129143
     
    168182        }
    169183
    170         dwindow = seat->focus;
     184        dwindow = seat->popup;
     185        if (dwindow == NULL)
     186                dwindow = seat->focus;
     187
    171188        if (dwindow == NULL)
    172189                return EOK;
     
    328345        /* Focus window on button press */
    329346        if (event->type == PTD_PRESS && event->btn_num == 1) {
    330                 if (wnd != NULL) {
     347                if (wnd != NULL && (wnd->flags & wndf_popup) == 0) {
    331348                        ds_seat_set_focus(seat, wnd);
    332349                }
     
    410427
    411428        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         */
     434        if (seat->popup != wnd && seat->popup != NULL) {
     435                rc = ds_window_post_pos_event(seat->popup, event);
     436                if (rc != EOK)
     437                        return rc;
     438        }
     439
    412440        if (seat->focus != wnd && seat->focus != NULL) {
    413441                rc = ds_window_post_pos_event(seat->focus, event);
Note: See TracChangeset for help on using the changeset viewer.