Ticket #2678: fixup of filemanager layout after screen resize.

Initial state: forced suspend the previous screen when new screen has
been created. Forced resume the current screen when the previous screen
has been closed. Don't redraw suspended screens, just set sinch_pending
flag. Screen will be redrawn immediately after resume.

This commit allow ret rid of setup_panels() call if screen is resized
and filemanager is not active screen at that time.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2011-11-30 13:17:07 +03:00
parent 91ab327d66
commit d99feea391

View File

@ -74,6 +74,17 @@ get_hotkey (int n)
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
static void
dialog_switch_suspend (void *data, void *user_data)
{
(void) user_data;
if (data != mc_current->data)
((Dlg_head *) data)->state = DLG_SUSPENDED;
}
/* --------------------------------------------------------------------------------------------- */
static void static void
dialog_switch_goto (GList * dlg) dialog_switch_goto (GList * dlg)
{ {
@ -99,8 +110,11 @@ dialog_switch_goto (GList * dlg)
/* return to panels before run the required dialog */ /* return to panels before run the required dialog */
dialog_switch_pending = TRUE; dialog_switch_pending = TRUE;
else else
{
/* switch to panels */ /* switch to panels */
midnight_dlg->state = DLG_ACTIVE;
do_refresh (); do_refresh ();
}
} }
} }
} }
@ -114,7 +128,10 @@ dlg_resize_cb (void *data, void *user_data)
Dlg_head *d = data; Dlg_head *d = data;
(void) user_data; (void) user_data;
d->callback (d, NULL, DLG_RESIZE, 0, NULL); if (d->state == DLG_ACTIVE)
d->callback (d, NULL, DLG_RESIZE, 0, NULL);
else
d->winch_pending = TRUE;
} }
#endif #endif
@ -136,6 +153,9 @@ dialog_switch_add (Dlg_head * h)
mc_dialogs = g_list_prepend (mc_dialogs, h); mc_dialogs = g_list_prepend (mc_dialogs, h);
mc_current = mc_dialogs; mc_current = mc_dialogs;
} }
/* suspend forced all other screens */
g_list_foreach (mc_dialogs, dialog_switch_suspend, NULL);
} }
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
@ -157,6 +177,10 @@ dialog_switch_remove (Dlg_head * h)
mc_current = g_list_find (mc_dialogs, (Dlg_head *) top_dlg->data); mc_current = g_list_find (mc_dialogs, (Dlg_head *) top_dlg->data);
else else
mc_current = mc_dialogs; mc_current = mc_dialogs;
/* resume forced the current screen */
if (mc_current != NULL)
((Dlg_head *) mc_current->data)->state = DLG_ACTIVE;
} }
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
@ -265,6 +289,7 @@ dialog_switch_process_pending (void)
if (h->state == DLG_CLOSED) if (h->state == DLG_CLOSED)
{ {
destroy_dlg (h); destroy_dlg (h);
/* return to panels */ /* return to panels */
if (mc_global.mc_run_mode == MC_RUN_FULL) if (mc_global.mc_run_mode == MC_RUN_FULL)
{ {