Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
patch 8.0.1582: in the MS-Windows console mouse movement is not used
Problem:    In the MS-Windows console mouse movement is not used.
Solution:   Pass mouse movement events when useful.
  • Loading branch information
brammool committed Mar 6, 2018
1 parent 3b3a9a5 commit 157d813
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/feature.h
Expand Up @@ -1318,7 +1318,7 @@
/*
* +balloon_eval_term Allow balloon expression evaluation in the terminal.
*/
#if defined(FEAT_HUGE) && defined(UNIX) && defined(FEAT_TIMERS)
#if defined(FEAT_HUGE) && (defined(UNIX) || defined(WIN32)) && defined(FEAT_TIMERS)
# define FEAT_BEVAL_TERM
#endif

Expand Down
27 changes: 24 additions & 3 deletions src/os_win32.c
Expand Up @@ -1164,6 +1164,18 @@ mch_setmouse(int on)
SetConsoleMode(g_hConIn, cmodein);
}


#if defined(FEAT_BEVAL_TERM) || defined(PROTO)
/*
* Called when 'balloonevalterm' changed.
*/
void
mch_bevalterm_changed(void)
{
mch_setmouse(g_fMouseActive);
}
#endif

/*
* Decode a MOUSE_EVENT. If it's a valid event, return MOUSE_LEFT,
* MOUSE_MIDDLE, or MOUSE_RIGHT for a click; MOUSE_DRAG for a mouse
Expand Down Expand Up @@ -1243,7 +1255,7 @@ decode_mouse_event(

if (pmer->dwEventFlags == MOUSE_MOVED)
{
/* ignore MOUSE_MOVED events if (x, y) hasn't changed. (We get these
/* Ignore MOUSE_MOVED events if (x, y) hasn't changed. (We get these
* events even when the mouse moves only within a char cell.) */
if (s_xOldMouse == g_xMouse && s_yOldMouse == g_yMouse)
return FALSE;
Expand All @@ -1252,11 +1264,20 @@ decode_mouse_event(
/* If no buttons are pressed... */
if ((pmer->dwButtonState & ((1 << cButtons) - 1)) == 0)
{
nButton = MOUSE_RELEASE;

/* If the last thing returned was MOUSE_RELEASE, ignore this */
if (s_fReleased)
return FALSE;
{
#ifdef FEAT_BEVAL_TERM
/* do return mouse move events when we want them */
if (p_bevalterm)
nButton = MOUSE_DRAG;
else
#endif
return FALSE;
}

nButton = MOUSE_RELEASE;
s_fReleased = TRUE;
}
else /* one or more buttons pressed */
Expand Down
1 change: 1 addition & 0 deletions src/proto/os_win32.pro
Expand Up @@ -6,6 +6,7 @@ int dyn_libintl_init(void);
void dyn_libintl_end(void);
void PlatformId(void);
void mch_setmouse(int on);
void mch_bevalterm_changed(void);
void mch_update_cursor(void);
int mch_char_avail(void);
int mch_check_messages(void);
Expand Down
2 changes: 2 additions & 0 deletions src/version.c
Expand Up @@ -766,6 +766,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1582,
/**/
1581,
/**/
Expand Down

0 comments on commit 157d813

Please sign in to comment.