mirror of
https://github.com/vim/vim.git
synced 2025-10-03 05:14:07 -04:00
patch 8.2.4936: MS-Windows: mouse coordinates for scroll event are wrong
Problem: MS-Windows: mouse coordinates for scroll event are wrong. Solution: Convert coordinates to the text area coordinates. (closes #10400)
This commit is contained in:
@@ -4146,15 +4146,16 @@ init_mouse_wheel(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Intellimouse wheel handler.
|
* Mouse scroll event handler.
|
||||||
* Treat a mouse wheel event as if it were a scroll request.
|
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
_OnMouseWheel(HWND hwnd, short zDelta, LPARAM param, int horizontal)
|
_OnMouseWheel(HWND hwnd, WPARAM wParam, LPARAM lParam, int horizontal)
|
||||||
{
|
{
|
||||||
int button;
|
int button;
|
||||||
win_T *wp;
|
win_T *wp;
|
||||||
int modifiers, kbd_modifiers;
|
int modifiers, kbd_modifiers;
|
||||||
|
int zDelta = GET_WHEEL_DELTA_WPARAM(wParam);
|
||||||
|
POINT pt;
|
||||||
|
|
||||||
wp = gui_mouse_window(FIND_POPUP);
|
wp = gui_mouse_window(FIND_POPUP);
|
||||||
|
|
||||||
@@ -4207,11 +4208,12 @@ _OnMouseWheel(HWND hwnd, short zDelta, LPARAM param, int horizontal)
|
|||||||
if ((kbd_modifiers & MOD_MASK_ALT) != 0)
|
if ((kbd_modifiers & MOD_MASK_ALT) != 0)
|
||||||
modifiers |= MOUSE_ALT;
|
modifiers |= MOUSE_ALT;
|
||||||
|
|
||||||
mch_disable_flush();
|
// The cursor position is relative to the upper-left corner of the screen.
|
||||||
gui_send_mouse_event(button, GET_X_LPARAM(param), GET_Y_LPARAM(param),
|
pt.x = GET_X_LPARAM(lParam);
|
||||||
FALSE, kbd_modifiers);
|
pt.y = GET_Y_LPARAM(lParam);
|
||||||
mch_enable_flush();
|
ScreenToClient(s_textArea, &pt);
|
||||||
gui_may_flush();
|
|
||||||
|
gui_send_mouse_event(button, pt.x, pt.y, FALSE, kbd_modifiers);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_SYSMENU_FONT
|
#ifdef USE_SYSMENU_FONT
|
||||||
@@ -4663,8 +4665,8 @@ _WndProc(
|
|||||||
WPARAM wParam,
|
WPARAM wParam,
|
||||||
LPARAM lParam)
|
LPARAM lParam)
|
||||||
{
|
{
|
||||||
// TRACE("WndProc: hwnd = %08x, msg = %x, wParam = %x, lParam = %x\n",
|
// ch_log(NULL, "WndProc: hwnd = %08x, msg = %x, wParam = %x, lParam = %x",
|
||||||
// hwnd, uMsg, wParam, lParam);
|
// hwnd, uMsg, wParam, lParam);
|
||||||
|
|
||||||
HandleMouseHide(uMsg, lParam);
|
HandleMouseHide(uMsg, lParam);
|
||||||
|
|
||||||
@@ -4763,7 +4765,7 @@ _WndProc(
|
|||||||
|
|
||||||
case WM_MOUSEWHEEL:
|
case WM_MOUSEWHEEL:
|
||||||
case WM_MOUSEHWHEEL:
|
case WM_MOUSEHWHEEL:
|
||||||
_OnMouseWheel(hwnd, HIWORD(wParam), lParam, uMsg == WM_MOUSEHWHEEL);
|
_OnMouseWheel(hwnd, wParam, lParam, uMsg == WM_MOUSEHWHEEL);
|
||||||
return 0L;
|
return 0L;
|
||||||
|
|
||||||
// Notification for change in SystemParametersInfo()
|
// Notification for change in SystemParametersInfo()
|
||||||
|
@@ -746,6 +746,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
4936,
|
||||||
/**/
|
/**/
|
||||||
4935,
|
4935,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user