Bläddra i källkod

Removed key repeat.

Camilla Berglund 13 år sedan
förälder
incheckning
c479124e69
7 ändrade filer med 2 tillägg och 41 borttagningar
  1. 0 2
      examples/gears.c
  2. 0 2
      examples/wave.c
  3. 0 7
      include/GL/glfw3.h
  4. 1 1
      readme.html
  5. 1 16
      src/input.c
  6. 0 1
      src/internal.h
  7. 0 12
      tests/events.c

+ 0 - 2
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);
 

+ 0 - 2
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();
 

+ 0 - 7
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

+ 1 - 1
readme.html

@@ -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>

+ 1 - 16
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;

+ 0 - 1
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;

+ 0 - 12
tests/events.c

@@ -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))