Пример #1
0
static bool  
Transfer_action(ia_t ia, unsigned argc, const char **argv)
{
    ft_conf_t *p = NULL;

    action_debug("Transfer", ia, argc, argv);

    /* Make sure we're connected. */
    if (!IN_3270) {
	popup_an_error("Transfer: Not connected");
	return false;
    }

    /* Check for interactive mode. */
    if (argc == 0) {
	if (!gui_conf_initted) {
	    ft_init_conf(&gui_ft_conf);
	    gui_ft_conf.is_action = true;
	    gui_conf_initted = true;
	}
	switch (ft_gui_interact(&gui_ft_conf)) {
	case FGI_NOP:
	    /* Hope the defaults are enough. */
	    break;
	case FGI_SUCCESS:
	    /* Proceed as specified in the ft_state. */
	    p = &gui_ft_conf;
	    break;
	case FGI_ABORT:
	    /* User said no. */
	    return false;
	}
    }

    if (p == NULL) {
	/* Parse the keywords into the ft_state structure. */
	p = parse_ft_keywords(argc, argv);
	if (p == NULL) {
	    return false;
	}
	p->is_interactive = (ia == IA_COMMAND);
    }

    /* Start the transfer. */
    fts.local_file = ft_go(p);
    if (fts.local_file == NULL) {
	return false;
    }

    /* If interactive, tell the user we're waiting. */
    ft_gui_awaiting();

    /* Set a timeout for failed command start. */
    ft_start_id = AddTimeOut(10 * 1000, ft_didnt_start);

    /* Success. */
    return true;
}
Пример #2
0
void		ft_mlx(int fd)
{
	t_struct	**matr = NULL;

	matr = ft_creatematr(matr, fd);
	matr[0]->mlx = mlx_init();
	matr[0]->win = mlx_new_window(matr[0]->mlx, 1280, 800, "Wolf3d");
	matr[0]->i = 0;
	matr[0]->image = ft_init_image(matr[0]->image, matr[0]->mlx);
	matr[0]->pproj = ft_init_pproj(matr[0]->pproj);
	matr[0]->player = ft_init_player(matr[0]->player, matr[0]->pproj);
	clear(matr[0]->image, matr);
	ft_go(matr);
	mlx_do_key_autorepeatoff(matr[0]->mlx);
	mlx_expose_hook(matr[0]->win, ft_expose, matr);
	mlx_hook(matr[0]->win, KeyPress, KeyPressMask, ft_mask, matr);
	mlx_hook(matr[0]->win, KeyRelease, KeyReleaseMask, ft_relaise, matr);
	mlx_loop_hook(matr[0]->mlx, ft_key, matr);
	mlx_loop(matr[0]->mlx);
	ft_freeall(matr);
}