To: vim_dev@googlegroups.com Subject: Patch 8.2.4936 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.4936 Problem: MS-Windows: mouse coordinates for scroll event are wrong. Solution: Convert coordinates to the text area coordinates. (closes #10400) Files: src/gui_w32.c *** ../vim-8.2.4935/src/gui_w32.c 2022-05-08 22:37:41.723289228 +0100 --- src/gui_w32.c 2022-05-10 20:52:57.580125064 +0100 *************** *** 4146,4160 **** } /* ! * Intellimouse wheel handler. ! * Treat a mouse wheel event as if it were a scroll request. */ static void ! _OnMouseWheel(HWND hwnd, short zDelta, LPARAM param, int horizontal) { int button; win_T *wp; int modifiers, kbd_modifiers; wp = gui_mouse_window(FIND_POPUP); --- 4146,4161 ---- } /* ! * Mouse scroll event handler. */ static void ! _OnMouseWheel(HWND hwnd, WPARAM wParam, LPARAM lParam, int horizontal) { int button; win_T *wp; int modifiers, kbd_modifiers; + int zDelta = GET_WHEEL_DELTA_WPARAM(wParam); + POINT pt; wp = gui_mouse_window(FIND_POPUP); *************** *** 4207,4217 **** if ((kbd_modifiers & MOD_MASK_ALT) != 0) modifiers |= MOUSE_ALT; ! mch_disable_flush(); ! gui_send_mouse_event(button, GET_X_LPARAM(param), GET_Y_LPARAM(param), ! FALSE, kbd_modifiers); ! mch_enable_flush(); ! gui_may_flush(); } #ifdef USE_SYSMENU_FONT --- 4208,4219 ---- if ((kbd_modifiers & MOD_MASK_ALT) != 0) modifiers |= MOUSE_ALT; ! // The cursor position is relative to the upper-left corner of the screen. ! pt.x = GET_X_LPARAM(lParam); ! pt.y = GET_Y_LPARAM(lParam); ! ScreenToClient(s_textArea, &pt); ! ! gui_send_mouse_event(button, pt.x, pt.y, FALSE, kbd_modifiers); } #ifdef USE_SYSMENU_FONT *************** *** 4663,4670 **** WPARAM wParam, LPARAM lParam) { ! // TRACE("WndProc: hwnd = %08x, msg = %x, wParam = %x, lParam = %x\n", ! // hwnd, uMsg, wParam, lParam); HandleMouseHide(uMsg, lParam); --- 4665,4672 ---- WPARAM wParam, LPARAM lParam) { ! // ch_log(NULL, "WndProc: hwnd = %08x, msg = %x, wParam = %x, lParam = %x", ! // hwnd, uMsg, wParam, lParam); HandleMouseHide(uMsg, lParam); *************** *** 4763,4769 **** case WM_MOUSEWHEEL: case WM_MOUSEHWHEEL: ! _OnMouseWheel(hwnd, HIWORD(wParam), lParam, uMsg == WM_MOUSEHWHEEL); return 0L; // Notification for change in SystemParametersInfo() --- 4765,4771 ---- case WM_MOUSEWHEEL: case WM_MOUSEHWHEEL: ! _OnMouseWheel(hwnd, wParam, lParam, uMsg == WM_MOUSEHWHEEL); return 0L; // Notification for change in SystemParametersInfo() *** ../vim-8.2.4935/src/version.c 2022-05-10 19:13:19.674926902 +0100 --- src/version.c 2022-05-10 20:54:22.748088706 +0100 *************** *** 748,749 **** --- 748,751 ---- { /* Add new patch number below this line */ + /**/ + 4936, /**/ -- An error has occurred. Hit any user to continue. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///