From 6cfefe7cb768a5c97fd28881c4643563943183e3 Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Mon, 20 Sep 2010 13:58:17 +0400 Subject: [PATCH] Ticket #1490: fix of mult-screen engine. Multi-screen engine doesn't handle correctly some cases. Example: 1. Run mc. 2. Open some file in internal editor. 3. Switch back to the file panels. 4. Open another file in internal editor. As a result, two editors are opened. 5. Close current editor. Now you are in file panels. 6. Run screen list dialog (Meta-`). 6a. The 1st editor is highlighted as current screen. This is wrong. Current screen is file panels. 6b. Cannot switch to the opened editor in this dialog. Signed-off-by: Andrew Borodin --- src/dialog-switch.c | 13 ++++++------- src/dialog.c | 3 ++- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/dialog-switch.c b/src/dialog-switch.c index c480aab0b..3db7de685 100644 --- a/src/dialog-switch.c +++ b/src/dialog-switch.c @@ -119,14 +119,13 @@ dialog_switch_remove (Dlg_head *h) else this = g_list_find (mc_dialogs, h); - if (this != NULL) - { - GList *next; + mc_dialogs = g_list_delete_link (mc_dialogs, this); - next = g_list_next (this); - mc_dialogs = g_list_delete_link (mc_dialogs, this); - mc_current = next == NULL ? mc_dialogs : next; - } + /* adjust current dialog */ + if (top_dlg != NULL) + mc_current = g_list_find (mc_dialogs, (Dlg_head *) top_dlg->data); + else + mc_current = mc_dialogs; } size_t diff --git a/src/dialog.c b/src/dialog.c index a6497731e..a19d39a64 100644 --- a/src/dialog.c +++ b/src/dialog.c @@ -1059,6 +1059,8 @@ frontend_run_dlg (Dlg_head * h) void dlg_run_done (Dlg_head * h) { + top_dlg = g_list_remove (top_dlg, h); + if (h->state == DLG_CLOSED) { h->callback (h, (Widget *) h->current->data, DLG_END, 0, NULL); @@ -1066,7 +1068,6 @@ dlg_run_done (Dlg_head * h) dialog_switch_remove (h); } - top_dlg = g_list_remove (top_dlg, h); } /* Standard run dialog routine -- 2.11.4.GIT