* fhandler.h (class dev_console): Add members ext_mouse_mode6 and
ext_mouse_mode15. * fhandler_console.cc (fhandler_console::read): Implement extended mouse modes 1015 (urxvt, mintty, xterm) and 1006 (xterm). Recognize, but don't implement extended mouse mode 1005 (xterm, mintty). Support mouse coordinates greater than 222 (each axis). Fix formatting. (fhandler_console::char_command): Initialize enhanced mouse reporting modes.
This commit is contained in:
parent
a5fa16e277
commit
c9df1b2729
|
@ -1,3 +1,14 @@
|
||||||
|
2012-04-24 Thomas Wolff <towo@towo.net>
|
||||||
|
|
||||||
|
* fhandler.h (class dev_console): Add members ext_mouse_mode6 and
|
||||||
|
ext_mouse_mode15.
|
||||||
|
* fhandler_console.cc (fhandler_console::read): Implement extended
|
||||||
|
mouse modes 1015 (urxvt, mintty, xterm) and 1006 (xterm). Recognize,
|
||||||
|
but don't implement extended mouse mode 1005 (xterm, mintty).
|
||||||
|
Support mouse coordinates greater than 222 (each axis). Fix formatting.
|
||||||
|
(fhandler_console::char_command): Initialize enhanced mouse reporting
|
||||||
|
modes.
|
||||||
|
|
||||||
2012-04-21 Christopher Faylor <me.cygwin2012@cgf.cx>
|
2012-04-21 Christopher Faylor <me.cygwin2012@cgf.cx>
|
||||||
|
|
||||||
* dtable.cc (fh_alloc): Only disallow opening of nonexistent on-disk
|
* dtable.cc (fh_alloc): Only disallow opening of nonexistent on-disk
|
||||||
|
|
|
@ -1288,6 +1288,8 @@ class dev_console
|
||||||
|
|
||||||
bool insert_mode;
|
bool insert_mode;
|
||||||
int use_mouse;
|
int use_mouse;
|
||||||
|
bool ext_mouse_mode6;
|
||||||
|
bool ext_mouse_mode15;
|
||||||
bool use_focus;
|
bool use_focus;
|
||||||
bool raw_win32_keyboard_mode;
|
bool raw_win32_keyboard_mode;
|
||||||
|
|
||||||
|
|
|
@ -453,12 +453,13 @@ fhandler_console::read (void *pv, size_t& buflen)
|
||||||
{
|
{
|
||||||
char c = dev_state.backspace_keycode;
|
char c = dev_state.backspace_keycode;
|
||||||
nread = 0;
|
nread = 0;
|
||||||
if (control_key_state & ALT_PRESSED) {
|
if (control_key_state & ALT_PRESSED)
|
||||||
if (dev_state.metabit)
|
{
|
||||||
c |= 0x80;
|
if (dev_state.metabit)
|
||||||
else
|
c |= 0x80;
|
||||||
tmp[nread++] = '\e';
|
else
|
||||||
}
|
tmp[nread++] = '\e';
|
||||||
|
}
|
||||||
tmp[nread++] = c;
|
tmp[nread++] = c;
|
||||||
tmp[nread] = 0;
|
tmp[nread] = 0;
|
||||||
toadd = tmp;
|
toadd = tmp;
|
||||||
|
@ -551,6 +552,7 @@ fhandler_console::read (void *pv, size_t& buflen)
|
||||||
events at the same time. */
|
events at the same time. */
|
||||||
int b = 0;
|
int b = 0;
|
||||||
char sz[32];
|
char sz[32];
|
||||||
|
char mode6_term = 'M';
|
||||||
|
|
||||||
if (mouse_event.dwEventFlags == MOUSE_WHEELED)
|
if (mouse_event.dwEventFlags == MOUSE_WHEELED)
|
||||||
{
|
{
|
||||||
|
@ -574,7 +576,7 @@ fhandler_console::read (void *pv, size_t& buflen)
|
||||||
{
|
{
|
||||||
b = dev_state.last_button_code;
|
b = dev_state.last_button_code;
|
||||||
}
|
}
|
||||||
else if (mouse_event.dwButtonState < dev_state.dwLastButtonState)
|
else if (mouse_event.dwButtonState < dev_state.dwLastButtonState && !dev_state.ext_mouse_mode6)
|
||||||
{
|
{
|
||||||
b = 3;
|
b = 3;
|
||||||
strcpy (sz, "btn up");
|
strcpy (sz, "btn up");
|
||||||
|
@ -595,6 +597,10 @@ fhandler_console::read (void *pv, size_t& buflen)
|
||||||
strcpy (sz, "btn3 down");
|
strcpy (sz, "btn3 down");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (dev_state.ext_mouse_mode6 /* distinguish release */
|
||||||
|
&& mouse_event.dwButtonState < dev_state.dwLastButtonState)
|
||||||
|
mode6_term = 'm';
|
||||||
|
|
||||||
dev_state.last_button_code = b;
|
dev_state.last_button_code = b;
|
||||||
|
|
||||||
if (mouse_event.dwEventFlags == MOUSE_MOVED)
|
if (mouse_event.dwEventFlags == MOUSE_MOVED)
|
||||||
|
@ -626,25 +632,54 @@ fhandler_console::read (void *pv, size_t& buflen)
|
||||||
b |= dev_state.nModifiers;
|
b |= dev_state.nModifiers;
|
||||||
|
|
||||||
/* We can now create the code. */
|
/* We can now create the code. */
|
||||||
sprintf (tmp, "\033[M%c%c%c", b + ' ', dev_state.dwMousePosition.X + ' ' + 1, dev_state.dwMousePosition.Y + ' ' + 1);
|
if (dev_state.ext_mouse_mode6)
|
||||||
syscall_printf ("mouse: %s at (%d,%d)", sz, dev_state.dwMousePosition.X, dev_state.dwMousePosition.Y);
|
{
|
||||||
|
__small_sprintf (tmp, "\033[<%d;%d;%d%c", b,
|
||||||
|
dev_state.dwMousePosition.X + 1,
|
||||||
|
dev_state.dwMousePosition.Y + 1,
|
||||||
|
mode6_term);
|
||||||
|
nread = strlen (tmp);
|
||||||
|
}
|
||||||
|
else if (dev_state.ext_mouse_mode15)
|
||||||
|
{
|
||||||
|
__small_sprintf (tmp, "\033[%d;%d;%dM", b + 32,
|
||||||
|
dev_state.dwMousePosition.X + 1,
|
||||||
|
dev_state.dwMousePosition.Y + 1);
|
||||||
|
nread = strlen (tmp);
|
||||||
|
}
|
||||||
|
/* else if (dev_state.ext_mouse_mode5) not implemented */
|
||||||
|
else
|
||||||
|
{
|
||||||
|
unsigned int xcode = dev_state.dwMousePosition.X + ' ' + 1;
|
||||||
|
unsigned int ycode = dev_state.dwMousePosition.Y + ' ' + 1;
|
||||||
|
if (xcode >= 256)
|
||||||
|
xcode = 0;
|
||||||
|
if (ycode >= 256)
|
||||||
|
ycode = 0;
|
||||||
|
__small_sprintf (tmp, "\033[M%c%c%c", b + ' ',
|
||||||
|
xcode, ycode);
|
||||||
|
nread = 6; /* tmp may contain NUL bytes */
|
||||||
|
}
|
||||||
|
syscall_printf ("mouse: %s at (%d,%d)", sz,
|
||||||
|
dev_state.dwMousePosition.X,
|
||||||
|
dev_state.dwMousePosition.Y);
|
||||||
|
|
||||||
toadd = tmp;
|
toadd = tmp;
|
||||||
nread = 6;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FOCUS_EVENT:
|
case FOCUS_EVENT:
|
||||||
if (dev_state.use_focus) {
|
if (dev_state.use_focus)
|
||||||
if (input_rec.Event.FocusEvent.bSetFocus)
|
{
|
||||||
sprintf (tmp, "\033[I");
|
if (input_rec.Event.FocusEvent.bSetFocus)
|
||||||
else
|
__small_sprintf (tmp, "\033[I");
|
||||||
sprintf (tmp, "\033[O");
|
else
|
||||||
|
__small_sprintf (tmp, "\033[O");
|
||||||
|
|
||||||
toadd = tmp;
|
toadd = tmp;
|
||||||
nread = 3;
|
nread = 3;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WINDOW_BUFFER_SIZE_EVENT:
|
case WINDOW_BUFFER_SIZE_EVENT:
|
||||||
|
@ -1517,22 +1552,30 @@ fhandler_console::char_command (char c)
|
||||||
|
|
||||||
case 1000: /* Mouse tracking */
|
case 1000: /* Mouse tracking */
|
||||||
dev_state.use_mouse = (c == 'h') ? 1 : 0;
|
dev_state.use_mouse = (c == 'h') ? 1 : 0;
|
||||||
syscall_printf ("mouse support set to mode %d", dev_state.use_mouse);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1002: /* Mouse button event tracking */
|
case 1002: /* Mouse button event tracking */
|
||||||
dev_state.use_mouse = (c == 'h') ? 2 : 0;
|
dev_state.use_mouse = (c == 'h') ? 2 : 0;
|
||||||
syscall_printf ("mouse support set to mode %d", dev_state.use_mouse);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1003: /* Mouse any event tracking */
|
case 1003: /* Mouse any event tracking */
|
||||||
dev_state.use_mouse = (c == 'h') ? 3 : 0;
|
dev_state.use_mouse = (c == 'h') ? 3 : 0;
|
||||||
syscall_printf ("mouse support set to mode %d", dev_state.use_mouse);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1004: /* Focus in/out event reporting */
|
case 1004: /* Focus in/out event reporting */
|
||||||
dev_state.use_focus = (c == 'h') ? true : false;
|
dev_state.use_focus = (c == 'h') ? true : false;
|
||||||
syscall_printf ("focus reporting set to %d", dev_state.use_focus);
|
break;
|
||||||
|
|
||||||
|
case 1005: /* Extended mouse mode */
|
||||||
|
syscall_printf ("ignored h/l command for extended mouse mode");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1006: /* SGR extended mouse mode */
|
||||||
|
dev_state.ext_mouse_mode6 = c == 'h';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1015: /* Urxvt extended mouse mode */
|
||||||
|
dev_state.ext_mouse_mode15 = c == 'h';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2000: /* Raw keyboard mode */
|
case 2000: /* Raw keyboard mode */
|
||||||
|
|
Loading…
Reference in New Issue