Changeset 5d380b6 in mainline for uspace/lib/ui/src/menu.c


Ignore:
Timestamp:
2023-01-20T11:50:41Z (23 months ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
b1f0a14
Parents:
6828a56
git-author:
Jiri Svoboda <jiri@…> (2023-01-20 19:50:21)
git-committer:
Jiri Svoboda <jiri@…> (2023-01-20 11:50:41)
Message:

Create menu windows in the correct seat

Add a mechanism to set the seat of a new display window, UI window,
UI popup - input device ID. This is set to the ID of the device which
activated the menu (mouse, keyboard). The display server determines
the correct seat from there.

This makes sure clicking outside closes the correct pop-up window.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/ui/src/menu.c

    r6828a56 r5d380b6  
    11/*
    2  * Copyright (c) 2022 Jiri Svoboda
     2 * Copyright (c) 2023 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    280280 * @param menu Menu
    281281 * @param prect Parent rectangle around which the menu should be placed
    282  */
    283 errno_t ui_menu_open(ui_menu_t *menu, gfx_rect_t *prect)
     282 * @param idev_id Input device associated with the menu's seat
     283 */
     284errno_t ui_menu_open(ui_menu_t *menu, gfx_rect_t *prect, sysarg_t idev_id)
    284285{
    285286        ui_popup_t *popup = NULL;
     
    301302        params.rect = geom.outer_rect;
    302303        params.place = *prect;
     304        params.idev_id = idev_id;
    303305
    304306        rc = ui_popup_create(menu->mbar->ui, menu->mbar->window, &params,
     
    522524        if (event->type == KEY_PRESS && (event->mods & KM_ALT) != 0 &&
    523525            (event->mods & (KM_CTRL | KM_SHIFT)) == 0 && event->c != '\0')
    524                 ui_menu_bar_press_accel(menu->mbar, event->c);
     526                ui_menu_bar_press_accel(menu->mbar, event->c, event->kbd_id);
    525527
    526528        return ui_claimed;
     
    616618                break;
    617619        case KC_LEFT:
    618                 ui_menu_bar_left(menu->mbar);
     620                ui_menu_bar_left(menu->mbar, event->kbd_id);
    619621                break;
    620622        case KC_RIGHT:
    621                 ui_menu_bar_right(menu->mbar);
     623                ui_menu_bar_right(menu->mbar, event->kbd_id);
    622624                break;
    623625        case KC_UP:
Note: See TracChangeset for help on using the changeset viewer.