コード例 #1
0
ファイル: mouse.c プロジェクト: L3oV1nc3/VMGL
static void
MouseFirstProtocol (Kmouse *km, char *prot)
{
    if (prot)
    {
	for (km->i_prot = 0; km->i_prot < NUM_PROT; km->i_prot++)
	    if (!strcmp (prot, kmouseProts[km->i_prot]->name))
		break;
	if (km->i_prot == NUM_PROT)
	{
	    int	i;
	    ErrorF ("Unknown mouse protocol \"%s\". Pick one of:", prot);
	    for (i = 0; i < NUM_PROT; i++)
		ErrorF (" %s", kmouseProts[i]->name);
	    ErrorF ("\n");
	}
	else
	{
	    km->prot = kmouseProts[km->i_prot];
	    if (km->tty && !km->prot->tty)
		ErrorF ("Mouse device is serial port, protocol %s is not serial protocol\n",
			prot);
	    else if (!km->tty && km->prot->tty)
		ErrorF ("Mouse device is not serial port, protocol %s is serial protocol\n",
			prot);
	}
    }
    if (!km->prot)
    {
	for (km->i_prot = 0; kmouseProts[km->i_prot]->tty != km->tty; km->i_prot++)
	    ;
	km->prot = kmouseProts[km->i_prot];
    }
    MouseInitProtocol (km);
}
コード例 #2
0
ファイル: mouse.c プロジェクト: Agnesa/xserver
static void
MouseNextProtocol(Kmouse * km)
{
    do {
        if (!km->prot)
            km->i_prot = 0;
        else if (++km->i_prot == NUM_PROT)
            km->i_prot = 0;
        km->prot = kmouseProts[km->i_prot];
    } while (km->prot->tty != km->tty);
    MouseInitProtocol(km);
    ErrorF("Switching to mouse protocol \"%s\"\n", km->prot->name);
}