summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/plugins/chessbox/chessbox.c19
-rw-r--r--apps/recorder/recording.c5
2 files changed, 21 insertions, 3 deletions
diff --git a/apps/plugins/chessbox/chessbox.c b/apps/plugins/chessbox/chessbox.c
index 7d42b72c1b..c7cd94c7e1 100644
--- a/apps/plugins/chessbox/chessbox.c
+++ b/apps/plugins/chessbox/chessbox.c
@@ -92,6 +92,9 @@ const char *level_string[] = { "Level 1: 60 moves / 5 min" ,
92/* "While thinking" command */ 92/* "While thinking" command */
93int wt_command = COMMAND_NOP; 93int wt_command = COMMAND_NOP;
94 94
95/* System event id */
96static long cb_sysevent = 0;
97
95/* ---- Get the board column and row (e2 f.e.) for a physical x y ---- */ 98/* ---- Get the board column and row (e2 f.e.) for a physical x y ---- */
96static void xy2cr ( short x, short y, short *c, short *r ) { 99static void xy2cr ( short x, short y, short *c, short *r ) {
97 if (computer == black ) { 100 if (computer == black ) {
@@ -189,12 +192,14 @@ static void cb_wt_callback ( void ) {
189 wt_command = COMMAND_NOP; 192 wt_command = COMMAND_NOP;
190 button = rb->button_get(false); 193 button = rb->button_get(false);
191 switch (button) { 194 switch (button) {
195 case SYS_POWEROFF:
196 cb_sysevent = button;
192#ifdef CB_RC_QUIT 197#ifdef CB_RC_QUIT
193 case CB_RC_QUIT: 198 case CB_RC_QUIT:
199#endif
194 wt_command = COMMAND_QUIT; 200 wt_command = COMMAND_QUIT;
195 timeout = true; 201 timeout = true;
196 break; 202 break;
197#endif
198 case CB_MENU: 203 case CB_MENU:
199 wt_command = COMMAND_MENU; 204 wt_command = COMMAND_MENU;
200 timeout = true; 205 timeout = true;
@@ -531,11 +536,13 @@ static struct cb_command cb_get_viewer_command (void) {
531 while ( true ) { 536 while ( true ) {
532 button = rb->button_get(true); 537 button = rb->button_get(true);
533 switch (button) { 538 switch (button) {
539 case SYS_POWEROFF:
540 cb_sysevent = button;
534#ifdef CB_RC_QUIT 541#ifdef CB_RC_QUIT
535 case CB_RC_QUIT: 542 case CB_RC_QUIT:
543#endif
536 result.type = COMMAND_QUIT; 544 result.type = COMMAND_QUIT;
537 return result; 545 return result;
538#endif
539#ifdef CB_RESTART 546#ifdef CB_RESTART
540 case CB_RESTART: 547 case CB_RESTART:
541 result.type = COMMAND_RESTART; 548 result.type = COMMAND_RESTART;
@@ -764,11 +771,13 @@ static struct cb_command cb_getcommand (void) {
764 while ( true ) { 771 while ( true ) {
765 button = rb->button_get(true); 772 button = rb->button_get(true);
766 switch (button) { 773 switch (button) {
774 case SYS_POWEROFF:
775 cb_sysevent = button;
767#ifdef CB_RC_QUIT 776#ifdef CB_RC_QUIT
768 case CB_RC_QUIT: 777 case CB_RC_QUIT:
778#endif
769 result.type = COMMAND_QUIT; 779 result.type = COMMAND_QUIT;
770 return result; 780 return result;
771#endif
772#ifdef CB_RESTART 781#ifdef CB_RESTART
773 case CB_RESTART: 782 case CB_RESTART:
774 result.type = COMMAND_RESTART; 783 result.type = COMMAND_RESTART;
@@ -1058,6 +1067,7 @@ enum plugin_status plugin_start(const void* parameter) {
1058#if LCD_DEPTH > 1 1067#if LCD_DEPTH > 1
1059 rb->lcd_set_backdrop(NULL); 1068 rb->lcd_set_backdrop(NULL);
1060#endif 1069#endif
1070 cb_sysevent = 0;
1061 1071
1062 /* end of plugin init */ 1072 /* end of plugin init */
1063 1073
@@ -1070,5 +1080,8 @@ enum plugin_status plugin_start(const void* parameter) {
1070 cb_play_game(); 1080 cb_play_game();
1071 } 1081 }
1072 1082
1083 if (cb_sysevent)
1084 rb->default_event_handler(cb_sysevent);
1085
1073 return PLUGIN_OK; 1086 return PLUGIN_OK;
1074} 1087}
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c
index 0098fea007..0ab5654b10 100644
--- a/apps/recorder/recording.c
+++ b/apps/recorder/recording.c
@@ -1615,6 +1615,11 @@ bool recording_screen(bool no_source)
1615 break; 1615 break;
1616#endif /* CONFIG_KEYPAD == RECORDER_PAD */ 1616#endif /* CONFIG_KEYPAD == RECORDER_PAD */
1617 1617
1618 case SYS_POWEROFF:
1619 default_event_handler(SYS_POWEROFF);
1620 done = true;
1621 break;
1622
1618 case SYS_USB_CONNECTED: 1623 case SYS_USB_CONNECTED:
1619 /* Only accept USB connection when not recording */ 1624 /* Only accept USB connection when not recording */
1620 if(!(audio_stat & AUDIO_STATUS_RECORD)) 1625 if(!(audio_stat & AUDIO_STATUS_RECORD))