From c0d36a72bafa08f598e164ee65bd16fed78a4ef7 Mon Sep 17 00:00:00 2001 From: simon Date: Sat, 9 Mar 2002 11:47:39 +0000 Subject: [PATCH] Well, there was bound to be one I'd forgotten: the new Features panel should include an option to disable xterm mouse reporting. So now it does. Woo. git-svn-id: svn://svn.tartarus.org/sgt/putty@1579 cda61777-01e9-0310-a592-d414129be87e --- doc/config.but | 26 +++++++++++++++++++++++++- putty.h | 1 + settings.c | 2 ++ terminal.c | 11 +++++++++-- windlg.c | 13 ++++++++++++- window.c | 4 +++- 6 files changed, 52 insertions(+), 5 deletions(-) diff --git a/doc/config.but b/doc/config.but index b7e16acd..5387a8a3 100644 --- a/doc/config.but +++ b/doc/config.but @@ -1,4 +1,4 @@ -\versionid $Id: config.but,v 1.27 2002/03/06 23:04:20 simon Exp $ +\versionid $Id: config.but,v 1.28 2002/03/09 11:47:39 simon Exp $ \C{config} Configuring PuTTY @@ -668,6 +668,26 @@ then do not deal correctly with the modified keys. You can force these modes to be permanently disabled no matter what the server tries to do. +\S{config-features-mouse} Disabling \cw{xterm}-style mouse reporting + +\cfg{winhelp-topic}{features.mouse} + +PuTTY allows the server to send control codes that let it take over +the mouse and use it for purposes other than copy and paste. +Applications which use this feature include the text-mode web +browser \c{links}, the Usenet newsreader \c{trn} version 4, and the +file manager \c{mc} (Midnight Commander). + +If you find this feature inconvenient, you can disable it using the +\q{Disable xterm-style mouse reporting} control. With this box +ticked, the mouse will \e{always} do copy and paste in the normal +way. + +Note that even if the application takes over the mouse, you can +still manage PuTTY's copy and paste by holding down the Shift key +while you select and paste, unless you have deliberately turned this +feature off (see \k{config-mouseshift}). + \S{config-features-resize} Disabling remote terminal resizing \cfg{winhelp-topic}{features.resize} @@ -1098,6 +1118,10 @@ unchecking the \q{Shift overrides application's use of mouse} checkbox will cause Shift + mouse clicks to go to the server as well (so that mouse-driven copy and paste will be completely disabled). +If you want to prevent the application from taking over the mouse at +all, you can do this using the Features control panel; see +\k{config-features-mouse}. + \S{config-rectselect} Default selection mode \cfg{winhelp-topic}{selection.rect} diff --git a/putty.h b/putty.h index 52e39dfc..e37c1a18 100644 --- a/putty.h +++ b/putty.h @@ -277,6 +277,7 @@ typedef struct { int funky_type; int no_applic_c; /* totally disable app cursor keys */ int no_applic_k; /* totally disable app keypad */ + int no_mouse_rep; /* totally disable mouse reporting */ int no_remote_resize; /* disable remote resizing */ int no_alt_screen; /* disable alternate screen */ int no_remote_wintitle; /* disable remote retitling */ diff --git a/settings.c b/settings.c index aead1061..3d54fe1f 100644 --- a/settings.c +++ b/settings.c @@ -189,6 +189,7 @@ void save_settings(char *section, int do_host, Config * cfg) write_setting_i(sesskey, "LinuxFunctionKeys", cfg->funky_type); write_setting_i(sesskey, "NoApplicationKeys", cfg->no_applic_k); write_setting_i(sesskey, "NoApplicationCursors", cfg->no_applic_c); + write_setting_i(sesskey, "NoMouseReporting", cfg->no_mouse_rep); write_setting_i(sesskey, "NoRemoteResize", cfg->no_remote_resize); write_setting_i(sesskey, "NoAltScreen", cfg->no_alt_screen); write_setting_i(sesskey, "NoRemoteWinTitle", cfg->no_remote_wintitle); @@ -385,6 +386,7 @@ void load_settings(char *section, int do_host, Config * cfg) gppi(sesskey, "LinuxFunctionKeys", 0, &cfg->funky_type); gppi(sesskey, "NoApplicationKeys", 0, &cfg->no_applic_k); gppi(sesskey, "NoApplicationCursors", 0, &cfg->no_applic_c); + gppi(sesskey, "NoMouseReporting", 0, &cfg->no_mouse_rep); gppi(sesskey, "NoRemoteResize", 0, &cfg->no_remote_resize); gppi(sesskey, "NoAltScreen", 0, &cfg->no_alt_screen); gppi(sesskey, "NoRemoteWinTitle", 0, &cfg->no_remote_wintitle); diff --git a/terminal.c b/terminal.c index 8afb98b8..af175d52 100644 --- a/terminal.c +++ b/terminal.c @@ -352,12 +352,17 @@ void term_pwron(void) /* * When the user reconfigures us, we need to check the forbidden- - * alternate-screen config option. + * alternate-screen config option, and also disable raw mouse mode + * if the user has disabled mouse reporting. */ void term_reconfig(void) { if (cfg.no_alt_screen) swap_screen(0); + if (cfg.no_mouse_rep) { + xterm_mouse = 0; + set_raw_mouse_mode(0); + } if (cfg.no_remote_charset) { cset_attr[0] = cset_attr[1] = ATTR_ASCII; sco_acs = alt_sco_acs = 0; @@ -3387,7 +3392,9 @@ void term_mouse(Mouse_Button b, Mouse_Action a, int x, int y, { pos selpoint; unsigned long *ldata; - int raw_mouse = xterm_mouse && !(cfg.mouse_override && shift); + int raw_mouse = (xterm_mouse && + !cfg.no_mouse_rep && + !(cfg.mouse_override && shift)); int default_seltype; if (y < 0) { diff --git a/windlg.c b/windlg.c index 2acf223a..2912040f 100644 --- a/windlg.c +++ b/windlg.c @@ -329,6 +329,7 @@ enum { IDCX_ABOUT = IDC_BOX_FEATURES1, IDC_NOAPPLICK, IDC_NOAPPLICC, + IDC_NOMOUSEREP, IDC_NORESIZE, IDC_NOALTSCREEN, IDC_NOWINTITLE, @@ -687,6 +688,8 @@ char *help_context_cmd(int id) case IDC_NOAPPLICK: case IDC_NOAPPLICC: return "JI(`',`features.application')"; + case IDC_NOMOUSEREP: + return "JI(`',`features.mouse')"; case IDC_NORESIZE: return "JI(`',`features.resize')"; case IDC_NOALTSCREEN: @@ -989,6 +992,7 @@ static void init_dlg_ctrls(HWND hwnd, int keepsess) cfg.funky_type == 5 ? IDC_FUNCSCO : IDC_FUNCTILDE); CheckDlgButton(hwnd, IDC_NOAPPLICC, cfg.no_applic_c); CheckDlgButton(hwnd, IDC_NOAPPLICK, cfg.no_applic_k); + CheckDlgButton(hwnd, IDC_NOMOUSEREP, cfg.no_mouse_rep); CheckDlgButton(hwnd, IDC_NORESIZE, cfg.no_remote_resize); CheckDlgButton(hwnd, IDC_NOALTSCREEN, cfg.no_alt_screen); CheckDlgButton(hwnd, IDC_NOWINTITLE, cfg.no_remote_wintitle); @@ -1353,7 +1357,7 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) } if (panel == featurespanelstart) { - /* The Features panel. Accelerators used: [acgoh] ukswtbr */ + /* The Features panel. Accelerators used: [acgoh] ukswtbrx */ struct ctlpos cp; ctlposinit(&cp, hwnd, 80, 3, 13); bartitle(&cp, "Enabling and disabling advanced terminal features ", @@ -1361,6 +1365,7 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) beginbox(&cp, NULL, IDC_BOX_FEATURES1); checkbox(&cp, "Disable application c&ursor keys mode", IDC_NOAPPLICC); checkbox(&cp, "Disable application &keypad mode", IDC_NOAPPLICK); + checkbox(&cp, "Disable &xterm-style mouse reporting", IDC_NOMOUSEREP); checkbox(&cp, "Disable remote-controlled terminal re&sizing", IDC_NORESIZE); checkbox(&cp, "Disable s&witching to alternate terminal screen", @@ -2315,6 +2320,12 @@ static int GenericMainDlgProc(HWND hwnd, UINT msg, cfg.no_applic_k = IsDlgButtonChecked(hwnd, IDC_NOAPPLICK); break; + case IDC_NOMOUSEREP: + if (HIWORD(wParam) == BN_CLICKED || + HIWORD(wParam) == BN_DOUBLECLICKED) + cfg.no_mouse_rep = + IsDlgButtonChecked(hwnd, IDC_NOMOUSEREP); + break; case IDC_NORESIZE: if (HIWORD(wParam) == BN_CLICKED || HIWORD(wParam) == BN_DOUBLECLICKED) diff --git a/window.c b/window.c index a0e3b03f..66067100 100644 --- a/window.c +++ b/window.c @@ -756,7 +756,8 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) } } - cleanup_exit(msg.wParam); + cleanup_exit(msg.wParam); /* this doesn't return... */ + return msg.wParam; /* ... but optimiser doesn't know */ } /* @@ -816,6 +817,7 @@ char *do_select(SOCKET skt, int startup) */ void set_raw_mouse_mode(int activate) { + activate = activate && !cfg.no_mouse_rep; send_raw_mouse = activate; SetCursor(LoadCursor(NULL, activate ? IDC_ARROW : IDC_IBEAM)); } -- 2.11.0