Skip to content

Commit 49fe95f

Browse files
committed
patch 8.1.1652: GUI: popup window doesn't close on mouse movement
Problem: GUI: popup window doesn't close on mouse movement. (Paul Jolly) Solution: Generate mouse-move events when a popup window is visible.
1 parent 9992244 commit 49fe95f

3 files changed

Lines changed: 32 additions & 14 deletions

File tree

src/globals.h

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,11 @@ EXTERN int aucmd_win_used INIT(= FALSE); /* aucmd_win is being used */
603603
#ifdef FEAT_TEXT_PROP
604604
EXTERN win_T *first_popupwin; // first global popup window
605605
EXTERN win_T *popup_dragwin INIT(= NULL); // popup window being dragged
606+
607+
// Set to TRUE if there is any visible popup.
608+
EXTERN int popup_visible INIT(= FALSE);
609+
610+
EXTERN int text_prop_frozen INIT(= 0);
606611
#endif
607612

608613
/*
@@ -1680,10 +1685,3 @@ typedef int HINSTANCE;
16801685
EXTERN int ctrl_break_was_pressed INIT(= FALSE);
16811686
EXTERN HINSTANCE g_hinst INIT(= NULL);
16821687
#endif
1683-
1684-
#ifdef FEAT_TEXT_PROP
1685-
EXTERN int text_prop_frozen INIT(= 0);
1686-
1687-
// Set to TRUE if there is any visible popup.
1688-
EXTERN int popup_visible INIT(= FALSE);
1689-
#endif

src/gui.c

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4823,18 +4823,15 @@ gui_focus_change(int in_focus)
48234823
}
48244824

48254825
/*
4826-
* Called when the mouse moved (but not when dragging).
4826+
* When mouse moved: apply 'mousefocus'.
4827+
* Also updates the mouse pointer shape.
48274828
*/
4828-
void
4829-
gui_mouse_moved(int x, int y)
4829+
static void
4830+
gui_mouse_focus(int x, int y)
48304831
{
48314832
win_T *wp;
48324833
char_u st[8];
48334834

4834-
/* Ignore this while still starting up. */
4835-
if (!gui.in_use || gui.starting)
4836-
return;
4837-
48384835
#ifdef FEAT_MOUSESHAPE
48394836
/* Get window pointer, and update mouse shape as well. */
48404837
wp = xy2win(x, y);
@@ -4893,6 +4890,27 @@ gui_mouse_moved(int x, int y)
48934890
}
48944891
}
48954892

4893+
/*
4894+
* Called when the mouse moved (but not when dragging).
4895+
*/
4896+
void
4897+
gui_mouse_moved(int x, int y)
4898+
{
4899+
// Ignore this while still starting up.
4900+
if (!gui.in_use || gui.starting)
4901+
return;
4902+
4903+
// apply 'mousefocus' and pointer shape
4904+
gui_mouse_focus(x, y);
4905+
4906+
#ifdef FEAT_TEXT_PROP
4907+
if (popup_visible)
4908+
// Generate a mouse-moved event, so that the popup can perhaps be
4909+
// closed, just like in the terminal.
4910+
gui_send_mouse_event(MOUSE_DRAG, x, y, FALSE, 0);
4911+
#endif
4912+
}
4913+
48964914
/*
48974915
* Called when mouse should be moved to window with focus.
48984916
*/

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -777,6 +777,8 @@ static char *(features[]) =
777777

778778
static int included_patches[] =
779779
{ /* Add new patch number below this line */
780+
/**/
781+
1652,
780782
/**/
781783
1651,
782784
/**/

0 commit comments

Comments
 (0)