diff options
-rw-r--r-- | apps/plugins/cube.c | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/apps/plugins/cube.c b/apps/plugins/cube.c index 4279a04ac6..57003a0eb8 100644 --- a/apps/plugins/cube.c +++ b/apps/plugins/cube.c | |||
@@ -477,6 +477,17 @@ static void cube_draw(void) | |||
477 | } | 477 | } |
478 | } | 478 | } |
479 | 479 | ||
480 | void cleanup(void *parameter) | ||
481 | { | ||
482 | (void)parameter; | ||
483 | |||
484 | #ifdef USE_GSLIB | ||
485 | gray_release(); | ||
486 | #elif defined HAVE_LCD_CHARCELLS | ||
487 | pgfx_release(); | ||
488 | #endif | ||
489 | } | ||
490 | |||
480 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 491 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) |
481 | { | 492 | { |
482 | char buffer[30]; | 493 | char buffer[30]; |
@@ -753,27 +764,20 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
753 | break; | 764 | break; |
754 | 765 | ||
755 | default: | 766 | default: |
756 | if (rb->default_event_handler(button) == SYS_USB_CONNECTED) | 767 | if (rb->default_event_handler_ex(button, cleanup, NULL) |
757 | { | 768 | == SYS_USB_CONNECTED) |
758 | #ifdef HAVE_LCD_CHARCELLS | ||
759 | pgfx_release(); | ||
760 | #elif defined(USE_GSLIB) | ||
761 | gray_release(); | ||
762 | #endif | ||
763 | return PLUGIN_USB_CONNECTED; | 769 | return PLUGIN_USB_CONNECTED; |
764 | } | ||
765 | break; | 770 | break; |
766 | } | 771 | } |
767 | if (button != BUTTON_NONE) | 772 | if (button != BUTTON_NONE) |
768 | lastbutton = button; | 773 | lastbutton = button; |
769 | } | 774 | } |
770 | 775 | ||
771 | #ifdef HAVE_LCD_CHARCELLS | 776 | #ifdef USE_GSLIB |
772 | pgfx_release(); | ||
773 | #elif defined(USE_GSLIB) | ||
774 | gray_release(); | 777 | gray_release(); |
778 | #elif defined(HAVE_LCD_CHARCELLS) | ||
779 | pgfx_release(); | ||
775 | #endif | 780 | #endif |
776 | |||
777 | return PLUGIN_OK; | 781 | return PLUGIN_OK; |
778 | } | 782 | } |
779 | 783 | ||