comparison src/gui_beval.c @ 16600:ff3c99bd1038 v8.1.1303

patch 8.1.1303: not possible to hide a balloon commit https://github.com/vim/vim/commit/be0a2597ae0d9eb0b8a8a2fc9ae1784faa929844 Author: Bram Moolenaar <Bram@vim.org> Date: Thu May 9 13:50:16 2019 +0200 patch 8.1.1303: not possible to hide a balloon Problem: Not possible to hide a balloon. Solution: Hide the balloon when balloon_show() is called with an empty string or list. Add balloon_gettext().
author Bram Moolenaar <Bram@vim.org>
date Thu, 09 May 2019 14:00:07 +0200
parents 7fad90423bd2
children 041156ce1d22
comparison
equal deleted inserted replaced
16599:319fe0ad8fdc 16600:ff3c99bd1038
115 #else 115 #else
116 beval->target = (Widget)target; 116 beval->target = (Widget)target;
117 beval->appContext = XtWidgetToApplicationContext((Widget)target); 117 beval->appContext = XtWidgetToApplicationContext((Widget)target);
118 #endif 118 #endif
119 beval->showState = ShS_NEUTRAL; 119 beval->showState = ShS_NEUTRAL;
120 beval->msg = mesg; 120 vim_free(beval->msg);
121 beval->msg = mesg == NULL ? NULL : vim_strsave(mesg);
121 beval->msgCB = mesgCB; 122 beval->msgCB = mesgCB;
122 beval->clientData = clientData; 123 beval->clientData = clientData;
123 124
124 /* 125 /*
125 * Set up event handler which will keep its eyes on the pointer, 126 * Set up event handler which will keep its eyes on the pointer,
206 * Show a balloon with "mesg". 207 * Show a balloon with "mesg".
207 */ 208 */
208 void 209 void
209 gui_mch_post_balloon(BalloonEval *beval, char_u *mesg) 210 gui_mch_post_balloon(BalloonEval *beval, char_u *mesg)
210 { 211 {
211 beval->msg = mesg; 212 vim_free(beval->msg);
212 if (mesg != NULL) 213 beval->msg = mesg == NULL ? NULL : vim_strsave(mesg);
214 if (beval->msg != NULL)
213 drawBalloon(beval); 215 drawBalloon(beval);
214 else 216 else
215 undrawBalloon(beval); 217 undrawBalloon(beval);
216 } 218 }
217 # endif /* !FEAT_GUI_MSWIN */ 219 # endif /* !FEAT_GUI_MSWIN */
223 * Hide the given balloon. 225 * Hide the given balloon.
224 */ 226 */
225 void 227 void
226 gui_mch_unpost_balloon(BalloonEval *beval) 228 gui_mch_unpost_balloon(BalloonEval *beval)
227 { 229 {
230 VIM_CLEAR(beval->msg);
228 undrawBalloon(beval); 231 undrawBalloon(beval);
229 } 232 }
230 #endif 233 #endif
231 234
232 #ifdef FEAT_GUI_GTK 235 #ifdef FEAT_GUI_GTK
973 gtk_widget_set_uposition(beval->balloonShell, x, y); 976 gtk_widget_set_uposition(beval->balloonShell, x, y);
974 # endif 977 # endif
975 gtk_widget_show(beval->balloonShell); 978 gtk_widget_show(beval->balloonShell);
976 979
977 beval->showState = ShS_SHOWING; 980 beval->showState = ShS_SHOWING;
981 gui_mch_update();
978 } 982 }
979 } 983 }
980 984
981 /* 985 /*
982 * Undraw a balloon. 986 * Undraw a balloon.