Remove DLG_WANT_IDLE. Use W_WANT_IDLE instead.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2012-09-28 11:41:04 +04:00
parent 843dcd104e
commit 497b69c106
5 changed files with 16 additions and 27 deletions

View File

@ -551,7 +551,7 @@ frontend_run_dlg (WDialog * h)
if (idle_hook)
execute_hooks (idle_hook);
while ((h->flags & DLG_WANT_IDLE) && is_idle ())
while ((WIDGET (h)->options & W_WANT_IDLE) != 0 && is_idle ())
h->callback (h, NULL, DLG_IDLE, 0, NULL);
/* Allow terminating the dialog from the idle handler */
@ -847,17 +847,6 @@ dlg_erase (WDialog * h)
}
}
/* --------------------------------------------------------------------------------------------- */
void
set_idle_proc (WDialog * d, int enable)
{
if (enable)
d->flags |= DLG_WANT_IDLE;
else
d->flags &= ~DLG_WANT_IDLE;
}
/* --------------------------------------------------------------------------------------------- */
/**
* Insert widget to dialog before requested widget. Make the widget current. Return widget ID.

View File

@ -51,12 +51,11 @@ typedef enum
/* Flags for create_dlg */
typedef enum
{
DLG_WANT_TAB = (1 << 4), /* Should the tab key be sent to the dialog? */
DLG_WANT_IDLE = (1 << 3), /* Dialog wants idle events */
DLG_COMPACT = (1 << 2), /* Suppress spaces around the frame */
DLG_TRYUP = (1 << 1), /* Try to move two lines up the dialog */
DLG_NONE = 0, /* No options */
DLG_CENTER = (1 << 0), /* Center the dialog */
DLG_NONE = 0 /* No options */
DLG_TRYUP = (1 << 1), /* Try to move two lines up the dialog */
DLG_COMPACT = (1 << 2), /* Suppress spaces around the frame */
DLG_WANT_TAB = (1 << 3) /* Should the tab key be sent to the dialog? */
} dlg_flags_t;
/* Dialog state */
@ -180,9 +179,6 @@ void dlg_process_event (WDialog * h, int key, Gpm_Event * event);
char *dlg_get_title (const WDialog * h, size_t len);
/* To activate/deactivate the idle message generation */
void set_idle_proc (WDialog * d, int enable);
void dlg_redraw (WDialog * h);
void dlg_broadcast_msg (WDialog * h, widget_msg_t message);

View File

@ -16,6 +16,7 @@
/* Sets/clear the specified flag in the options field */
#define widget_want_cursor(w,i) widget_set_options(w, W_WANT_CURSOR, i)
#define widget_want_hotkey(w,i) widget_set_options(w, W_WANT_HOTKEY, i)
#define widget_want_idle(w,i) widget_set_options(w, W_WANT_IDLE, i)
#define widget_disable(w,i) widget_set_options(w, W_DISABLED, i)
/*** enums ***************************************************************************************/

View File

@ -350,7 +350,7 @@ add_to_list (const char *text, void *data)
static inline void
stop_idle (void *data)
{
set_idle_proc (data, 0);
widget_want_idle (WIDGET (data), FALSE);
}
/* --------------------------------------------------------------------------------------------- */
@ -1001,7 +1001,7 @@ check_find_events (WDialog * h)
/* dialog terminated */
return FIND_ABORT;
}
if (!(h->flags & DLG_WANT_IDLE))
if ((WIDGET (h)->options & W_WANT_IDLE) == 0)
{
/* searching suspended */
return FIND_SUSPEND;
@ -1508,7 +1508,7 @@ start_stop (WButton * button, int action)
(void) action;
running = is_start;
set_idle_proc (find_dlg, running);
widget_want_idle (WIDGET (find_dlg), running);
is_start = !is_start;
status_update (is_start ? _("Stopped") : _("Searching"));
@ -1640,7 +1640,7 @@ run_process (void)
resuming = 0;
set_idle_proc (find_dlg, 1);
widget_want_idle (WIDGET (find_dlg), TRUE);
ret = run_dlg (find_dlg);
mc_search_free (search_file_handle);
@ -1656,7 +1656,7 @@ run_process (void)
static void
kill_gui (void)
{
set_idle_proc (find_dlg, 0);
widget_want_idle (WIDGET (find_dlg), FALSE);
destroy_dlg (find_dlg);
}

View File

@ -1428,7 +1428,7 @@ midnight_callback (WDialog * h, Widget * sender, dlg_msg_t msg, int parm, void *
case DLG_IDLE:
/* We only need the first idle event to show user menu after start */
set_idle_proc (h, 0);
widget_want_idle (WIDGET (h), FALSE);
if (boot_current_is_left)
dlg_select_widget (get_panel_widget (0));
@ -1757,7 +1757,7 @@ do_nc (void)
#endif
midnight_dlg = create_dlg (FALSE, 0, 0, LINES, COLS, midnight_colors, midnight_callback,
midnight_event, "[main]", NULL, DLG_WANT_IDLE);
midnight_event, "[main]", NULL, DLG_NONE);
/* Check if we were invoked as an editor or file viewer */
if (mc_global.mc_run_mode != MC_RUN_FULL)
@ -1767,6 +1767,9 @@ do_nc (void)
}
else
{
/* We only need the first idle event to show user menu after start */
widget_want_idle (WIDGET (midnight_dlg), TRUE);
setup_mc ();
mc_filehighlight = mc_fhl_new (TRUE);
create_panels_and_run_mc ();