Exemple #1
0
FileProgressStatus
check_progress_buttons (FileOpContext * ctx)
{
    int c;
    Gpm_Event event;
    FileOpContextUI *ui;

    g_return_val_if_fail (ctx->ui != NULL, FILE_CONT);

    ui = ctx->ui;

    event.x = -1;               /* Don't show the GPM cursor */
    c = tty_get_event (&event, FALSE, FALSE);
    if (c == EV_NONE)
        return FILE_CONT;

    /* Reinitialize to avoid old values after events other than
       selecting a button */
    ui->op_dlg->ret_value = FILE_CONT;

    dlg_process_event (ui->op_dlg, c, &event);
    switch (ui->op_dlg->ret_value)
    {
    case FILE_SKIP:
        return FILE_SKIP;
    case B_CANCEL:
    case FILE_ABORT:
        return FILE_ABORT;
    default:
        return FILE_CONT;
    }
}
Exemple #2
0
FileProgressStatus
check_progress_buttons (file_op_context_t * ctx)
{
    int c;
    Gpm_Event event;
    file_op_context_ui_t *ui;

    if (ctx == NULL || ctx->ui == NULL)
        return FILE_CONT;

    ui = ctx->ui;

  get_event:
    event.x = -1;               /* Don't show the GPM cursor */
    c = tty_get_event (&event, FALSE, ctx->suspended);
    if (c == EV_NONE)
        return FILE_CONT;

    /* Reinitialize to avoid old values after events other than selecting a button */
    ui->op_dlg->ret_value = FILE_CONT;

    dlg_process_event (ui->op_dlg, c, &event);
    switch (ui->op_dlg->ret_value)
    {
    case FILE_SKIP:
        if (ctx->suspended)
        {
            /* redraw dialog in case of Skip after Suspend */
            place_progress_buttons (ui->op_dlg, FALSE);
            dlg_redraw (ui->op_dlg);
        }
        ctx->suspended = FALSE;
        return FILE_SKIP;
    case B_CANCEL:
    case FILE_ABORT:
        ctx->suspended = FALSE;
        return FILE_ABORT;
    case FILE_SUSPEND:
        ctx->suspended = !ctx->suspended;
        place_progress_buttons (ui->op_dlg, ctx->suspended);
        dlg_redraw (ui->op_dlg);
        /* fallthrough */
    default:
        if (ctx->suspended)
            goto get_event;
        return FILE_CONT;
    }
}
Exemple #3
0
static void
frontend_dlg_run (WDialog * h)
{
    Widget *wh = WIDGET (h);
    Gpm_Event event;

    event.x = -1;

    /* close opened editors, viewers, etc */
    if (!widget_get_state (wh, WST_MODAL) && mc_global.midnight_shutdown)
    {
        send_message (h, NULL, MSG_VALIDATE, 0, NULL);
        return;
    }

    while (widget_get_state (wh, WST_ACTIVE))
    {
        int d_key;

        if (mc_global.tty.winch_flag != 0)
            dialog_change_screen_size ();

        if (is_idle ())
        {
            if (idle_hook)
                execute_hooks (idle_hook);

            while (widget_get_state (wh, WST_IDLE) && is_idle ())
                send_message (wh, NULL, MSG_IDLE, 0, NULL);

            /* Allow terminating the dialog from the idle handler */
            if (!widget_get_state (wh, WST_ACTIVE))
                break;
        }

        update_cursor (h);

        /* Clear interrupt flag */
        tty_got_interrupt ();
        d_key = tty_get_event (&event, h->mouse_status == MOU_REPEAT, TRUE);

        dlg_process_event (h, d_key, &event);

        if (widget_get_state (wh, WST_CLOSED))
            send_message (h, NULL, MSG_VALIDATE, 0, NULL);
    }
}
Exemple #4
0
static void
frontend_run_dlg (Dlg_head * h)
{
    int d_key;
    Gpm_Event event;

    event.x = -1;

    /* close opened editors, viewers, etc */
    if (!h->modal && mc_global.midnight_shutdown)
    {
        h->callback (h, NULL, DLG_VALIDATE, 0, NULL);
        return;
    }

    while (h->state == DLG_ACTIVE)
    {
        if (mc_global.tty.winch_flag)
            dialog_change_screen_size ();

        if (is_idle ())
        {
            if (idle_hook)
                execute_hooks (idle_hook);

            while ((h->flags & DLG_WANT_IDLE) && is_idle ())
                h->callback (h, NULL, DLG_IDLE, 0, NULL);

            /* Allow terminating the dialog from the idle handler */
            if (h->state != DLG_ACTIVE)
                break;
        }

        update_cursor (h);

        /* Clear interrupt flag */
        tty_got_interrupt ();
        d_key = tty_get_event (&event, h->mouse_status == MOU_REPEAT, TRUE);

        dlg_process_event (h, d_key, &event);

        if (h->state == DLG_CLOSED)
            h->callback (h, NULL, DLG_VALIDATE, 0, NULL);
    }
}
FileProgressStatus
file_progress_check_buttons (void)
{
    int c;
    Gpm_Event event;

    x_flush_events ();
    c = get_event (&event, 0, 0);
    if (c == EV_NONE)
      return FILE_CONT;
    dlg_process_event (op_dlg, c, &event);
    switch (op_dlg->ret_value) {
    case FILE_SKIP:
	return FILE_SKIP;
	break;
    case B_CANCEL:
    case FILE_ABORT:
	return FILE_ABORT;
	break;
    default:
	return FILE_CONT;
    }
}