changeset 6395:6240067bfe33

(Fx_popup_dialog, Fx_popup_menu): Handle case where mouse_position_hook doesn't store anything.
author Richard M. Stallman <rms@gnu.org>
date Fri, 18 Mar 1994 01:27:43 +0000
parents a829e7875542
children 1740ec160ff8
files src/xmenu.c
diffstat 1 files changed, 19 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/xmenu.c	Fri Mar 18 00:31:13 1994 +0000
+++ b/src/xmenu.c	Fri Mar 18 01:27:43 1994 +0000
@@ -672,13 +672,19 @@
       if (EQ (position, Qt))
 	{
 	  /* Use the mouse's current position.  */
-	  FRAME_PTR new_f;
+	  FRAME_PTR new_f = 0;
 	  Lisp_Object bar_window;
 	  int part;
 	  unsigned long time;
 
-	  (*mouse_position_hook) (&new_f, &bar_window, &part, &x, &y, &time);
-	  XSET (window, Lisp_Frame, new_f);
+	  if (new_f != 0)
+	    XSET (window, Lisp_Frame, new_f);
+	  else
+	    {
+	      window = selected_window;
+	      XFASTINT (x) = 0;
+	      XFASTINT (y) = 0;
+	    }
 	}
       else
 	{
@@ -884,13 +890,21 @@
       if (EQ (position, Qt))
 	{
 	  /* Use the mouse's current position.  */
-	  FRAME_PTR new_f;
+	  FRAME_PTR new_f = 0;
 	  Lisp_Object bar_window;
 	  int part;
 	  unsigned long time;
 
 	  (*mouse_position_hook) (&new_f, &bar_window, &part, &x, &y, &time);
-	  XSET (window, Lisp_Frame, new_f);
+
+	  if (new_f != 0)
+	    XSET (window, Lisp_Frame, new_f);
+	  else
+	    {
+	      window = selected_window;
+	      XFASTINT (x) = 0;
+	      XFASTINT (y) = 0;
+	    }
 	}
 
       CHECK_NUMBER (x, 0);
@@ -1808,7 +1822,6 @@
   /* No selection has been chosen yet.  */
   menu_item_selection = 0;
 
-
   /* Display the menu.  */
   lw_pop_up_all_widgets (dialog_id);