Skip to content

Character Release Event #21

Closed
wants to merge 3 commits into from
View
8 glfw/lib/window.c
@@ -199,8 +199,8 @@ void _glfwInputChar( int character, int action )
_glfwInput.LastChar = 0;
}
- if( action != GLFW_PRESS )
- {
+ // if( action != GLFW_PRESS )
+ // {
// This intentionally breaks release notifications for Unicode
// characters, partly to see if anyone cares but mostly because it's
// a nonsensical concept to begin with
@@ -214,8 +214,8 @@ void _glfwInputChar( int character, int action )
//
// However, if your particular application uses this misfeature for...
// something, you can re-enable it by removing this if-statement
- return;
- }
+ // return;
+ // }
if( _glfwWin.charCallback && (_glfwInput.KeyRepeat || !keyrepeat) )
{
View
10 src/Graphics/UI/GLFW.hsc
@@ -62,6 +62,8 @@ module Graphics.UI.GLFW
, keyIsPressed
, setCharCallback
, setKeyCallback
+ , enableKeyRepeat
+ , disableKeyRepeat
--
, Key(..)
, CharCallback
@@ -584,6 +586,14 @@ setKeyCallback cb = do
glfwSetKeyCallback ccb
storeCallback keyCallback ccb
+-- Key and Character callbacks are called repeatedly when a key is held down long enough
+enableKeyRepeat :: IO ()
+enableKeyRepeat = glfwEnable (#const GLFW_KEY_REPEAT)
+
+-- Key and Character callbacks are called only once when a key is pressed (Default)
+disableKeyRepeat :: IO ()
+disableKeyRepeat = glfwDisable (#const GLFW_KEY_REPEAT)
+
-- -- -- -- -- -- -- -- -- --
data Key
Something went wrong with that request. Please try again.