mirror of
https://github.com/vim/vim.git
synced 2025-09-25 03:54:15 -04:00
patch 8.1.2257: MS-Windows GUI: scroll wheel always uses current window
Problem: MS-Windows GUI: scroll wheel always uses current window. Solution: Add the 'scrollfocus' option for MS-Windows.
This commit is contained in:
@@ -6282,6 +6282,15 @@ A jump table for the options with a short description can be found at |Q_op|.
|
|||||||
file. This means that ":split | edit file" results in two windows
|
file. This means that ":split | edit file" results in two windows
|
||||||
with scroll-binding, but ":split file" does not.
|
with scroll-binding, but ":split file" does not.
|
||||||
|
|
||||||
|
*'scrollfocus'* *'scf'* *'noscrollfocus'* *'noscf'*
|
||||||
|
'scrollfocus' 'scf' boolean (default off)
|
||||||
|
global
|
||||||
|
{only for MS-Windows GUI}
|
||||||
|
When using the scroll wheel and this option is set, the window under
|
||||||
|
the mouse pointer is scrolled. With this option off the current
|
||||||
|
window is scrolled.
|
||||||
|
Systems other than MS-Windows behave like this option is on.
|
||||||
|
|
||||||
*'scrolljump'* *'sj'*
|
*'scrolljump'* *'sj'*
|
||||||
'scrolljump' 'sj' number (default 1)
|
'scrolljump' 'sj' number (default 1)
|
||||||
global
|
global
|
||||||
|
@@ -4234,60 +4234,58 @@ init_mouse_wheel(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Intellimouse wheel handler */
|
/*
|
||||||
|
* Intellimouse wheel handler.
|
||||||
|
* Treat a mouse wheel event as if it were a scroll request.
|
||||||
|
*/
|
||||||
static void
|
static void
|
||||||
_OnMouseWheel(
|
_OnMouseWheel(
|
||||||
HWND hwnd,
|
HWND hwnd,
|
||||||
short zDelta)
|
short zDelta)
|
||||||
{
|
{
|
||||||
/* Treat a mouse wheel event as if it were a scroll request */
|
|
||||||
int i;
|
int i;
|
||||||
int size;
|
int size;
|
||||||
HWND hwndCtl;
|
HWND hwndCtl;
|
||||||
|
win_T *wp;
|
||||||
|
|
||||||
if (curwin->w_scrollbars[SBAR_RIGHT].id != 0)
|
|
||||||
{
|
|
||||||
hwndCtl = curwin->w_scrollbars[SBAR_RIGHT].id;
|
|
||||||
size = curwin->w_scrollbars[SBAR_RIGHT].size;
|
|
||||||
}
|
|
||||||
else if (curwin->w_scrollbars[SBAR_LEFT].id != 0)
|
|
||||||
{
|
|
||||||
hwndCtl = curwin->w_scrollbars[SBAR_LEFT].id;
|
|
||||||
size = curwin->w_scrollbars[SBAR_LEFT].size;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return;
|
|
||||||
|
|
||||||
size = curwin->w_height;
|
|
||||||
if (mouse_scroll_lines == 0)
|
if (mouse_scroll_lines == 0)
|
||||||
init_mouse_wheel();
|
init_mouse_wheel();
|
||||||
|
|
||||||
|
wp = gui_mouse_window(FIND_POPUP);
|
||||||
|
|
||||||
#ifdef FEAT_TEXT_PROP
|
#ifdef FEAT_TEXT_PROP
|
||||||
|
if (wp != NULL && popup_is_popup(wp))
|
||||||
{
|
{
|
||||||
win_T *wp = gui_mouse_window(FIND_POPUP);
|
cmdarg_T cap;
|
||||||
|
oparg_T oa;
|
||||||
|
|
||||||
if (wp != NULL && popup_is_popup(wp))
|
// Mouse hovers over popup window, scroll it if possible.
|
||||||
{
|
mouse_row = wp->w_winrow;
|
||||||
cmdarg_T cap;
|
mouse_col = wp->w_wincol;
|
||||||
oparg_T oa;
|
vim_memset(&cap, 0, sizeof(cap));
|
||||||
|
cap.arg = zDelta < 0 ? MSCR_UP : MSCR_DOWN;
|
||||||
// Mouse hovers over popup window, scroll it if possible.
|
cap.cmdchar = zDelta < 0 ? K_MOUSEUP : K_MOUSEDOWN;
|
||||||
mouse_row = wp->w_winrow;
|
clear_oparg(&oa);
|
||||||
mouse_col = wp->w_wincol;
|
cap.oap = &oa;
|
||||||
vim_memset(&cap, 0, sizeof(cap));
|
nv_mousescroll(&cap);
|
||||||
cap.arg = zDelta < 0 ? MSCR_UP : MSCR_DOWN;
|
update_screen(0);
|
||||||
cap.cmdchar = zDelta < 0 ? K_MOUSEUP : K_MOUSEDOWN;
|
setcursor();
|
||||||
clear_oparg(&oa);
|
out_flush();
|
||||||
cap.oap = &oa;
|
return;
|
||||||
nv_mousescroll(&cap);
|
|
||||||
update_screen(0);
|
|
||||||
setcursor();
|
|
||||||
out_flush();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (wp == NULL || !p_scf)
|
||||||
|
wp = curwin;
|
||||||
|
|
||||||
|
if (wp->w_scrollbars[SBAR_RIGHT].id != 0)
|
||||||
|
hwndCtl = wp->w_scrollbars[SBAR_RIGHT].id;
|
||||||
|
else if (wp->w_scrollbars[SBAR_LEFT].id != 0)
|
||||||
|
hwndCtl = wp->w_scrollbars[SBAR_LEFT].id;
|
||||||
|
else
|
||||||
|
return;
|
||||||
|
size = wp->w_height;
|
||||||
|
|
||||||
mch_disable_flush();
|
mch_disable_flush();
|
||||||
if (mouse_scroll_lines > 0
|
if (mouse_scroll_lines > 0
|
||||||
&& mouse_scroll_lines < (size > 2 ? size - 2 : 1))
|
&& mouse_scroll_lines < (size > 2 ? size - 2 : 1))
|
||||||
|
@@ -814,6 +814,9 @@ EXTERN char_u *p_ruf; // 'rulerformat'
|
|||||||
EXTERN char_u *p_pp; // 'packpath'
|
EXTERN char_u *p_pp; // 'packpath'
|
||||||
EXTERN char_u *p_rtp; // 'runtimepath'
|
EXTERN char_u *p_rtp; // 'runtimepath'
|
||||||
EXTERN long p_sj; // 'scrolljump'
|
EXTERN long p_sj; // 'scrolljump'
|
||||||
|
#if defined(MSWIN) && defined(FEAT_GUI)
|
||||||
|
EXTERN int p_scf; // 'scrollfocus'
|
||||||
|
#endif
|
||||||
EXTERN long p_so; // 'scrolloff'
|
EXTERN long p_so; // 'scrolloff'
|
||||||
EXTERN char_u *p_sbo; // 'scrollopt'
|
EXTERN char_u *p_sbo; // 'scrollopt'
|
||||||
EXTERN char_u *p_sections; // 'sections'
|
EXTERN char_u *p_sections; // 'sections'
|
||||||
|
@@ -2148,6 +2148,13 @@ static struct vimoption options[] =
|
|||||||
{"scrollbind", "scb", P_BOOL|P_VI_DEF,
|
{"scrollbind", "scb", P_BOOL|P_VI_DEF,
|
||||||
(char_u *)VAR_WIN, PV_SCBIND,
|
(char_u *)VAR_WIN, PV_SCBIND,
|
||||||
{(char_u *)FALSE, (char_u *)0L} SCTX_INIT},
|
{(char_u *)FALSE, (char_u *)0L} SCTX_INIT},
|
||||||
|
{"scrollfocus", "scf", P_BOOL|P_VI_DEF,
|
||||||
|
#if defined(MSWIN) && defined(FEAT_GUI)
|
||||||
|
(char_u *)&p_scf, PV_NONE,
|
||||||
|
#else
|
||||||
|
(char_u *)NULL, PV_NONE,
|
||||||
|
#endif
|
||||||
|
{(char_u *)FALSE, (char_u *)0L} SCTX_INIT},
|
||||||
{"scrolljump", "sj", P_NUM|P_VI_DEF|P_VIM,
|
{"scrolljump", "sj", P_NUM|P_VI_DEF|P_VIM,
|
||||||
(char_u *)&p_sj, PV_NONE,
|
(char_u *)&p_sj, PV_NONE,
|
||||||
{(char_u *)1L, (char_u *)0L} SCTX_INIT},
|
{(char_u *)1L, (char_u *)0L} SCTX_INIT},
|
||||||
|
@@ -741,6 +741,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 */
|
||||||
|
/**/
|
||||||
|
2257,
|
||||||
/**/
|
/**/
|
||||||
2256,
|
2256,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user