mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-06-13 19:43:34 -07:00
Support modularly hiding statusbar
This commit is contained in:
@@ -31,7 +31,7 @@ void desktop_scene_lock_menu_on_enter(void* context) {
|
||||
desktop_lock_menu_set_idx(desktop->lock_menu, 3);
|
||||
|
||||
Gui* gui = furi_record_open(RECORD_GUI);
|
||||
gui_set_lockmenu(gui, true);
|
||||
gui_set_hide_statusbar(gui, true);
|
||||
furi_record_close(RECORD_GUI);
|
||||
|
||||
view_dispatcher_switch_to_view(desktop->view_dispatcher, DesktopViewIdLockMenu);
|
||||
@@ -117,6 +117,6 @@ void desktop_scene_lock_menu_on_exit(void* context) {
|
||||
desktop_scene_lock_menu_save_settings(desktop);
|
||||
|
||||
Gui* gui = furi_record_open(RECORD_GUI);
|
||||
gui_set_lockmenu(gui, false);
|
||||
gui_set_hide_statusbar(gui, false);
|
||||
furi_record_close(RECORD_GUI);
|
||||
}
|
||||
|
||||
@@ -47,6 +47,7 @@ static bool gui_redraw_fs(Gui* gui) {
|
||||
}
|
||||
|
||||
static void gui_redraw_status_bar(Gui* gui, bool need_attention) {
|
||||
if(gui->hide_statusbar_count > 0) return;
|
||||
ViewPortArray_it_t it;
|
||||
uint8_t left_used = 0;
|
||||
uint8_t right_used = 0;
|
||||
@@ -276,9 +277,7 @@ static void gui_redraw(Gui* gui) {
|
||||
if(!gui_redraw_window(gui)) {
|
||||
gui_redraw_desktop(gui);
|
||||
}
|
||||
if(!gui->lockmenu) {
|
||||
gui_redraw_status_bar(gui, false);
|
||||
}
|
||||
gui_redraw_status_bar(gui, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -517,22 +516,26 @@ size_t gui_get_framebuffer_size(const Gui* gui) {
|
||||
return canvas_get_buffer_size(gui->canvas);
|
||||
}
|
||||
|
||||
void gui_set_lockdown(Gui* gui, bool lockdown) {
|
||||
void gui_set_hide_statusbar(Gui* gui, bool hidden) {
|
||||
furi_assert(gui);
|
||||
|
||||
gui_lock(gui);
|
||||
gui->lockdown = lockdown;
|
||||
if(hidden) {
|
||||
gui->hide_statusbar_count++;
|
||||
} else {
|
||||
gui->hide_statusbar_count--;
|
||||
}
|
||||
gui_unlock(gui);
|
||||
|
||||
// Request redraw
|
||||
gui_update(gui);
|
||||
}
|
||||
|
||||
void gui_set_lockmenu(Gui* gui, bool lockmenu) {
|
||||
void gui_set_lockdown(Gui* gui, bool lockdown) {
|
||||
furi_assert(gui);
|
||||
|
||||
gui_lock(gui);
|
||||
gui->lockmenu = lockmenu;
|
||||
gui->lockdown = lockdown;
|
||||
gui_unlock(gui);
|
||||
|
||||
// Request redraw
|
||||
|
||||
@@ -100,6 +100,15 @@ void gui_remove_framebuffer_callback(Gui* gui, GuiCanvasCommitCallback callback,
|
||||
*/
|
||||
size_t gui_get_framebuffer_size(const Gui* gui);
|
||||
|
||||
/** Set hidden statusbar
|
||||
*
|
||||
* Hide the statusbar (stacks if called multiple times).
|
||||
*
|
||||
* @param gui Gui instance
|
||||
* @param hinned bool, true if hidden
|
||||
*/
|
||||
void gui_set_hide_statusbar(Gui* gui, bool hidden);
|
||||
|
||||
/** Set lockdown mode
|
||||
*
|
||||
* When lockdown mode is enabled, only GuiLayerDesktop is shown.
|
||||
@@ -110,15 +119,6 @@ size_t gui_get_framebuffer_size(const Gui* gui);
|
||||
*/
|
||||
void gui_set_lockdown(Gui* gui, bool lockdown);
|
||||
|
||||
/** Set lockmenu mode
|
||||
*
|
||||
* When lockmenu mode is enabled, the lockmenu is visible and statusbar is hidden.
|
||||
*
|
||||
* @param gui Gui instance
|
||||
* @param lockmenu bool, true if enabled
|
||||
*/
|
||||
void gui_set_lockmenu(Gui* gui, bool lockmenu);
|
||||
|
||||
/** Acquire Direct Draw lock and get Canvas instance
|
||||
*
|
||||
* This method return Canvas instance for use in monopoly mode. Direct draw lock
|
||||
|
||||
@@ -62,8 +62,8 @@ struct Gui {
|
||||
FuriMutex* mutex;
|
||||
|
||||
// Layers and Canvas
|
||||
uint16_t hide_statusbar_count;
|
||||
bool lockdown;
|
||||
bool lockmenu;
|
||||
bool direct_draw;
|
||||
ViewPortArray_t layers[GuiLayerMAX];
|
||||
Canvas* canvas;
|
||||
|
||||
@@ -1309,7 +1309,7 @@ Function,+,gui_get_framebuffer_size,size_t,const Gui*
|
||||
Function,+,gui_remove_framebuffer_callback,void,"Gui*, GuiCanvasCommitCallback, void*"
|
||||
Function,+,gui_remove_view_port,void,"Gui*, ViewPort*"
|
||||
Function,+,gui_set_lockdown,void,"Gui*, _Bool"
|
||||
Function,+,gui_set_lockmenu,void,"Gui*, _Bool"
|
||||
Function,+,gui_set_hide_statusbar,void,"Gui*, _Bool"
|
||||
Function,-,gui_view_port_send_to_back,void,"Gui*, ViewPort*"
|
||||
Function,+,gui_view_port_send_to_front,void,"Gui*, ViewPort*"
|
||||
Function,+,hal_sd_detect,_Bool,
|
||||
|
||||
|
@@ -1693,7 +1693,7 @@ Function,+,gui_get_framebuffer_size,size_t,const Gui*
|
||||
Function,+,gui_remove_framebuffer_callback,void,"Gui*, GuiCanvasCommitCallback, void*"
|
||||
Function,+,gui_remove_view_port,void,"Gui*, ViewPort*"
|
||||
Function,+,gui_set_lockdown,void,"Gui*, _Bool"
|
||||
Function,+,gui_set_lockmenu,void,"Gui*, _Bool"
|
||||
Function,+,gui_set_hide_statusbar,void,"Gui*, _Bool"
|
||||
Function,-,gui_view_port_send_to_back,void,"Gui*, ViewPort*"
|
||||
Function,+,gui_view_port_send_to_front,void,"Gui*, ViewPort*"
|
||||
Function,+,hal_sd_detect,_Bool,
|
||||
|
||||
|
Reference in New Issue
Block a user