summaryrefslogtreecommitdiff
path: root/apps/gui/skin_engine/skin_touchsupport.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/gui/skin_engine/skin_touchsupport.c')
-rw-r--r--apps/gui/skin_engine/skin_touchsupport.c41
1 files changed, 36 insertions, 5 deletions
diff --git a/apps/gui/skin_engine/skin_touchsupport.c b/apps/gui/skin_engine/skin_touchsupport.c
index e5a39cddc5..7a2e6c922b 100644
--- a/apps/gui/skin_engine/skin_touchsupport.c
+++ b/apps/gui/skin_engine/skin_touchsupport.c
@@ -24,6 +24,10 @@
24#include "action.h" 24#include "action.h"
25#include "skin_engine.h" 25#include "skin_engine.h"
26#include "wps_internals.h" 26#include "wps_internals.h"
27#include "misc.h"
28#include "option_select.h"
29#include "sound.h"
30
27 31
28/** Disarms all touchregions. */ 32/** Disarms all touchregions. */
29void skin_disarm_touchregions(struct wps_data *data) 33void skin_disarm_touchregions(struct wps_data *data)
@@ -48,7 +52,7 @@ int skin_get_touchaction(struct wps_data *data, int* edge_offset,
48 short vx, vy; 52 short vx, vy;
49 int type = action_get_touchscreen_press(&x, &y); 53 int type = action_get_touchscreen_press(&x, &y);
50 static int last_action = ACTION_NONE; 54 static int last_action = ACTION_NONE;
51 struct touchregion *r; 55 struct touchregion *r, *temp;
52 bool repeated = (type == BUTTON_REPEAT); 56 bool repeated = (type == BUTTON_REPEAT);
53 bool released = (type == BUTTON_REL); 57 bool released = (type == BUTTON_REL);
54 bool pressed = (type == BUTTON_TOUCHSCREEN); 58 bool pressed = (type == BUTTON_TOUCHSCREEN);
@@ -85,8 +89,7 @@ int skin_get_touchaction(struct wps_data *data, int* edge_offset,
85 { 89 {
86 last_action = r->action; 90 last_action = r->action;
87 returncode = r->action; 91 returncode = r->action;
88 if (retregion) 92 temp = r;
89 *retregion = r;
90 } 93 }
91 if (pressed) 94 if (pressed)
92 { 95 {
@@ -105,8 +108,7 @@ int skin_get_touchaction(struct wps_data *data, int* edge_offset,
105 *edge_offset = 100 - *edge_offset; 108 *edge_offset = 100 - *edge_offset;
106 } 109 }
107 returncode = r->type; 110 returncode = r->type;
108 if (retregion) 111 temp = r;
109 *retregion = r;
110 break; 112 break;
111 } 113 }
112 } 114 }
@@ -117,9 +119,38 @@ int skin_get_touchaction(struct wps_data *data, int* edge_offset,
117 /* On release, all regions are disarmed. */ 119 /* On release, all regions are disarmed. */
118 if (released) 120 if (released)
119 skin_disarm_touchregions(data); 121 skin_disarm_touchregions(data);
122 if (retregion)
123 *retregion = temp;
120 124
121 if (returncode != ACTION_NONE) 125 if (returncode != ACTION_NONE)
126 {
127 switch (returncode)
128 {
129 case ACTION_SETTINGS_INC:
130 case ACTION_SETTINGS_DEC:
131 {
132 const struct settings_list *setting = temp->data;
133 option_select_next_val(setting, returncode == ACTION_SETTINGS_DEC, true);
134 returncode = ACTION_REDRAW;
135 }
136 break;
137 case ACTION_TOUCH_MUTE:
138 {
139 const int min_vol = sound_min(SOUND_VOLUME);
140 if (global_settings.volume == min_vol)
141 global_settings.volume = temp->value;
142 else
143 {
144 temp->value = global_settings.volume;
145 global_settings.volume = min_vol;
146 }
147 setvol();
148 returncode = ACTION_REDRAW;
149 }
150 break;
151 }
122 return returncode; 152 return returncode;
153 }
123 154
124 last_action = ACTION_TOUCHSCREEN; 155 last_action = ACTION_TOUCHSCREEN;
125 return ACTION_TOUCHSCREEN; 156 return ACTION_TOUCHSCREEN;