Changeset 5de852c in mainline
- Timestamp:
- 2022-01-11T13:12:15Z (3 years ago)
- Branches:
- master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- bfc0fc6
- Parents:
- 59768c7
- git-author:
- Jiri Svoboda <jiri@…> (2022-01-10 20:11:54)
- git-committer:
- Jiri Svoboda <jiri@…> (2022-01-11 13:12:15)
- Location:
- uspace
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/calculator/calculator.c
r59768c7 r5de852c 186 186 calc_t *calc = (calc_t *) arg; 187 187 188 if (ui_window_def_kbd(window, event) == ui_claimed) 189 return; 190 188 191 if (event->type == KEY_PRESS && (event->mods & KM_CTRL) != 0) { 189 192 switch (event->key) { -
uspace/app/edit/edit.c
r59768c7 r5de852c 2230 2230 pane.keymod = event->mods; 2231 2231 2232 if (ui_window_def_kbd(window, event) == ui_claimed) 2233 return; 2234 2232 2235 if (event->type == KEY_PRESS) { 2233 2236 key_handle_press(event); -
uspace/lib/ui/include/ui/menu.h
r59768c7 r5de852c 39 39 #include <errno.h> 40 40 #include <gfx/coord.h> 41 #include <io/kbd_event.h> 41 42 #include <io/pos_event.h> 42 43 #include <stdbool.h> … … 57 58 extern bool ui_menu_is_open(ui_menu_t *); 58 59 extern errno_t ui_menu_paint(ui_menu_t *, gfx_coord2_t *); 60 extern ui_evclaim_t ui_menu_kbd_event(ui_menu_t *, kbd_event_t *); 59 61 extern ui_evclaim_t ui_menu_pos_event(ui_menu_t *, gfx_coord2_t *, 60 62 pos_event_t *); -
uspace/lib/ui/include/ui/window.h
r59768c7 r5de852c 65 65 extern void ui_window_set_ctl_cursor(ui_window_t *, ui_stock_cursor_t); 66 66 extern errno_t ui_window_paint(ui_window_t *); 67 extern voidui_window_def_kbd(ui_window_t *, kbd_event_t *);67 extern ui_evclaim_t ui_window_def_kbd(ui_window_t *, kbd_event_t *); 68 68 extern errno_t ui_window_def_paint(ui_window_t *); 69 69 extern void ui_window_def_pos(ui_window_t *, pos_event_t *); -
uspace/lib/ui/src/menu.c
r59768c7 r5de852c 66 66 static void ui_menu_popup_kbd(ui_popup_t *, void *, kbd_event_t *); 67 67 static void ui_menu_popup_pos(ui_popup_t *, void *, pos_event_t *); 68 static void ui_menu_key_press_unmod(ui_menu_t *, kbd_event_t *); 68 69 69 70 static ui_popup_cb_t ui_menu_popup_cb = { … … 493 494 } 494 495 495 /** Handle close event in menu popup window. 496 * 497 * @param popup Menu popup window 498 * @param arg Argument (ui_menu_t *) 499 */ 500 static void ui_menu_popup_close(ui_popup_t *popup, void *arg) 501 { 502 ui_menu_t *menu = (ui_menu_t *)arg; 503 504 /* Deactivate menu bar, close menu */ 505 ui_menu_bar_deactivate(menu->mbar); 496 /** Handle keyboard event in menu. 497 * 498 * @param menu Menu 499 * @param event Keyboard event 500 * @return ui_claimed iff the event was claimed 501 */ 502 ui_evclaim_t ui_menu_kbd_event(ui_menu_t *menu, kbd_event_t *event) 503 { 504 if (event->type == KEY_PRESS && (event->mods & 505 (KM_CTRL | KM_ALT | KM_SHIFT)) == 0) { 506 ui_menu_key_press_unmod(menu, event); 507 } 508 509 return ui_claimed; 506 510 } 507 511 … … 612 616 } 613 617 618 /** Handle close event in menu popup window. 619 * 620 * @param popup Menu popup window 621 * @param arg Argument (ui_menu_t *) 622 */ 623 static void ui_menu_popup_close(ui_popup_t *popup, void *arg) 624 { 625 ui_menu_t *menu = (ui_menu_t *)arg; 626 627 /* Deactivate menu bar, close menu */ 628 ui_menu_bar_deactivate(menu->mbar); 629 } 630 614 631 /** Handle keyboard event in menu popup window. 615 632 * … … 622 639 ui_menu_t *menu = (ui_menu_t *)arg; 623 640 624 if (event->type == KEY_PRESS && (event->mods & 625 (KM_CTRL | KM_ALT | KM_SHIFT)) == 0) { 626 ui_menu_key_press_unmod(menu, event); 627 } 641 ui_menu_kbd_event(menu, event); 628 642 } 629 643 -
uspace/lib/ui/src/menubar.c
r59768c7 r5de852c 371 371 if (event->type == KEY_PRESS && (event->mods & 372 372 (KM_CTRL | KM_ALT | KM_SHIFT)) == 0) { 373 ui_menu_bar_key_press_unmod(mbar, event); 373 return ui_menu_bar_key_press_unmod(mbar, event); 374 } 375 376 if (mbar->active) 374 377 return ui_claimed; 375 } 376 377 return ui_claimed; 378 379 return ui_unclaimed; 378 380 } 379 381 -
uspace/lib/ui/src/window.c
r59768c7 r5de852c 963 963 window->cb->kbd(window, window->arg, kbd); 964 964 else 965 returnui_window_def_kbd(window, kbd);965 ui_window_def_kbd(window, kbd); 966 966 } 967 967 … … 1005 1005 * 1006 1006 * @param window Window 1007 */ 1008 void ui_window_def_kbd(ui_window_t *window, kbd_event_t *kbd) 1007 * @return ui_claimed iff event was claimed 1008 */ 1009 ui_evclaim_t ui_window_def_kbd(ui_window_t *window, kbd_event_t *kbd) 1009 1010 { 1010 1011 if (window->control != NULL) 1011 ui_control_kbd_event(window->control, kbd); 1012 return ui_control_kbd_event(window->control, kbd); 1013 1014 return ui_unclaimed; 1012 1015 } 1013 1016 -
uspace/lib/ui/test/menubar.c
r59768c7 r5de852c 188 188 event.type = KEY_PRESS; 189 189 event.key = KC_ESCAPE; 190 claimed = ui_menu_ kbd_pos_event(mbar, &event);190 claimed = ui_menu_bar_kbd_event(mbar, &event); 191 191 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 192 192 PCUT_ASSERT_EQUALS(ui_claimed, claimed);
Note:
See TracChangeset
for help on using the changeset viewer.