1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 09:27:59 +00:00

Cleanup: make an enum for the values of CONF_mouse_is_xterm.

Again, there's no sensible reason why these should be written at the
point of use as bare integers.
This commit is contained in:
Simon Tatham 2023-05-29 15:52:32 +01:00
parent fd9bc8c86a
commit 5e055a374f
2 changed files with 10 additions and 3 deletions

View File

@ -487,6 +487,13 @@ enum {
RESIZE_TERM, RESIZE_DISABLED, RESIZE_FONT, RESIZE_EITHER
};
enum {
/* Mouse-button assignments */
MOUSE_COMPROMISE, /* xterm-ish but with paste on RB in case no MB exists */
MOUSE_XTERM, /* xterm-style: MB pastes, RB extends selection */
MOUSE_WINDOWS /* Windows-style: RB brings up menu. MB still extends. */
};
enum {
/* Function key types (CONF_funky_type) */
FUNKY_TILDE,

View File

@ -2046,10 +2046,10 @@ static Mouse_Button translate_button(WinGuiSeat *wgs, Mouse_Button button)
if (button == MBT_LEFT)
return MBT_SELECT;
if (button == MBT_MIDDLE)
return conf_get_int(wgs->conf, CONF_mouse_is_xterm) == 1 ?
return conf_get_int(wgs->conf, CONF_mouse_is_xterm) == MOUSE_XTERM ?
MBT_PASTE : MBT_EXTEND;
if (button == MBT_RIGHT)
return conf_get_int(wgs->conf, CONF_mouse_is_xterm) == 1 ?
return conf_get_int(wgs->conf, CONF_mouse_is_xterm) == MOUSE_XTERM ?
MBT_EXTEND : MBT_PASTE;
return 0; /* shouldn't happen */
}
@ -2603,7 +2603,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
case WM_RBUTTONUP:
if (message == WM_RBUTTONDOWN &&
((wParam & MK_CONTROL) ||
(conf_get_int(wgs->conf, CONF_mouse_is_xterm) == 2))) {
(conf_get_int(wgs->conf, CONF_mouse_is_xterm) == MOUSE_WINDOWS))) {
POINT cursorpos;
/* Just in case this happened in mid-select */