diff options
| author | Richard M. Stallman | 1993-03-12 06:20:52 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1993-03-12 06:20:52 +0000 |
| commit | 7da99777446e018cfe2eac5659034568db52a303 (patch) | |
| tree | e23b5f23ac2630062fcdf6523edf615b5aeae658 /src | |
| parent | 323e7e53e35a17765e92443b50b21398062bd05b (diff) | |
| download | emacs-7da99777446e018cfe2eac5659034568db52a303.tar.gz emacs-7da99777446e018cfe2eac5659034568db52a303.zip | |
(Fx_popup_menu): Allow a frame instead of a window, in arg.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xmenu.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/src/xmenu.c b/src/xmenu.c index bf0d4c497da..aa8ec70a520 100644 --- a/src/xmenu.c +++ b/src/xmenu.c | |||
| @@ -89,7 +89,7 @@ DEFUN ("x-popup-menu",Fx_popup_menu, Sx_popup_menu, 1, 2, 0, | |||
| 89 | POSITION is a position specification. This is either a mouse button event\n\ | 89 | POSITION is a position specification. This is either a mouse button event\n\ |
| 90 | or a list ((XOFFSET YOFFSET) WINDOW)\n\ | 90 | or a list ((XOFFSET YOFFSET) WINDOW)\n\ |
| 91 | where XOFFSET and YOFFSET are positions in characters from the top left\n\ | 91 | where XOFFSET and YOFFSET are positions in characters from the top left\n\ |
| 92 | corner of WINDOW's frame. A mouse-event list will serve for this.\n\ | 92 | corner of WINDOW's frame. (WINDOW may be a frame object instead of a window.)\n\ |
| 93 | This controls the position of the center of the first line\n\ | 93 | This controls the position of the center of the first line\n\ |
| 94 | in the first pane of the menu, not the top left of the menu as a whole.\n\ | 94 | in the first pane of the menu, not the top left of the menu as a whole.\n\ |
| 95 | \n\ | 95 | \n\ |
| @@ -138,16 +138,28 @@ be the return value for that line (i.e. if it is selected).") | |||
| 138 | x = Fcar (tem); | 138 | x = Fcar (tem); |
| 139 | y = Fcdr (tem); | 139 | y = Fcdr (tem); |
| 140 | } | 140 | } |
| 141 | CHECK_LIVE_WINDOW (window, 0); | ||
| 142 | CHECK_NUMBER (x, 0); | 141 | CHECK_NUMBER (x, 0); |
| 143 | CHECK_NUMBER (y, 0); | 142 | CHECK_NUMBER (y, 0); |
| 144 | 143 | ||
| 145 | f = XFRAME (WINDOW_FRAME (XWINDOW (window))); | 144 | if (XTYPE (window) == Lisp_Frame) |
| 145 | { | ||
| 146 | f = XFRAME (window); | ||
| 147 | |||
| 148 | XMenu_xpos = 0; | ||
| 149 | XMenu_ypos = 0; | ||
| 150 | } | ||
| 151 | else if (XTYPE (window) == Lisp_Window) | ||
| 152 | { | ||
| 153 | CHECK_LIVE_WINDOW (window, 0); | ||
| 154 | f = XFRAME (WINDOW_FRAME (XWINDOW (window))); | ||
| 155 | |||
| 156 | XMenu_xpos = FONT_WIDTH (f->display.x->font) * XWINDOW (window)->left; | ||
| 157 | XMenu_ypos = FONT_HEIGHT (f->display.x->font) * XWINDOW (window)->top; | ||
| 158 | } | ||
| 159 | |||
| 160 | XMenu_xpos += FONT_WIDTH (f->display.x->font) * XINT (x); | ||
| 161 | XMenu_ypos += FONT_HEIGHT (f->display.x->font) * XINT (y); | ||
| 146 | 162 | ||
| 147 | XMenu_xpos | ||
| 148 | = FONT_WIDTH (f->display.x->font) * (XINT (x) + XWINDOW (window)->left); | ||
| 149 | XMenu_ypos | ||
| 150 | = FONT_HEIGHT (f->display.x->font) * (XINT (y) + XWINDOW (window)->top); | ||
| 151 | XMenu_xpos += f->display.x->left_pos; | 163 | XMenu_xpos += f->display.x->left_pos; |
| 152 | XMenu_ypos += f->display.x->top_pos; | 164 | XMenu_ypos += f->display.x->top_pos; |
| 153 | 165 | ||