To: vim_dev@googlegroups.com Subject: Patch 8.1.1652 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.1652 Problem: GUI: popup window doesn't close on mouse movement. (Paul Jolly) Solution: Generate mouse-move events when a popup window is visible. Files: src/gui.c, src/globals.h *** ../vim-8.1.1651/src/gui.c 2019-07-07 14:56:19.424152595 +0200 --- src/gui.c 2019-07-08 21:57:15.551709893 +0200 *************** *** 4823,4840 **** } /* ! * Called when the mouse moved (but not when dragging). */ ! void ! gui_mouse_moved(int x, int y) { win_T *wp; char_u st[8]; - /* Ignore this while still starting up. */ - if (!gui.in_use || gui.starting) - return; - #ifdef FEAT_MOUSESHAPE /* Get window pointer, and update mouse shape as well. */ wp = xy2win(x, y); --- 4823,4837 ---- } /* ! * When mouse moved: apply 'mousefocus'. ! * Also updates the mouse pointer shape. */ ! static void ! gui_mouse_focus(int x, int y) { win_T *wp; char_u st[8]; #ifdef FEAT_MOUSESHAPE /* Get window pointer, and update mouse shape as well. */ wp = xy2win(x, y); *************** *** 4894,4899 **** --- 4891,4917 ---- } /* + * Called when the mouse moved (but not when dragging). + */ + void + gui_mouse_moved(int x, int y) + { + // Ignore this while still starting up. + if (!gui.in_use || gui.starting) + return; + + // apply 'mousefocus' and pointer shape + gui_mouse_focus(x, y); + + #ifdef FEAT_TEXT_PROP + if (popup_visible) + // Generate a mouse-moved event, so that the popup can perhaps be + // closed, just like in the terminal. + gui_send_mouse_event(MOUSE_DRAG, x, y, FALSE, 0); + #endif + } + + /* * Called when mouse should be moved to window with focus. */ void *** ../vim-8.1.1651/src/globals.h 2019-06-23 00:15:02.581534910 +0200 --- src/globals.h 2019-07-08 21:31:14.830985363 +0200 *************** *** 603,608 **** --- 603,613 ---- #ifdef FEAT_TEXT_PROP EXTERN win_T *first_popupwin; // first global popup window EXTERN win_T *popup_dragwin INIT(= NULL); // popup window being dragged + + // Set to TRUE if there is any visible popup. + EXTERN int popup_visible INIT(= FALSE); + + EXTERN int text_prop_frozen INIT(= 0); #endif /* *************** *** 1680,1689 **** EXTERN int ctrl_break_was_pressed INIT(= FALSE); EXTERN HINSTANCE g_hinst INIT(= NULL); #endif - - #ifdef FEAT_TEXT_PROP - EXTERN int text_prop_frozen INIT(= 0); - - // Set to TRUE if there is any visible popup. - EXTERN int popup_visible INIT(= FALSE); - #endif --- 1685,1687 ---- *** ../vim-8.1.1651/src/version.c 2019-07-08 20:58:22.315648064 +0200 --- src/version.c 2019-07-08 21:54:53.819641061 +0200 *************** *** 779,780 **** --- 779,782 ---- { /* Add new patch number below this line */ + /**/ + 1652, /**/ -- A poem: read aloud: <> !*''# Waka waka bang splat tick tick hash, ^"`$$- Caret quote back-tick dollar dollar dash, !*=@$_ Bang splat equal at dollar under-score, %*<> ~#4 Percent splat waka waka tilde number four, &[]../ Ampersand bracket bracket dot dot slash, |{,,SYSTEM HALTED Vertical-bar curly-bracket comma comma CRASH. Fred Bremmer and Steve Kroese (Calvin College & Seminary of Grand Rapids, MI.) /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///