comparison src/xmenu.c @ 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 d6817c9c0413
children 6c9903c97bf4
comparison
equal deleted inserted replaced
6394:a829e7875542 6395:6240067bfe33
670 670
671 /* Decode the first argument: find the window and the coordinates. */ 671 /* Decode the first argument: find the window and the coordinates. */
672 if (EQ (position, Qt)) 672 if (EQ (position, Qt))
673 { 673 {
674 /* Use the mouse's current position. */ 674 /* Use the mouse's current position. */
675 FRAME_PTR new_f; 675 FRAME_PTR new_f = 0;
676 Lisp_Object bar_window; 676 Lisp_Object bar_window;
677 int part; 677 int part;
678 unsigned long time; 678 unsigned long time;
679 679
680 (*mouse_position_hook) (&new_f, &bar_window, &part, &x, &y, &time); 680 if (new_f != 0)
681 XSET (window, Lisp_Frame, new_f); 681 XSET (window, Lisp_Frame, new_f);
682 else
683 {
684 window = selected_window;
685 XFASTINT (x) = 0;
686 XFASTINT (y) = 0;
687 }
682 } 688 }
683 else 689 else
684 { 690 {
685 tem = Fcar (position); 691 tem = Fcar (position);
686 if (XTYPE (tem) == Lisp_Cons) 692 if (XTYPE (tem) == Lisp_Cons)
882 { 888 {
883 /* Decode the first argument: find the window and the coordinates. */ 889 /* Decode the first argument: find the window and the coordinates. */
884 if (EQ (position, Qt)) 890 if (EQ (position, Qt))
885 { 891 {
886 /* Use the mouse's current position. */ 892 /* Use the mouse's current position. */
887 FRAME_PTR new_f; 893 FRAME_PTR new_f = 0;
888 Lisp_Object bar_window; 894 Lisp_Object bar_window;
889 int part; 895 int part;
890 unsigned long time; 896 unsigned long time;
891 897
892 (*mouse_position_hook) (&new_f, &bar_window, &part, &x, &y, &time); 898 (*mouse_position_hook) (&new_f, &bar_window, &part, &x, &y, &time);
893 XSET (window, Lisp_Frame, new_f); 899
900 if (new_f != 0)
901 XSET (window, Lisp_Frame, new_f);
902 else
903 {
904 window = selected_window;
905 XFASTINT (x) = 0;
906 XFASTINT (y) = 0;
907 }
894 } 908 }
895 909
896 CHECK_NUMBER (x, 0); 910 CHECK_NUMBER (x, 0);
897 CHECK_NUMBER (y, 0); 911 CHECK_NUMBER (y, 0);
898 912
1806 free_menubar_widget_value_tree (first_wv); 1820 free_menubar_widget_value_tree (first_wv);
1807 1821
1808 /* No selection has been chosen yet. */ 1822 /* No selection has been chosen yet. */
1809 menu_item_selection = 0; 1823 menu_item_selection = 0;
1810 1824
1811
1812 /* Display the menu. */ 1825 /* Display the menu. */
1813 lw_pop_up_all_widgets (dialog_id); 1826 lw_pop_up_all_widgets (dialog_id);
1814 1827
1815 /* Process events that apply to the menu. */ 1828 /* Process events that apply to the menu. */
1816 while (1) 1829 while (1)