sc: Use current console rather than first console for mouse input
authorVadim Ushakov <igeekless@gmail.com>
Sun, 14 Jan 2024 16:22:17 +0000 (09:22 -0700)
committerWarner Losh <imp@FreeBSD.org>
Sun, 14 Jan 2024 16:24:41 +0000 (09:24 -0700)
commit751c323b829c36ca63a123a02a51f971ca3bd409
tree7f991c9216132e336741e0eab4da6fc705beda4c
parent256fe4a15484d72452ada288f5a3d9c9672b2d57
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