This is the mail archive of the
cygwin-patches
mailing list for the Cygwin project.
Re: console enhancements: mouse events etc
On Dec 16 10:48, Thomas Wolff wrote:
> * fhandler_console.cc (read): Detect and handle mouse wheel scrolling
> events (for completion of mouse reporting mode 1000) and mouse
> movement events (for additional mouse reporting modes 1002 and 1003).
> Use mouse_aware() as a guard and only condition for mouse
> reporting in order to enforce consistence of read() and select().
> Add focus reports (for additional focus reporting mode 1004).
> (mouse_aware): Enable detection of additional mouse events for select().
> Tune function to precisely match actual reporting criteria.
> Move adjustment of mouse position (by window scroll offset)
> here to avoid duplicate code.
> (char_command): Initialization of enhanced mouse reporting modes.
> Initialization of focus reporting mode.
> * fhandler.h (use_mouse): Change flag (bool->int) to indicate
> additional mouse modes. Add flag to indicate focus reporting.
> (mouse_aware): Move enhanced function into fhandler_console.cc.
> * select.cc (peek_console): Use modified mouse_aware() for more
> general detection of mouse events. Also check for focus reports.
Thank you. Applied with two changes:
> @@ -362,9 +405,12 @@ fhandler_console::read (void *pv, size_t
> /* Determine if the keystroke is modified by META. The tricky
> part is to distinguish whether the right Alt key should be
> recognized as Alt, or as AltGr. */
> - bool meta;
> - meta = (control_key_state & ALT_PRESSED) != 0
> + bool meta =
> + /* Alt but not AltGr (= left ctrl + right alt)? */
> + (control_key_state & ALT_PRESSED) != 0
> && ((control_key_state & CTRL_PRESSED) == 0
> + /* but also allow Alt-AltGr: */
> + || (control_key_state & ALT_PRESSED) == ALT_PRESSED
> || (wch <= 0x1f || wch == 0x7f));
> if (!meta)
> {
This hunk apparently belongs to another part of the patch and isn't
mentioned in the ChangeLog. I removed it for now.
> @@ -400,10 +446,18 @@ fhandler_console::read (void *pv, size_t
> break;
>
> case MOUSE_EVENT:
> - send_winch_maybe ();
> - if (dev_state->use_mouse)
> + send_winch_maybe ();
> + {
> [...]
The above and the followup hunks within the MOUSE_EVENT case were not
correctly indented. I fixed that.
> + case 1000: /* Mouse tracking */
> + dev_state->use_mouse = (c == 'h') ? 1 : 0;
> + syscall_printf ("mouse support set to mode %d", dev_state->use_mouse);
> + break;
> +
> + case 1002: /* Mouse button event tracking */
Just curious: Is there a 1001 control sequence as well?
Thanks again for the patch,
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Project Co-Leader cygwin AT cygwin DOT com
Red Hat