[PR #7166] Fix VT mouse capture issues in Terminal and conhost #26855

Open
opened 2026-01-31 09:18:32 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/7166

State: closed
Merged: Yes


This pull request fixes capture and event generation in VT mouse mode
for both conhost and terminal.

Fixes #6401.

[1/3] Terminal: clamp mouse events to the viewport, don't throw them away

gnome-terminal (at least) sends mouse events whose x/y are at the
extreme ends of the buffer when a drag starts inside the terminal and
then exits it.

We would previously discard any mouse events that exited the borders of
the viewport. Now we will keep emitting events where X/Y=0/w/h.

[2/3] conhost: clamp VT mouse to viewport, capture pointer

This is the same as (1), but for conhost. conhost wasn't already
capturing the pointer when VT mouse mode was in use. By capturing, we
ensure that events that happen outside the screen still result in events
sent to an application (like a release after a drag)

[3/3] wpf: capture the pointer when VT mouse is enabled

This is the same as (2), but for the WPF control. Clamping is handled
in TerminalCore in (1), so we didn't need to do it in WPF.

**Original Pull Request:** https://github.com/microsoft/terminal/pull/7166 **State:** closed **Merged:** Yes --- This pull request fixes capture and event generation in VT mouse mode for both conhost and terminal. Fixes #6401. [1/3] Terminal: clamp mouse events to the viewport, don't throw them away gnome-terminal (at least) sends mouse events whose x/y are at the extreme ends of the buffer when a drag starts inside the terminal and then exits it. We would previously discard any mouse events that exited the borders of the viewport. Now we will keep emitting events where X/Y=0/w/h. [2/3] conhost: clamp VT mouse to viewport, capture pointer This is the same as (1), but for conhost. conhost wasn't already capturing the pointer when VT mouse mode was in use. By capturing, we ensure that events that happen outside the screen still result in events sent to an application (like a release after a drag) [3/3] wpf: capture the pointer when VT mouse is enabled This is the same as (2), but for the WPF control. Clamping is handled in TerminalCore in (1), so we didn't need to do it in WPF.
claunia added the pull-request label 2026-01-31 09:18:32 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#26855