/*
* Close a popup window by Window-id.
* Does not invoke the callback.
+ * Return OK if the popup was closed, FAIL otherwise.
*/
- void
+ int
popup_close(int id)
{
win_T *wp;
if (wp == curwin)
{
error_for_popup_window();
- return;
+ return FAIL;
}
if (prev == NULL)
first_popupwin = wp->w_next;
else
prev->w_next = wp->w_next;
popup_free(wp);
- return;
+ return OK;
}
// go through tab-local popups
FOR_ALL_TABPAGES(tp)
- popup_close_tabpage(tp, id);
+ if (popup_close_tabpage(tp, id) == OK)
+ return OK;
+ return FAIL;
}
/*
* Close a popup window with Window-id "id" in tabpage "tp".
*/
- void
+ int
popup_close_tabpage(tabpage_T *tp, int id)
{
win_T *wp;
if (wp == curwin)
{
error_for_popup_window();
- return;
+ return FAIL;
}
if (prev == NULL)
*root = wp->w_next;
else
prev->w_next = wp->w_next;
popup_free(wp);
- return;
+ return OK;
}
+ return FAIL;
}
void
if (ERROR_IF_ANY_POPUP_WINDOW)
return;
while (first_popupwin != NULL)
- popup_close(first_popupwin->w_id);
+ if (popup_close(first_popupwin->w_id) == FAIL)
+ return;
while (curtab->tp_first_popupwin != NULL)
- popup_close(curtab->tp_first_popupwin->w_id);
+ if (popup_close(curtab->tp_first_popupwin->w_id) == FAIL)
+ return;
}
/*
void f_popup_show(typval_T *argvars, typval_T *rettv);
void f_popup_settext(typval_T *argvars, typval_T *rettv);
int error_if_popup_window(int also_with_term);
-void popup_close(int id);
-void popup_close_tabpage(tabpage_T *tp, int id);
+int popup_close(int id);
+int popup_close_tabpage(tabpage_T *tp, int id);
void close_all_popups(void);
void f_popup_move(typval_T *argvars, typval_T *rettv);
void f_popup_setoptions(typval_T *argvars, typval_T *rettv);