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

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


Ignore:
Timestamp:
2021-04-09T22:41:22Z (8 months ago)
Author:
jxsvoboda <5887334+jxsvoboda@…>
Branches:
master
Children:
f0ccb2a
Parents:
f251883
git-author:
Jiri Svoboda <jiri@…> (2021-04-01 22:31:15)
git-committer:
jxsvoboda <5887334+jxsvoboda@…> (2021-04-09 22:41:22)
Message:

Close menu when button is pressed outside of it

File:
1 edited

Legend:

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

    rf251883 rf536a16  
    273273}
    274274
    275 /** Handle button press in menu.
     275/** Handle position event in menu.
    276276 *
    277277 * @param menu Menu
     
    305305        }
    306306
    307         if (gfx_pix_inside_rect(&epos, &geom.outer_rect))
     307        /* Event inside menu? */
     308        if (gfx_pix_inside_rect(&epos, &geom.outer_rect)) {
     309                /* Claim event */
    308310                return ui_claimed;
     311        } else {
     312                /* Press outside menu - close it */
     313                if (event->type == POS_PRESS)
     314                        ui_menu_bar_select(menu->mbar, NULL, NULL);
     315        }
    309316
    310317        return ui_unclaimed;
Note: See TracChangeset for help on using the changeset viewer.