X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/cd1ed48ddbbb487a40bbf2ecc55ca1d8377c1819..d3155315c85212f224fc5df0239182dafdfd6284:/src/menu.c diff --git a/src/menu.c b/src/menu.c index 61163ae021..e925f29ac5 100644 --- a/src/menu.c +++ b/src/menu.c @@ -1,6 +1,6 @@ /* Platform-independent code for terminal communications. -Copyright (C) 1986, 1988, 1993-1994, 1996, 1999-2014 Free Software +Copyright (C) 1986, 1988, 1993-1994, 1996, 1999-2015 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -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);