From c479124e69437f73ffae429eac9b3c3f52923e16 Mon Sep 17 00:00:00 2001
From: Camilla Berglund
Date: Thu, 22 Nov 2012 17:14:50 +0100
Subject: [PATCH] Removed key repeat.
---
examples/gears.c | 2 --
examples/wave.c | 2 --
include/GL/glfw3.h | 7 -------
readme.html | 2 +-
src/input.c | 17 +----------------
src/internal.h | 1 -
tests/events.c | 12 ------------
7 files changed, 2 insertions(+), 41 deletions(-)
diff --git a/examples/gears.c b/examples/gears.c
index 63f973d2..b056251a 100644
--- a/examples/gears.c
+++ b/examples/gears.c
@@ -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);
diff --git a/examples/wave.c b/examples/wave.c
index c04bfb2d..7b4b4c32 100644
--- a/examples/wave.c
+++ b/examples/wave.c
@@ -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();
diff --git a/include/GL/glfw3.h b/include/GL/glfw3.h
index ba2184da..4b55ddfe 100644
--- a/include/GL/glfw3.h
+++ b/include/GL/glfw3.h
@@ -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
diff --git a/readme.html b/readme.html
index 14531575..c2d18be4 100644
--- a/readme.html
+++ b/readme.html
@@ -313,7 +313,7 @@ version of GLFW.
Replaced glfwEnable
and glfwDisable
with glfwGetInputMode
and glfwSetInputMode
Replaced joystick
test with graphical version
Replaced automatic closing of windows with GLFW_CLOSE_REQUESTED
window parameter
- Made Unicode character input unaffected by GLFW_KEY_REPEAT
+ Removed the GLFW_KEY_REPEAT
input option
Removed event auto-polling and the GLFW_AUTO_POLL_EVENTS
window enable
Removed the Win32 port .def files
Removed the entire threading API
diff --git a/src/input.c b/src/input.c
index 66e82b68..787103a8 100644
--- a/src/input.c
+++ b/src/input.c
@@ -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;
diff --git a/src/internal.h b/src/internal.h
index c4ac9d2d..c43ad37f 100644
--- a/src/internal.h
+++ b/src/internal.h
@@ -185,7 +185,6 @@ struct _GLFWwindow
// Window input state
GLboolean stickyKeys;
GLboolean stickyMouseButtons;
- GLboolean keyRepeat;
int cursorPosX, cursorPosY;
int cursorMode;
double scrollX, scrollY;
diff --git a/tests/events.c b/tests/events.c
index e260cc3b..3150a82e 100644
--- a/tests/events.c
+++ b/tests/events.c
@@ -41,7 +41,6 @@
#include
// 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))