Example #1
0
static void I_CheckGUICapture ()
{
	bool wantCapt;
	bool repeat;
	int oldrepeat, interval;

	SDL_GetKeyRepeat(&oldrepeat, &interval);

	if (menuactive == MENU_Off)
	{
		wantCapt = ConsoleState == c_down || ConsoleState == c_falling || chatmodeon;
	}
	else
	{
		wantCapt = (menuactive == MENU_On || menuactive == MENU_OnNoPause);
	}

	if (wantCapt != GUICapture)
	{
		GUICapture = wantCapt;
		if (wantCapt)
		{
			int x, y;
			SDL_GetMouseState (&x, &y);
			cursorBlit.x = x;
			cursorBlit.y = y;

			FlushDIKState ();
			memset (DownState, 0, sizeof(DownState));
			repeat = !sdl_nokeyrepeat;
			SDL_EnableUNICODE (1);
		}
		else
		{
			repeat = false;
			SDL_EnableUNICODE (0);
		}
	}
	if (wantCapt)
	{
		repeat = !sdl_nokeyrepeat;
	}
	else
	{
		repeat = false;
	}
	if (repeat != (oldrepeat != 0))
	{
		if (repeat)
		{
			SDL_EnableKeyRepeat (SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
		}
		else
		{
			SDL_EnableKeyRepeat (0, 0);
		}
	}
}
Example #2
0
// check whether key repeat is enabled ----------------------------------------
//
PRIVATE
bool ISDLm_IsKeyRepeatEnabled()
{
#if SDL_VERSION_ATLEAST(2,0,0)
	return false;
#else
	int delay, interval;
	SDL_GetKeyRepeat(&delay, &interval);
	
	return delay > 0;
#endif
}
Example #3
0
static PyObject*
key_get_repeat (PyObject* self, PyObject* args)
{
    int delay = 0, interval = 0;

    VIDEO_INIT_CHECK ();
#if SDL_VERSION_ATLEAST(1, 2, 10)
    SDL_GetKeyRepeat (&delay, &interval);
    return Py_BuildValue ("(ii)", delay, interval);
#else
    Py_RETURN_NONE;
#endif
}
Example #4
0
	int Keyboard::getKeyRepeatInterval() const
	{
		int delay, interval;
		SDL_GetKeyRepeat(&delay, &interval);
		return interval;
	}
Example #5
0
	int Keyboard::getKeyRepeatDelay() const
	{
		int delay, interval;
		SDL_GetKeyRepeat(&delay, &interval);
		return delay;
	}