patch 8.1.1673: cannot easily find the popup window at a certain position

Problem:    Cannot easily find the popup window at a certain position.
Solution:   Add popup_locate().
diff --git a/src/evalfunc.c b/src/evalfunc.c
index 4ee0d5d..43c8028 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -781,6 +781,7 @@
     {"popup_getoptions", 1, 1, f_popup_getoptions},
     {"popup_getpos",	1, 1, f_popup_getpos},
     {"popup_hide",	1, 1, f_popup_hide},
+    {"popup_locate",	2, 2, f_popup_locate},
     {"popup_menu",	2, 2, f_popup_menu},
     {"popup_move",	2, 2, f_popup_move},
     {"popup_notification", 2, 2, f_popup_notification},
diff --git a/src/popupwin.c b/src/popupwin.c
index aa19a5d..ea85588 100644
--- a/src/popupwin.c
+++ b/src/popupwin.c
@@ -1890,6 +1890,20 @@
 		      win_valid(wp) && (wp->w_popup_flags & POPF_HIDDEN) == 0);
     }
 }
+/*
+ * popup_locate({row}, {col})
+ */
+    void
+f_popup_locate(typval_T *argvars, typval_T *rettv)
+{
+    int		row = tv_get_number(&argvars[0]) - 1;
+    int		col = tv_get_number(&argvars[1]) - 1;
+    win_T	*wp;
+
+    wp = mouse_find_win(&row, &col, FIND_POPUP);
+    if (WIN_IS_POPUP(wp))
+	rettv->vval.v_number = wp->w_id;
+}
 
 /*
  * For popup_getoptions(): add a "border" or "padding" entry to "dict".
diff --git a/src/proto/popupwin.pro b/src/proto/popupwin.pro
index 7733368..d1267e0 100644
--- a/src/proto/popupwin.pro
+++ b/src/proto/popupwin.pro
@@ -29,6 +29,7 @@
 void f_popup_move(typval_T *argvars, typval_T *rettv);
 void f_popup_setoptions(typval_T *argvars, typval_T *rettv);
 void f_popup_getpos(typval_T *argvars, typval_T *rettv);
+void f_popup_locate(typval_T *argvars, typval_T *rettv);
 void f_popup_getoptions(typval_T *argvars, typval_T *rettv);
 int error_if_popup_window(void);
 void popup_reset_handled(void);
diff --git a/src/testdir/test_popupwin.vim b/src/testdir/test_popupwin.vim
index 7b7b1bd..a55e913 100644
--- a/src/testdir/test_popupwin.vim
+++ b/src/testdir/test_popupwin.vim
@@ -713,7 +713,7 @@
   topleft vnew
   call setline(1, 'hello')
 
-  call popup_create('world', {
+  let winid = popup_create('world', {
 	\ 'line': 1,
 	\ 'col': 1,
 	\ 'minwidth': 20,
@@ -723,6 +723,11 @@
   let line = join(map(range(1, 5), 'screenstring(1, v:val)'), '')
   call assert_equal('world', line)
 
+  call assert_equal(winid, popup_locate(1, 1))
+  call assert_equal(winid, popup_locate(1, 20))
+  call assert_equal(0, popup_locate(1, 21))
+  call assert_equal(0, popup_locate(2, 1))
+
   sleep 700m
   redraw
   let line = join(map(range(1, 5), 'screenstring(1, v:val)'), '')
diff --git a/src/version.c b/src/version.c
index ea5de7d..07c0d7a 100644
--- a/src/version.c
+++ b/src/version.c
@@ -778,6 +778,8 @@
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1673,
+/**/
     1672,
 /**/
     1671,