aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2015-02-14 15:03:20 +0200
committerEli Zaretskii2015-02-14 15:03:20 +0200
commit432b00e6597f2a1eec192d807ad554a430f96f93 (patch)
tree99be029c5d1fcfa6586050c50db94527dc0b1f9b /src
parent0077b36e2ed14e484c1f736496db9314ef7ca177 (diff)
downloademacs-432b00e6597f2a1eec192d807ad554a430f96f93.tar.gz
emacs-432b00e6597f2a1eec192d807ad554a430f96f93.zip
Fix assertions in popping up menus on TTY (Bug#19862)
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.
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 20d3fb34034..52be915ecb9 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
12015-02-14 Eli Zaretskii <eliz@gnu.org>
2
3 * menu.c (Fx_popup_menu) [HAVE_X_WINDOWS]: Call
4 mouse_position_for_popup only for X frames. (Bug#19862)
5
12015-02-13 Eli Zaretskii <eliz@gnu.org> 62015-02-13 Eli Zaretskii <eliz@gnu.org>
2 7
3 * buffer.c (syms_of_buffer): Doc fix. (Bug#19841) 8 * buffer.c (syms_of_buffer): Doc fix. (Bug#19841)
diff --git a/src/menu.c b/src/menu.c
index e318da059a3..3e0a89dc076 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -1238,35 +1238,39 @@ no quit occurs and `x-popup-menu' returns nil. */)
1238 /* Use the mouse's current position. */ 1238 /* Use the mouse's current position. */
1239 struct frame *new_f = SELECTED_FRAME (); 1239 struct frame *new_f = SELECTED_FRAME ();
1240#ifdef HAVE_X_WINDOWS 1240#ifdef HAVE_X_WINDOWS
1241 /* Can't use mouse_position_hook for X since it returns 1241 if (FRAME_X_P (new_f))
1242 coordinates relative to the window the mouse is in,
1243 we need coordinates relative to the edit widget always. */
1244 if (new_f != 0)
1245 { 1242 {
1246 int cur_x, cur_y; 1243 /* Can't use mouse_position_hook for X since it returns
1247 1244 coordinates relative to the window the mouse is in,
1248 mouse_position_for_popup (new_f, &cur_x, &cur_y); 1245 we need coordinates relative to the edit widget always. */
1249 /* cur_x/y may be negative, so use make_number. */ 1246 if (new_f != 0)
1250 x = make_number (cur_x); 1247 {
1251 y = make_number (cur_y); 1248 int cur_x, cur_y;
1249
1250 mouse_position_for_popup (new_f, &cur_x, &cur_y);
1251 /* cur_x/y may be negative, so use make_number. */
1252 x = make_number (cur_x);
1253 y = make_number (cur_y);
1254 }
1255 }
1256 else
1257#endif /* HAVE_X_WINDOWS */
1258 {
1259 Lisp_Object bar_window;
1260 enum scroll_bar_part part;
1261 Time time;
1262 void (*mouse_position_hook) (struct frame **, int,
1263 Lisp_Object *,
1264 enum scroll_bar_part *,
1265 Lisp_Object *,
1266 Lisp_Object *,
1267 Time *) =
1268 FRAME_TERMINAL (new_f)->mouse_position_hook;
1269
1270 if (mouse_position_hook)
1271 (*mouse_position_hook) (&new_f, 1, &bar_window,
1272 &part, &x, &y, &time);
1252 } 1273 }
1253
1254#else /* not HAVE_X_WINDOWS */
1255 Lisp_Object bar_window;
1256 enum scroll_bar_part part;
1257 Time time;
1258 void (*mouse_position_hook) (struct frame **, int,
1259 Lisp_Object *,
1260 enum scroll_bar_part *,
1261 Lisp_Object *,
1262 Lisp_Object *,
1263 Time *) =
1264 FRAME_TERMINAL (new_f)->mouse_position_hook;
1265
1266 if (mouse_position_hook)
1267 (*mouse_position_hook) (&new_f, 1, &bar_window,
1268 &part, &x, &y, &time);
1269#endif /* not HAVE_X_WINDOWS */
1270 1274
1271 if (new_f != 0) 1275 if (new_f != 0)
1272 XSETFRAME (window, new_f); 1276 XSETFRAME (window, new_f);