From 478a80e47ba9f9e231e0fb315872e6455c976bda Mon Sep 17 00:00:00 2001 From: skeezix Date: Sun, 29 Aug 2010 20:18:06 -0400 Subject: [PATCH] Added some options to mm conf, to request not mucking with cpu clock speed at all; goofy way to add it, but in a hurry :) --- minimenu/mmconf.c | 22 ++++++++++++---------- minimenu/mmenu.c | 15 +++++++++------ minimenu/mmui.c | 15 +++++++++------ 3 files changed, 30 insertions(+), 22 deletions(-) diff --git a/minimenu/mmconf.c b/minimenu/mmconf.c index 18535da..cd6dbe7 100644 --- a/minimenu/mmconf.c +++ b/minimenu/mmconf.c @@ -23,16 +23,18 @@ static unsigned char conf_render_line ( SDL_Rect *dest, unsigned int y ); static char *conf_format_int ( int v, change_type_e c ); confitem_t page_general[] = { - { "Default tab to show", "On startup, Minimenu will try to switch to this tab", NULL /* default */, "categories.default_cat", ct_visible_tab_list }, - { "CPU speed within Minimenu", "Set low; speed to run Minimenu at", NULL, "minimenu.mm_speed", ct_cpu_speed }, - { "CPU speed to run apps", "Before running app, set this speed; app may override.", "500", "minimenu.run_speed", ct_cpu_speed }, - { "Show 'All' tab", "Whethor an All tab is shown or not", "1", "categories.do_all_cat", ct_boolean }, - { "Start with app selected", "Whethor selection is placed by default or not", "0", "minimenu.start_selected", ct_boolean }, - { "Wrap tab change", "Changing tab left or right, does it wrap around?", "0", "tabs.wraparound", ct_boolean }, - { "Grid stop vertical", "Changing selection up or down, does it stop or wrap?", "0", "grid.wrap_vert_stop", ct_boolean }, - { "Force wallpaper with..", "You can force an override over themes background", "/pandora/appdata/mmenu/wallpaper.png", "minimenu.force_wallpaper", ct_filename }, - { "", "", NULL, NULL, ct_nil }, - { "^- Back up to main", "Go back to top level of configuration", NULL, NULL, ct_switch_page, NULL }, + { "Default tab to show", "On startup, Minimenu will try to switch to this tab", NULL /* default */, "categories.default_cat", ct_visible_tab_list }, + { "Set CPU speed within Minimenu", "Whether the next setting is applied or not", "0", "minimenu.use_mm_speed", ct_boolean }, + { "CPU speed within Minimenu", "Set low; speed to run Minimenu at", "400", "minimenu.mm_speed", ct_cpu_speed }, + { "Set CPU speed when leaving", "Whether the next setting is applied or not", "0", "minimenu.use_run_speed", ct_boolean }, + { "CPU speed when leaving", "Before running app, set this speed; app may override.", "500", "minimenu.run_speed", ct_cpu_speed }, + { "Show 'All' tab", "Whethor an All tab is shown or not", "1", "categories.do_all_cat", ct_boolean }, + { "Start with app selected", "Whethor selection is placed by default or not", "0", "minimenu.start_selected", ct_boolean }, + { "Wrap tab change", "Changing tab left or right, does it wrap around?", "0", "tabs.wraparound", ct_boolean }, + { "Grid stop vertical", "Changing selection up or down, does it stop or wrap?", "0", "grid.wrap_vert_stop", ct_boolean }, + { "Force wallpaper with..", "You can force an override over themes background", "/pandora/appdata/mmenu/wallpaper.png", "minimenu.force_wallpaper", ct_filename }, + { "", "", NULL, NULL, ct_nil }, + { "^- Back up to main", "Go back to top level of configuration", NULL, NULL, ct_switch_page, NULL }, { NULL } }; diff --git a/minimenu/mmenu.c b/minimenu/mmenu.c index 1f6270c..ca0d4aa 100644 --- a/minimenu/mmenu.c +++ b/minimenu/mmenu.c @@ -385,12 +385,15 @@ int main ( int argc, char *argv[] ) { /* set speed to minimenu run-speed, now that we're all set up */ - int mm_speed = pnd_conf_get_as_int_d ( g_conf, "minimenu.mm_speed", -1 ); - if ( mm_speed > 50 && mm_speed < 800 ) { - char buffer [ 512 ]; - snprintf ( buffer, 500, "sudo /usr/pandora/scripts/op_cpuspeed.sh %d", mm_speed ); - system ( buffer ); - } + int use_mm_speed = pnd_conf_get_as_int_d ( g_conf, "minimenu.use_mm_speed", 0 ); + if ( use_mm_speed > 0 ) { + int mm_speed = pnd_conf_get_as_int_d ( g_conf, "minimenu.mm_speed", -1 ); + if ( mm_speed > 50 && mm_speed < 800 ) { + char buffer [ 512 ]; + snprintf ( buffer, 500, "sudo /usr/pandora/scripts/op_cpuspeed.sh %d", mm_speed ); + system ( buffer ); + } + } // do speed change? // do it! while ( 1 ) { // forever! diff --git a/minimenu/mmui.c b/minimenu/mmui.c index 370644d..8992674 100644 --- a/minimenu/mmui.c +++ b/minimenu/mmui.c @@ -1690,12 +1690,15 @@ void ui_push_exec ( void ) { } else { // set app-run speed - int mm_speed = pnd_conf_get_as_int_d ( g_conf, "minimenu.run_speed", -1 ); - if ( mm_speed > -1 ) { - char buffer [ 512 ]; - snprintf ( buffer, 500, "sudo /usr/pandora/scripts/op_cpuspeed.sh %d", mm_speed ); - system ( buffer ); - } + int use_run_speed = pnd_conf_get_as_int_d ( g_conf, "minimenu.use_run_speed", 0 ); + if ( use_run_speed > 0 ) { + int mm_speed = pnd_conf_get_as_int_d ( g_conf, "minimenu.run_speed", -1 ); + if ( mm_speed > -1 ) { + char buffer [ 512 ]; + snprintf ( buffer, 500, "sudo /usr/pandora/scripts/op_cpuspeed.sh %d", mm_speed ); + system ( buffer ); + } + } // do speed change? // request app to run and quit mmenu pnd_apps_exec_disco ( pnd_run_script, ui_selected -> ref, PND_EXEC_OPTION_NORUN, NULL ); -- 2.39.2