Mercurial > emacs
changeset 2147:1b6e54507323
(Fx_popup_menu): Allow a frame instead of a window, in arg.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Fri, 12 Mar 1993 06:20:52 +0000 |
parents | e0e6af0c26ef |
children | 9b8040c3f320 |
files | src/xmenu.c |
diffstat | 1 files changed, 19 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/src/xmenu.c Thu Mar 11 21:36:22 1993 +0000 +++ b/src/xmenu.c Fri Mar 12 06:20:52 1993 +0000 @@ -89,7 +89,7 @@ POSITION is a position specification. This is either a mouse button event\n\ or a list ((XOFFSET YOFFSET) WINDOW)\n\ where XOFFSET and YOFFSET are positions in characters from the top left\n\ -corner of WINDOW's frame. A mouse-event list will serve for this.\n\ +corner of WINDOW's frame. (WINDOW may be a frame object instead of a window.)\n\ This controls the position of the center of the first line\n\ in the first pane of the menu, not the top left of the menu as a whole.\n\ \n\ @@ -138,16 +138,28 @@ x = Fcar (tem); y = Fcdr (tem); } - CHECK_LIVE_WINDOW (window, 0); CHECK_NUMBER (x, 0); CHECK_NUMBER (y, 0); - f = XFRAME (WINDOW_FRAME (XWINDOW (window))); + if (XTYPE (window) == Lisp_Frame) + { + f = XFRAME (window); - XMenu_xpos - = FONT_WIDTH (f->display.x->font) * (XINT (x) + XWINDOW (window)->left); - XMenu_ypos - = FONT_HEIGHT (f->display.x->font) * (XINT (y) + XWINDOW (window)->top); + XMenu_xpos = 0; + XMenu_ypos = 0; + } + else if (XTYPE (window) == Lisp_Window) + { + CHECK_LIVE_WINDOW (window, 0); + f = XFRAME (WINDOW_FRAME (XWINDOW (window))); + + XMenu_xpos = FONT_WIDTH (f->display.x->font) * XWINDOW (window)->left; + XMenu_ypos = FONT_HEIGHT (f->display.x->font) * XWINDOW (window)->top; + } + + XMenu_xpos += FONT_WIDTH (f->display.x->font) * XINT (x); + XMenu_ypos += FONT_HEIGHT (f->display.x->font) * XINT (y); + XMenu_xpos += f->display.x->left_pos; XMenu_ypos += f->display.x->top_pos;