1
0
Fork 0
mirror of https://github.com/gwm17/glfw.git synced 2024-11-22 18:28:52 -05:00

Removed key repeat.

This commit is contained in:
Camilla Berglund 2012-11-22 17:14:50 +01:00
parent ef1da2dde9
commit c479124e69
7 changed files with 2 additions and 41 deletions

View File

@ -359,8 +359,6 @@ int main(int argc, char *argv[])
glfwGetWindowSize(window, &width, &height);
reshape(window, width, height);
glfwSetInputMode( window, GLFW_KEY_REPEAT, GL_TRUE );
// Parse command-line options
init(argc, argv);

View File

@ -419,8 +419,6 @@ int main(int argc, char* argv[])
glfwGetWindowSize(window, &width, &height);
window_size_callback(window, width, height);
glfwSetInputMode(window, GLFW_KEY_REPEAT, GL_TRUE);
// Initialize OpenGL
init_opengl();

View File

@ -605,11 +605,6 @@ extern "C" {
* @ingroup input
*/
#define GLFW_STICKY_MOUSE_BUTTONS 0x00030003
/*! @brief Whether to allow key repeat for the @link GLFWkeyfun key callback
* @endlink.
* @ingroup input
*/
#define GLFW_KEY_REPEAT 0x00030004
/*! @} */
/*! @name Cursor modes
@ -1272,7 +1267,6 @@ GLFWAPI void glfwWaitEvents(void);
* @arg @ref GLFW_CURSOR_MODE Sets the cursor mode.
* @arg @ref GLFW_STICKY_KEYS Sets whether sticky keys are enabled.
* @arg @ref GLFW_STICKY_MOUSE_BUTTONS Sets whether sticky mouse buttons are enabled.
* @arg @ref GLFW_KEY_REPEAT Sets whether key repeat is enabled.
* @ingroup input
*
* @sa glfwSetInputMode
@ -1284,7 +1278,6 @@ GLFWAPI int glfwGetInputMode(GLFWwindow window, int mode);
* @arg @ref GLFW_CURSOR_MODE Sets the cursor mode.
* @arg @ref GLFW_STICKY_KEYS Sets whether sticky keys are enabled.
* @arg @ref GLFW_STICKY_MOUSE_BUTTONS Sets whether sticky mouse buttons are enabled.
* @arg @ref GLFW_KEY_REPEAT Sets whether key repeat is enabled.
* @ingroup input
*
* @sa glfwGetInputMode

View File

@ -313,7 +313,7 @@ version of GLFW.</p>
<li>Replaced <code>glfwEnable</code> and <code>glfwDisable</code> with <code>glfwGetInputMode</code> and <code>glfwSetInputMode</code></li>
<li>Replaced <code>joystick</code> test with graphical version</li>
<li>Replaced automatic closing of windows with <code>GLFW_CLOSE_REQUESTED</code> window parameter</li>
<li>Made Unicode character input unaffected by <code>GLFW_KEY_REPEAT</code></li>
<li>Removed the <code>GLFW_KEY_REPEAT</code> input option</li>
<li>Removed event auto-polling and the <code>GLFW_AUTO_POLL_EVENTS</code> window enable</li>
<li>Removed the Win32 port .def files</li>
<li>Removed the entire threading API</li>

View File

@ -115,16 +115,6 @@ static void setStickyMouseButtons(_GLFWwindow* window, int enabled)
}
//========================================================================
// Set key repeat for the specified window
//========================================================================
static void setKeyRepeat(_GLFWwindow* window, int enabled)
{
window->keyRepeat = enabled;
}
//////////////////////////////////////////////////////////////////////////
////// GLFW internal API //////
//////////////////////////////////////////////////////////////////////////
@ -154,7 +144,7 @@ void _glfwInputKey(_GLFWwindow* window, int key, int action)
}
// Call user callback function
if (window->keyCallback && (window->keyRepeat || !repeated))
if (window->keyCallback && !repeated)
window->keyCallback(window, key, action);
}
@ -277,8 +267,6 @@ GLFWAPI int glfwGetInputMode(GLFWwindow handle, int mode)
return window->stickyKeys;
case GLFW_STICKY_MOUSE_BUTTONS:
return window->stickyMouseButtons;
case GLFW_KEY_REPEAT:
return window->keyRepeat;
default:
_glfwSetError(GLFW_INVALID_ENUM, NULL);
return 0;
@ -311,9 +299,6 @@ GLFWAPI void glfwSetInputMode(GLFWwindow handle, int mode, int value)
case GLFW_STICKY_MOUSE_BUTTONS:
setStickyMouseButtons(window, value ? GL_TRUE : GL_FALSE);
break;
case GLFW_KEY_REPEAT:
setKeyRepeat(window, value ? GL_TRUE : GL_FALSE);
break;
default:
_glfwSetError(GLFW_INVALID_ENUM, NULL);
break;

View File

@ -185,7 +185,6 @@ struct _GLFWwindow
// Window input state
GLboolean stickyKeys;
GLboolean stickyMouseButtons;
GLboolean keyRepeat;
int cursorPosX, cursorPosY;
int cursorMode;
double scrollX, scrollY;

View File

@ -41,7 +41,6 @@
#include <locale.h>
// These must match the input mode defaults
static GLboolean keyrepeat = GL_FALSE;
static GLboolean closeable = GL_TRUE;
// Event index
@ -310,15 +309,6 @@ static void key_callback(GLFWwindow window, int key, int action)
switch (key)
{
case GLFW_KEY_R:
{
keyrepeat = !keyrepeat;
glfwSetInputMode(window, GLFW_KEY_REPEAT, keyrepeat);
printf("(( key repeat %s ))\n", keyrepeat ? "enabled" : "disabled");
break;
}
case GLFW_KEY_C:
{
closeable = !closeable;
@ -382,8 +372,6 @@ int main(void)
glfwGetWindowSize(window, &width, &height);
printf("Window size should be %ix%i\n", width, height);
printf("Key repeat should be %s\n", keyrepeat ? "enabled" : "disabled");
printf("Main loop starting\n");
while (!glfwGetWindowParam(window, GLFW_CLOSE_REQUESTED))