diff --git a/apps/gui/quickscreen.c b/apps/gui/quickscreen.c index 3f5fb78b22..b76a4fd386 100644 --- a/apps/gui/quickscreen.c +++ b/apps/gui/quickscreen.c @@ -50,6 +50,11 @@ #define MARGIN 10 #define CENTER_ICONAREA_SIZE (MARGIN+8*2) +struct gui_quickscreen +{ + const struct settings_list *items[QUICKSCREEN_ITEM_COUNT]; +}; + static bool redraw; static void quickscreen_update_callback(unsigned short id, @@ -297,22 +302,30 @@ static bool gui_quickscreen_do_button(struct gui_quickscreen * qs, int button) #ifdef HAVE_TOUCHSCREEN static int quickscreen_touchscreen_button(void) { - short x,y; - if (action_get_touchscreen_press(&x, &y) != BUTTON_REL) + struct gesture_event gevent; + if (!action_gesture_get_event(&gevent)) return ACTION_NONE; + switch (gevent.id) { + case GESTURE_TAP: + case GESTURE_HOLD: + break; + default: + return ACTION_NONE; + } + enum { left=1, right=2, top=4, bottom=8 }; int bits = 0; - if(x < LCD_WIDTH/3) + if(gevent.x < LCD_WIDTH/3) bits |= left; - else if(x > 2*LCD_WIDTH/3) + else if(gevent.x > 2*LCD_WIDTH/3) bits |= right; - if(y < LCD_HEIGHT/3) + if(gevent.y < LCD_HEIGHT/3) bits |= top; - else if(y > 2*LCD_HEIGHT/3) + else if(gevent.y > 2*LCD_HEIGHT/3) bits |= bottom; switch(bits) { @@ -366,6 +379,10 @@ static int gui_syncquickscreen_run(struct gui_quickscreen * qs, int button_enter talk_qs_option(qs->items[QUICKSCREEN_LEFT], true); if (qs->items[QUICKSCREEN_LEFT] != qs->items[QUICKSCREEN_RIGHT]) talk_qs_option(qs->items[QUICKSCREEN_RIGHT], true); + +#ifdef HAVE_TOUCHSCREEN + action_gesture_reset(); +#endif while (true) { if (redraw) { diff --git a/apps/gui/quickscreen.h b/apps/gui/quickscreen.h index 2f51d6b4ce..ae56231129 100644 --- a/apps/gui/quickscreen.h +++ b/apps/gui/quickscreen.h @@ -28,6 +28,8 @@ #include "screen_access.h" +struct settings_list; + enum quickscreen_item { QUICKSCREEN_TOP = 0, QUICKSCREEN_LEFT, @@ -43,11 +45,6 @@ enum quickscreen_return { QUICKSCREEN_CHANGED = 0x4, }; -struct gui_quickscreen -{ - const struct settings_list *items[QUICKSCREEN_ITEM_COUNT]; -}; - extern int quick_screen_quick(int button_enter); int quickscreen_set_option(void *data); bool is_setting_quickscreenable(const struct settings_list *setting);