Change key data type in some functions

This commit is contained in:
Kovid Goyal 2021-01-09 12:44:57 +05:30
parent a681162326
commit 397d7d044b
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
7 changed files with 9 additions and 9 deletions

View File

@ -1979,7 +1979,7 @@ const char* _glfwPlatformGetNativeKeyName(int keycode)
return _glfw.ns.keyName; return _glfw.ns.keyName;
} }
int _glfwPlatformGetNativeKeyForKey(int key) int _glfwPlatformGetNativeKeyForKey(uint32_t key)
{ {
return _glfw.ns.key_to_keycode[key]; return _glfw.ns.key_to_keycode[key];
} }

6
glfw/glfw3.h vendored
View File

@ -1738,7 +1738,7 @@ typedef void (* GLFWscrollfun)(GLFWwindow*,double,double,int,int);
* This is the function pointer type for key callbacks. A keyboard * This is the function pointer type for key callbacks. A keyboard
* key callback function has the following signature: * key callback function has the following signature:
* @code * @code
* void function_name(GLFWwindow* window, int key, int native_key, int action, int mods) * void function_name(GLFWwindow* window, uint32_t key, int native_key, int action, int mods)
* @endcode * @endcode
* The semantics of this function are that the key that is interacted with on the * The semantics of this function are that the key that is interacted with on the
* keyboard is reported, and the text, if any generated by the key is reported. * keyboard is reported, and the text, if any generated by the key is reported.
@ -4499,7 +4499,7 @@ GLFWAPI int glfwRawMouseMotionSupported(void);
* *
* @ingroup input * @ingroup input
*/ */
GLFWAPI const char* glfwGetKeyName(int key, int native_key); GLFWAPI const char* glfwGetKeyName(uint32_t key, int native_key);
/*! @brief Returns the platform-specific identifier of the specified key. /*! @brief Returns the platform-specific identifier of the specified key.
* *
@ -4523,7 +4523,7 @@ GLFWAPI const char* glfwGetKeyName(int key, int native_key);
* *
* @ingroup input * @ingroup input
*/ */
GLFWAPI int glfwGetNativeKeyForKey(int key); GLFWAPI int glfwGetNativeKeyForKey(uint32_t key);
/*! @brief Returns the last reported state of a keyboard key for the specified /*! @brief Returns the last reported state of a keyboard key for the specified
* window. * window.

2
glfw/internal.h vendored
View File

@ -654,7 +654,7 @@ void _glfwPlatformDestroyCursor(_GLFWcursor* cursor);
void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor); void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor);
const char* _glfwPlatformGetNativeKeyName(int native_key); const char* _glfwPlatformGetNativeKeyName(int native_key);
int _glfwPlatformGetNativeKeyForKey(int key); int _glfwPlatformGetNativeKeyForKey(uint32_t key);
void _glfwPlatformFreeMonitor(_GLFWmonitor* monitor); void _glfwPlatformFreeMonitor(_GLFWmonitor* monitor);
void _glfwPlatformGetMonitorPos(_GLFWmonitor* monitor, int* xpos, int* ypos); void _glfwPlatformGetMonitorPos(_GLFWmonitor* monitor, int* xpos, int* ypos);

2
glfw/wl_window.c vendored
View File

@ -1346,7 +1346,7 @@ const char* _glfwPlatformGetNativeKeyName(int native_key)
return glfw_xkb_keysym_name(native_key); return glfw_xkb_keysym_name(native_key);
} }
int _glfwPlatformGetNativeKeyForKey(int key) int _glfwPlatformGetNativeKeyForKey(uint32_t key)
{ {
return glfw_xkb_sym_for_key(key); return glfw_xkb_sym_for_key(key);
} }

2
glfw/x11_window.c vendored
View File

@ -2778,7 +2778,7 @@ const char* _glfwPlatformGetNativeKeyName(int native_key)
return glfw_xkb_keysym_name(native_key); return glfw_xkb_keysym_name(native_key);
} }
int _glfwPlatformGetNativeKeyForKey(int key) int _glfwPlatformGetNativeKeyForKey(uint32_t key)
{ {
return glfw_xkb_sym_for_key(key); return glfw_xkb_sym_for_key(key);
} }

2
glfw/xkb_glfw.c vendored
View File

@ -228,7 +228,7 @@ glfw_key_for_sym(xkb_keysym_t key) {
} }
xkb_keysym_t xkb_keysym_t
glfw_xkb_sym_for_key(int key) { glfw_xkb_sym_for_key(uint32_t key) {
#define S(f, t) case GLFW_KEY_##t: return XKB_KEY_##f #define S(f, t) case GLFW_KEY_##t: return XKB_KEY_##f
#define F(...) #define F(...)
#define R(s, e, gs, ge) case GLFW_KEY_##gs ... GLFW_KEY_##ge: return XKB_KEY_##s + key - GLFW_KEY_##gs #define R(s, e, gs, ge) case GLFW_KEY_##gs ... GLFW_KEY_##ge: return XKB_KEY_##s + key - GLFW_KEY_##gs

2
glfw/xkb_glfw.h vendored
View File

@ -89,7 +89,7 @@ bool glfw_xkb_compile_keymap(_GLFWXKBData *xkb, const char *map_str);
void glfw_xkb_update_modifiers(_GLFWXKBData *xkb, xkb_mod_mask_t depressed, xkb_mod_mask_t latched, xkb_mod_mask_t locked, xkb_layout_index_t base_group, xkb_layout_index_t latched_group, xkb_layout_index_t locked_group); void glfw_xkb_update_modifiers(_GLFWXKBData *xkb, xkb_mod_mask_t depressed, xkb_mod_mask_t latched, xkb_mod_mask_t locked, xkb_layout_index_t base_group, xkb_layout_index_t latched_group, xkb_layout_index_t locked_group);
bool glfw_xkb_should_repeat(_GLFWXKBData *xkb, xkb_keycode_t keycode); bool glfw_xkb_should_repeat(_GLFWXKBData *xkb, xkb_keycode_t keycode);
const char* glfw_xkb_keysym_name(xkb_keysym_t sym); const char* glfw_xkb_keysym_name(xkb_keysym_t sym);
xkb_keysym_t glfw_xkb_sym_for_key(int key); xkb_keysym_t glfw_xkb_sym_for_key(uint32_t key);
void glfw_xkb_handle_key_event(_GLFWwindow *window, _GLFWXKBData *xkb, xkb_keycode_t keycode, int action); void glfw_xkb_handle_key_event(_GLFWwindow *window, _GLFWXKBData *xkb, xkb_keycode_t keycode, int action);
int glfw_xkb_keysym_from_name(const char *name, bool case_sensitive); int glfw_xkb_keysym_from_name(const char *name, bool case_sensitive);
void glfw_xkb_update_ime_state(_GLFWwindow *w, _GLFWXKBData *xkb, int which, int a, int b, int c, int d); void glfw_xkb_update_ime_state(_GLFWwindow *w, _GLFWXKBData *xkb, int which, int a, int b, int c, int d);