window.c: Dismiss menu on touch up events

This commit is contained in:
Kristian Høgsberg 2014-04-29 14:47:19 -07:00
parent 1f67117f6f
commit 9c60933a13

View File

@ -4496,6 +4496,20 @@ menu_button_handler(struct widget *widget,
}
}
static void
menu_touch_up_handler(struct widget *widget,
struct input *input,
uint32_t serial,
uint32_t time,
int32_t id,
void *data)
{
struct menu *menu = data;
input_ungrab(input);
menu_destroy(menu);
}
static void
menu_redraw_handler(struct widget *widget, void *data)
{
@ -4595,6 +4609,7 @@ window_show_menu(struct display *display,
widget_set_leave_handler(menu->widget, menu_leave_handler);
widget_set_motion_handler(menu->widget, menu_motion_handler);
widget_set_button_handler(menu->widget, menu_button_handler);
widget_set_touch_up_handler(menu->widget, menu_touch_up_handler);
input_grab(input, menu->widget, 0);
frame_resize_inside(menu->frame, 200, count * 20);