diff options
author | ConfuSomu | 2021-08-05 14:29:20 -0400 |
---|---|---|
committer | ConfuSomu | 2021-08-05 14:29:20 -0400 |
commit | a9b45a41a5c7fa91f4e920eb28fe10c2af18a37a (patch) | |
tree | f89d4c75b2300d0add709abf15864ba664803d9c | |
parent | ea9511a96adac32dd7277649be7684202244c5bc (diff) | |
download | pico-watch-a9b45a41a5c7fa91f4e920eb28fe10c2af18a37a.tar pico-watch-a9b45a41a5c7fa91f4e920eb28fe10c2af18a37a.tar.gz pico-watch-a9b45a41a5c7fa91f4e920eb28fe10c2af18a37a.zip |
Rename current_app to foreground_app
This is a more descriptive name as there could be multiple apps that are
currently open, or on-screen, such as a system UI or a status bar.
-rw-r--r-- | app_manager.cpp | 6 | ||||
-rw-r--r-- | buttons.cpp | 4 | ||||
-rw-r--r-- | globals.hpp | 2 | ||||
-rw-r--r-- | pico-watch.cpp | 6 |
4 files changed, 9 insertions, 9 deletions
diff --git a/app_manager.cpp b/app_manager.cpp index f7ca969..fb5d8c6 100644 --- a/app_manager.cpp +++ b/app_manager.cpp @@ -74,7 +74,7 @@ int app_mgr::app_destroy(BaseApp* to_erase) { void app_mgr::app_all_bgrefresh() { for (auto app : open_apps) { - app->bgrefresh(&app_api, app->app_get_attributes().id == g_s.current_app->app_get_attributes().id); + app->bgrefresh(&app_api, app->app_get_attributes().id == g_s.foreground_app->app_get_attributes().id); } } @@ -94,9 +94,9 @@ void app_mgr::app_switch(BaseApp* app, int new_appid) { auto app_ptr = app_check_if_init(new_appid); if (app_ptr) - g_s.current_app = app_ptr; + g_s.foreground_app = app_ptr; else - g_s.current_app = app_init(new_appid); + g_s.foreground_app = app_init(new_appid); g_s.app_ready = true; } diff --git a/buttons.cpp b/buttons.cpp index 79202c8..a4eacab 100644 --- a/buttons.cpp +++ b/buttons.cpp @@ -16,10 +16,10 @@ void gpio_interrupt_cb(uint gpio, uint32_t events) { if (delta_since_press > g_s.button_delay_time) { if (app_api.m_interpret_button_press) { - if (gpio == BUTTON_HOME && (g_s.current_app->app_get_attributes().id != 0)) // Home app + if (gpio == BUTTON_HOME && (g_s.foreground_app->app_get_attributes().id != 0)) // Home app app_mgr::app_switch_request(0); else - app_mgr::app_btnpressed(g_s.current_app, gpio, delta_since_press); + app_mgr::app_btnpressed(g_s.foreground_app, gpio, delta_since_press); } app_api.button_last_set(gpio); diff --git a/globals.hpp b/globals.hpp index 0f61f64..7c6b866 100644 --- a/globals.hpp +++ b/globals.hpp @@ -2,7 +2,7 @@ #include "base_app.hpp" struct global_status { - BaseApp* current_app = 0; + BaseApp* foreground_app = 0; bool is_sleeping = false; bool app_ready = true; bool app_switch_requested = false; diff --git a/pico-watch.cpp b/pico-watch.cpp index efa7702..abfcdf6 100644 --- a/pico-watch.cpp +++ b/pico-watch.cpp @@ -42,16 +42,16 @@ int main() { struct repeating_timer timer; add_repeating_timer_ms(250, repeating_callback, NULL, &timer); // TODO: Execute on core1 - g_s.current_app = app_mgr::app_init(0); + g_s.foreground_app = app_mgr::app_init(0); while (1) { if (g_s.app_switch_requested) { - app_mgr::app_switch(g_s.current_app, g_s.app_switch_to_app); + app_mgr::app_switch(g_s.foreground_app, g_s.app_switch_to_app); g_s.app_switch_requested = false; } if (g_s.app_ready && !g_s.is_sleeping) { - app_mgr::app_render(g_s.current_app); + app_mgr::app_render(g_s.foreground_app); app_api.display_write_backbuffer(); } |