diff options
Diffstat (limited to 'apps/action.c')
-rw-r--r-- | apps/action.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/apps/action.c b/apps/action.c index 15b2d8a4c8..0b21a27ea9 100644 --- a/apps/action.c +++ b/apps/action.c | |||
@@ -149,6 +149,27 @@ static inline int get_next_context(const struct button_mapping *items, int i) | |||
149 | CONTEXT_STD : | 149 | CONTEXT_STD : |
150 | items[i].action_code; | 150 | items[i].action_code; |
151 | } | 151 | } |
152 | |||
153 | #if defined(HAVE_GUI_BOOST) && defined(HAVE_ADJUSTABLE_CPU_FREQ) | ||
154 | /* Helper function which is called to boost / unboost CPU. This function | ||
155 | * avoids to increase boost_count with each call of gui_boost(). */ | ||
156 | static void gui_boost(bool want_to_boost) | ||
157 | { | ||
158 | static bool boosted = false; | ||
159 | |||
160 | if (want_to_boost && !boosted) | ||
161 | { | ||
162 | cpu_boost(true); | ||
163 | boosted = true; | ||
164 | } | ||
165 | else if (!want_to_boost && boosted) | ||
166 | { | ||
167 | cpu_boost(false); | ||
168 | boosted = false; | ||
169 | } | ||
170 | } | ||
171 | #endif | ||
172 | |||
152 | /* | 173 | /* |
153 | * int get_action_worker(int context, struct button_mapping *user_mappings, | 174 | * int get_action_worker(int context, struct button_mapping *user_mappings, |
154 | int timeout) | 175 | int timeout) |
@@ -183,6 +204,23 @@ static int get_action_worker(int context, int timeout, | |||
183 | else | 204 | else |
184 | button = button_get_w_tmo(timeout); | 205 | button = button_get_w_tmo(timeout); |
185 | 206 | ||
207 | #if defined(HAVE_GUI_BOOST) && defined(HAVE_ADJUSTABLE_CPU_FREQ) | ||
208 | /* Boost the CPU in case of wheel scrolling activity in the defined contexts. | ||
209 | * Unboost the CPU after timeout. */ | ||
210 | static long last_boost_tick; | ||
211 | if ((button&(BUTTON_SCROLL_BACK|BUTTON_SCROLL_FWD)) && | ||
212 | (context == CONTEXT_STD || context == CONTEXT_LIST || | ||
213 | context == CONTEXT_MAINMENU || context == CONTEXT_TREE)) | ||
214 | { | ||
215 | last_boost_tick = current_tick; | ||
216 | gui_boost(true); | ||
217 | } | ||
218 | else if (TIME_AFTER(current_tick, last_boost_tick + HZ)) | ||
219 | { | ||
220 | gui_boost(false); | ||
221 | } | ||
222 | #endif | ||
223 | |||
186 | /* Data from sys events can be pulled with button_get_data | 224 | /* Data from sys events can be pulled with button_get_data |
187 | * multimedia button presses don't go through the action system */ | 225 | * multimedia button presses don't go through the action system */ |
188 | if (button == BUTTON_NONE || button & (SYS_EVENT|BUTTON_MULTIMEDIA)) | 226 | if (button == BUTTON_NONE || button & (SYS_EVENT|BUTTON_MULTIMEDIA)) |