0
0
mirror of https://github.com/vim/vim.git synced 2025-10-16 07:24:23 -04:00

patch 9.0.0793: MS-Windows: mouse scroll events only work with the dll

Problem:    MS-Windows: mouse scroll events only work with the dll.
Solution:   Accept CSI codes for MS-Windows without the GUI. (Christopher
            Plewright, closes #11401)
This commit is contained in:
Christopher Plewright
2022-10-19 11:54:46 +01:00
committed by Bram Moolenaar
parent bf72e0c67f
commit 605d02a9b7
3 changed files with 13 additions and 13 deletions

View File

@@ -1745,8 +1745,10 @@ vgetc(void)
// Get two extra bytes for special keys // Get two extra bytes for special keys
if (c == K_SPECIAL if (c == K_SPECIAL
#ifdef FEAT_GUI #if defined(FEAT_GUI) || defined(MSWIN)
|| (c == CSI) // GUI codes start with CSI; MS-Windows sends mouse scroll
// events with CSI.
|| c == CSI
#endif #endif
) )
{ {

View File

@@ -1231,7 +1231,6 @@ mch_bevalterm_changed(void)
} }
# endif # endif
#ifdef VIMDLL
/* /*
* Win32 console mouse scroll event handler. * Win32 console mouse scroll event handler.
* Loosely based on the _OnMouseWheel() function in gui_w32.c * Loosely based on the _OnMouseWheel() function in gui_w32.c
@@ -1264,10 +1263,8 @@ decode_mouse_wheel(MOUSE_EVENT_RECORD *pmer)
g_yMouse = pmer->dwMousePosition.Y; g_yMouse = pmer->dwMousePosition.Y;
#ifdef FEAT_PROP_POPUP #ifdef FEAT_PROP_POPUP
int lcol; int lcol = g_xMouse;
int lrow; int lrow = g_yMouse;
lcol = g_xMouse;
lrow = g_yMouse;
wp = mouse_find_win(&lrow, &lcol, FAIL_POPUP); wp = mouse_find_win(&lrow, &lcol, FAIL_POPUP);
if (wp != NULL && popup_is_popup(wp)) if (wp != NULL && popup_is_popup(wp))
{ {
@@ -1312,9 +1309,9 @@ decode_mouse_wheel(MOUSE_EVENT_RECORD *pmer)
// Decode the win32 console key modifers into Vim mouse modifers. // Decode the win32 console key modifers into Vim mouse modifers.
if (pmer->dwControlKeyState & SHIFT_PRESSED) if (pmer->dwControlKeyState & SHIFT_PRESSED)
modifiers |= MOD_MASK_SHIFT; //MOUSE_SHIFT; modifiers |= MOD_MASK_SHIFT; // MOUSE_SHIFT;
if (pmer->dwControlKeyState & (RIGHT_CTRL_PRESSED | LEFT_CTRL_PRESSED)) if (pmer->dwControlKeyState & (RIGHT_CTRL_PRESSED | LEFT_CTRL_PRESSED))
modifiers |= MOD_MASK_CTRL; //MOUSE_CTRL; modifiers |= MOD_MASK_CTRL; // MOUSE_CTRL;
if (pmer->dwControlKeyState & (RIGHT_ALT_PRESSED | LEFT_ALT_PRESSED)) if (pmer->dwControlKeyState & (RIGHT_ALT_PRESSED | LEFT_ALT_PRESSED))
modifiers |= MOD_MASK_ALT; // MOUSE_ALT; modifiers |= MOD_MASK_ALT; // MOUSE_ALT;
@@ -1324,7 +1321,6 @@ decode_mouse_wheel(MOUSE_EVENT_RECORD *pmer)
return; return;
} }
#endif
/* /*
* Decode a MOUSE_EVENT. If it's a valid event, return MOUSE_LEFT, * Decode a MOUSE_EVENT. If it's a valid event, return MOUSE_LEFT,
@@ -1395,17 +1391,17 @@ decode_mouse_event(
return FALSE; return FALSE;
} }
// unprocessed mouse click? // If there is an unprocessed mouse click drop this one.
if (g_nMouseClick != -1) if (g_nMouseClick != -1)
return TRUE; return TRUE;
#ifdef VIMDLL
if (pmer->dwEventFlags == MOUSE_WHEELED if (pmer->dwEventFlags == MOUSE_WHEELED
|| pmer->dwEventFlags == MOUSE_HWHEELED) || pmer->dwEventFlags == MOUSE_HWHEELED)
{ {
decode_mouse_wheel(pmer); decode_mouse_wheel(pmer);
return TRUE; // we now should have a mouse scroll in g_nMouseClick return TRUE; // we now should have a mouse scroll in g_nMouseClick
} }
#endif
nButton = -1; nButton = -1;
g_xMouse = pmer->dwMousePosition.X; g_xMouse = pmer->dwMousePosition.X;
g_yMouse = pmer->dwMousePosition.Y; g_yMouse = pmer->dwMousePosition.Y;

View File

@@ -695,6 +695,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 */
/**/
793,
/**/ /**/
792, 792,
/**/ /**/