Exemple #1
0
void MCScreenDC::getkeysdown(MCExecPoint &ep)
{
	BYTE keystates[256];
	ep.clear();
	if (GetKeyboardState((PBYTE)&keystates) == 0) // should use an async function?
		return;
	MCmodifierstate = querymods();
	bool first = true;
	KeySym ksym;
	uint2 i;
	for (i = 0; i < 256; i++)
	{
		if (keystates[i] & 0x80)
		{
			ksym = i;
			if (i <= VK_LAST)
			{
				if (MCmodifierstate & MS_SHIFT || GetKeyState(VK_CAPITAL) & 0x1)
					ksym = shift_keysyms[i];
				else
					ksym = keysyms[i];
			}
			if (ksym > 0)
			{
				ep.concatuint(ksym, EC_COMMA, first);
				first = false;
			}
		}
	}
}
Exemple #2
0
// MW-2008-06-12: [[ Bug 6396 ]] Make sure r_abort is set to False if
//   the first two checks against 'button' fail. Also update the code
//   to use GetCurrentButtonState
Boolean MCScreenDC::getmouse(uint2 button, Boolean& r_abort)
{
	// Make the check interval what it always has been - 9!
	static real8 lasttime;
	real8 newtime = MCS_time();
	real8 sr = (real8)9.0 / 1000.0;
	if ((newtime - lasttime) < sr)
	{
		r_abort = MCscreen->wait(sr, False, False);
		if (r_abort)
			return False;
	}
	
	r_abort = False;
	lasttime = newtime;
	
	UInt32 t_state;
	t_state = GetCurrentButtonState();
	
	if (button == 0)
		return t_state != 0;
	
	if (button == 1)
		return (t_state & (1 << 0)) != 0;
		
	if (button == 2)
		return (t_state & (1 << 2)) != 0;
		
	if (button == 3)
		return (t_state & (1 << 1)) != 0 || ((t_state & (1 << 0)) != 0 && (querymods() & MS_MOD2) != 0);
		
	return False;
}
Exemple #3
0
void MCScreenDC::getkeysdown(MCExecPoint &ep)
{
	char kstring[U4L];
	char km[32];
	ep.clear();
	MCmodifierstate = querymods();
	XQueryKeymap(dpy, km);
	bool first = true;
	uint2 i;
	KeySym ksym;
	for (i = 0; i < 256; i++)
	{
		if (isKeyPressed(km, i))
		{
			ksym = i;
			if (MCmodifierstate & MS_SHIFT || MCmodifierstate & MS_CAPS_LOCK)
				ksym = XKeycodeToKeysym(dpy, i, 1);
			else
				ksym  = XKeycodeToKeysym(dpy, i, 0);
			if (ksym > 0)
			{
				ep.concatuint(ksym, EC_COMMA, first);
				first = false;
			}
		}
	}
}
Exemple #4
0
void MCScreenDC::setmods()
{
	if (!curinfo->live)
		return;
	MCmodifierstate = querymods();
}