Correctly record the mouse position in the current VTY.

This commit is contained in:
Kazutaka YOKOTA 1999-11-09 12:35:36 +00:00
parent 10b50b7afd
commit cc5c7f76de
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=53057

View file

@ -639,6 +639,7 @@ sc_mouse_ioctl(struct tty *tp, u_long cmd, caddr_t data, int flag,
mouse_info_t buf; mouse_info_t buf;
scr_stat *cur_scp; scr_stat *cur_scp;
struct tty *mtty; struct tty *mtty;
int f;
if (scp == NULL) if (scp == NULL)
return ENOTTY; return ENOTTY;
@ -752,6 +753,19 @@ sc_mouse_ioctl(struct tty *tp, u_long cmd, caddr_t data, int flag,
if (SC_VTY(tp->t_dev) != SC_CONSOLECTL) if (SC_VTY(tp->t_dev) != SC_CONSOLECTL)
return ENOTTY; return ENOTTY;
#endif #endif
s = spltty();
if (mouse->u.data.x != 0 || mouse->u.data.y != 0) {
cur_scp->mouse_xpos += mouse->u.data.x;
cur_scp->mouse_ypos += mouse->u.data.y;
set_mouse_pos(cur_scp);
}
f = 0;
if (mouse->operation == MOUSE_ACTION) {
f = cur_scp->mouse_buttons ^ mouse->u.data.buttons;
cur_scp->mouse_buttons = mouse->u.data.buttons;
}
splx(s);
mouse_status.dx += mouse->u.data.x; mouse_status.dx += mouse->u.data.x;
mouse_status.dy += mouse->u.data.y; mouse_status.dy += mouse->u.data.y;
mouse_status.dz += mouse->u.data.z; mouse_status.dz += mouse->u.data.z;
@ -792,7 +806,6 @@ sc_mouse_ioctl(struct tty *tp, u_long cmd, caddr_t data, int flag,
} }
if (cur_scp->mouse_signal) { if (cur_scp->mouse_signal) {
cur_scp->mouse_buttons = mouse->u.data.buttons;
/* has controlling process died? */ /* has controlling process died? */
if (cur_scp->mouse_proc && if (cur_scp->mouse_proc &&
(cur_scp->mouse_proc != pfind(cur_scp->mouse_pid))){ (cur_scp->mouse_proc != pfind(cur_scp->mouse_pid))){
@ -823,31 +836,17 @@ sc_mouse_ioctl(struct tty *tp, u_long cmd, caddr_t data, int flag,
if (cur_scp->sc->flags & SC_MOUSE_ENABLED) if (cur_scp->sc->flags & SC_MOUSE_ENABLED)
cur_scp->status |= MOUSE_VISIBLE; cur_scp->status |= MOUSE_VISIBLE;
if (mouse->operation == MOUSE_ACTION) { if ((mouse->operation == MOUSE_ACTION) && f) {
/* process button presses */ /* process button presses */
if (cur_scp->mouse_buttons ^ mouse->u.data.buttons) { if (cur_scp->mouse_buttons & MOUSE_BUTTON1DOWN)
cur_scp->mouse_buttons = mouse->u.data.buttons; mouse_cut_start(cur_scp);
if (cur_scp->mouse_buttons & MOUSE_BUTTON1DOWN) else
mouse_cut_start(cur_scp); mouse_cut_end(cur_scp);
else if (cur_scp->mouse_buttons & MOUSE_BUTTON2DOWN ||
mouse_cut_end(cur_scp); cur_scp->mouse_buttons & MOUSE_BUTTON3DOWN)
if (cur_scp->mouse_buttons & MOUSE_BUTTON2DOWN || mouse_paste(cur_scp);
cur_scp->mouse_buttons & MOUSE_BUTTON3DOWN)
mouse_paste(cur_scp);
}
} }
#else /* SC_NO_CUTPASTE */
if (mouse->operation == MOUSE_ACTION)
cur_scp->mouse_buttons = mouse->u.data.buttons;
#endif /* SC_NO_CUTPASTE */ #endif /* SC_NO_CUTPASTE */
if (mouse->u.data.x != 0 || mouse->u.data.y != 0) {
s = spltty();
cur_scp->mouse_xpos += mouse->u.data.x;
cur_scp->mouse_ypos += mouse->u.data.y;
set_mouse_pos(cur_scp);
splx(s);
}
break; break;
case MOUSE_BUTTON_EVENT: case MOUSE_BUTTON_EVENT: