From edd1539f57f8d7d7953e0d7d31b08166128af6b7 Mon Sep 17 00:00:00 2001 From: lixianjing Date: Tue, 9 Jan 2024 17:06:07 +0800 Subject: [PATCH] improve window_manager_back_to --- docs/changes.md | 1 + src/base/window_manager.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/docs/changes.md b/docs/changes.md index edbb0e85e..705515650 100644 --- a/docs/changes.md +++ b/docs/changes.md @@ -2,6 +2,7 @@ 2024/01/09 * 完善utils.py,兼容Python2.7(感谢雨欣提供补丁) + * 修复存在多个模态对话时,window\_manager\_back\_to接口无法正常返回主页窗口的问题(感谢雨欣提供补丁) 2024/01/08 * 完善编译脚本,修改打印信息(感谢智明提供补丁) diff --git a/src/base/window_manager.c b/src/base/window_manager.c index 05c23399f..5f0d43cae 100644 --- a/src/base/window_manager.c +++ b/src/base/window_manager.c @@ -100,6 +100,10 @@ static ret_t window_manager_back_to_win_sync(widget_t* widget, widget_t* target) WIDGET_FOR_EACH_CHILD_END() top = wins.size > 0 ? WIDGET(darray_pop(&wins)) : NULL; + if (widget_is_dialog(top) && dialog_is_modal(top)) { + dialog_quit(top, DIALOG_QUIT_NONE); + top = NULL; + } for (k = 0; k < wins.size; k++) { widget_t* iter = WIDGET(wins.elms[k]); if (widget_is_dialog(iter) && dialog_is_modal(iter)) {