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


Ignore:
Timestamp:
2023-01-05T19:28:22Z (16 months ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ededdc4
Parents:
5d86797
Message:

Switch to another window when window is minimized

And do it properly. Never switch to a minimized window. Only switch to
a system window (Task bar) when no other is available.

File:
1 edited

Legend:

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

    r5d86797 r17c0f5d  
    11/*
    2  * Copyright (c) 2022 Jiri Svoboda
     2 * Copyright (c) 2023 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    142142 *
    143143 * @param seat Seat
    144  * @param wnd Window to evacuate focus from
     144 * @param wnd Window to evacuate references from
    145145 */
    146146void ds_seat_evac_wnd_refs(ds_seat_t *seat, ds_window_t *wnd)
     
    160160        if (seat->popup == wnd)
    161161                ds_seat_set_popup(seat, NULL);
     162}
     163
     164/** Unfocus window.
     165 *
     166 * If seat's focus is @a wnd, it will be set to a different window
     167 * that is not minimized, preferably not a system window.
     168 *
     169 * @param seat Seat
     170 * @param wnd Window to remove focus from
     171 */
     172void ds_seat_unfocus_wnd(ds_seat_t *seat, ds_window_t *wnd)
     173{
     174        ds_window_t *nwnd;
     175
     176        if (seat->focus != wnd)
     177                return;
     178
     179        /* Find alternate window that is neither system nor minimized */
     180        nwnd = ds_window_find_alt(wnd, ~(wndf_minimized | wndf_system));
     181
     182        if (nwnd == NULL) {
     183                /* Find alternate window that is not minimized */
     184                nwnd = ds_window_find_alt(wnd, ~wndf_minimized);
     185        }
     186
     187        ds_seat_set_focus(seat, nwnd);
    162188}
    163189
Note: See TracChangeset for help on using the changeset viewer.