]> code.delx.au - gnu-emacs/commitdiff
Fix assertions in popping up menus on TTY (Bug#19862)
authorEli Zaretskii <eliz@gnu.org>
Sat, 14 Feb 2015 13:03:20 +0000 (15:03 +0200)
committerEli Zaretskii <eliz@gnu.org>
Sat, 14 Feb 2015 13:03:20 +0000 (15:03 +0200)
Do not merge this commit to trunk!

 src/menu.c (Fx_popup_menu) [HAVE_X_WINDOWS]: Call
 mouse_position_for_popup only for X frames.

src/ChangeLog
src/menu.c

index 20d3fb34034c16b5ad218f1b4213092d3a7fc056..52be915ecb97cb5f0dadac5349f6250ff071022c 100644 (file)
@@ -1,3 +1,8 @@
+2015-02-14  Eli Zaretskii  <eliz@gnu.org>
+
+       * menu.c (Fx_popup_menu) [HAVE_X_WINDOWS]: Call
+       mouse_position_for_popup only for X frames.  (Bug#19862)
+
 2015-02-13  Eli Zaretskii  <eliz@gnu.org>
 
        * buffer.c (syms_of_buffer): Doc fix.  (Bug#19841)
index e318da059a33140b28fb8acda1e7cfd572c2211b..3e0a89dc0761b487fce945fc685a1a6762bb6aae 100644 (file)
@@ -1238,35 +1238,39 @@ no quit occurs and `x-popup-menu' returns nil.  */)
        /* Use the mouse's current position.  */
        struct frame *new_f = SELECTED_FRAME ();
 #ifdef HAVE_X_WINDOWS
-       /* Can't use mouse_position_hook for X since it returns
-          coordinates relative to the window the mouse is in,
-          we need coordinates relative to the edit widget always.  */
-       if (new_f != 0)
+       if (FRAME_X_P (new_f))
          {
-           int cur_x, cur_y;
-
-           mouse_position_for_popup (new_f, &cur_x, &cur_y);
-           /* cur_x/y may be negative, so use make_number.  */
-           x = make_number (cur_x);
-           y = make_number (cur_y);
+           /* Can't use mouse_position_hook for X since it returns
+              coordinates relative to the window the mouse is in,
+              we need coordinates relative to the edit widget always.  */
+           if (new_f != 0)
+             {
+               int cur_x, cur_y;
+
+               mouse_position_for_popup (new_f, &cur_x, &cur_y);
+               /* cur_x/y may be negative, so use make_number.  */
+               x = make_number (cur_x);
+               y = make_number (cur_y);
+             }
+         }
+       else
+#endif /* HAVE_X_WINDOWS */
+         {
+           Lisp_Object bar_window;
+           enum scroll_bar_part part;
+           Time time;
+           void (*mouse_position_hook) (struct frame **, int,
+                                        Lisp_Object *,
+                                        enum scroll_bar_part *,
+                                        Lisp_Object *,
+                                        Lisp_Object *,
+                                        Time *) =
+             FRAME_TERMINAL (new_f)->mouse_position_hook;
+
+           if (mouse_position_hook)
+             (*mouse_position_hook) (&new_f, 1, &bar_window,
+                                     &part, &x, &y, &time);
          }
-
-#else /* not HAVE_X_WINDOWS */
-       Lisp_Object bar_window;
-       enum scroll_bar_part part;
-       Time time;
-        void (*mouse_position_hook) (struct frame **, int,
-                                     Lisp_Object *,
-                                     enum scroll_bar_part *,
-                                     Lisp_Object *,
-                                     Lisp_Object *,
-                                     Time *) =
-         FRAME_TERMINAL (new_f)->mouse_position_hook;
-
-       if (mouse_position_hook)
-         (*mouse_position_hook) (&new_f, 1, &bar_window,
-                                 &part, &x, &y, &time);
-#endif /* not HAVE_X_WINDOWS */
 
        if (new_f != 0)
          XSETFRAME (window, new_f);