summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2015-02-14 15:11:30 +0200
committerEli Zaretskii <eliz@gnu.org>2015-02-14 15:11:30 +0200
commit93888585deba41f7f67a83cda2c69927ffb130c8 (patch)
tree8de1cb6d12c67b5506556e0236351a4b9bebb1b0 /src
parent34c75359126e78367e4542a39b4b687c8955e1c6 (diff)
downloademacs-93888585deba41f7f67a83cda2c69927ffb130c8.tar.gz
Fix assertion violations when popping menus on TTY (Bug#19862)
src/menu.c (Fx_popup_menu) [HAVE_X_WINDOWS]: Call x_relative_mouse_position only for X frames.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog5
-rw-r--r--src/menu.c58
2 files changed, 36 insertions, 27 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 6d246fb52c6..5144738a708 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2015-02-14 Eli Zaretskii <eliz@gnu.org>
+
+ * menu.c (Fx_popup_menu) [HAVE_X_WINDOWS]: Call
+ x_relative_mouse_position only for X frames. (Bug#19862)
+
2015-02-13 Paul Eggert <eggert@cs.ucla.edu>
Better support for future plugins
diff --git a/src/menu.c b/src/menu.c
index 5a8ea34242f..e925f29ac5f 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -1243,35 +1243,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;
-
- x_relative_mouse_position (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;
+
+ x_relative_mouse_position (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);