Changeset 5d9403d5 in mainline for uspace/app/taskbar/taskbar.c


Ignore:
Timestamp:
2023-10-13T20:27:14Z (19 months ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7aa9fa1b
Parents:
788c76e3
Message:

Open start menu using Enter, fix input device ID

Pressing Enter opens start menu, but only if it is focused.
Need to fix input device ID so that the menu is opened in the
correct seat, both in case of clicking and in case a key is
pressed to open the menu.

File:
1 edited

Legend:

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

    r788c76e3 r5d9403d5  
    4949
    5050static void taskbar_wnd_close(ui_window_t *, void *);
     51static void taskbar_wnd_kbd(ui_window_t *, void *, kbd_event_t *);
    5152static void taskbar_wnd_pos(ui_window_t *, void *, pos_event_t *);
    5253
    5354static ui_window_cb_t window_cb = {
    5455        .close = taskbar_wnd_close,
     56        .kbd = taskbar_wnd_kbd,
    5557        .pos = taskbar_wnd_pos
    5658};
     
    6668
    6769        ui_quit(taskbar->ui);
     70}
     71
     72/** Window received keyboard event.
     73 *
     74 * @param window Window
     75 * @param arg Argument (taskbar)
     76 * @param event Keyboard event
     77 */
     78static void taskbar_wnd_kbd(ui_window_t *window, void *arg, kbd_event_t *event)
     79{
     80        taskbar_t *taskbar = (taskbar_t *) arg;
     81        ui_evclaim_t claim;
     82
     83        /* Remember ID of device that sent the last event */
     84        taskbar->wndlist->ev_idev_id = event->kbd_id;
     85        taskbar->tbsmenu->ev_idev_id = event->kbd_id;
     86
     87        claim = ui_window_def_kbd(window, event);
     88        if (claim == ui_claimed)
     89                return;
     90
     91        if (event->type == KEY_PRESS && (event->mods & KM_CTRL) == 0 &&
     92            (event->mods & KM_ALT) == 0 && (event->mods & KM_SHIFT) == 0 &&
     93            event->key == KC_ENTER) {
     94                if (!tbsmenu_is_open(taskbar->tbsmenu))
     95                        tbsmenu_open(taskbar->tbsmenu);
     96        }
    6897}
    6998
     
    79108
    80109        /* Remember ID of device that sent the last event */
    81         taskbar->wndlist->ev_pos_id = event->pos_id;
     110        taskbar->wndlist->ev_idev_id = event->pos_id;
     111        taskbar->tbsmenu->ev_idev_id = event->pos_id;
    82112
    83113        ui_window_def_pos(window, event);
Note: See TracChangeset for help on using the changeset viewer.