Jacob's patch to cause Shift to return to copy-and-paste when xterm
authorsimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Fri, 7 Sep 2001 20:35:38 +0000 (20:35 +0000)
committersimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Fri, 7 Sep 2001 20:35:38 +0000 (20:35 +0000)
mouse tracking is enabled. (This can be turned off if your app
really wants Shift+mouse, but it defaults to on for general
usefulness.)

git-svn-id: svn://svn.tartarus.org/sgt/putty@1235 cda61777-01e9-0310-a592-d414129be87e

putty.h
settings.c
terminal.c
windlg.c
window.c

diff --git a/putty.h b/putty.h
index d8a6daf..39dfc94 100644 (file)
--- a/putty.h
+++ b/putty.h
@@ -333,6 +333,7 @@ typedef struct {
     /* Selection options */
     int mouse_is_xterm;
     int rawcnp;
+    int mouse_override;
     short wordness[256];
     /* translations */
     VT_Mode vtmode;
index 9db6fe2..d2ba357 100644 (file)
@@ -233,6 +233,7 @@ void save_settings(char *section, int do_host, Config * cfg)
     }
     write_setting_i(sesskey, "RawCNP", cfg->rawcnp);
     write_setting_i(sesskey, "MouseIsXterm", cfg->mouse_is_xterm);
+    write_setting_i(sesskey, "MouseOverride", cfg->mouse_override);
     for (i = 0; i < 256; i += 32) {
        char buf[20], buf2[256];
        int j;
@@ -432,6 +433,7 @@ void load_settings(char *section, int do_host, Config * cfg)
     }
     gppi(sesskey, "RawCNP", 0, &cfg->rawcnp);
     gppi(sesskey, "MouseIsXterm", 0, &cfg->mouse_is_xterm);
+    gppi(sesskey, "MouseOverride", 1, &cfg->mouse_override);
     for (i = 0; i < 256; i += 32) {
        static char *defaults[] = {
            "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0",
index 87c151e..8f8ec15 100644 (file)
@@ -3100,7 +3100,7 @@ void term_mouse(Mouse_Button b, Mouse_Action a, int x, int y,
     if ((ldata[cols] & LATTR_MODE) != LATTR_NORM)
        selpoint.x /= 2;
 
-    if (xterm_mouse) {
+    if (xterm_mouse && !(cfg.mouse_override && shift)) {
        int encstate = 0, r, c;
        char abuf[16];
        static int is_down = 0;
index d9206a8..a8f7ef0 100644 (file)
--- a/windlg.c
+++ b/windlg.c
@@ -470,6 +470,7 @@ enum { IDCX_ABOUT =
     IDC_MBSTATIC,
     IDC_MBWINDOWS,
     IDC_MBXTERM,
+    IDC_MOUSEOVERRIDE,
     IDC_CCSTATIC,
     IDC_CCLIST,
     IDC_CCSET,
@@ -749,6 +750,7 @@ static void init_dlg_ctrls(HWND hwnd, int keepsess)
 
     CheckRadioButton(hwnd, IDC_MBWINDOWS, IDC_MBXTERM,
                     cfg.mouse_is_xterm ? IDC_MBXTERM : IDC_MBWINDOWS);
+    CheckDlgButton(hwnd, IDC_MOUSEOVERRIDE, cfg.mouse_override);
     CheckDlgButton(hwnd, IDC_RAWCNP, cfg.rawcnp);
     {
        static int tabs[4] = { 25, 61, 96, 128 };
@@ -1108,7 +1110,7 @@ static void create_controls(HWND hwnd, int dlgtype, int panel)
     }
 
     if (panel == selectionpanelstart) {
-       /* The Selection panel. Accelerators used: [acgo] d wx hst */
+       /* The Selection panel. Accelerators used: [acgo] d wxp hst */
        struct ctlpos cp;
        ctlposinit(&cp, hwnd, 80, 3, 13);
        bartitle(&cp, "Options controlling copy and paste",
@@ -1125,6 +1127,9 @@ static void create_controls(HWND hwnd, int dlgtype, int panel)
                 "&Windows (Right pastes, Middle extends)", IDC_MBWINDOWS,
                 "&xterm (Right extends, Middle pastes)", IDC_MBXTERM,
                 NULL);
+       checkbox(&cp,
+                "Shift overrides a&pplication's use of mouse",
+                IDC_MOUSEOVERRIDE);
        endbox(&cp);
        beginbox(&cp, "Control the select-one-word-at-a-time mode",
                 IDC_BOX_SELECTION3);
@@ -2334,10 +2339,14 @@ static int GenericMainDlgProc(HWND hwnd, UINT msg,
                break;
              case IDC_RAWCNP:
                cfg.rawcnp = IsDlgButtonChecked(hwnd, IDC_RAWCNP);
+               break;
              case IDC_MBWINDOWS:
              case IDC_MBXTERM:
                cfg.mouse_is_xterm = IsDlgButtonChecked(hwnd, IDC_MBXTERM);
                break;
+             case IDC_MOUSEOVERRIDE:
+               cfg.mouse_override = IsDlgButtonChecked(hwnd, IDC_MOUSEOVERRIDE);
+               break;
              case IDC_CCSET:
                {
                    BOOL ok;
index 46bf64f..609b837 100644 (file)
--- a/window.c
+++ b/window.c
@@ -1129,7 +1129,8 @@ static void click(Mouse_Button b, int x, int y, int shift, int ctrl)
 {
     int thistime = GetMessageTime();
 
-    if (send_raw_mouse) {
+    if (send_raw_mouse && !(cfg.mouse_override && shift)) {
+       lastbtn = MBT_NOTHING;
        term_mouse(b, MA_CLICK, x, y, shift, ctrl);
        return;
     }