Keyboard protocol: Do not deliver a fake key release events on OS window focus out for engaged modifiers
Fixes #7196
This commit is contained in:
parent
210c417d96
commit
6c31256aa1
5 changed files with 10 additions and 2 deletions
|
|
@ -86,6 +86,8 @@ Detailed list of changes
|
|||
- Remote control: Fix ``--match`` argument not working for @ls, @send-key,
|
||||
@set-background-image (:iss:`7192`)
|
||||
|
||||
- Keyboard protocol: Do not deliver a fake key release events on OS window focus out for engaged modifiers (:iss:`7196`)
|
||||
|
||||
|
||||
0.32.2 [2024-02-12]
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
|
|
|||
3
glfw/glfw3.h
vendored
3
glfw/glfw3.h
vendored
|
|
@ -1288,6 +1288,9 @@ typedef struct GLFWkeyevent
|
|||
// For internal use only. On Linux it is the actual keycode reported by the windowing system, in contrast
|
||||
// to native_key which can be the result of a compose operation. On macOS it is the same as native_key.
|
||||
uint32_t native_key_id;
|
||||
|
||||
// True if this is a synthesized event on focus change
|
||||
bool fake_event_on_focus_change;
|
||||
} GLFWkeyevent;
|
||||
|
||||
/*! @brief The function pointer type for error callbacks.
|
||||
|
|
|
|||
2
glfw/window.c
vendored
2
glfw/window.c
vendored
|
|
@ -57,7 +57,7 @@ void _glfwInputWindowFocus(_GLFWwindow* window, bool focused)
|
|||
if (window->activated_keys[i].key > 0 && window->activated_keys[i].action == GLFW_PRESS)
|
||||
{
|
||||
const int native_key = _glfwPlatformGetNativeKeyForKey(window->activated_keys[i].key);
|
||||
GLFWkeyevent ev = {.key = window->activated_keys[i].key, .native_key = native_key, .action = GLFW_RELEASE};
|
||||
GLFWkeyevent ev = {.key = window->activated_keys[i].key, .native_key = native_key, .action = GLFW_RELEASE, .fake_event_on_focus_change = true};
|
||||
_glfwInputKeyboard(window, &ev);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
3
kitty/glfw-wrapper.h
generated
3
kitty/glfw-wrapper.h
generated
|
|
@ -1026,6 +1026,9 @@ typedef struct GLFWkeyevent
|
|||
// For internal use only. On Linux it is the actual keycode reported by the windowing system, in contrast
|
||||
// to native_key which can be the result of a compose operation. On macOS it is the same as native_key.
|
||||
uint32_t native_key_id;
|
||||
|
||||
// True if this is a synthesized event on focus change
|
||||
bool fake_event_on_focus_change;
|
||||
} GLFWkeyevent;
|
||||
|
||||
/*! @brief The function pointer type for error callbacks.
|
||||
|
|
|
|||
|
|
@ -457,7 +457,7 @@ key_callback(GLFWwindow *w, GLFWkeyevent *ev) {
|
|||
#endif
|
||||
mods_at_last_key_or_button_event = ev->mods;
|
||||
global_state.callback_os_window->cursor_blink_zero_time = monotonic();
|
||||
if (is_window_ready_for_callbacks()) on_key_input(ev);
|
||||
if (is_window_ready_for_callbacks() && !ev->fake_event_on_focus_change) on_key_input(ev);
|
||||
global_state.callback_os_window = NULL;
|
||||
request_tick_callback();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue