From 25e4fd0ebab3963e7283ecb2356c9c7537463724 Mon Sep 17 00:00:00 2001 From: Aaron Culliney Date: Sat, 9 Sep 2017 16:55:39 -1000 Subject: [PATCH] Allow querying whether the classic interface is showing --- src/interface.c | 13 +++++++++++++ src/interface.h | 1 + 2 files changed, 14 insertions(+) diff --git a/src/interface.c b/src/interface.c index 11a3d537..7183951c 100644 --- a/src/interface.c +++ b/src/interface.c @@ -22,6 +22,8 @@ int64_t (*interface_onTouchEvent)(interface_touch_event_t action, int pointer_co static uint8_t *stagingFB = NULL; +static bool isShowing = false; + static char disk_path[PATH_MAX] = { 0 }; // 2015/04/12 : This was legacy code for rendering the menu interfaces on desktop Linux. Portions here are resurrected @@ -1512,10 +1514,12 @@ static void *interface_thread(void *data) switch (interface_key->current_key) { case kF1: + isShowing = true; c_interface_select_diskette( 0 ); break; case kF2: + isShowing = true; c_interface_select_diskette( 1 ); break; @@ -1528,18 +1532,22 @@ static void *interface_thread(void *data) break; case kF5: + isShowing = true; c_interface_keyboard_layout(); break; case kF7: + isShowing = true; c_interface_debugging(stagingFB); break; case kF8: + isShowing = true; c_interface_credits(); break; case kF10: + isShowing = true; c_interface_parameters(); break; @@ -1550,6 +1558,7 @@ static void *interface_thread(void *data) cpu_resume(); interface_thread_id = 0; + isShowing = false; pthread_mutex_unlock(&classic_interface_lock); return NULL; } @@ -1568,5 +1577,9 @@ void c_interface_begin(int current_key) pthread_detach(interface_thread_id); } +bool interface_isShowing(void) { + return isShowing; +} + #endif diff --git a/src/interface.h b/src/interface.h index 7427ef6f..2e3bf9fd 100644 --- a/src/interface.h +++ b/src/interface.h @@ -34,6 +34,7 @@ void c_interface_credits(); void c_interface_exit(int ch); void c_interface_translate_screen(char screen[24][INTERFACE_SCREEN_X+1]); void c_interface_select_diskette(int); +bool interface_isShowing(void); void interface_setStagingFramebuffer(uint8_t *stagingFB); #endif