From 7fb0350fa76484a686f7a7a67a5e52d365d008c2 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 12 Jul 2025 12:37:21 +0530 Subject: [PATCH] Also set the motion indicator bit for mouse leave events --- docs/misc-protocol.rst | 3 ++- kitty/mouse.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/misc-protocol.rst b/docs/misc-protocol.rst index dc67f8a41..c7caf098e 100644 --- a/docs/misc-protocol.rst +++ b/docs/misc-protocol.rst @@ -37,7 +37,8 @@ Reporting when the mouse leaves the window kitty extends the SGR Pixel mouse reporting protocol created by xterm to also report when the mouse leaves the window. This is event is delivered encoded as a normal SGR pixel event except that the eight bit is set on the -first number. bits 1-7 are used to encode button and modifier information. +first number. Additionally, bit 5 is set to indicate this is a motion related event. +The remaining bits 1-7 (except 5) are used to encode button and modifier information. When bit 8 is set it means the event is a mouse has left the window event, and all other bits should be ignored. The pixel position values must also be ignored as they may not be accurate. diff --git a/kitty/mouse.c b/kitty/mouse.c index 122fcd28c..be945fec5 100644 --- a/kitty/mouse.c +++ b/kitty/mouse.c @@ -73,7 +73,7 @@ encode_mouse_event_impl(const MousePosition *mpos, int mouse_tracking_protocol, break; case LEAVE: if (mouse_tracking_protocol != SGR_PIXEL_PROTOCOL) return 0; - cb = LEAVE_INDICATOR; + cb = LEAVE_INDICATOR | MOTION_INDICATOR; break; default: if (cb == UINT_MAX) return 0;