summaryrefslogtreecommitdiff
path: root/src/popupwin.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/popupwin.c')
-rw-r--r--src/popupwin.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/src/popupwin.c b/src/popupwin.c
index e8abf6dc3..7aef27358 100644
--- a/src/popupwin.c
+++ b/src/popupwin.c
@@ -222,14 +222,22 @@ popup_on_border(win_T *wp, int row, int col)
}
/*
- * Return TRUE if "row"/"col" is on the "X" button of the popup.
+ * Return TRUE and close the popup if "row"/"col" is on the "X" button of the
+ * popup and w_popup_close is POPCLOSE_BUTTON.
* The values are relative to the top-left corner.
- * Caller should check w_popup_close is POPCLOSE_BUTTON.
+ * Caller should check the left mouse button was clicked.
+ * Return TRUE if the popup was closed.
*/
int
-popup_on_X_button(win_T *wp, int row, int col)
+popup_close_if_on_X(win_T *wp, int row, int col)
{
- return row == 0 && col == popup_width(wp) - 1;
+ if (wp->w_popup_close == POPCLOSE_BUTTON
+ && row == 0 && col == popup_width(wp) - 1)
+ {
+ popup_close_for_mouse_click(wp);
+ return TRUE;
+ }
+ return FALSE;
}
// Values set when dragging a popup window starts.
@@ -2635,6 +2643,16 @@ popup_do_filter(int c)
popup_reset_handled();
+ if (c == K_LEFTMOUSE)
+ {
+ int row = mouse_row;
+ int col = mouse_col;
+
+ wp = mouse_find_win(&row, &col, FIND_POPUP);
+ if (wp != NULL && popup_close_if_on_X(wp, row, col))
+ return TRUE;
+ }
+
while (!res && (wp = find_next_popup(FALSE)) != NULL)
if (wp->w_filter_cb.cb_name != NULL)
res = invoke_popup_filter(wp, c);