diff --git a/client/src/app.c b/client/src/app.c index f57f0d11..156dab00 100644 --- a/client/src/app.c +++ b/client/src/app.c @@ -656,8 +656,6 @@ MsgBoxHandle app_msgBox(const char * caption, const char * fmt, ...) MsgBoxHandle handle = overlayMsg_show(caption, NULL, NULL, fmt, args); va_end(args); - core_updateOverlayState(); - return handle; } @@ -669,8 +667,6 @@ MsgBoxHandle app_confirmMsgBox(const char * caption, MsgBoxHandle handle = overlayMsg_show(caption, callback, opaque, fmt, args); va_end(args); - core_updateOverlayState(); - return handle; } diff --git a/client/src/overlay/msg.c b/client/src/overlay/msg.c index 68765e91..fea4dde9 100644 --- a/client/src/overlay/msg.c +++ b/client/src/overlay/msg.c @@ -27,6 +27,7 @@ #include "common/stringlist.h" #include "../main.h" +#include "../core.h" #include <string.h> @@ -41,6 +42,8 @@ struct Msg struct MsgState { + bool initialized; + bool updateOverlayState; struct ll * messages; }; @@ -53,6 +56,7 @@ static void msg_earlyInit(void) static bool msg_init(void ** udata, const void * params) { + l_msg.initialized = true; return true; } @@ -70,6 +74,7 @@ static void msg_free(void * udata) while(ll_shift(l_msg.messages, (void **)&msg)) freeMsg(msg); ll_free(l_msg.messages); + l_msg.initialized = false; } static bool msg_needsOverlay(void * udata) @@ -181,6 +186,12 @@ struct LG_OverlayOps LGOverlayMsg = bool overlayMsg_modal(void) { + if (l_msg.updateOverlayState) + { + core_updateOverlayState(); + l_msg.updateOverlayState = false; + } + return ll_count(l_msg.messages) > 0; } @@ -221,6 +232,11 @@ MsgBoxHandle overlayMsg_show( ll_push(l_msg.messages, msg); app_invalidateOverlay(false); + if (l_msg.initialized) + core_updateOverlayState(); + else + l_msg.updateOverlayState = true; + return (MsgBoxHandle)msg; }