mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-02-03 21:52:24 +00:00
Stop sending release events for mouse wheel 'buttons' in X mouse mode.
On Windows (X mouse reporting of the mouse wheel isn't currently done by the Unix front end, though I'm shortly about to fix that too) a mouse wheel event is translated into a virtual button, and we send both a press and a release of that button to terminal.c, which encodes both in X mouse reporting escape sequences and passes them on to the server. This isn't consistent with what xterm does - scroll-wheel events are encoded _like_ button presses, but differ semantically in that they don't have matching releases. So we're updating to match xterm. [originally from svn r10138]
This commit is contained in:
parent
0f04cab151
commit
7d394fc9e9
22
terminal.c
22
terminal.c
@ -5896,7 +5896,7 @@ void term_mouse(Terminal *term, Mouse_Button braw, Mouse_Button bcooked,
|
|||||||
*/
|
*/
|
||||||
if (raw_mouse &&
|
if (raw_mouse &&
|
||||||
(term->selstate != ABOUT_TO) && (term->selstate != DRAGGING)) {
|
(term->selstate != ABOUT_TO) && (term->selstate != DRAGGING)) {
|
||||||
int encstate = 0, r, c;
|
int encstate = 0, r, c, wheel;
|
||||||
char abuf[32];
|
char abuf[32];
|
||||||
int len = 0;
|
int len = 0;
|
||||||
|
|
||||||
@ -5905,22 +5905,35 @@ void term_mouse(Terminal *term, Mouse_Button braw, Mouse_Button bcooked,
|
|||||||
switch (braw) {
|
switch (braw) {
|
||||||
case MBT_LEFT:
|
case MBT_LEFT:
|
||||||
encstate = 0x00; /* left button down */
|
encstate = 0x00; /* left button down */
|
||||||
|
wheel = FALSE;
|
||||||
break;
|
break;
|
||||||
case MBT_MIDDLE:
|
case MBT_MIDDLE:
|
||||||
encstate = 0x01;
|
encstate = 0x01;
|
||||||
|
wheel = FALSE;
|
||||||
break;
|
break;
|
||||||
case MBT_RIGHT:
|
case MBT_RIGHT:
|
||||||
encstate = 0x02;
|
encstate = 0x02;
|
||||||
|
wheel = FALSE;
|
||||||
break;
|
break;
|
||||||
case MBT_WHEEL_UP:
|
case MBT_WHEEL_UP:
|
||||||
encstate = 0x40;
|
encstate = 0x40;
|
||||||
|
wheel = TRUE;
|
||||||
break;
|
break;
|
||||||
case MBT_WHEEL_DOWN:
|
case MBT_WHEEL_DOWN:
|
||||||
encstate = 0x41;
|
encstate = 0x41;
|
||||||
|
wheel = TRUE;
|
||||||
break;
|
break;
|
||||||
default: break; /* placate gcc warning about enum use */
|
default:
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
switch (a) {
|
if (wheel) {
|
||||||
|
/* For mouse wheel buttons, we only ever expect to see
|
||||||
|
* MA_CLICK actions, and we don't try to keep track of
|
||||||
|
* the buttons being 'pressed' (since without matching
|
||||||
|
* click/release pairs that's pointless). */
|
||||||
|
if (a != MA_CLICK)
|
||||||
|
return;
|
||||||
|
} else switch (a) {
|
||||||
case MA_DRAG:
|
case MA_DRAG:
|
||||||
if (term->xterm_mouse == 1)
|
if (term->xterm_mouse == 1)
|
||||||
return;
|
return;
|
||||||
@ -5937,7 +5950,8 @@ void term_mouse(Terminal *term, Mouse_Button braw, Mouse_Button bcooked,
|
|||||||
return;
|
return;
|
||||||
term->mouse_is_down = braw;
|
term->mouse_is_down = braw;
|
||||||
break;
|
break;
|
||||||
default: break; /* placate gcc warning about enum use */
|
default:
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
if (shift)
|
if (shift)
|
||||||
encstate += 0x04;
|
encstate += 0x04;
|
||||||
|
@ -3248,10 +3248,6 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
|
|||||||
TO_CHR_X(p.x),
|
TO_CHR_X(p.x),
|
||||||
TO_CHR_Y(p.y), shift_pressed,
|
TO_CHR_Y(p.y), shift_pressed,
|
||||||
control_pressed, is_alt_pressed());
|
control_pressed, is_alt_pressed());
|
||||||
term_mouse(term, b, translate_button(b),
|
|
||||||
MA_RELEASE, TO_CHR_X(p.x),
|
|
||||||
TO_CHR_Y(p.y), shift_pressed,
|
|
||||||
control_pressed, is_alt_pressed());
|
|
||||||
} /* else: not sure when this can fail */
|
} /* else: not sure when this can fail */
|
||||||
} else {
|
} else {
|
||||||
/* trigger a scroll */
|
/* trigger a scroll */
|
||||||
|
Loading…
Reference in New Issue
Block a user