From 7ce5a8668792311a016b166d6abf69b23b0dc3e1 Mon Sep 17 00:00:00 2001 From: skeezix Date: Wed, 24 Mar 2010 16:30:47 -0400 Subject: [PATCH] Some defaults chanigng in the mmenu conf-- -- default to preload icons -- its fast, and doesn't slow user down later; they can set to defer themselves -- default to unthreaded preview loads; better to hit the user now, than chug them for a few motions -- show hourglass art while loading previews in foreground, so they know to wait -- show previews after 2s or so, rather than 1s, of paused selection; give the user a bit more breather --> this should all make the experience feel better Preview caching-- -- if do_cache is set in conf, will now attempt to cache previews _to SD_ for long term storage --> risk is the preview pics change, and mmenu never updates them; should maybe check preview pic age and re-export it once a month or something, or if age < pmnd age, or something. -- Seledct menu can do 'mass cache', which chugs for a few mins, but will do all preview caching -- otherwise, with do_Cache on (default!), after the 2s wait, it'll cache out to SD and load preview --> thus, first preview is slow, but very fast next time, even next mmenu session --- deployment/etc/pandora/conf/mmenu.conf | 16 ++- include/pnd_apps.h | 2 + include/pnd_utility.h | 3 + lib/pnd_apps.c | 2 +- lib/pnd_utility.c | 56 +++++++++++ minimenu/TODO.txt | 2 + minimenu/mmcache.c | 130 +++++++++++++++++++++++-- minimenu/mmcache.h | 2 + minimenu/mmenu.c | 6 ++ minimenu/mmenu.conf | 16 ++- minimenu/mmui.c | 58 +++++++++-- minimenu/mmui.h | 2 + 12 files changed, 265 insertions(+), 30 deletions(-) diff --git a/deployment/etc/pandora/conf/mmenu.conf b/deployment/etc/pandora/conf/mmenu.conf index 4d0fc58..77c967a 100644 --- a/deployment/etc/pandora/conf/mmenu.conf +++ b/deployment/etc/pandora/conf/mmenu.conf @@ -11,9 +11,9 @@ font_ptsize 24 pndrun /usr/pandora/scripts:./testdata/scripts # searchpath to locate "pnd_run.sh"; why aren't I looking in /etc/pandora/conf/apps for this? load_previews_now 0 # if >0, will try to load preview pics from pnds at boot time, not defer till later load_previews_later 1 # if >0, will try to load preview pics sometime (see defer_timer_ms as well) -load_icons_later 1 # if >0, will try to load icons after grid is showing, not during app scanning +load_icons_later 0 # if >0, will try to load icons after grid is showing, not during app scanning defer_icon_us 100000 # when background loading icons (load_icons_later), time between icon loadsa -threaded_preview 1 # if 1, will try to load the preview in background, to avoid slowing up navigation +threaded_preview 0 # if 1, will try to load the preview in background, to avoid slowing up navigation loglevel 0 # 0 is debug, lots of crap; 3 is better, means 'errors only'. Output may screw up the wrapper! x11_present_sh /bin/pidof X # command to invoke to determine if X11 is running or not; expects a number on X is present. desktop_apps 1 # search the pnd standard desktop searchpath for apps @@ -33,8 +33,8 @@ font_rgba_b 220 # RGBA for the display text font_rgba_a 20 # RGBA for the display text battery_x 10 # (x,y) for battery level battery_y 450 # (x,y) for battery level -hintline Push SELECT for shutdown options # shown at bottom of screen -hint_x 275 # (x,y) for hint line +hintline Push SELECT for options # shown at bottom of screen +hint_x 300 # (x,y) for hint line hint_y 450 # (x,y) for hint line clock_x 650 # (x,y) for clock clock_y 450 # (x,y) for clock @@ -102,12 +102,17 @@ cell_offset_y 312 # top edge of text cell cell_width 250 # width of cell (for text clipping) [previewpic] -defer_timer_ms 1000 # after setting selection, how long to wait before we try to load the previewpic +defer_timer_ms 2000 # after setting selection, how long to wait before we try to load the previewpic cell_offset_x 480 # left edge of text cell cell_offset_y 90 # top edge of text cell cell_width 285 cell_height 180 scale_up_bool 1 # if 0, will not try to scale up preview +do_cache 1 # if 1, will try to cache previews to SD, for performance boost +cache_searchpath /media/mmcblk[12]p? # devices to consider for caching to, in order +cache_minfree 500 # if free space is less than this (in KB), move to next device +cache_path /pandora/appdata/mmenu.pvwcache # where to write cached images to +cache_findpath /media/mmcblk[12]p?/pandora/appdata/mmenu.pvwcache # where to look for cached preview pics [graphics] IMG_BACKGROUND_800480 800480_6.png @@ -126,6 +131,7 @@ IMG_PREVIEW_MISSING pandora60.png IMG_ARROW_UP arrowup.png IMG_ARROW_DOWN arrowdown.png IMG_ARROW_SCROLLBAR arrowscroller.png +IMG_HOURGLASS hourglass.png [categories] do_all_cat 1 # if >0, will show an All category; if 0, skip it, just your cats. diff --git a/include/pnd_apps.h b/include/pnd_apps.h index 5db22a3..5f8f12b 100644 --- a/include/pnd_apps.h +++ b/include/pnd_apps.h @@ -10,6 +10,8 @@ extern "C" { #define PND_APPS_SEARCHPATH "/media/*/pandora/apps:/usr/pandora/apps" #define PND_APPS_KEY "autodiscovery.searchpath" +#define PND_APPS_APPDATA_PREFIX "/pandora/appdata" /* /media/DEVNAME + PREFIX + unique-id */ + // default notify searchpath (and key to look it up in config) #define PND_APPS_NOTIFYPATH "/media:/media/*/pandora/apps:/usr/pandora/apps" #define PND_APPS_NOTIFY_KEY "autodiscovery.notifypath" diff --git a/include/pnd_utility.h b/include/pnd_utility.h index 3be73d2..5cc2bb4 100644 --- a/include/pnd_utility.h +++ b/include/pnd_utility.h @@ -27,6 +27,9 @@ pnd_pxml_handle *pnd_pxml_get_by_path ( char *fullpath ); // consider for a similar effect: df /home -> look at "Mounted on" unsigned char pnd_determine_mountpoint ( char *fullpath, char *r_mountpoint, unsigned char mountpoint_len ); +// filecopy will return >0 on success +unsigned char pnd_filecopy ( char *sourcepath, char *targetpath ); + #ifdef __cplusplus } /* "C" */ #endif diff --git a/lib/pnd_apps.c b/lib/pnd_apps.c index 73a78e3..cefebbb 100644 --- a/lib/pnd_apps.c +++ b/lib/pnd_apps.c @@ -217,7 +217,7 @@ unsigned char pnd_get_appdata_path ( char *fullpath, char *unique_id, char *r_pa *ws = '\0'; if ( r_path && path_len ) { - snprintf ( r_path, path_len, "%s/appdata/%s/", cmdbuf, unique_id ); + snprintf ( r_path, path_len, "%s/pandora/appdata/%s/", cmdbuf, unique_id ); } return ( 1 ); diff --git a/lib/pnd_utility.c b/lib/pnd_utility.c index 6c521b9..4c1a6a3 100644 --- a/lib/pnd_utility.c +++ b/lib/pnd_utility.c @@ -303,3 +303,59 @@ unsigned char pnd_determine_mountpoint ( char *fullpath, char *r_mountpoint, uns return ( 0 ); } + +unsigned char pnd_filecopy ( char *sourcepath, char *targetpath ) { +#define BITLEN (64*1024) + FILE *pnd, *target; // pnd == from, since I cribbed the code from pnd_desktop.c :/ + unsigned char bits [ BITLEN ]; + unsigned int bitlen; + + pnd = fopen ( sourcepath, "rb" ); + + if ( ! pnd ) { + return ( 0 ); + } + + unsigned int len; + + target = fopen ( targetpath, "wb" ); + + if ( ! target ) { + fclose ( pnd ); + return ( 0 ); + } + + fseek ( pnd, 0, SEEK_END ); + len = ftell ( pnd ); + fseek ( pnd, 0, SEEK_SET ); + + while ( len ) { + + if ( len > (BITLEN) ) { + bitlen = (BITLEN); + } else { + bitlen = len; + } + + if ( fread ( bits, bitlen, 1, pnd ) != 1 ) { + fclose ( pnd ); + fclose ( target ); + unlink ( targetpath ); + return ( 0 ); + } + + if ( fwrite ( bits, bitlen, 1, target ) != 1 ) { + fclose ( pnd ); + fclose ( target ); + unlink ( targetpath ); + return ( 0 ); + } + + len -= bitlen; + } // while + + fclose ( pnd ); + fclose ( target ); + + return ( 1 ); +} diff --git a/minimenu/TODO.txt b/minimenu/TODO.txt index 09a26ed..b7d66b0 100644 --- a/minimenu/TODO.txt +++ b/minimenu/TODO.txt @@ -5,6 +5,8 @@ - libpnd: appdata-dir-name? +- speed up render, use render mask? +- evmapperd.. no force off, if charging on /sys/class/power_supply/bq27500-0/current_now is +ve - skinning .. mmenu.conf and then skin.conf in each skin dir? - preview pic override for davec :) - some ultra primtive frame draw, so the 'detail menu' and any 'sub menus' can draw diff --git a/minimenu/mmcache.c b/minimenu/mmcache.c index 48a023d..2d3464e 100644 --- a/minimenu/mmcache.c +++ b/minimenu/mmcache.c @@ -29,12 +29,17 @@ #include "pnd_desktop.h" #include "pnd_pndfiles.h" #include "pnd_apps.h" +#include "../lib/pnd_pathiter.h" +#include "pnd_locate.h" #include "mmenu.h" #include "mmapps.h" #include "mmcache.h" +#include "mmcat.h" +#include "mmui.h" extern pnd_conf_handle g_conf; +extern unsigned char g_pvwcache; mm_cache_t *g_icon_cache = NULL; mm_cache_t *g_preview_cache = NULL; @@ -56,33 +61,91 @@ unsigned char cache_preview ( pnd_disco_t *app, unsigned int maxwidth, unsigned // not cached, load it up // + // show hourglass + ui_show_hourglass ( 1 /* updaterect*/ ); + // see if we can mount the pnd/dir // does preview file exist? // if so, load it up, size it, cache it // if not, warning and bail // unmount it - // can we mount? - char fullpath [ PATH_MAX ]; - char filepath [ PATH_MAX ]; + // can we mount? or can we find it in preview cache? + char fullpath [ PATH_MAX ] = ""; + char filepath [ PATH_MAX ] = ""; - sprintf ( fullpath, "%s/%s", app -> object_path, app -> object_filename ); + if ( g_pvwcache ) { + static char *cache_findpath = NULL; + if ( ! cache_findpath ) { + cache_findpath = pnd_conf_get_as_char ( g_conf, "previewpic.cache_findpath" ); + } + char buffer [ FILENAME_MAX ]; + sprintf ( buffer, "%s.png", app -> unique_id ); + char *f = pnd_locate_filename ( cache_findpath, buffer ); + if ( f ) { + strncpy ( filepath, f, PATH_MAX ); + } + } + + // if we don't have a file path sorted out yet, means we need to mount and figure it + if ( ! filepath [ 0 ] ) { + sprintf ( fullpath, "%s/%s", app -> object_path, app -> object_filename ); + + if ( ! pnd_pnd_mount ( pnd_run_script, fullpath, app -> unique_id ) ) { + pnd_log ( pndn_debug, "Couldn't mount '%s' for preview\n", fullpath ); + return ( 0 ); // couldn't mount?! + } - if ( ! pnd_pnd_mount ( pnd_run_script, fullpath, app -> unique_id ) ) { - pnd_log ( pndn_debug, "Couldn't mount '%s' for preview\n", fullpath ); - return ( 0 ); // couldn't mount?! + sprintf ( filepath, "%s/%s/%s", PND_MOUNT_PATH, app -> unique_id, app -> preview_pic1 ); } - sprintf ( filepath, "%s/%s/%s", PND_MOUNT_PATH, app -> unique_id, app -> preview_pic1 ); + // load whatever path we've got s = IMG_Load ( filepath ); - pnd_pnd_unmount ( pnd_run_script, fullpath, app -> unique_id ); - if ( ! s ) { + // unmount it, if mounted + if ( fullpath [ 0 ] ) { + pnd_pnd_unmount ( pnd_run_script, fullpath, app -> unique_id ); + } pnd_log ( pndn_debug, "Couldn't open image '%s' for preview\n", filepath ); return ( 0 ); } + // try to copy file to the cache, if we're doing that, and if mounted + if ( g_pvwcache && fullpath [ 0 ] ) { + char cacheoutpath [ PATH_MAX ] = ""; + + // figure out where we want to write the file to + if ( cache_find_writable ( cacheoutpath, PATH_MAX ) ) { + static char *cache_path = NULL; + char buffer [ PATH_MAX ]; + if ( ! cache_path ) { + cache_path = pnd_conf_get_as_char ( g_conf, "previewpic.cache_path" ); + } + // make the dir + snprintf ( buffer, PATH_MAX, "%s/%s", cacheoutpath, cache_path ); + struct stat statbuf; + if ( stat ( buffer, &statbuf ) != 0 ) { + snprintf ( buffer, PATH_MAX, "/bin/mkdir -p %s/%s", cacheoutpath, cache_path ); + system ( buffer ); + } + // set up target filename to copy + snprintf ( buffer, PATH_MAX, "%s/%s/%s.png", cacheoutpath, cache_path, app -> unique_id ); + pnd_log ( pndn_debug, "Found free space to cache preview to here: %s", buffer ); + if ( ! pnd_filecopy ( filepath, buffer ) ) { + pnd_log ( pndn_error, "ERROR: Copying preview from %s to %s", filepath, buffer ); + } + } else { + pnd_log ( pndn_warning, "WARN: Couldn't find a device to cache preview to.\n" ); + } + + } // preview file cache + + // unmount it, if mounted + if ( fullpath [ 0 ] ) { + pnd_pnd_unmount ( pnd_run_script, fullpath, app -> unique_id ); + } + //pnd_log ( pndn_debug, "Image size is %u x %u (max %u x %u)\n", s -> w, s -> h, maxwidth, maxheight ); // scale @@ -245,3 +308,50 @@ mm_cache_t *cache_query_icon ( char *id ) { mm_cache_t *cache_query_preview ( char *id ) { return ( cache_query ( id, g_preview_cache ) ); } + +unsigned char cache_find_writable ( char *r_writepath, unsigned int len ) { + static char *searchpath = NULL; + static unsigned int minfree = 0; + char cmdbuf [ PATH_MAX ]; + FILE *f; + unsigned int freespace = 0; + + // try to find a device, in order of searchpath, with enough space for this cache-out + + if ( ! searchpath ) { + searchpath = pnd_conf_get_as_char ( g_conf, "previewpic.cache_searchpath" ); + minfree = pnd_conf_get_as_int_d ( g_conf, "previewpic.cache_minfree", 500 ); + } + + if ( ! searchpath ) { + return ( 0 ); // fail! + } + + SEARCHPATH_PRE + { + + // since I didn't figure out which /sys/block I can pull remaining space from, I'll use df for now :/ + sprintf ( cmdbuf, "/bin/df %s", buffer ); + + f = popen ( cmdbuf, "r" ); + + if ( f ) { + while ( fgets ( cmdbuf, PATH_MAX, f ) ) { + // just eat it up + // /dev/sdc2 7471392 725260 6366600 11% /media/IMAGE + if ( sscanf ( cmdbuf, "%*s %*u %*u %u %*u %*s\n", &freespace ) == 1 ) { + strncpy ( r_writepath, buffer, len ); + if ( freespace > minfree ) { + pclose ( f ); + return ( 1 ); + } // enough free? + } // df + } // while + pclose ( f ); + } + + } + SEARCHPATH_POST + + return ( 0 ); +} diff --git a/minimenu/mmcache.h b/minimenu/mmcache.h index 6a5f39a..b377099 100644 --- a/minimenu/mmcache.h +++ b/minimenu/mmcache.h @@ -24,4 +24,6 @@ mm_cache_t *cache_query ( char *id, mm_cache_t *head ); mm_cache_t *cache_query_icon ( char *id ); // specialized version mm_cache_t *cache_query_preview ( char *id ); // specialized version +unsigned char cache_find_writable ( char *r_writepath, unsigned int len ); + #endif diff --git a/minimenu/mmenu.c b/minimenu/mmenu.c index 23dfeb8..97328f5 100644 --- a/minimenu/mmenu.c +++ b/minimenu/mmenu.c @@ -60,6 +60,7 @@ char *pnd_run_script = NULL; char *g_skinpath = NULL; unsigned char g_x11_present = 1; // >0 if X is present unsigned char g_catmap = 0; // if 1, we're doing category mapping +unsigned char g_pvwcache = 0; // if 1, we're trying to do preview caching int main ( int argc, char *argv[] ) { int logall = -1; // -1 means normal logging rules; >=0 means log all! @@ -235,6 +236,11 @@ int main ( int argc, char *argv[] ) { // show load screen ui_loadscreen(); + // store flag if we're doing preview caching or not + if ( pnd_conf_get_as_int_d ( g_conf, "previewpic.do_cache", 0 ) ) { + g_pvwcache = 1; + } + // set up static image cache if ( ! ui_imagecache ( g_skinpath ) ) { pnd_log ( pndn_error, "ERROR: Couldn't set up static UI image cache!\n" ); diff --git a/minimenu/mmenu.conf b/minimenu/mmenu.conf index 9a2dc00..cf609fb 100644 --- a/minimenu/mmenu.conf +++ b/minimenu/mmenu.conf @@ -11,9 +11,9 @@ font_ptsize 24 pndrun /usr/pandora/scripts:./testdata/scripts # searchpath to locate "pnd_run.sh"; why aren't I looking in /etc/pandora/conf/apps for this? load_previews_now 0 # if >0, will try to load preview pics from pnds at boot time, not defer till later load_previews_later 0 # if >0, will try to load preview pics sometime (see defer_timer_ms as well) -load_icons_later 1 # if >0, will try to load icons after grid is showing, not during app scanning +load_icons_later 0 # if >0, will try to load icons after grid is showing, not during app scanning defer_icon_us 100000 # when background loading icons (load_icons_later), time between icon loadsa -threaded_preview 1 # if 1, will try to load the preview in background, to avoid slowing up navigation +threaded_preview 0 # if 1, will try to load the preview in background, to avoid slowing up navigation loglevel 0 # 0 is debug, lots of crap; 3 is better, means 'errors only'. Output may screw up the wrapper! x11_present_sh /bin/pidof X # command to invoke to determine if X11 is running or not; expects a number on X is present. desktop_apps 1 # search the pnd standard desktop searchpath for apps @@ -33,8 +33,8 @@ font_rgba_b 220 # RGBA for the display text font_rgba_a 20 # RGBA for the display text battery_x 10 # (x,y) for battery level battery_y 450 # (x,y) for battery level -hintline Push SELECT for shutdown options # shown at bottom of screen -hint_x 275 # (x,y) for hint line +hintline Push SELECT for options # shown at bottom of screen +hint_x 300 # (x,y) for hint line hint_y 450 # (x,y) for hint line clock_x 650 # (x,y) for clock clock_y 450 # (x,y) for clock @@ -102,12 +102,17 @@ cell_offset_y 312 # top edge of text cell cell_width 250 # width of cell (for text clipping) [previewpic] -defer_timer_ms 1000 # after setting selection, how long to wait before we try to load the previewpic +defer_timer_ms 2000 # after setting selection, how long to wait before we try to load the previewpic cell_offset_x 480 # left edge of text cell cell_offset_y 90 # top edge of text cell cell_width 285 cell_height 180 scale_up_bool 1 # if 0, will not try to scale up preview +do_cache 1 # if 1, will try to cache previews to SD, for performance boost +cache_searchpath /media/mmcblk[12]p? # devices to consider for caching to, in order +cache_minfree 500 # if free space is less than this (in KB), move to next device +cache_path /pandora/appdata/mmenu.pvwcache # where to write cached images to +cache_findpath /media/mmcblk[12]p?/pandora/appdata/mmenu.pvwcache # where to look for cached preview pics [graphics] IMG_BACKGROUND_800480 800480_6.png @@ -126,6 +131,7 @@ IMG_PREVIEW_MISSING pandora60.png IMG_ARROW_UP arrowup.png IMG_ARROW_DOWN arrowdown.png IMG_ARROW_SCROLLBAR arrowscroller.png +IMG_HOURGLASS hourglass.png [categories] do_all_cat 1 # if >0, will show an All category; if 0, skip it, just your cats. diff --git a/minimenu/mmui.c b/minimenu/mmui.c index 2d2ac5f..d6016a1 100644 --- a/minimenu/mmui.c +++ b/minimenu/mmui.c @@ -193,6 +193,7 @@ mm_imgcache_t g_imagecache [ IMG_TRUEMAX ] = { { IMG_ARROW_UP, "graphics.IMG_ARROW_UP", }, { IMG_ARROW_DOWN, "graphics.IMG_ARROW_DOWN", }, { IMG_ARROW_SCROLLBAR, "graphics.IMG_ARROW_SCROLLBAR", }, + { IMG_HOURGLASS, "graphics.IMG_HOURGLASS", }, { IMG_MAX, NULL }, }; @@ -821,14 +822,13 @@ void ui_process_input ( unsigned char block_p ) { // timer went off, time to load something if ( pnd_conf_get_as_int_d ( g_conf, "minimenu.load_previews_later", 0 ) ) { - pnd_log ( pndn_debug, "Deferred preview pic load ----------\n" ); - // load the preview pics now! pnd_disco_t *iter = ui_selected -> ref; if ( iter -> preview_pic1 ) { if ( pnd_conf_get_as_int_d ( g_conf, "minimenu.threaded_preview", 0 ) ) { + // load in bg thread, make user experience chuggy g_preview_thread = SDL_CreateThread ( (void*)ui_threaded_defered_preview, iter ); @@ -837,6 +837,7 @@ void ui_process_input ( unsigned char block_p ) { } } else { + // load it now, make user wait if ( ! cache_preview ( iter, pnd_conf_get_as_int_d ( g_conf, "previewpic.cell_width", 200 ), pnd_conf_get_as_int_d ( g_conf, "previewpic.cell_height", 180 ) ) @@ -850,8 +851,6 @@ void ui_process_input ( unsigned char block_p ) { } // got a preview at all? - pnd_log ( pndn_debug, "Deferred preview pic load finish ---\n" ); - ui_event++; } @@ -1007,6 +1006,7 @@ void ui_process_input ( unsigned char block_p ) { "Return to Minimenu", "Shutdown Pandora", "Rescan for Applications", + "Cache previews to SD now", "Run xfce4 from Minimenu", "Run a terminal/console", "Exit and run xfce4", @@ -1033,11 +1033,34 @@ void ui_process_input ( unsigned char block_p ) { ui_selected = NULL; ui_rows_scrolled_down = 0; } else if ( sel == 3 ) { + // cache preview to SD now + extern pnd_box_handle g_active_apps; + pnd_box_handle h = g_active_apps; + + unsigned char maxwidth, maxheight; + maxwidth = pnd_conf_get_as_int_d ( g_conf, "previewpic.cell_width", 200 ); + maxheight = pnd_conf_get_as_int_d ( g_conf, "previewpic.cell_height", 180 ); + + pnd_disco_t *iter = pnd_box_get_head ( h ); + + while ( iter ) { + + // cache it + if ( ! cache_preview ( iter, maxwidth, maxheight ) ) { + pnd_log ( pndn_debug, "Force cache: Couldn't load preview pic: '%s' -> '%s'\n", + IFNULL(iter->title_en,"No Name"), iter -> preview_pic1 ); + } + + // next + iter = pnd_box_get_next ( iter ); + } // while + + } else if ( sel == 4 ) { // run xfce char buffer [ PATH_MAX ]; sprintf ( buffer, "%s %s\n", MM_RUN, "/usr/bin/startxfce4" ); emit_and_quit ( buffer ); - } else if ( sel == 4 ) { + } else if ( sel == 5 ) { // run terminal char *argv[5]; argv [ 0 ] = pnd_conf_get_as_char ( g_conf, "utility.terminal" ); @@ -1047,23 +1070,23 @@ void ui_process_input ( unsigned char block_p ) { ui_forkexec ( argv ); } - } else if ( sel == 5 ) { + } else if ( sel == 6 ) { // set env to xfce sprintf ( buffer, "echo startxfce4 > /tmp/gui.load" ); system ( buffer ); //sprintf ( buffer, "sudo poweroff" ); //system ( buffer ); exit ( 0 ); - } else if ( sel == 6 ) { + } else if ( sel == 7 ) { // set env to pmenu sprintf ( buffer, "echo pmenu > /tmp/gui.load" ); system ( buffer ); //sprintf ( buffer, "sudo poweroff" ); //system ( buffer ); exit ( 0 ); - } else if ( sel == 7 ) { - emit_and_quit ( MM_QUIT ); } else if ( sel == 8 ) { + emit_and_quit ( MM_QUIT ); + } else if ( sel == 9 ) { // about } @@ -2024,3 +2047,20 @@ unsigned char ui_threaded_defered_icon ( void *p ) { return ( 0 ); } + +void ui_show_hourglass ( unsigned char updaterect ) { + + SDL_Rect dest; + SDL_Surface *s = g_imagecache [ IMG_HOURGLASS ].i; + + dest.x = ( 800 - s -> w ) / 2; + dest.y = ( 480 - s -> h ) / 2; + + SDL_BlitSurface ( s, NULL /* whole image */, sdl_realscreen, &dest ); + + if ( updaterect ) { + SDL_UpdateRects ( sdl_realscreen, 1, &dest ); + } + + return; +} diff --git a/minimenu/mmui.h b/minimenu/mmui.h index 72c74c2..c322b3a 100644 --- a/minimenu/mmui.h +++ b/minimenu/mmui.h @@ -27,6 +27,7 @@ typedef enum { IMG_ARROW_UP, IMG_ARROW_DOWN, IMG_ARROW_SCROLLBAR, + IMG_HOURGLASS, IMG_MAX, // before this point is loaded; after is generated IMG_TRUEMAX } mm_imgcache_e; @@ -67,6 +68,7 @@ void ui_render ( unsigned int render_mask ); void ui_loadscreen ( void ); // show screen while loading the menu void ui_discoverscreen ( unsigned char clearscreen ); // screen to show while scanning for apps void ui_cachescreen ( unsigned char clearscreen, char *filename ); // while caching icons, categories and preview-pics-Now-mode +void ui_show_hourglass ( unsigned char updaterect ); void ui_post_scan ( void ); /* internal functions follow -- 2.39.2