Fork us on GitHub Follow us on Facebook Follow us on Twitter

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


Ignore:
Timestamp:
2021-06-10T13:22:33Z (6 months ago)
Author:
jxsvoboda <5887334+jxsvoboda@…>
Branches:
master
Children:
98735eb
Parents:
5823aef3
git-author:
Jiri Svoboda <jiri@…> (2021-06-04 20:02:36)
git-committer:
jxsvoboda <5887334+jxsvoboda@…> (2021-06-10 13:22:33)
Message:

Deliver close event to popup window when appropriate

That is, when focus changes or when user clicks outside of the
popup window.

File:
1 edited

Legend:

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

    r5823aef3 rd7f82635  
    6161};
    6262
     63static void ui_menu_popup_close(ui_popup_t *, void *);
    6364static void ui_menu_popup_pos(ui_popup_t *, void *, pos_event_t *);
    6465
    6566static ui_popup_cb_t ui_menu_popup_cb = {
     67        .close = ui_menu_popup_close,
    6668        .pos = ui_menu_popup_pos
    6769};
     
    366368        } else {
    367369                /* Press outside menu - close it */
    368 //              if (event->type == POS_PRESS)
    369 //                      ui_menu_bar_select(menu->mbar, NULL, NULL);
     370                if (event->type == POS_PRESS)
     371                        ui_menu_bar_select(menu->mbar, NULL, NULL);
    370372        }
    371373
    372374        return ui_unclaimed;
     375}
     376
     377/** Handle close event in menu popup window.
     378 *
     379 * @param popup Menu popup window
     380 * @param arg Argument (ui_menu_t *)
     381 */
     382static void ui_menu_popup_close(ui_popup_t *popup, void *arg)
     383{
     384        ui_menu_t *menu = (ui_menu_t *)arg;
     385
     386        /* Close the menu */
     387        ui_menu_bar_select(menu->mbar, NULL, NULL);
    373388}
    374389
Note: See TracChangeset for help on using the changeset viewer.