示例#1
0
文件: lxdm.c 项目: carlodoro88/lxdm
static void lxsession_set_active(LXSession *s)
{
	if(!s || s->tty<=0) return;
	if(get_active_vt()==s->tty)
		return;
	set_active_vt(s->tty);
}
示例#2
0
文件: lxdm.c 项目: carlodoro88/lxdm
static void exit_cb(void)
{
	g_message("exit cb\n");
	ui_drop();
	while(session_list)
		lxsession_free(session_list->data);
	g_message("free session\n");
	put_lock();
	set_active_vt(old_tty);
	g_key_file_free(config);
}
示例#3
0
bool
ply_terminal_deactivate_vt (ply_terminal_t *terminal)
{
    int old_vt_number;

    assert (terminal != NULL);

    if (!ply_terminal_is_vt (terminal)) {
        ply_trace ("terminal is not for a VT");
        return false;
    }

    if (terminal->initial_vt_number < 0) {
        ply_trace ("Don't know where to jump to");
        return false;
    }

    if (terminal->initial_vt_number == terminal->vt_number) {
        ply_trace ("can't deactivate initial VT");
        return false;
    }

    /* Otherwise we'd close and free the terminal before handling the
     * "leaving the VT" signal.
     */
    ply_terminal_stop_watching_for_vt_changes (terminal);

    old_vt_number = terminal->vt_number;

    if (ply_terminal_is_active (terminal)) {
        ply_trace ("Attempting to set active vt back to %d from %d",
                   terminal->initial_vt_number, old_vt_number);
        if (!set_active_vt (terminal, terminal->initial_vt_number)) {
            ply_trace ("Couldn't move console to initial vt: %m");
            return false;
        }

        if (!wait_for_vt_to_become_active (terminal, terminal->initial_vt_number)) {
            ply_trace ("Error while waiting for vt %d to become active: %m",
                       terminal->initial_vt_number);
            return false;
        }
    } else {
        ply_trace ("terminal for vt %d is inactive", terminal->vt_number);
    }

    if (!deallocate_vt (terminal, old_vt_number)) {
        ply_trace ("couldn't deallocate vt %d: %m", old_vt_number);
        return false;
    }

    return true;
}
示例#4
0
bool
ply_terminal_activate_vt (ply_terminal_t *terminal)
{
    assert (terminal != NULL);

    if (!ply_terminal_is_vt (terminal))
        return false;

    if (terminal->is_active)
        return true;

    if (!set_active_vt (terminal, terminal->vt_number)) {
        ply_trace ("unable to set active vt to %d: %m",
                   terminal->vt_number);
        return false;
    }

    return true;
}