diff options
| author | Eli Zaretskii | 2015-02-14 15:11:30 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2015-02-14 15:11:30 +0200 |
| commit | 93888585deba41f7f67a83cda2c69927ffb130c8 (patch) | |
| tree | 8de1cb6d12c67b5506556e0236351a4b9bebb1b0 /src/menu.c | |
| parent | 34c75359126e78367e4542a39b4b687c8955e1c6 (diff) | |
| download | emacs-93888585deba41f7f67a83cda2c69927ffb130c8.tar.gz emacs-93888585deba41f7f67a83cda2c69927ffb130c8.zip | |
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/menu.c')
| -rw-r--r-- | src/menu.c | 58 |
1 files changed, 31 insertions, 27 deletions
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. */) | |||
| 1243 | /* Use the mouse's current position. */ | 1243 | /* Use the mouse's current position. */ |
| 1244 | struct frame *new_f = SELECTED_FRAME (); | 1244 | struct frame *new_f = SELECTED_FRAME (); |
| 1245 | #ifdef HAVE_X_WINDOWS | 1245 | #ifdef HAVE_X_WINDOWS |
| 1246 | /* Can't use mouse_position_hook for X since it returns | 1246 | if (FRAME_X_P (new_f)) |
| 1247 | coordinates relative to the window the mouse is in, | ||
| 1248 | we need coordinates relative to the edit widget always. */ | ||
| 1249 | if (new_f != 0) | ||
| 1250 | { | 1247 | { |
| 1251 | int cur_x, cur_y; | 1248 | /* Can't use mouse_position_hook for X since it returns |
| 1252 | 1249 | coordinates relative to the window the mouse is in, | |
| 1253 | x_relative_mouse_position (new_f, &cur_x, &cur_y); | 1250 | we need coordinates relative to the edit widget always. */ |
| 1254 | /* cur_x/y may be negative, so use make_number. */ | 1251 | if (new_f != 0) |
| 1255 | x = make_number (cur_x); | 1252 | { |
| 1256 | y = make_number (cur_y); | 1253 | int cur_x, cur_y; |
| 1254 | |||
| 1255 | x_relative_mouse_position (new_f, &cur_x, &cur_y); | ||
| 1256 | /* cur_x/y may be negative, so use make_number. */ | ||
| 1257 | x = make_number (cur_x); | ||
| 1258 | y = make_number (cur_y); | ||
| 1259 | } | ||
| 1260 | } | ||
| 1261 | else | ||
| 1262 | #endif /* HAVE_X_WINDOWS */ | ||
| 1263 | { | ||
| 1264 | Lisp_Object bar_window; | ||
| 1265 | enum scroll_bar_part part; | ||
| 1266 | Time time; | ||
| 1267 | void (*mouse_position_hook) (struct frame **, int, | ||
| 1268 | Lisp_Object *, | ||
| 1269 | enum scroll_bar_part *, | ||
| 1270 | Lisp_Object *, | ||
| 1271 | Lisp_Object *, | ||
| 1272 | Time *) = | ||
| 1273 | FRAME_TERMINAL (new_f)->mouse_position_hook; | ||
| 1274 | |||
| 1275 | if (mouse_position_hook) | ||
| 1276 | (*mouse_position_hook) (&new_f, 1, &bar_window, | ||
| 1277 | &part, &x, &y, &time); | ||
| 1257 | } | 1278 | } |
| 1258 | |||
| 1259 | #else /* not HAVE_X_WINDOWS */ | ||
| 1260 | Lisp_Object bar_window; | ||
| 1261 | enum scroll_bar_part part; | ||
| 1262 | Time time; | ||
| 1263 | void (*mouse_position_hook) (struct frame **, int, | ||
| 1264 | Lisp_Object *, | ||
| 1265 | enum scroll_bar_part *, | ||
| 1266 | Lisp_Object *, | ||
| 1267 | Lisp_Object *, | ||
| 1268 | Time *) = | ||
| 1269 | FRAME_TERMINAL (new_f)->mouse_position_hook; | ||
| 1270 | |||
| 1271 | if (mouse_position_hook) | ||
| 1272 | (*mouse_position_hook) (&new_f, 1, &bar_window, | ||
| 1273 | &part, &x, &y, &time); | ||
| 1274 | #endif /* not HAVE_X_WINDOWS */ | ||
| 1275 | 1279 | ||
| 1276 | if (new_f != 0) | 1280 | if (new_f != 0) |
| 1277 | XSETFRAME (window, new_f); | 1281 | XSETFRAME (window, new_f); |