mirror of
https://github.com/kovidgoyal/kitty.git
synced 2024-09-11 22:47:45 +03:00
Update glfw
This commit is contained in:
parent
677c47b9dd
commit
9edfafcac2
5
glfw/glfw3.h
vendored
5
glfw/glfw3.h
vendored
@ -1394,6 +1394,11 @@ typedef void (* GLFWscrollfun)(GLFWwindow*,double,double);
|
||||
* @param[in] text UTF-8 encoded text generated by this key event or empty string.
|
||||
* @param[in] reserved Reserved for future use.
|
||||
*
|
||||
* @note On X11/Wayland if a modifier other than the modifiers GLFW reports
|
||||
* (ctrl/shift/alt/super) is used, GLFW will report the shifted key rather
|
||||
* than the unshifted key. So for example, if ISO_Shift_Level_5 is used to
|
||||
* convert the key A into UP GLFW will report the key as UP with no modifiers.
|
||||
*
|
||||
* @sa @ref input_key
|
||||
* @sa @ref glfwSetKeyboardCallback
|
||||
*
|
||||
|
2
glfw/wl_init.c
vendored
2
glfw/wl_init.c
vendored
@ -434,7 +434,7 @@ static void keyboardHandleModifiers(void* data,
|
||||
uint32_t modsLocked,
|
||||
uint32_t group)
|
||||
{
|
||||
glfw_xkb_update_modifiers(&_glfw.wl.xkb, modsDepressed, modsLatched, modsLocked, group);
|
||||
glfw_xkb_update_modifiers(&_glfw.wl.xkb, modsDepressed, modsLatched, modsLocked, 0, 0, group);
|
||||
}
|
||||
|
||||
static void keyboardHandleRepeatInfo(void* data,
|
||||
|
5
glfw/x11_window.c
vendored
5
glfw/x11_window.c
vendored
@ -1166,7 +1166,10 @@ static void processEvent(XEvent *event)
|
||||
case XkbStateNotify:
|
||||
{
|
||||
XkbStateNotifyEvent *state_event = (XkbStateNotifyEvent*)kb_event;
|
||||
glfw_xkb_update_modifiers(&_glfw.x11.xkb, state_event->base_mods, state_event->latched_mods, state_event->locked_mods, state_event->group);
|
||||
glfw_xkb_update_modifiers(
|
||||
&_glfw.x11.xkb, state_event->base_mods, state_event->latched_mods,
|
||||
state_event->locked_mods, state_event->base_group, state_event->latched_group, state_event->locked_group
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
8
glfw/xkb_glfw.c
vendored
8
glfw/xkb_glfw.c
vendored
@ -288,10 +288,10 @@ active_unknown_modifiers(_GLFWXKBData *xkb) {
|
||||
|
||||
|
||||
void
|
||||
glfw_xkb_update_modifiers(_GLFWXKBData *xkb, unsigned int depressed, unsigned int latched, unsigned int locked, unsigned int group) {
|
||||
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) {
|
||||
if (!xkb->keymap) return;
|
||||
xkb->modifiers = 0;
|
||||
xkb_state_update_mask(xkb->state, depressed, latched, locked, 0, 0, group);
|
||||
xkb_state_update_mask(xkb->state, depressed, latched, locked, base_group, latched_group, locked_group);
|
||||
#define S(attr, name) if (xkb_state_mod_index_is_active(xkb->state, xkb->attr##Idx, XKB_STATE_MODS_EFFECTIVE)) xkb->modifiers |= GLFW_MOD_##name
|
||||
S(control, CONTROL); S(alt, ALT); S(shift, SHIFT); S(super, SUPER); S(capsLock, CAPS_LOCK); S(numLock, NUM_LOCK);
|
||||
#undef S
|
||||
@ -403,8 +403,8 @@ glfw_xkb_handle_key_event(_GLFWwindow *window, _GLFWXKBData *xkb, xkb_keycode_t
|
||||
}
|
||||
debug("composed_sym: %s ", glfw_xkb_keysym_name(glfw_sym));
|
||||
if (glfw_sym == syms[0]) { // composed sym is the same as non-composed sym
|
||||
// Only use the clean_sym if the mods other than the mods we report
|
||||
// are active (for example if ISO_Shift_Level_* mods are pressed
|
||||
// Only use the clean_sym if no mods other than the mods we report
|
||||
// are active (for example if ISO_Shift_Level_* mods are active
|
||||
// they are not reported by GLFW so the key should be the shifted
|
||||
// key). See https://github.com/kovidgoyal/kitty/issues/171#issuecomment-377557053
|
||||
xkb_mod_mask_t consumed_unknown_mods = xkb_state_key_get_consumed_mods(xkb->state, code_for_sym) & xkb->activeUnknownModifiers;
|
||||
|
2
glfw/xkb_glfw.h
vendored
2
glfw/xkb_glfw.h
vendored
@ -76,7 +76,7 @@ GLFWbool glfw_xkb_update_x11_keyboard_id(_GLFWXKBData *xkb);
|
||||
void glfw_xkb_release(_GLFWXKBData *xkb);
|
||||
GLFWbool glfw_xkb_create_context(_GLFWXKBData *xkb);
|
||||
GLFWbool glfw_xkb_compile_keymap(_GLFWXKBData *xkb, const char *map_str);
|
||||
void glfw_xkb_update_modifiers(_GLFWXKBData *xkb, unsigned int depressed, unsigned int latched, unsigned int locked, unsigned int 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);
|
||||
GLFWbool glfw_xkb_should_repeat(_GLFWXKBData *xkb, xkb_keycode_t scancode);
|
||||
const char* glfw_xkb_keysym_name(xkb_keysym_t sym);
|
||||
xkb_keysym_t glfw_xkb_sym_for_key(int key);
|
||||
|
5
kitty/glfw-wrapper.h
generated
5
kitty/glfw-wrapper.h
generated
@ -1152,6 +1152,11 @@ typedef void (* GLFWscrollfun)(GLFWwindow*,double,double);
|
||||
* @param[in] text UTF-8 encoded text generated by this key event or empty string.
|
||||
* @param[in] reserved Reserved for future use.
|
||||
*
|
||||
* @note On X11/Wayland if a modifier other than the modifiers GLFW reports
|
||||
* (ctrl/shift/alt/super) is used, GLFW will report the shifted key rather
|
||||
* than the unshifted key. So for example, if ISO_Shift_Level_5 is used to
|
||||
* convert the key A into UP GLFW will report the key as UP with no modifiers.
|
||||
*
|
||||
* @sa @ref input_key
|
||||
* @sa @ref glfwSetKeyboardCallback
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user