Changeset 166aba54 in mainline for uspace/app/nav/nav.c


Ignore:
Timestamp:
2021-10-07T18:43:56Z (3 years ago)
Author:
Jiri Svoboda <jiri@…>
Children:
af2ea83
Parents:
8e5f39d
Message:

Ctrl-Q to quit Navigator

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/nav/nav.c

    r8e5f39d r166aba54  
    4848
    4949static void wnd_close(ui_window_t *, void *);
     50static void wnd_kbd(ui_window_t *, void *, kbd_event_t *);
    5051
    5152static ui_window_cb_t window_cb = {
    52         .close = wnd_close
     53        .close = wnd_close,
     54        .kbd = wnd_kbd
    5355};
    5456
     
    6365
    6466        ui_quit(navigator->ui);
     67}
     68
     69/** Window keyboard event handler.
     70 *
     71 * @param window Window
     72 * @param arg Argument (navigator)
     73 * @param event Keyboard event
     74 */
     75static void wnd_kbd(ui_window_t *window, void *arg, kbd_event_t *event)
     76{
     77        navigator_t *navigator = (navigator_t *) arg;
     78
     79        if (event->type == KEY_PRESS &&
     80            ((event->mods & KM_ALT) == 0) &&
     81            ((event->mods & KM_SHIFT) == 0) &&
     82            (event->mods & KM_CTRL) != 0) {
     83                if (event->key == KC_Q)
     84                        ui_quit(navigator->ui);
     85        }
     86
     87        ui_window_def_kbd(window, event);
    6588}
    6689
Note: See TracChangeset for help on using the changeset viewer.