From 00adae53bc6659fc68eb1726ae160b3543a2636e Mon Sep 17 00:00:00 2001 From: skeezix Date: Sun, 23 Jan 2011 23:15:58 -0500 Subject: [PATCH] Aesthetic changes to conf panel; minor fix to libpnd that no one but mmenu will notice. --- lib/pnd_utility.c | 3 +++ minimenu/mmconf.c | 16 +++++++++++++++- minimenu/mmconf.h | 1 + minimenu/mmui.c | 25 ++++++++++++++++++++++--- 4 files changed, 41 insertions(+), 4 deletions(-) diff --git a/lib/pnd_utility.c b/lib/pnd_utility.c index a002bbb..9647f20 100644 --- a/lib/pnd_utility.c +++ b/lib/pnd_utility.c @@ -167,6 +167,9 @@ void pnd_exec_no_wait_1 ( char *fullpath, char *arg1 ) { execl ( fullpath, fullpath, (char*) NULL ); } + // error invoking something, and we're the child process, so just die before all hell breaks lose with us thinking we're the (second!) parent on return! + exit ( -1 ); + // getting here is an error //printf ( "Error attempting to run %s\n", fullpath ); diff --git a/minimenu/mmconf.c b/minimenu/mmconf.c index 544aef8..80347b0 100644 --- a/minimenu/mmconf.c +++ b/minimenu/mmconf.c @@ -392,9 +392,16 @@ void conf_display_page ( confitem_t *page, unsigned int selitem, unsigned int fi dest += conf_render_text ( g_tab_font, "No default value", dest, 380, 420, CONF_UNSELECTED ); } + // cursor's conf item count number - not for top level, just the sublevels + if ( page != pages ) { + char buffer [ 40 ]; + sprintf ( buffer, "Config item %d of %d", selitem + 1, conf_determine_pagelength ( page ) ); + /*dest += */conf_render_text ( g_tab_font, buffer, dest, 380, 440, CONF_UNSELECTED ); + } + // help dest += conf_render_line ( dest, 380 ); - dest += conf_render_text ( g_tab_font, "Up and down to switch selection", dest, 10, 400, CONF_UNSELECTED ); + dest += conf_render_text ( g_tab_font, "D-pad Up/down; Y return to index", dest, 10, 400, CONF_UNSELECTED ); dest += conf_render_text ( g_tab_font, "Left and right to alter selected item", dest, 10, 420, CONF_UNSELECTED ); dest += conf_render_text ( g_tab_font, "B or Enter to activate an option", dest, 10, 440, CONF_UNSELECTED ); @@ -783,3 +790,10 @@ void conf_reset_to_default ( pnd_conf_handle h ) { return; } +unsigned int conf_determine_pagelength ( confitem_t *page ) { + confitem_t *p = page; + while ( p -> text ) { + p++; + } + return ( p - page ); +} diff --git a/minimenu/mmconf.h b/minimenu/mmconf.h index a8d6c7b..53d7635 100644 --- a/minimenu/mmconf.h +++ b/minimenu/mmconf.h @@ -34,6 +34,7 @@ void conf_display_page ( confitem_t *page, unsigned int selitem, unsigned int fi #define CONF_SELECTED 1 #define CONF_UNSELECTED 0 unsigned char conf_prepare_page ( confitem_t *page ); +unsigned int conf_determine_pagelength ( confitem_t *page ); void conf_merge_into ( char *fullpath, pnd_conf_handle h ); // merge fullpath as a conf file into 'h'; no turning back. unsigned char conf_write ( pnd_conf_handle h, char *fullpath ); // emit a conf file, based on items known to conf-ui diff --git a/minimenu/mmui.c b/minimenu/mmui.c index 4b61f78..08d8dac 100644 --- a/minimenu/mmui.c +++ b/minimenu/mmui.c @@ -1224,10 +1224,10 @@ void ui_process_input ( unsigned char block_p ) { ui_detail_hidden = 0; } ui_event++; - } else if ( event.key.keysym.sym == SDLK_RSHIFT ) { // left trigger + } else if ( event.key.keysym.sym == SDLK_RSHIFT || event.key.keysym.sym == SDLK_COMMA ) { // left trigger or comma ui_push_ltrigger(); ui_event++; - } else if ( event.key.keysym.sym == SDLK_RCTRL ) { // right trigger + } else if ( event.key.keysym.sym == SDLK_RCTRL || event.key.keysym.sym == SDLK_PERIOD ) { // right trigger or period ui_push_rtrigger(); ui_event++; } else if ( event.key.keysym.sym == SDLK_PAGEUP ) { // Y @@ -1643,7 +1643,7 @@ void ui_push_exec ( void ) { pnd_log ( pndn_debug, "Cat %s is now in path %s\n", g_categories [ ui_category ].catname, g_categories [ ui_category ].fspath ); // rescan the dir - category_fs_restock ( &(g_categories [ ui_category]) ); + category_fs_restock ( &(g_categories [ ui_category ]) ); // forget the selection, nolonger applies ui_selected = NULL; ui_set_selected ( ui_selected ); @@ -1672,7 +1672,23 @@ void ui_push_exec ( void ) { } else { // random bin file + + // is it even executable? if we don't have handlers for non-executables yet (Jan 2011 we don't), + // then don't even try to run things not-flagged as executable.. but wait most people are on + // FAT filesystems, what a drag, we can't tell. + +#if 0 // eat up any pending SDL events and toss 'em? + { + SDL_PumpEvents(); + SDL_Event e; + while ( SDL_PeepEvents ( &e, 1, SDL_GETEVENT, SDL_ALLEVENTS ) > 0 ) { + // spin + } + } +#endif + #if 1 + // just exec it char cwd [ PATH_MAX ]; getcwd ( cwd, PATH_MAX ); @@ -1680,6 +1696,7 @@ void ui_push_exec ( void ) { pnd_exec_no_wait_1 ( ui_selected -> ref -> title_en, NULL ); chdir ( cwd ); #else + // get mmwrapper to run it char buffer [ PATH_MAX ]; sprintf ( buffer, "%s %s/%s\n", MM_RUN, g_categories [ ui_category ].fspath, ui_selected -> ref -> title_en ); if ( pnd_conf_get_as_int_d ( g_conf, "minimenu.live_on_run", 0 ) == 0 ) { @@ -2367,6 +2384,8 @@ void ui_touch_act ( unsigned int x, unsigned int y ) { } ui_category = t -> catnum; render_mask |= CHANGED_CATEGORY; + // rescan the dir + category_fs_restock ( &(g_categories [ ui_category ]) ); } break; -- 2.39.2