Bug 193339

Summary: syscons: mouse reporting works properly only on ttyv0
Product: Base System Reporter: Vadim Ushakov <igeekless>
Component: kernAssignee: Warner Losh <imp>
Status: Closed FIXED    
Severity: Affects Some People CC: emaste, imp
Priority: ---    
Version: CURRENT   
Hardware: Any   
OS: Any   
URL: https://github.com/freebsd/freebsd-src/blob/main/sys/dev/syscons/scmouse.c
Attachments:
Description Flags
The patch none

Description Vadim Ushakov 2014-09-05 09:50:06 UTC
When mouse reporting feature is turned on (control sequence ^[[?1000h), syscons sends valid mouse coordinates only for ttyv0. Applications running on other ttys always (erroneously) get mouse coordinates from the first tty, not from tty they actually run.

Steps to reproduce:
1. On ttyv0, run any application that uses mouse reporting feature. Make some clicks. The feature works properly.
2. Switch to another ttyv, run the application. The application receives mouse click events, but mouse position reported by syscons to the application does not match with the actual mouse position on the screen.

Expected result:
Reported mouse position should match with visible mouse position.

The bug affects CURRENT as well as 10.0-RELEASE.

The patch seems to be trivial.
Comment 1 Vadim Ushakov 2014-09-05 09:51:02 UTC
Created attachment 146855 [details]
The patch

(patch)
Comment 2 Graham Perrin freebsd_committer freebsd_triage 2022-10-17 12:40:16 UTC
Keyword: 

    patch
or  patch-ready

– in lieu of summary line prefix: 

    [patch]

* bulk change for the keyword
* summary lines may be edited manually (not in bulk). 

Keyword descriptions and search interface: 

    <https://bugs.freebsd.org/bugzilla/describekeywords.cgi>
Comment 3 Graham Perrin 2023-10-01 15:52:31 UTC
I'm sorry for the apparent lack of attention. 

(In reply to Vadim Ushakov from comment #1)

Still applicable:

% git -C /usr/src pull --ff-only freebsd main
From https://git.freebsd.org/src
 * branch                      main       -> FETCH_HEAD
Already up to date.
% git -C /usr/src/sys apply --check --verbose /tmp/146855.diff
Checking patch sys/dev/syscons/scmouse.c...
%
Comment 4 commit-hook freebsd_committer freebsd_triage 2024-01-14 16:33:32 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=751c323b829c36ca63a123a02a51f971ca3bd409

commit 751c323b829c36ca63a123a02a51f971ca3bd409
Author:     Vadim Ushakov <igeekless@gmail.com>
AuthorDate: 2024-01-14 16:22:17 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2024-01-14 16:24:41 +0000

    sc: Use current console rather than first console for mouse input

    When mouse reporting feature is turned on (control sequence ^[[?1000h),
    syscons sends valid mouse coordinates only for ttyv0. Applications
    running on other ttys always (erroneously) get mouse coordinates from
    the first tty, not from tty they actually run.

    Steps to reproduce:
    1. On ttyv0, run any application that uses mouse reporting feature. Make
       some clicks. The feature works properly.
    2. Switch to another ttyv, run the application. The application receives
       mouse click events, but mouse position reported by syscons to the
       application does not match with the actual mouse position on the screen.

    Expected result:
    Reported mouse position should match with visible mouse position.

    PR: 193339
    Reviewed by: imp

 sys/dev/syscons/scmouse.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Comment 5 Warner Losh freebsd_committer freebsd_triage 2024-01-14 16:34:28 UTC
This patch is good. Everything else uses the current console, except this. Either the sc_mouse_input should use the current console and be passed the base one, or like this patch: it should just pass the current one.

Committing.