aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2021-11-21 19:07:10 +0200
committerEli Zaretskii2021-11-21 19:07:10 +0200
commitb7db7eb2c7b8ac1bddf4afa9ccf9b30ebeb0224e (patch)
tree333cfc3acef9087683aeb96ec0c4193b432b48ab /src
parent85f193b6133387b0901ea89d7ff9f665a5f33d26 (diff)
downloademacs-b7db7eb2c7b8ac1bddf4afa9ccf9b30ebeb0224e.tar.gz
emacs-b7db7eb2c7b8ac1bddf4afa9ccf9b30ebeb0224e.zip
Fix positioning of pop-up menus when there are window-margins
* src/menu.c (x_popup_menu_1): Calculate X and Y correctly for clicks in the text area. (Bug#51782)
Diffstat (limited to 'src')
-rw-r--r--src/menu.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/menu.c b/src/menu.c
index ab01e1bfad2..96d1c5208a9 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -1113,7 +1113,7 @@ into menu items. */)
1113Lisp_Object 1113Lisp_Object
1114x_popup_menu_1 (Lisp_Object position, Lisp_Object menu) 1114x_popup_menu_1 (Lisp_Object position, Lisp_Object menu)
1115{ 1115{
1116 Lisp_Object keymap, tem, tem2; 1116 Lisp_Object keymap, tem, tem2 = Qnil;
1117 int xpos = 0, ypos = 0; 1117 int xpos = 0, ypos = 0;
1118 Lisp_Object title; 1118 Lisp_Object title;
1119 const char *error_name = NULL; 1119 const char *error_name = NULL;
@@ -1252,8 +1252,21 @@ x_popup_menu_1 (Lisp_Object position, Lisp_Object menu)
1252 CHECK_LIVE_WINDOW (window); 1252 CHECK_LIVE_WINDOW (window);
1253 f = XFRAME (WINDOW_FRAME (win)); 1253 f = XFRAME (WINDOW_FRAME (win));
1254 1254
1255 xpos = WINDOW_LEFT_EDGE_X (win); 1255 if (FIXNUMP (tem2))
1256 ypos = WINDOW_TOP_EDGE_Y (win); 1256 {
1257 /* Clicks in the text area, where TEM2 is a buffer
1258 position, are relative to the top-left edge of the text
1259 area, see keyboard.c:make_lispy_position. */
1260 xpos = window_box_left (win, TEXT_AREA);
1261 ypos = (WINDOW_TOP_EDGE_Y (win)
1262 + WINDOW_TAB_LINE_HEIGHT (win)
1263 + WINDOW_HEADER_LINE_HEIGHT (win));
1264 }
1265 else
1266 {
1267 xpos = WINDOW_LEFT_EDGE_X (win);
1268 ypos = WINDOW_TOP_EDGE_Y (win);
1269 }
1257 } 1270 }
1258 else 1271 else
1259 /* ??? Not really clean; should be CHECK_WINDOW_OR_FRAME, 1272 /* ??? Not really clean; should be CHECK_WINDOW_OR_FRAME,