mouse suppress split focus-transfer clicks

Treat left clicks that only transfer split focus as focus-only events. Suppress forwarding the left press and matching release to the child so applications do not see release-without-press sequences.

Amp-Thread-ID: https://ampcode.com/threads/T-019cba50-5f2e-763b-ab5f-aa8c96a45747
Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
Tim Culverhouse 2026-03-04 13:35:55 -06:00
parent a5322c06d1
commit b277a016be
No known key found for this signature in database
2 changed files with 13 additions and 1 deletions

View file

@ -832,10 +832,21 @@ HANDLER(handle_button_event) {
Tab *t = osw->tabs + osw->active_tab;
bool is_release = !osw->mouse_button_pressed[button];
if (button == GLFW_MOUSE_BUTTON_LEFT && is_release && osw->suppress_left_mouse_release) {
osw->suppress_left_mouse_release = false;
return;
}
if (handle_scrollbar_mouse(w, button, is_release ? RELEASE : PRESS, modifiers)) return;
if (window_idx != t->active_window && !is_release) {
if (osw->is_focused && window_idx != t->active_window && !is_release) {
call_boss(switch_focus_to_in_active_tab, "K", t->windows[window_idx].id);
if (button == GLFW_MOUSE_BUTTON_LEFT) {
// Treat split-focus transfer clicks as focus-only and suppress
// the matching release to avoid release-without-press reports.
osw->suppress_left_mouse_release = true;
return;
}
}
Screen *screen = w->render_data.screen;

View file

@ -329,6 +329,7 @@ typedef struct OSWindow {
double mouse_x, mouse_y;
bool mouse_button_pressed[32];
bool has_too_few_tabs;
bool suppress_left_mouse_release;
PyObject *window_title;
bool disallow_title_changes, title_is_overriden;
bool viewport_size_dirty, viewport_updated_at_least_once;