To: vim-dev@vim.org Subject: Patch 5.6.038 Fcc: outbox From: Bram Moolenaar ------------ Patch 5.6.038 Problem: Multi-clicks in GUI are interpreted as a mouse wheel click. When 'ttymouse' is "xterm" a mouse click is interpreted as a mouse wheel click. Solution: Don't recognize the mouse wheel in check_termcode() in the GUI. Use 0x43 for a mouse drag in do_xterm_trace(), not 0x63. Files: src/term.c, src/os_unix.c *** ../vim-5.6.37/src/term.c Sat Mar 25 20:39:12 2000 --- src/term.c Tue Mar 28 17:40:05 2000 *************** *** 3148,3153 **** --- 3148,3154 ---- int mouse_code = 0; /* init for GCC */ int modifiers; int is_click, is_drag; + int wheel_code = 0; int current_button; static int held_button = MOUSE_RELEASE; static int orig_num_clicks = 1; *************** *** 3371,3397 **** slen += num_bytes; /* ! * Handle mouse events other than using the mouse wheel. */ # ifdef UNIX ! if (use_xterm_mouse() > 1) { ! if ((mouse_code & MOUSE_DRAG_XTERM) ! && mouse_code < MOUSEWHEEL_LOW) mouse_code |= MOUSE_DRAG; } # endif # ifdef XTERM_CLIP ! else { ! if (!(mouse_code & MOUSE_DRAG & ~MOUSE_CLICK_MASK) ! && mouse_code < MOUSEWHEEL_LOW) ! { ! if ((mouse_code & MOUSE_RELEASE) == MOUSE_RELEASE) ! stop_xterm_trace(); ! else ! start_xterm_trace(mouse_code); ! } } # endif } --- 3372,3405 ---- slen += num_bytes; /* ! * Handle mouse events. ! * Recognize the xterm mouse wheel, but not in the GUI ! * (multi-clicks use >= 0x60). */ + if (mouse_code >= MOUSEWHEEL_LOW + #ifdef USE_GUI + && !gui.in_use + #endif + ) + { + /* Keep the mouse_code before it's changed, so that we + * remember that it was a mouse wheel click. */ + wheel_code = mouse_code; + } # ifdef UNIX ! else if (use_xterm_mouse() > 1) { ! if (mouse_code & MOUSE_DRAG_XTERM) mouse_code |= MOUSE_DRAG; } # endif # ifdef XTERM_CLIP ! else if (!(mouse_code & MOUSE_DRAG & ~MOUSE_CLICK_MASK)) { ! if ((mouse_code & MOUSE_RELEASE) == MOUSE_RELEASE) ! stop_xterm_trace(); ! else ! start_xterm_trace(mouse_code); } # endif } *************** *** 3574,3580 **** is_drag = TRUE; current_button = held_button; } ! else if (mouse_code < MOUSEWHEEL_LOW) { # if defined(UNIX) && defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H) # ifdef GPM_MOUSE --- 3582,3588 ---- is_drag = TRUE; current_button = held_button; } ! else if (wheel_code == 0) { # if defined(UNIX) && defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H) # ifdef GPM_MOUSE *************** *** 3659,3666 **** /* Work out our pseudo mouse event */ key_name[0] = (int)KS_EXTRA; ! if (mouse_code >= MOUSEWHEEL_LOW) ! key_name[1] = (mouse_code & 1) ? KE_MOUSEUP : KE_MOUSEDOWN; else key_name[1] = get_pseudo_mouse_code(current_button, is_click, is_drag); --- 3667,3674 ---- /* Work out our pseudo mouse event */ key_name[0] = (int)KS_EXTRA; ! if (wheel_code != 0) ! key_name[1] = (wheel_code & 1) ? KE_MOUSEUP : KE_MOUSEDOWN; else key_name[1] = get_pseudo_mouse_code(current_button, is_click, is_drag); *** ../vim-5.6.37/src/os_unix.c Thu Mar 23 17:46:04 2000 --- src/os_unix.c Tue Mar 28 17:39:35 2000 *************** *** 4038,4044 **** STRCPY(buf, mouse_code); strp = buf + STRLEN(buf); ! *strp++ = xterm_button | MOUSE_DRAG; *strp++ = (char_u)(col + ' ' + 1); *strp++ = (char_u)(row + ' ' + 1); *strp = 0; --- 4038,4044 ---- STRCPY(buf, mouse_code); strp = buf + STRLEN(buf); ! *strp++ = (xterm_button | MOUSE_DRAG) & ~0x20; *strp++ = (char_u)(col + ' ' + 1); *strp++ = (char_u)(row + ' ' + 1); *strp = 0; *** ../vim-5.6.37/src/version.c Tue Mar 28 11:58:41 2000 --- src/version.c Tue Mar 28 16:23:09 2000 *************** *** 420,421 **** --- 420,423 ---- { /* Add new patch number below this line */ + /**/ + 38, /**/ -- Q: Is selling software the same as selling hardware? A: No, good hardware is sold new, good software has already been used by many. /-/-- Bram Moolenaar --- Bram@moolenaar.net --- http://www.moolenaar.net --\-\ \-\-- Vim: http://www.vim.org ---- ICCF Holland: http://www.vim.org/iccf --/-/