Move the some stuff from dialog.[ch] to dialog-switch.[ch]:

* variables: top_dlg, fast_refresh;
  * function: do_refresh().

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2023-04-23 13:22:05 +03:00
parent fc6cc7bfc3
commit 702c3634e5
4 changed files with 45 additions and 44 deletions

View File

@ -40,6 +40,14 @@
/*** global variables ****************************************************************************/
/* Primitive way to check if the the current dialog is our dialog */
/* This is needed by async routines like load_prompt */
GList *top_dlg = NULL;
/* If set then dialogs just clean the screen when refreshing, else */
/* they do a complete refresh, refreshing all the parts of the program */
gboolean fast_refresh = FALSE;
WDialog *filemanager = NULL;
/*** file scope macro definitions ****************************************************************/
@ -315,6 +323,36 @@ dialog_switch_shutdown (void)
/* --------------------------------------------------------------------------------------------- */
void
do_refresh (void)
{
GList *d = top_dlg;
if (fast_refresh)
{
if (d != NULL)
widget_draw (WIDGET (d->data));
}
else
{
/* Search first fullscreen dialog */
for (; d != NULL; d = g_list_next (d))
if ((WIDGET (d->data)->pos_flags & WPOS_FULLSCREEN) != 0)
break;
/* when small dialog (i.e. error message) is created first,
there is no fullscreen dialog in the stack */
if (d == NULL)
d = g_list_last (top_dlg);
/* back to top dialog */
for (; d != NULL; d = g_list_previous (d))
widget_draw (WIDGET (d->data));
}
}
/* --------------------------------------------------------------------------------------------- */
void
repaint_screen (void)
{

View File

@ -12,6 +12,10 @@
/*** global variables defined in .c file *********************************************************/
extern GList *top_dlg;
extern gboolean fast_refresh;
extern WDialog *filemanager;
/*** declarations of public functions ************************************************************/
@ -28,6 +32,9 @@ int dialog_switch_process_pending (void);
void dialog_switch_got_winch (void);
void dialog_switch_shutdown (void);
/* Redraw all dialogs */
void do_refresh (void);
void repaint_screen (void);
void mc_refresh (void);
void dialog_change_screen_size (void);

View File

@ -55,17 +55,9 @@ dlg_colors_t dialog_colors;
dlg_colors_t alarm_colors;
dlg_colors_t listbox_colors;
/* Primitive way to check if the the current dialog is our dialog */
/* This is needed by async routines like load_prompt */
GList *top_dlg = NULL;
/* A hook list for idle events */
hook_t *idle_hook = NULL;
/* If set then dialogs just clean the screen when refreshing, else */
/* they do a complete refresh, refreshing all the parts of the program */
gboolean fast_refresh = FALSE;
/* left click outside of dialog closes it */
gboolean mouse_close_dialog = FALSE;
@ -474,36 +466,6 @@ dlg_set_default_colors (void)
/* --------------------------------------------------------------------------------------------- */
void
do_refresh (void)
{
GList *d = top_dlg;
if (fast_refresh)
{
if (d != NULL)
widget_draw (WIDGET (d->data));
}
else
{
/* Search first fullscreen dialog */
for (; d != NULL; d = g_list_next (d))
if ((WIDGET (d->data)->pos_flags & WPOS_FULLSCREEN) != 0)
break;
/* when small dialog (i.e. error message) is created first,
there is no fullscreen dialog in the stack */
if (d == NULL)
d = g_list_last (top_dlg);
/* back to top dialog */
for (; d != NULL; d = g_list_previous (d))
widget_draw (WIDGET (d->data));
}
}
/* --------------------------------------------------------------------------------------------- */
void
dlg_close (WDialog * h)
{

View File

@ -90,12 +90,9 @@ extern dlg_colors_t dialog_colors;
extern dlg_colors_t alarm_colors;
extern dlg_colors_t listbox_colors;
extern GList *top_dlg;
/* A hook list for idle events */
extern hook_t *idle_hook;
extern gboolean fast_refresh;
extern gboolean mouse_close_dialog;
extern const global_keymap_t *dialog_map;
@ -125,9 +122,6 @@ void dlg_default_mouse_callback (Widget * w, mouse_msg_t msg, mouse_event_t * ev
void dlg_close (WDialog * h);
/* Redraw all dialogs */
void do_refresh (void);
/* --------------------------------------------------------------------------------------------- */
/*** inline functions ****************************************************************************/
/* --------------------------------------------------------------------------------------------- */