]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
Introduce a new mouse handling option, in which the right button
authorSimon Tatham <anakin@pobox.com>
Thu, 20 Nov 2003 18:41:12 +0000 (18:41 +0000)
committerSimon Tatham <anakin@pobox.com>
Thu, 20 Nov 2003 18:41:12 +0000 (18:41 +0000)
brings up the context menu (and you can then paste by selecting
`Paste'). Should be more friendly to Windows-oriented users as
opposed to expatriate X users; also has the effect of making it more
difficult to paste into PuTTY by a single misplaced mouse click,
which has been a common theme of complaint recently.
For the moment, `Compromise' (the X-like behaviour with the right
and middle buttons reversed so that two-button users still get the
two most important functions) is still the default. I'm uncertain
that it might not be better to make the new option the default,
though, since the compromise option is optimal for _nobody_.

[originally from svn r3565]

wincfg.c
window.c

index ffb18113474c88180c4d7e5421556eee5deb9c9b..070e6f53dd33108ec66163aee43842d82f05b850 100644 (file)
--- a/wincfg.c
+++ b/wincfg.c
@@ -246,12 +246,13 @@ void win_setup_config_box(struct controlbox *b, HWND *hwndp, int has_help,
      */
     s = ctrl_getset(b, "Window/Selection", "mouse",
                    "Control use of mouse");
-    ctrl_radiobuttons(s, "Action of mouse buttons:", NO_SHORTCUT, 1,
+    ctrl_radiobuttons(s, "Action of mouse buttons:", 'm', 1,
                      HELPCTX(selection_buttons),
                      dlg_stdradiobutton_handler,
                      I(offsetof(Config, mouse_is_xterm)),
-                     "Windows (Right pastes, Middle extends)", 'w', I(0),
-                     "xterm (Right extends, Middle pastes)", 'x', I(1), NULL);
+                     "Windows (Middle extends, Right brings up menu)", I(2),
+                     "Compromise (Middle extends, Right pastes)", I(0),
+                     "xterm (Right extends, Middle pastes)", I(1), NULL);
     /*
      * This really ought to go at the _top_ of its box, not the
      * bottom, so we'll just do some shuffling now we've set it
index db6451371975d61f0b74ade3d4ad9e4d3e98f7d8..9c77861f453e93d6734aa63bc86d7a22a4b052db 100644 (file)
--- a/window.c
+++ b/window.c
@@ -1640,9 +1640,9 @@ static Mouse_Button translate_button(Mouse_Button button)
     if (button == MBT_LEFT)
        return MBT_SELECT;
     if (button == MBT_MIDDLE)
-       return cfg.mouse_is_xterm ? MBT_PASTE : MBT_EXTEND;
+       return cfg.mouse_is_xterm == 1 ? MBT_PASTE : MBT_EXTEND;
     if (button == MBT_RIGHT)
-       return cfg.mouse_is_xterm ? MBT_EXTEND : MBT_PASTE;
+       return cfg.mouse_is_xterm == 1 ? MBT_EXTEND : MBT_PASTE;
     return 0;                         /* shouldn't happen */
 }
 
@@ -2028,9 +2028,11 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
       case WM_LBUTTONUP:
       case WM_MBUTTONUP:
       case WM_RBUTTONUP:
-       if (message == WM_RBUTTONDOWN && (wParam & MK_CONTROL)) {
+       if (message == WM_RBUTTONDOWN &&
+           ((wParam & MK_CONTROL) || (cfg.mouse_is_xterm == 2))) {
            POINT cursorpos;
 
+           show_mouseptr(1);          /* make sure pointer is visible */
            GetCursorPos(&cursorpos);
            TrackPopupMenu(popup_menus[CTXMENU].menu,
                           TPM_LEFTALIGN | TPM_TOPALIGN | TPM_RIGHTBUTTON,