diff options
author | Thomas Martitz <kugel@rockbox.org> | 2009-10-20 21:54:59 +0000 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2009-10-20 21:54:59 +0000 |
commit | d85c3ec41020a6c56b0d5d95a9ed790f57d73c6e (patch) | |
tree | 2f51ed47fee689024ed8c145634044362c8ed7d5 /apps | |
parent | 774bacc692b4d5c7b769bb88d24e182db9e4656f (diff) | |
download | rockbox-d85c3ec41020a6c56b0d5d95a9ed790f57d73c6e.tar.gz rockbox-d85c3ec41020a6c56b0d5d95a9ed790f57d73c6e.zip |
Convert lcd_activation callbacks to use the event system to allow for multiple parallel callbacks (for custom statusbar).
Increase maximum event count as we need more (I actually had a report about it during custom statusbar testing).
Removed corresponding functions from the core and plugin api. Bump min version and sort.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23302 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r-- | apps/gui/wps.c | 13 | ||||
-rw-r--r-- | apps/plugin.c | 8 | ||||
-rw-r--r-- | apps/plugin.h | 14 | ||||
-rw-r--r-- | apps/plugins/mpegplayer/mpeg_settings.c | 7 | ||||
-rw-r--r-- | apps/plugins/mpegplayer/mpegplayer.c | 9 |
5 files changed, 25 insertions, 26 deletions
diff --git a/apps/gui/wps.c b/apps/gui/wps.c index 11ce946e98..6d9d8443dd 100644 --- a/apps/gui/wps.c +++ b/apps/gui/wps.c | |||
@@ -562,8 +562,9 @@ static void play_hop(int direction) | |||
562 | * we suppress updates until the wps is activated again (the lcd driver will | 562 | * we suppress updates until the wps is activated again (the lcd driver will |
563 | * call this hook to issue an instant update) | 563 | * call this hook to issue an instant update) |
564 | * */ | 564 | * */ |
565 | static void wps_lcd_activation_hook(void) | 565 | static void wps_lcd_activation_hook(void *param) |
566 | { | 566 | { |
567 | (void)param; | ||
567 | wps_state.do_full_update = true; | 568 | wps_state.do_full_update = true; |
568 | /* force timeout in wps main loop, so that the update is instantly */ | 569 | /* force timeout in wps main loop, so that the update is instantly */ |
569 | queue_post(&button_queue, BUTTON_NONE, 0); | 570 | queue_post(&button_queue, BUTTON_NONE, 0); |
@@ -585,7 +586,7 @@ static void gwps_leave_wps(void) | |||
585 | viewportmanager_set_statusbar(oldbars); | 586 | viewportmanager_set_statusbar(oldbars); |
586 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) | 587 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) |
587 | /* Play safe and unregister the hook */ | 588 | /* Play safe and unregister the hook */ |
588 | lcd_activation_set_hook(NULL); | 589 | remove_event(LCD_EVENT_ACTIVATION, wps_lcd_activation_hook); |
589 | #endif | 590 | #endif |
590 | /* unhandle statusbar update delay */ | 591 | /* unhandle statusbar update delay */ |
591 | sb_skin_set_update_delay(DEFAULT_UPDATE_DELAY); | 592 | sb_skin_set_update_delay(DEFAULT_UPDATE_DELAY); |
@@ -1164,13 +1165,9 @@ long gui_wps_show(void) | |||
1164 | FOR_NB_SCREENS(i) | 1165 | FOR_NB_SCREENS(i) |
1165 | { | 1166 | { |
1166 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) | 1167 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) |
1167 | if (lcd_active() | ||
1168 | #ifdef HAVE_REMOTE_LCD | ||
1169 | /* currently, all remotes are readable without backlight | 1168 | /* currently, all remotes are readable without backlight |
1170 | * so still update those */ | 1169 | * so still update those */ |
1171 | || (i == SCREEN_REMOTE) | 1170 | if (lcd_active() || (i != SCREEN_MAIN)) |
1172 | #endif | ||
1173 | ) | ||
1174 | #endif | 1171 | #endif |
1175 | { | 1172 | { |
1176 | skin_update(&gui_wps[i], WPS_REFRESH_NON_STATIC); | 1173 | skin_update(&gui_wps[i], WPS_REFRESH_NON_STATIC); |
@@ -1193,7 +1190,7 @@ long gui_wps_show(void) | |||
1193 | restore = false; | 1190 | restore = false; |
1194 | restoretimer = RESTORE_WPS_INSTANTLY; | 1191 | restoretimer = RESTORE_WPS_INSTANTLY; |
1195 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) | 1192 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) |
1196 | lcd_activation_set_hook(wps_lcd_activation_hook); | 1193 | add_event(LCD_EVENT_ACTIVATION, false, wps_lcd_activation_hook); |
1197 | #endif | 1194 | #endif |
1198 | /* we remove the update delay since it's not very usable in the wps, | 1195 | /* we remove the update delay since it's not very usable in the wps, |
1199 | * e.g. during volume changing or ffwd/rewind */ | 1196 | * e.g. during volume changing or ffwd/rewind */ |
diff --git a/apps/plugin.c b/apps/plugin.c index 77fb925ba2..ae889d68fd 100644 --- a/apps/plugin.c +++ b/apps/plugin.c | |||
@@ -155,7 +155,6 @@ static const struct plugin_api rockbox_api = { | |||
155 | lcd_set_mode, | 155 | lcd_set_mode, |
156 | #endif | 156 | #endif |
157 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) | 157 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) |
158 | lcd_activation_set_hook, | ||
159 | &button_queue, | 158 | &button_queue, |
160 | #endif | 159 | #endif |
161 | bidi_l2v, | 160 | bidi_l2v, |
@@ -255,6 +254,7 @@ static const struct plugin_api rockbox_api = { | |||
255 | button_status, | 254 | button_status, |
256 | #ifdef HAVE_BUTTON_DATA | 255 | #ifdef HAVE_BUTTON_DATA |
257 | button_get_data, | 256 | button_get_data, |
257 | button_status_wdata, | ||
258 | #endif | 258 | #endif |
259 | button_clear_queue, | 259 | button_clear_queue, |
260 | button_queue_count, | 260 | button_queue_count, |
@@ -376,6 +376,9 @@ static const struct plugin_api rockbox_api = { | |||
376 | __cyg_profile_func_enter, | 376 | __cyg_profile_func_enter, |
377 | __cyg_profile_func_exit, | 377 | __cyg_profile_func_exit, |
378 | #endif | 378 | #endif |
379 | add_event, | ||
380 | remove_event, | ||
381 | send_event, | ||
379 | 382 | ||
380 | #ifdef SIMULATOR | 383 | #ifdef SIMULATOR |
381 | /* special simulator hooks */ | 384 | /* special simulator hooks */ |
@@ -668,9 +671,6 @@ static const struct plugin_api rockbox_api = { | |||
668 | appsversion, | 671 | appsversion, |
669 | /* new stuff at the end, sort into place next time | 672 | /* new stuff at the end, sort into place next time |
670 | the API gets incompatible */ | 673 | the API gets incompatible */ |
671 | #ifdef HAVE_BUTTON_DATA | ||
672 | button_status_wdata, | ||
673 | #endif | ||
674 | }; | 674 | }; |
675 | 675 | ||
676 | int plugin_load(const char* plugin, const void* parameter) | 676 | int plugin_load(const char* plugin, const void* parameter) |
diff --git a/apps/plugin.h b/apps/plugin.h index 6ff7e7e568..7ea1943395 100644 --- a/apps/plugin.h +++ b/apps/plugin.h | |||
@@ -133,12 +133,12 @@ void* plugin_get_buffer(size_t *buffer_size); | |||
133 | #define PLUGIN_MAGIC 0x526F634B /* RocK */ | 133 | #define PLUGIN_MAGIC 0x526F634B /* RocK */ |
134 | 134 | ||
135 | /* increase this every time the api struct changes */ | 135 | /* increase this every time the api struct changes */ |
136 | #define PLUGIN_API_VERSION 172 | 136 | #define PLUGIN_API_VERSION 173 |
137 | 137 | ||
138 | /* update this to latest version if a change to the api struct breaks | 138 | /* update this to latest version if a change to the api struct breaks |
139 | backwards compatibility (and please take the opportunity to sort in any | 139 | backwards compatibility (and please take the opportunity to sort in any |
140 | new function which are "waiting" at the end of the function table) */ | 140 | new function which are "waiting" at the end of the function table) */ |
141 | #define PLUGIN_MIN_API_VERSION 172 | 141 | #define PLUGIN_MIN_API_VERSION 173 |
142 | 142 | ||
143 | /* plugin return codes */ | 143 | /* plugin return codes */ |
144 | enum plugin_status { | 144 | enum plugin_status { |
@@ -244,7 +244,6 @@ struct plugin_api { | |||
244 | #endif | 244 | #endif |
245 | 245 | ||
246 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) | 246 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) |
247 | void (*lcd_activation_set_hook)(void (*enable_hook)(void)); | ||
248 | struct event_queue *button_queue; | 247 | struct event_queue *button_queue; |
249 | #endif | 248 | #endif |
250 | unsigned short *(*bidi_l2v)( const unsigned char *str, int orientation ); | 249 | unsigned short *(*bidi_l2v)( const unsigned char *str, int orientation ); |
@@ -367,6 +366,7 @@ struct plugin_api { | |||
367 | int (*button_status)(void); | 366 | int (*button_status)(void); |
368 | #ifdef HAVE_BUTTON_DATA | 367 | #ifdef HAVE_BUTTON_DATA |
369 | intptr_t (*button_get_data)(void); | 368 | intptr_t (*button_get_data)(void); |
369 | int (*button_status_wdata)(int *pdata); | ||
370 | #endif | 370 | #endif |
371 | void (*button_clear_queue)(void); | 371 | void (*button_clear_queue)(void); |
372 | int (*button_queue_count)(void); | 372 | int (*button_queue_count)(void); |
@@ -500,6 +500,10 @@ struct plugin_api { | |||
500 | void (*profile_func_enter)(void *this_fn, void *call_site); | 500 | void (*profile_func_enter)(void *this_fn, void *call_site); |
501 | void (*profile_func_exit)(void *this_fn, void *call_site); | 501 | void (*profile_func_exit)(void *this_fn, void *call_site); |
502 | #endif | 502 | #endif |
503 | /* event api */ | ||
504 | bool (*add_event)(unsigned short id, bool oneshot, void (*handler)(void *data)); | ||
505 | void (*remove_event)(unsigned short id, void (*handler)(void *data)); | ||
506 | void (*send_event)(unsigned short id, void *data); | ||
503 | 507 | ||
504 | #ifdef SIMULATOR | 508 | #ifdef SIMULATOR |
505 | /* special simulator hooks */ | 509 | /* special simulator hooks */ |
@@ -837,10 +841,6 @@ struct plugin_api { | |||
837 | const char *appsversion; | 841 | const char *appsversion; |
838 | /* new stuff at the end, sort into place next time | 842 | /* new stuff at the end, sort into place next time |
839 | the API gets incompatible */ | 843 | the API gets incompatible */ |
840 | |||
841 | #ifdef HAVE_BUTTON_DATA | ||
842 | int (*button_status_wdata)(int *pdata); | ||
843 | #endif | ||
844 | }; | 844 | }; |
845 | 845 | ||
846 | /* plugin header */ | 846 | /* plugin header */ |
diff --git a/apps/plugins/mpegplayer/mpeg_settings.c b/apps/plugins/mpegplayer/mpeg_settings.c index df926f4c17..eb55c1444e 100644 --- a/apps/plugins/mpegplayer/mpeg_settings.c +++ b/apps/plugins/mpegplayer/mpeg_settings.c | |||
@@ -599,8 +599,9 @@ static uint32_t increment_time(uint32_t val, int32_t amount, uint32_t range) | |||
599 | } | 599 | } |
600 | 600 | ||
601 | #if defined(HAVE_LCD_ENABLE) && defined(HAVE_LCD_COLOR) | 601 | #if defined(HAVE_LCD_ENABLE) && defined(HAVE_LCD_COLOR) |
602 | static void get_start_time_lcd_enable_hook(void) | 602 | static void get_start_time_lcd_enable_hook(void *param) |
603 | { | 603 | { |
604 | (void)param; | ||
604 | rb->queue_post(rb->button_queue, LCD_ENABLE_EVENT_0, 0); | 605 | rb->queue_post(rb->button_queue, LCD_ENABLE_EVENT_0, 0); |
605 | } | 606 | } |
606 | #endif /* HAVE_LCD_ENABLE */ | 607 | #endif /* HAVE_LCD_ENABLE */ |
@@ -619,7 +620,7 @@ static int get_start_time(uint32_t duration) | |||
619 | lcd_(update)(); | 620 | lcd_(update)(); |
620 | 621 | ||
621 | #if defined(HAVE_LCD_ENABLE) && defined(HAVE_LCD_COLOR) | 622 | #if defined(HAVE_LCD_ENABLE) && defined(HAVE_LCD_COLOR) |
622 | rb->lcd_activation_set_hook(get_start_time_lcd_enable_hook); | 623 | rb->add_event(LCD_EVENT_ACTIVATION, false, get_start_time_lcd_enable_hook); |
623 | #endif | 624 | #endif |
624 | 625 | ||
625 | draw_slider(0, 100, &rc_bound); | 626 | draw_slider(0, 100, &rc_bound); |
@@ -810,7 +811,7 @@ static int get_start_time(uint32_t duration) | |||
810 | } | 811 | } |
811 | 812 | ||
812 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) | 813 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) |
813 | rb->lcd_activation_set_hook(NULL); | 814 | rb->remove_event(LCD_EVENT_ACTIVATION, get_start_time_lcd_enable_hook); |
814 | #endif | 815 | #endif |
815 | #ifndef HAVE_LCD_COLOR | 816 | #ifndef HAVE_LCD_COLOR |
816 | stream_gray_show(false); | 817 | stream_gray_show(false); |
diff --git a/apps/plugins/mpegplayer/mpegplayer.c b/apps/plugins/mpegplayer/mpegplayer.c index 0cb5f94d19..7c52a47260 100644 --- a/apps/plugins/mpegplayer/mpegplayer.c +++ b/apps/plugins/mpegplayer/mpegplayer.c | |||
@@ -652,8 +652,9 @@ static void draw_putsxy_oriented(int x, int y, const char *str) | |||
652 | 652 | ||
653 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) | 653 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) |
654 | /* So we can refresh the overlay */ | 654 | /* So we can refresh the overlay */ |
655 | static void wvs_lcd_enable_hook(void) | 655 | static void wvs_lcd_enable_hook(void* param) |
656 | { | 656 | { |
657 | (void)param; | ||
657 | rb->queue_post(rb->button_queue, LCD_ENABLE_EVENT_1, 0); | 658 | rb->queue_post(rb->button_queue, LCD_ENABLE_EVENT_1, 0); |
658 | } | 659 | } |
659 | #endif | 660 | #endif |
@@ -665,11 +666,11 @@ static void wvs_backlight_on_video_mode(bool video_on) | |||
665 | /* backlight control in lib/helper.c */ | 666 | /* backlight control in lib/helper.c */ |
666 | backlight_force_on(); | 667 | backlight_force_on(); |
667 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) | 668 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) |
668 | rb->lcd_activation_set_hook(NULL); | 669 | rb->remove_event(LCD_EVENT_ACTIVATION, wvs_lcd_enable_hook); |
669 | #endif | 670 | #endif |
670 | } else { | 671 | } else { |
671 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) | 672 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) |
672 | rb->lcd_activation_set_hook(wvs_lcd_enable_hook); | 673 | rb->add_event(LCD_EVENT_ACTIVATION, false, wvs_lcd_enable_hook); |
673 | #endif | 674 | #endif |
674 | /* Revert to user's backlight settings */ | 675 | /* Revert to user's backlight settings */ |
675 | backlight_use_settings(); | 676 | backlight_use_settings(); |
@@ -1671,7 +1672,7 @@ static void button_loop(void) | |||
1671 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) | 1672 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) |
1672 | /* Be sure hook is removed before exiting since the stop will put it | 1673 | /* Be sure hook is removed before exiting since the stop will put it |
1673 | * back because of the backlight restore. */ | 1674 | * back because of the backlight restore. */ |
1674 | rb->lcd_activation_set_hook(NULL); | 1675 | rb->remove_event(LCD_EVENT_ACTIVATION, wvs_lcd_enable_hook); |
1675 | #endif | 1676 | #endif |
1676 | 1677 | ||
1677 | rb->lcd_setfont(FONT_UI); | 1678 | rb->lcd_setfont(FONT_UI); |