mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2025-10-09 22:52:32 +02:00
[FL-3842] Desktop lockup fix, GUI improvements (#3710)
* Gui: increase ViewDispatcher messages queues size, improves event processing with blocking operations. * Gui: fix log message text in view dispatcher, loosen some mutexes in view port
This commit is contained in:
@@ -52,7 +52,7 @@ void view_dispatcher_enable_queue(ViewDispatcher* view_dispatcher) {
|
||||
|
||||
view_dispatcher->event_loop = furi_event_loop_alloc();
|
||||
|
||||
view_dispatcher->input_queue = furi_message_queue_alloc(8, sizeof(InputEvent));
|
||||
view_dispatcher->input_queue = furi_message_queue_alloc(16, sizeof(InputEvent));
|
||||
furi_event_loop_message_queue_subscribe(
|
||||
view_dispatcher->event_loop,
|
||||
view_dispatcher->input_queue,
|
||||
@@ -60,7 +60,7 @@ void view_dispatcher_enable_queue(ViewDispatcher* view_dispatcher) {
|
||||
view_dispatcher_run_input_callback,
|
||||
view_dispatcher);
|
||||
|
||||
view_dispatcher->event_queue = furi_message_queue_alloc(8, sizeof(uint32_t));
|
||||
view_dispatcher->event_queue = furi_message_queue_alloc(16, sizeof(uint32_t));
|
||||
furi_event_loop_message_queue_subscribe(
|
||||
view_dispatcher->event_loop,
|
||||
view_dispatcher->event_queue,
|
||||
@@ -298,7 +298,7 @@ void view_dispatcher_handle_input(ViewDispatcher* view_dispatcher, InputEvent* e
|
||||
} else if(view_dispatcher->ongoing_input_view && event->type == InputTypeRelease) {
|
||||
FURI_LOG_D(
|
||||
TAG,
|
||||
"View changed while key press %p -> %p. Sending key: %s, type: %s, sequence: %p to previous view port",
|
||||
"View changed while key press %p -> %p. Sending key: %s, type: %s, sequence: %p to previous view",
|
||||
view_dispatcher->ongoing_input_view,
|
||||
view_dispatcher->current_view,
|
||||
input_get_key_name(event->key),
|
||||
|
@@ -139,12 +139,17 @@ uint8_t view_port_get_height(const ViewPort* view_port) {
|
||||
|
||||
void view_port_enabled_set(ViewPort* view_port, bool enabled) {
|
||||
furi_check(view_port);
|
||||
furi_check(furi_mutex_acquire(view_port->mutex, FuriWaitForever) == FuriStatusOk);
|
||||
|
||||
// We are not going to lockup system, but will notify you instead
|
||||
// Make sure that you don't call viewport methods inside of another mutex, especially one that is used in draw call
|
||||
if(furi_mutex_acquire(view_port->mutex, 2) != FuriStatusOk) {
|
||||
FURI_LOG_W(TAG, "ViewPort lockup: see %s:%d", __FILE__, __LINE__ - 3);
|
||||
}
|
||||
if(view_port->is_enabled != enabled) {
|
||||
view_port->is_enabled = enabled;
|
||||
if(view_port->gui) gui_update(view_port->gui);
|
||||
}
|
||||
furi_check(furi_mutex_release(view_port->mutex) == FuriStatusOk);
|
||||
furi_mutex_release(view_port->mutex);
|
||||
}
|
||||
|
||||
bool view_port_is_enabled(const ViewPort* view_port) {
|
||||
@@ -236,8 +241,13 @@ void view_port_set_orientation(ViewPort* view_port, ViewPortOrientation orientat
|
||||
}
|
||||
|
||||
ViewPortOrientation view_port_get_orientation(const ViewPort* view_port) {
|
||||
furi_check(furi_mutex_acquire(view_port->mutex, FuriWaitForever) == FuriStatusOk);
|
||||
furi_check(view_port);
|
||||
// We are not going to lockup system, but will notify you instead
|
||||
// Make sure that you don't call viewport methods inside of another mutex, especially one that is used in draw call
|
||||
if(furi_mutex_acquire(view_port->mutex, 2) != FuriStatusOk) {
|
||||
FURI_LOG_W(TAG, "ViewPort lockup: see %s:%d", __FILE__, __LINE__ - 3);
|
||||
}
|
||||
ViewPortOrientation orientation = view_port->orientation;
|
||||
furi_check(furi_mutex_release(view_port->mutex) == FuriStatusOk);
|
||||
furi_mutex_release(view_port->mutex);
|
||||
return orientation;
|
||||
}
|
||||
|
Reference in New Issue
Block a user