Forward mouse wheel events to applications in mouse tracking mode#178
Merged
kdj0c merged 1 commit intokmscon:mainfrom Dec 17, 2025
Merged
Forward mouse wheel events to applications in mouse tracking mode#178kdj0c merged 1 commit intokmscon:mainfrom
kdj0c merged 1 commit intokmscon:mainfrom
Conversation
When an application enables mouse tracking (e.g., vim with 'set mouse=a'), kmscon now forwards mouse wheel events to the application by converting them to button events (button 4 for scroll up, button 5 for scroll down), following the xterm mouse protocol. Previously, wheel events were only handled by kmscon itself for scrolling the terminal history, even when an application requested mouse tracking. This change allows: - Mouse wheel to scroll content in applications like vim, less, etc. when they enable mouse mode - Mouse wheel to continue scrolling kmscon history when no application has enabled mouse tracking (shell prompt) Changes: - Add UTERM_WHEEL case to forward_pointer_event() - Convert wheel events to button 4/5 according to xterm protocol - Use local button variable to allow modification before forwarding
Contributor
|
Thanks, that's a useful addition to kmscon. |
Contributor
Author
|
There's an update to be done in libtsm too: kmscon/libtsm#5 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes mouse wheel support in applications that use mouse tracking mode (e.g., vim, less, tmux).
Problem
When an application enables mouse tracking (like vim with ), kmscon was not forwarding mouse wheel events to the application. The wheel events were only used for scrolling kmscon's own terminal history, even when the application explicitly requested mouse input.
Solution
This PR adds support for forwarding mouse wheel events to applications by converting them to button events following the xterm mouse protocol:
Behavior
Changes
Testing
This fix brings kmscon's mouse wheel behavior in line with other terminal emulators like xterm, urxvt, and gnome-terminal.